Java Code Examples for org.eclipse.swt.widgets.Text

The following are top voted examples for showing how to use org.eclipse.swt.widgets.Text. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Hydrograph   File: FilterHelper.java   View source code 7 votes vote down vote up
/**
 * Gets the text box value 1 listener.
 * 
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the text box value 1 listener
 */
public  Listener getTextBoxValue1Listener(final List<Condition> conditionsList, 
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	Listener listener = new Listener() {
		
		@Override
		public void handleEvent(Event event) {
			Text text = (Text)event.widget;
			int index = (int) text.getData(FilterConstants.ROW_INDEX);
			Condition filterConditions = conditionsList.get(index);
			filterConditions.setValue1(text.getText());
			validateText(text, filterConditions.getFieldName(), fieldsAndTypes, filterConditions.getConditionalOperator());
			toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
Example 2
Project: com.onpositive.prefeditor   File: ViewerPage.java   View source code 7 votes vote down vote up
protected void createFilterControls(Composite con) {
	Label filterLabel = new Label(con,SWT.NONE);
	filterLabel.setText("Filter:");
	GridDataFactory.swtDefaults().applyTo(filterLabel);
	Text filterText = new Text(con, SWT.BORDER);
	filterText.setMessage("(" + PreferenceFilter.MIN_FILTER_CHARS + " chars at least)");
	filterText.addModifyListener(event -> {
		filterChanged(filterText.getText());
	});
	GridDataFactory.fillDefaults().grab(true,false).applyTo(filterText);
	Button clearBtn = new Button(con, SWT.PUSH);
	clearBtn.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(PrefEditorPlugin.PLUGIN_ID,"icons/clear.gif").createImage());
	GridDataFactory.swtDefaults().applyTo(clearBtn);
	clearBtn.addSelectionListener(new SelectionAdapter() {
		
		@Override
		public void widgetSelected(SelectionEvent e) {
			filterText.setText("");
			filterChanged("");
		}
		
	});
}
 
Example 3
Project: n4js   File: SuffixText.java   View source code 6 votes vote down vote up
@Override
protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
	int width = 0;
	int height = 0;
	Point textDimension = textDimensions();
	Control[] children = composite.getChildren();
	for (Control child : children) {
		if (child instanceof Text) {
			final String textContent = ((Text) child).getText();
			textDimension = gc.textExtent(textContent);
			width += textDimension.x;
			height += textDimension.y;
		}
		if (child instanceof Label) {
			Point computedSize = child.computeSize(0, 0);
			width += computedSize.x;
		}
	}
	return new Point(width, height + 4);
}
 
Example 4
Project: gw4e.project   File: GW4ELaunchConfigurationTab.java   View source code 6 votes vote down vote up
/**
 * Create the element that allow to select a project See the GraphWalker
 * offline command for more information
 */
private void createProjectSection(Composite parent) {
	fProjLabel = new Label(parent, SWT.NONE);
	fProjLabel.setText(MessageUtil.getString("label_project"));
	GridData gd = new GridData();
	gd.horizontalIndent = 25;
	fProjLabel.setLayoutData(gd);

	fProjText = new Text(parent, SWT.SINGLE | SWT.BORDER);
	fProjText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	fProjText.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent evt) {
			validatePage();
			updateConfigState();

		}
	});
	fProjText.setData(GW4E_LAUNCH_CONFIGURATION_CONTROL_ID, GW4E_LAUNCH_CONFIGURATION_TEXT_ID_PROJECT);

}
 
Example 5
Project: n4js   File: SuperClassComponentProvider.java   View source code 6 votes vote down vote up
/**
 * Creates a new super class component using the given model and container.
 *
 * @param model
 *            The model to bind this to
 * @param container
 *            The parent WizardComponentContainer
 */
public SuperClassComponent(N4JSClassWizardModel model, WizardComponentContainer container) {
	super(container);
	this.model = model;

	Label superClassLabel = new Label(container.getComposite(), SWT.NONE);
	superClassLabel.setText("Super class:");

	text = new Text(container.getComposite(), SWT.BORDER);
	text.setLayoutData(fillTextDefaults());

	browseButton = new Button(container.getComposite(), SWT.NONE);
	browseButton.setToolTipText("Opens a dialog to choose the super class");
	browseButton.setText("Browse...");

	setupBindings();
	setupDialog();
}
 
Example 6
Project: n4js   File: InstallNpmDependencyDialog.java   View source code 6 votes vote down vote up
private void createVersionArea(final Group parent, String versionLabel, Consumer<String> textHandler,
		Consumer<Boolean> flagHandler) {
	final Composite area = createVersionArea(parent, versionLabel);
	final Composite textArea = createVersionInputArea(area);

	final Text txtUpperVersion = getSimpleTextArea(textArea);
	txtUpperVersion.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent e) {
			Text textWidget = (Text) e.getSource();
			textHandler.accept(textWidget.getText());
		}
	});

	createVersionInclsivnessArea(area, flagHandler);
}
 
Example 7
Project: Hydrograph   File: WidgetUtility.java   View source code 6 votes vote down vote up
public static void addVerifyListnerToOutputEditingSupport(JoinMappingEditingSupport outputEditingSupport) {
	((Text)outputEditingSupport.getEditor().getControl()).addVerifyListener(new VerifyListener() {
		
		@Override
		public void verifyText(VerifyEvent e) {
			String text=e.text;
			Matcher matcher=Pattern.compile(Constants.REGEX).matcher(text);
			
			if(matcher.matches()){
				e.doit=true;
			}else{
				e.doit=false;
			}
		}
	});
}
 
Example 8
Project: Hydrograph   File: FTPAuthenticEditorUtility.java   View source code 6 votes vote down vote up
/**
 * @param container
 * @return
 */
public Control addIdKeyComposite(Composite container, FTPAuthOperationDetails authOperationDetails) {
	Composite keyFileComposite = new Composite(container, SWT.BORDER);
	keyFileComposite.setLayout(new GridLayout(3, false));
	keyFileComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
	
	FTPWidgetUtility ftpWidgetUtility = new FTPWidgetUtility();
	ftpWidgetUtility.createLabel(keyFileComposite, "User ID");
	ftpWidgetUtility.createText(keyFileComposite, "", SWT.BORDER);
	Button keyFileBrwsBtn1 = new Button(keyFileComposite, SWT.NONE);
	keyFileBrwsBtn1.setVisible(false);
	
	ftpWidgetUtility.createLabel(keyFileComposite, "Public/Private Key");
	Text privateKeyTxt = (Text) ftpWidgetUtility.createText(keyFileComposite, "", SWT.BORDER);
	Button keyFileBrwsBtn = new Button(keyFileComposite, SWT.NONE);
	keyFileBrwsBtn.setText("...");
	
	selectionListener(keyFileBrwsBtn, privateKeyTxt);

	return keyFileComposite;
}
 
Example 9
Project: Hydrograph   File: FTPAuthenticEditorUtility.java   View source code 6 votes vote down vote up
/**
 * @param control
 * @return
 */
public Control addBasicAuthKeyComposite(Composite control, FTPAuthOperationDetails authOperationDetails){
	Composite basicAuthKeyComposite = new Composite(control, SWT.BORDER);
	basicAuthKeyComposite.setLayout(new GridLayout(3, false));
	basicAuthKeyComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
	
	FTPWidgetUtility ftpWidgetUtility = new FTPWidgetUtility();
	ftpWidgetUtility.createLabel(basicAuthKeyComposite, "User ID");
	ftpWidgetUtility.createText(basicAuthKeyComposite, "", SWT.BORDER);
	new Button(basicAuthKeyComposite, SWT.NONE).setVisible(false);
	
	ftpWidgetUtility.createLabel(basicAuthKeyComposite, "Password");
	ftpWidgetUtility.createText(basicAuthKeyComposite, "", SWT.PASSWORD|SWT.BORDER);
	new Button(basicAuthKeyComposite, SWT.NONE).setVisible(false);
	
	ftpWidgetUtility.createLabel(basicAuthKeyComposite, "Public/Private Key");
	Text privateKeyTxt = (Text) ftpWidgetUtility.createText(basicAuthKeyComposite, "", SWT.BORDER);
	Button keyFileBrwsBtn = new Button(basicAuthKeyComposite, SWT.NONE);
	keyFileBrwsBtn.setText("...");
	
	selectionListener(keyFileBrwsBtn, privateKeyTxt);
	
	return basicAuthKeyComposite;
}
 
Example 10
Project: Hydrograph   File: ExpressionComposite.java   View source code 6 votes vote down vote up
private void createSimpleIdTextBox(Composite composite_1) {
	Composite composite = new Composite(composite_1, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd_composite.heightHint = 29;
	composite.setLayoutData(gd_composite);

	idTextBox = new Text(composite, SWT.BORDER);
	idTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	idTextBox.setText(expressionDataStructure.getId());
	idTextBox.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent e) {
			expressionDataStructure.setId(idTextBox.getText());
			dialog.refreshErrorLogs();
		}
	});

}
 
Example 11
Project: eZooKeeper   File: ZooKeeperServerNewWizardPage1.java   View source code 6 votes vote down vote up
@Override
public boolean canFlipToNextPage() {

    ZooKeeperServerNewWizardPage2 jmxPage = (ZooKeeperServerNewWizardPage2) getNextPage();

    if (jmxPage != null) {
        GridComposite jmxPageGridComposite = jmxPage.getGridComposite();

        if (jmxPageGridComposite != null) {

            String hostPortString = getHost() + ":" + String.valueOf(ZooKeeperServerDescriptor.DEFAULT_JMX_PORT);
            String defaultJmxServiceUrlString = "service:jmx:rmi:///jndi/rmi://" + hostPortString + "/jmxrmi";

            Text jmxUrlText = (Text) jmxPageGridComposite
                    .getControl(ZooKeeperServerNewWizardPage2.CONTROL_NAME_JMX_URL_TEXT);
            
            if (jmxUrlText != null && !jmxUrlText.isDisposed()) {
                jmxUrlText.setText(defaultJmxServiceUrlString);
            }
        }
    }

    return super.canFlipToNextPage();
}
 
Example 12
Project: eZooKeeper   File: ZnodeNewWizardComposite1.java   View source code 6 votes vote down vote up
public Znode getZnode() throws Exception {

        byte[] data = getZnodeData();

        ZnodeModel parentZnodeModel = getParentZnodeModel();

        Text pathText = (Text) getControl(CONTROL_NAME_PATH_TEXT);
        String relativePath = pathText.getText();
        Znode parentZnode = parentZnodeModel.getData();
        String parentPath = parentZnode.getPath();
        String absolutePath = Znode.getAbsolutePath(parentPath, relativePath);

        Button sequentialCheckbox = (Button) getControl(CONTROL_NAME_CREATE_MODE_SEQUENTIAL_BUTTON);
        boolean isSequential = sequentialCheckbox.getSelection();

        Button ephemeralRadioButton = (Button) getControl(CONTROL_NAME_CREATE_MODE_EPHEMERAL_BUTTON);
        boolean isEphemeral = ephemeralRadioButton.getSelection();

        Znode znode = new Znode(absolutePath);
        znode.setSequential(isSequential);
        znode.setEphemeral(isEphemeral);
        znode.setData(data);

        return znode;
    }
 
Example 13
Project: eZooKeeper   File: ZnodeNewWizardComposite1.java   View source code 6 votes vote down vote up
@Override
public byte[] getZnodeData() throws Exception {
    Text filePathText = (Text) getControl(CONTROL_NAME_DATA_FILE_TEXT);
    String filePath = filePathText.getText();
    File file = new File(filePath);
    String fileName = file.getName();
    if (!file.exists()) {
        throw new IOException("File '" + fileName + "' does not exist.");
    }

    if (!file.isFile()) {
        throw new IOException("Path '" + filePath + "' is not a valid file.");
    }

    long length = file.length();

    if (length > Znode.MAX_DATA_SIZE) {
        throw new Exception("File '" + fileName
                + "' size is greater than the maximum allowed Znode data size (" + Znode.MAX_DATA_SIZE
                + " bytes).");
    }

    FileEditor fileEditor = new FileEditor(file);
    return fileEditor.read();
}
 
Example 14
Project: Hydrograph   File: OperationComposite.java   View source code 6 votes vote down vote up
private void createSimpleIdTextBox(Composite composite_1) {
	Composite composite = new Composite(composite_1, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd_composite.heightHint = 29;
	composite.setLayoutData(gd_composite);

	idTextBox = new Text(composite, SWT.BORDER);
	idTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	idTextBox.setText(operationDataStructure.getId());
	idTextBox.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent e) {
			operationDataStructure.setId(idTextBox.getText());
			dialog.refreshErrorLogs();
		}
	});

}
 
Example 15
Project: neoscada   File: FilterAdvancedComposite.java   View source code 6 votes vote down vote up
private Text createAttributeText ( final String attribute )
{
    final Text t = new Text ( this, SWT.BORDER );
    final Fields field = Fields.byField ( attribute );
    if ( field == null )
    {
        t.setEditable ( true );
        t.setMessage ( Messages.custom_field );
    }
    else
    {
        t.setEditable ( false );
        t.setText ( field.getName () );
    }
    t.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        };
    } );
    final RowData rowData = new RowData ();
    rowData.width = 132;
    t.setLayoutData ( rowData );
    return t;
}
 
Example 16
Project: neoscada   File: FilterAdvancedComposite.java   View source code 6 votes vote down vote up
private Text createValueText ()
{
    final Text t = new Text ( this, SWT.BORDER );
    t.setMessage ( Messages.argument );
    t.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        }
    } );
    final RowData rowData = new RowData ();
    rowData.width = 132;
    t.setLayoutData ( rowData );
    return t;
}
 
Example 17
Project: pgcodekeeper   File: NewObjectWizard.java   View source code 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
    Composite area = new Composite(parent, SWT.NONE);
    area.setLayout(new GridLayout(2, false));
    area.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    new Label(area, SWT.NONE).setText(Messages.PgObject_project_name);
    viewerProject = new ComboViewer(area, SWT.READ_ONLY | SWT.DROP_DOWN);

    new Label(area, SWT.NONE).setText(Messages.PgObject_object_type);
    viewerType = new ComboViewer(area, SWT.READ_ONLY | SWT.DROP_DOWN);

    new Label(area, SWT.NONE).setText(Messages.PgObject_object_name);
    final Text txtName = new Text(area, SWT.BORDER);
    txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    txtName.addModifyListener(e -> {
        name = txtName.getText();
        getWizard().getContainer().updateButtons();
    });
    fillProjects();
    fillTypes();
    setControl(area);
}
 
Example 18
Project: convertigo-eclipse   File: HttpTriggerXpathEditorComposite.java   View source code 6 votes vote down vote up
/**
 * This method initializes this
 * 
 */
private void initialize() {
	XpathTrigger trigger = (parent.getTrigger() instanceof XpathTrigger)?(XpathTrigger)parent.getTrigger():null;
       GridData gridData2 = new GridData();
       gridData2.horizontalAlignment = GridData.FILL;
       gridData2.grabExcessHorizontalSpace = true;
       gridData2.verticalAlignment = GridData.CENTER;
       GridLayout gridLayout = new GridLayout();
       gridLayout.numColumns = 2;
       this.setLayout(gridLayout);
       xpath_label = new Label(this, SWT.NONE);
       xpath_label.setText("Waiting for Xpath");
       xpath_txt = new Text(this, SWT.BORDER);
       xpath_txt.setText( (trigger!=null)? trigger.getXPath():"");
       xpath_txt.setLayoutData(gridData2);
       xpath_txt.setSize(600, 50);
}
 
Example 19
Project: convertigo-eclipse   File: TextEditorComposite.java   View source code 6 votes vote down vote up
private void initialize() {
	GridLayout gridLayout = new GridLayout();
	gridLayout.numColumns = 1;
	GridData gridData = new org.eclipse.swt.layout.GridData();
	gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
	gridData.grabExcessVerticalSpace = true;
	gridData.grabExcessHorizontalSpace = true;
	gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
	
	//minimum size (when dialog open)
	gridData.minimumHeight = 200;
	gridData.minimumWidth = 300;
	
	this.setLayout(gridLayout);
	textArea = new Text(this, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
	textArea.setFont(new Font(null,"Tahoma",10,0));
	textArea.setLayoutData(gridData);
}
 
Example 20
Project: Hydrograph   File: DebugDataViewer.java   View source code 6 votes vote down vote up
private void createJumpPageTextBox(Composite composite_3) {
	Text jumpPageTextBox = new Text(composite_3, SWT.BORDER);
	jumpPageTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	jumpPageTextBox.addVerifyListener(new VerifyListener() {
		@Override
		public void verifyText(VerifyEvent e) {
			String currentText = ((Text) e.widget).getText();
			String pageNumberText = currentText.substring(0, e.start) + e.text + currentText.substring(e.end);
			try {
				long pageNumber = Long.valueOf(pageNumberText);
				if (pageNumber < 1) {
					e.doit = false;
				}
			} catch (NumberFormatException ex) {
				if (!pageNumberText.equals(""))
					e.doit = false;
			}
		}
	});

	dataViewerListeners.attachJumpPageListener(jumpPageTextBox);
	windowControls.put(ControlConstants.JUMP_TEXT, jumpPageTextBox);

}
 
Example 21
Project: Hydrograph   File: ExecutionTrackingPreferanceComposite.java   View source code 6 votes vote down vote up
/**
 * Checks if all values are correct and enable/disable ok button
 */
private void checkState() {
	if (editorList != null) {
		int size = editorList.size();
		for (int i = 0; i < size; i++) {
			Text fieldEditor = editorList.get(i);
			String errorMessage = (String) fieldEditor.getData(ERROR_KEY);
			if (StringUtils.isNotBlank(errorMessage)) {
				executionTrackPreference.setErrorMessage(errorMessage);
				executionTrackPreference.setValid(false);
				break;
			} else {
				executionTrackPreference.setErrorMessage(null);
				executionTrackPreference.setValid(true);
			}
		}
	}
}
 
Example 22
Project: Hydrograph   File: ELTFocusGainedListener.java   View source code 6 votes vote down vote up
@Override
public Listener getListener(
		PropertyDialogButtonBar propertyDialogButtonBar,
		ListenerHelper helper, Widget... widgets) {
	final Widget[] widgetList = widgets;
	if (helper != null) {
		txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
	}

	Listener listener = new Listener() {

		@Override
		public void handleEvent(Event event) {
			String charSet = ((Text) widgetList[0]).getText().trim();
			if (event.type == SWT.FocusIn) {
				((Text) widgetList[0]).setText(charSet.replace("@{", "").replace("}", ""));
			}
		}
	};

	return listener;
}
 
Example 23
Project: Hydrograph   File: SelectionDatabaseWidget.java   View source code 6 votes vote down vote up
/**
 * Applies multiple listeners to textBoxes 
 * @param widgetList
 * @return
 */
private ModifyListener attachTextModifyListner(final ArrayList<AbstractWidget> widgetList) {
	return new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent event) {
			Text text = (Text)event.getSource();
			if(((Button) tableNameRadioButton.getSWTWidgetControl()).getSelection()){
				databaseSelectionConfig.setTableName(text.getText());
			}else{
				databaseSelectionConfig.setSqlQuery(text.getText());
			}
			Utils.INSTANCE.addMouseMoveListener(sqlQueryTextBox, cursor);
			Utils.INSTANCE.addMouseMoveListener(textBoxTableName, cursor);
			showHideErrorSymbol(widgetList);
		}
	};
}
 
Example 24
Project: dsp4e   File: DSPMainTab.java   View source code 6 votes vote down vote up
private void createDebugJSonComponent(Composite parent) {
	Composite comp = new Group(parent, SWT.NONE);
	comp.setLayout(new GridLayout());
	comp.setLayoutData(new GridData(GridData.FILL_BOTH));

	Label jsonLabel = new Label(comp, SWT.NONE);
	jsonLabel.setText("&Launch Parameters (Json):");
	jsonLabel.setLayoutData(new GridData(GridData.BEGINNING));

	jsonText = new Text(comp, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
	jsonText.setLayoutData(new GridData(GridData.FILL_BOTH));
	jsonText.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent e) {
			updateLaunchConfigurationDialog();
		}
	});

}
 
Example 25
Project: convertigo-eclipse   File: UrlMappingWizardPage.java   View source code 6 votes vote down vote up
public void createControl(Composite parent) {
	container = new Composite(parent, SWT.NULL);
	GridLayout gridLayout = new GridLayout();
	gridLayout.verticalSpacing = 10;
	container.setLayout(gridLayout);
	
	Label label = new Label(container, SWT.NONE);
	label.setText("Please enter the Convertigo api path of the mapping\n");
	
	mappingPath = new Text(container, SWT.BORDER | SWT.SINGLE);
	mappingPath.setFont(new Font(container.getDisplay(), "Tahoma", 10, 0));
	mappingPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	mappingPath.setText("/");
	mappingPath.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			dialogChanged();
		}
	});
	
	setControl(container);
}
 
Example 26
Project: n4js   File: SuffixText.java   View source code 5 votes vote down vote up
/**
 * Create the suffix text.
 *
 * @param parent
 *            Parent composite
 * @param style
 *            additional style configuration
 */
public SuffixText(Composite parent, int style) {
	super(parent, style);
	this.setLayout(new SuffixLayout());

	suffixText = createSuffixText();
	editableText = new Text(this, SWT.NONE);

	configureListeners();

	this.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
	this.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_IBEAM));
}
 
Example 27
Project: Hydrograph   File: FTPProtocolWidget.java   View source code 5 votes vote down vote up
private void validateTextWidget(Text text, boolean isEnable, ControlDecoration controlDecoration, Color color){
	text.setText("");
	text.setEnabled(isEnable);
	if(!isEnable){
		controlDecoration.hide();
	}
	text.setBackground(color);
}
 
Example 28
Project: n4js   File: NameComponent.java   View source code 5 votes vote down vote up
/**
 * Creates a new class name component.
 *
 * @param model
 *            The model to bind it to
 * @param container
 *            The container to place it in
 */
public NameComponent(NamedModel model, WizardComponentContainer container) {
	super(container);
	this.model = model;

	Label classNameLabel = new Label(getParentComposite(), SWT.NONE);
	classNameLabel.setText("Name:");

	nameText = new Text(getParentComposite(), SWT.BORDER);
	nameText.setLayoutData(fillTextDefaults());

	WizardComponentUtils.emptyGridCell(container.getComposite());

	setupBindings();
}
 
Example 29
Project: RefDiff   File: ProgressBarDialog.java   View source code 5 votes vote down vote up
private Control createDialogArea(Composite shell) {
       GridLayout layout = new GridLayout();
	layout.numColumns = 1;
	shell.setLayout(layout);

	lblStep = new Label(shell, SWT.NONE);
	lblStep.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	lblStep.setText("Step 1 / 999");

	lblMessage = new Label(shell, SWT.NONE);
	lblMessage.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	lblMessage.setText("Idle");

	pbProg = new ProgressBar(shell, SWT.SMOOTH | SWT.INDETERMINATE);
	pbProg.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	pbProg.setMaximum(1000);
	pbProg.setSelection(0);
	pbProg.setSelection(256);

	final Label lblSeparator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
	lblSeparator.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	txtLog = new Text(shell, SWT.MULTI
	          | SWT.BORDER
	          | SWT.H_SCROLL
	          | SWT.V_SCROLL);
	txtLog.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
	txtLog.setEditable(false);
	txtLog.setBackground(new Color(shell.getDisplay(), 10,10,10));
	txtLog.setForeground(new Color(shell.getDisplay(), 200,200,200));

	shell.layout();

	return shell;
}
 
Example 30
Project: Hydrograph   File: HiveInputExtractMetaStoreDialog.java   View source code 5 votes vote down vote up
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	
	getShell().setText("Credentials Required");
	
	Composite container = (Composite) super.createDialogArea(parent);
	container.getLayout();

	
	Composite composite = new Composite(container, SWT.NONE);
	composite.setLayout(new GridLayout(4, false));
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	new Label(composite, SWT.NONE);
	new Label(composite, SWT.NONE);
	new Label(composite, SWT.NONE);
	new Label(composite, SWT.NONE);
	new Label(composite, SWT.NONE);
	
	Label lblUserName = new Label(composite, SWT.NONE);
	lblUserName.setText("User Name");
	new Label(composite, SWT.NONE);
	
	username = new Text(composite, SWT.BORDER);
	username.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	new Label(composite, SWT.NONE);
	
	Label lblPassword = new Label(composite, SWT.NONE);
	lblPassword.setText("Password");
	new Label(composite, SWT.NONE);
	
	password = new Text(composite, SWT.PASSWORD|SWT.BORDER);
	password.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	createErrorComposite(container);

	return container;
}
 
Example 31
Project: Hydrograph   File: DirectoryDialogSelectionListener.java   View source code 5 votes vote down vote up
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers,
		final Widget... widgets) {
	final Button button = ((Button) widgets[0]);
	button.getShell();
	if (helpers != null) {
		txtDecorator = (ControlDecoration) helpers.get(HelperType.CONTROL_DECORATION);
	}

	Listener listener = new Listener() {
		@Override
		public void handleEvent(Event event) {
			LOGGER.debug("Launching Directory Dialog for selecting directory path");
			if (event.type == SWT.Selection) {
				String path = null;
				DirectoryDialog filedialog = new DirectoryDialog(button.getShell(), SWT.None);
				filedialog.setFilterPath(((Text) widgets[1]).getText());
				path=filedialog.open();
				if (StringUtils.isNotEmpty(path)) {
					((Text) widgets[1]).setText(path);
					propertyDialogButtonBar.enableApplyButton(true);
					txtDecorator.hide();
				}
			}
		}
	};
	return listener;
}
 
Example 32
Project: orientdb-oda-birt   File: CustomDataSetWizardPage.java   View source code 5 votes vote down vote up
/**
 * Creates custom control for user-defined query text.
 */
private Control createPageControl( Composite parent )
{
    Composite composite = new Composite( parent, SWT.NONE );
    composite.setLayout( new GridLayout( 1, false ) );
    GridData gridData = new GridData( GridData.HORIZONTAL_ALIGN_FILL
            | GridData.VERTICAL_ALIGN_FILL );

    composite.setLayoutData( gridData );

    Label fieldLabel = new Label( composite, SWT.NONE );
    fieldLabel.setText( "&Query Text:" );
    
    m_queryTextField = new Text( composite, SWT.BORDER
            | SWT.V_SCROLL | SWT.H_SCROLL );
    GridData data = new GridData( GridData.FILL_HORIZONTAL );
    data.heightHint = 100;
    m_queryTextField.setLayoutData( data );
    m_queryTextField.addModifyListener( new ModifyListener( ) 
    {
        public void modifyText( ModifyEvent e )
        {
            validateData();
        }
    } );
   
    setPageComplete( false );
    return composite;
}
 
Example 33
Project: EclipseMinifyBuilder   File: MinifyPropertyPage.java   View source code 5 votes vote down vote up
private void addFirstSection(Composite parent) {
	Composite composite = createDefaultComposite(parent);

	//Label for path field
	Label pathLabel = new Label(composite, SWT.NONE);
	pathLabel.setText(PATH_TITLE);

	// Path text field
	Text pathValueText = new Text(composite, SWT.WRAP | SWT.READ_ONLY);
	pathValueText.setText(((IResource) getElement()).getFullPath().toString());
}
 
Example 34
Project: Hydrograph   File: RunConfigDialog.java   View source code 5 votes vote down vote up
private void applyServerDetailsCrossTextEmptyValidationListener(Text text) {
	text.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent e) {

			toggleOkButton();
		}
	});
}
 
Example 35
Project: Hydrograph   File: WorksheetWidget.java   View source code 5 votes vote down vote up
@Override
public void attachToPropertySubGroup(AbstractELTContainerWidget subGroup) {
	eltSubgroupComposite = new ELTDefaultSubgroupComposite(subGroup.getContainerControl());
	eltSubgroupComposite.createContainerWidget();
	Utils.INSTANCE.loadProperties();
	this.cursor = subGroup.getContainerControl().getDisplay().getSystemCursor(SWT.CURSOR_HAND);

	AbstractELTWidget label = new ELTDefaultLable(Messages.LABEL_WORKSHEET_NAME + " ");
	eltSubgroupComposite.attachWidget(label);
	setPropertyHelpWidget((Control) label.getSWTWidgetControl());

	AbstractELTWidget textBoxWidget = new ELTDefaultTextBox();
	eltSubgroupComposite.attachWidget(textBoxWidget);

	textBox = (Text) textBoxWidget.getSWTWidgetControl();
	txtDecorator = WidgetUtility.addDecorator(textBox, Messages.bind(Messages.EMPTY_FIELD, ((Label) label.getSWTWidgetControl()).getText()));
	txtDecorator.setMarginWidth(3);
	txtDecorator.show();
	textBox.setToolTipText("Worksheet Name can be static or FieldName or a Parameter");
	GridData gridData = (GridData) textBox.getLayoutData();
	if (OSValidator.isMac()) {
		gridData.widthHint = 106;
	} else {
		gridData.widthHint = 80;
	}
	attachListeners(textBox);

	isFieldCheckBox = new Button(eltSubgroupComposite.getContainerControl(), SWT.CHECK);
	isFieldCheckBox.setEnabled(false);
	isFieldCheckBox.setText(Constants.IS_FIELD);
	attachSelectionListener(isFieldCheckBox);
	populateWidget();
}
 
Example 36
Project: Hydrograph   File: FilterHelper.java   View source code 5 votes vote down vote up
private void showToolTip(Text text1, String selectedValue) {
	if (StringUtils.equalsIgnoreCase(selectedValue, FilterConstants.IN)
			|| StringUtils.equalsIgnoreCase(selectedValue, FilterConstants.NOT_IN)) {
		text1.setToolTipText(Messages.COMMA_SEPERATED_VALUE);
	} else {
		text1.setToolTipText("");
	}
}
 
Example 37
Project: Hydrograph   File: OperationComposite.java   View source code 5 votes vote down vote up
private void createExpressionEditingTextBox(Composite composite_1) {
	Composite composite = new Composite(composite_1, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd_composite.heightHint = 29;
	composite.setLayoutData(gd_composite);

	logicTextBox = new Text(composite, SWT.BORDER);
	logicTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	logicTextBox.setEditable(false);
	logicTextBox.setText(operationDataStructure.getQualifiedOperationClassName());

	Button openEditorButton = new Button(composite, SWT.NONE);
	openEditorButton.setText("...");
	openEditorButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			ELTOperationClassDialog eltOperationClassDialog = new ELTOperationClassDialog(
					Display.getCurrent().getActiveShell(), dialog.getPropertyDialogButtonBar(),
					createDSForClassWindow(), dialog.getWidgetConfig(), dialog.getComponent().getComponentName());
			eltOperationClassDialog.open();
			updateOperationDS(eltOperationClassDialog);
			if (eltOperationClassDialog.isYesPressed()) {
				dialog.pressOK();
			} else if (eltOperationClassDialog.isNoPressed()) {
				dialog.pressCancel();
			}
			dialog.refreshErrorLogs();
		}

	});

}
 
Example 38
Project: convertigo-eclipse   File: InteractiveSplashHandler.java   View source code 5 votes vote down vote up
/**
 * 
 */
private void createUITextUserName() {
	// Create the text widget
	fTextUsername = new Text(fCompositeLogin, SWT.BORDER);
	// Configure layout data
	GridData data = new GridData(SWT.NONE, SWT.NONE, false, false);
	data.widthHint = F_TEXT_WIDTH_HINT;
	data.horizontalSpan = 2;
	fTextUsername.setLayoutData(data);		
}
 
Example 39
Project: Hydrograph   File: ViewExecutionHistoryComponentDialog.java   View source code 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.getShell().setText("Component Details");
	container.setLayout(new GridLayout(1, false));
	
	ScrolledComposite scrolledComposite = new ScrolledComposite(container, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
	GridData gd_scrolledComposite = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_scrolledComposite.heightHint = 289;
	gd_scrolledComposite.widthHint = 571;
	scrolledComposite.setLayoutData(gd_scrolledComposite);
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);
	
	text = new Text(scrolledComposite, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
	StringBuilder stringBuilder = new StringBuilder();
	
	if(extraComponentList != null && extraComponentList.size() > 0){
		stringBuilder.append(Messages.REPLAY_EXTRA_COMPONENTS + "\n");
		extraComponentList.forEach(componentName -> { stringBuilder.append(extraCompcount + ". " + componentName + "\n");
			extraCompcount++;
		});
	}
	
	if(missedComponentList != null && missedComponentList.size() > 0 && !missedComponentList.isEmpty()){
		stringBuilder.append(Messages.REPLAY_MISSING_COMPONENTS + "\n");
		missedComponentList.forEach(componentName -> { stringBuilder.append(missedCompcount + "." + componentName + "\n");
			missedCompcount++;
		});
	}
	
	text.setText(stringBuilder.toString());
	
	scrolledComposite.setContent(text);
	
	
	return super.createDialogArea(parent);
}
 
Example 40
Project: eZooKeeper   File: ZnodeAclComposite.java   View source code 5 votes vote down vote up
private void setId() {

        SetDigestIdDialog dialog = new SetDigestIdDialog(getShell());
        dialog.setBlockOnOpen(true);
        if (dialog.open() == SetDigestIdDialog.OK) {
            Text idEditor = (Text) _IdTableEditor.getEditor();
            if (idEditor != null && !idEditor.isDisposed()) {
                idEditor.setText(dialog.getDigestId());
                idEditor.forceFocus();
            }
        }

    }