Java Code Examples for org.eclipse.swt.widgets.Text.setFocus()

The following are Jave code examples for showing how to use setFocus() of the org.eclipse.swt.widgets.Text class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: convertigo-eclipse   File: NewProjectWizardComposite1.java   View Source Code Vote up 5 votes
/**
 * This method initializes this
 * 
 */
private void initialize() {
       GridData gridData2 = new org.eclipse.swt.layout.GridData();
       gridData2.horizontalSpan = 3;
       label1 = new Label(this, SWT.NONE);
       label1.setText("Please use a relevant project name. Avoid the use of special characters  (âàéèêù...)\nand punctuation characters as space, pound or others. We suggest you use only lowercase letters. \nIf you use uppercase letters, be sure use the same letter case when you will call\ntransactions using the convertigo's url interface.\n\nThe project name also defines the Convertigo's physical and virtual directories:\n\n- All your project's ressources will be held in the <your_workspace>/convertigo/projects/<your_project_name> directory.\n- Your project's URL will be http://<server_name>:<port>/convertigo/projects/<your_project_name>\n\n");
       label1.setLayoutData(gridData2);
       GridData gridData1 = new org.eclipse.swt.layout.GridData();
       gridData1.grabExcessHorizontalSpace = true;
       gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
       gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
       GridData gridData = new org.eclipse.swt.layout.GridData();
       gridData.grabExcessHorizontalSpace = false;
       gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
       gridData.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
       gridData.grabExcessVerticalSpace = false;
       label = new Label(this, SWT.NONE);
       label.setText("Project's name");
       label.setLayoutData(gridData);
       projectName = new Text(this, SWT.BORDER);
       projectName.setLayoutData(gridData1);
       projectName.addModifyListener(modifyListener);
       projectName.setFocus();
       GridLayout gridLayout = new GridLayout();
       gridLayout.numColumns = 2;
       this.setLayout(gridLayout);
       this.setSize(new org.eclipse.swt.graphics.Point(514,264));
		
}
 
Example 2
Project: Hydrograph   File: TextGridRowBuilder.java   View Source Code Vote up 5 votes
public Composite addHeader(){
	Composite composite = new Composite(container, SWT.NONE);
	GridLayout gl_composite = new GridLayout(textGridRow.getNumberOfColumn() + 1, false);
	gl_composite.horizontalSpacing = 7;
	gl_composite.marginWidth = 1;
	gl_composite.marginHeight = 0;
	gl_composite.verticalSpacing = 1;
	composite.setLayout(gl_composite);
		
	Button rowSelection = new Button(composite, SWT.CHECK);
	
	Map<Integer, TextGridColumnLayout> columns = textGridRow.getTextGridColumns();
	for(int columnNumber:columns.keySet()){
		Text text = new Text(composite, SWT.BORDER);
		if(!columns.get(columnNumber).grabHorizantalAccessSpace()){
			GridData gd_text = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
			gd_text.widthHint = columns.get(columnNumber).getColumnWidth();
			text.setLayoutData(gd_text);
			
			text.setEditable(false);
			text.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
			text.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION));
		}else{
			text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
			text.setBounds(0, 0, 76, 21);
			text.setFocus();
			
			text.setEditable(false);
			text.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
			text.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION));				
		}
		

		if(rowData!=null)
			text.setText(rowData.get(columnNumber));
	}
	
	return composite;
}
 
Example 3
Project: Hydrograph   File: TextGridRowBuilder.java   View Source Code Vote up 5 votes
public Composite addRaw(){
	Composite composite = new Composite(container, SWT.NONE);
	GridLayout gl_composite = new GridLayout(textGridRow.getNumberOfColumn() + 1, false);
	gl_composite.horizontalSpacing = 7;
	gl_composite.marginWidth = 1;
	gl_composite.marginHeight = 0;
	gl_composite.verticalSpacing = 1;
	composite.setLayout(gl_composite);
		
	Button rowSelection = new Button(composite, SWT.CHECK);
	rowSelection.setEnabled(enabled);
	
	Map<Integer, TextGridColumnLayout> columns = textGridRow.getTextGridColumns();
	for(int columnNumber:columns.keySet()){
		Text text = new Text(composite, SWT.BORDER);
		if(!columns.get(columnNumber).grabHorizantalAccessSpace()){
			GridData gd_text = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
			gd_text.widthHint = columns.get(columnNumber).getColumnWidth();
			text.setLayoutData(gd_text);
			
			text.setEditable(columns.get(columnNumber).isEditable());
			text.setEnabled(columns.get(columnNumber).isEnabled());
		}else{
			text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
			text.setBounds(0, 0, 76, 21);
			text.setFocus();
			
			text.setEditable(columns.get(columnNumber).isEditable());
			text.setEnabled(columns.get(columnNumber).isEnabled());
		}
		
		if(rowData!=null)
			text.setText(rowData.get(columnNumber));
	}
	
	return composite;
}
 
Example 4
Project: Hydrograph   File: ComponentSearchUtility.java   View Source Code Vote up 5 votes
private void createAssitTextBox(Point cursorRelativePosition) {
	assistText = new Text((Composite) graphicControl, SWT.BORDER);
	assistText.setLocation(cursorRelativePosition.x, cursorRelativePosition.y - assistText.getLineHeight());
	assistText.setSize(200, assistText.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
	assistText.setTextLimit(51);
	assistText.setFocus();
}
 
Example 5
Project: bdf2   File: AbstractSection.java   View Source Code Vote up 5 votes
public void controlChanged(Control control) {
	sectionChanged(control);
	if (control instanceof Text) {
		Text t = ((Text) control);
		t.setFocus();
		t.setSelection(t.getText().length());
	} else if (control instanceof Combo) {
		Combo combo = (Combo) control;
		combo.setFocus();
	} else {
		control.setFocus();
	}
}
 
Example 6
Project: AppleCommander   File: ExportFileDestinationPane.java   View Source Code Vote up 4 votes
/**
 * Create and display the wizard pane.
 * @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#open()
 */
public void open() {
	control = new Composite(parent, SWT.NULL);
	control.setLayoutData(layoutData);
	wizard.enableNextButton(false);
	wizard.enableFinishButton(true);
	RowLayout layout = new RowLayout(SWT.VERTICAL);
	layout.justify = true;
	layout.marginBottom = 5;
	layout.marginLeft = 5;
	layout.marginRight = 5;
	layout.marginTop = 5;
	layout.spacing = 3;
	control.setLayout(layout);
	Label label = new Label(control, SWT.WRAP);
	label.setText(textBundle.get("ExportFilePrompt")); //$NON-NLS-1$

	directoryText = new Text(control, SWT.WRAP | SWT.BORDER);
	if (wizard.getDirectory() != null) directoryText.setText(wizard.getDirectory());
	directoryText.setLayoutData(new RowData(parent.getSize().x - 30, -1));
	directoryText.setBackground(new Color(control.getDisplay(), 255,255,255));
	directoryText.setFocus();
	directoryText.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent event) {
			Text text = (Text) event.getSource();
			getWizard().setDirectory(text.getText());
		}
	});
	
	Button button = new Button(control, SWT.PUSH);
	button.setText(textBundle.get("BrowseButton")); //$NON-NLS-1$
	button.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			DirectoryDialog directoryDialog = new DirectoryDialog(getShell());
			directoryDialog.setFilterPath(getDirectoryText().getText());
			directoryDialog.setMessage(
				UiBundle.getInstance().get("ExportFileDirectoryPrompt")); //$NON-NLS-1$
			String directory = directoryDialog.open();
			if (directory != null) {
				getDirectoryText().setText(directory);
			}
		}
	});
}
 
Example 7
Project: applecommander   File: ExportFileDestinationPane.java   View Source Code Vote up 4 votes
/**
 * Create and display the wizard pane.
 * @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#open()
 */
public void open() {
	control = new Composite(parent, SWT.NULL);
	control.setLayoutData(layoutData);
	wizard.enableNextButton(false);
	wizard.enableFinishButton(true);
	RowLayout layout = new RowLayout(SWT.VERTICAL);
	layout.justify = true;
	layout.marginBottom = 5;
	layout.marginLeft = 5;
	layout.marginRight = 5;
	layout.marginTop = 5;
	layout.spacing = 3;
	control.setLayout(layout);
	Label label = new Label(control, SWT.WRAP);
	label.setText(textBundle.get("ExportFilePrompt")); //$NON-NLS-1$

	directoryText = new Text(control, SWT.WRAP | SWT.BORDER);
	if (wizard.getDirectory() != null) directoryText.setText(wizard.getDirectory());
	directoryText.setLayoutData(new RowData(parent.getSize().x - 30, -1));
	directoryText.setBackground(new Color(control.getDisplay(), 255,255,255));
	directoryText.setFocus();
	directoryText.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent event) {
			Text text = (Text) event.getSource();
			getWizard().setDirectory(text.getText());
		}
	});
	
	Button button = new Button(control, SWT.PUSH);
	button.setText(textBundle.get("BrowseButton")); //$NON-NLS-1$
	button.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			DirectoryDialog directoryDialog = new DirectoryDialog(getShell());
			directoryDialog.setFilterPath(getDirectoryText().getText());
			directoryDialog.setMessage(
				UiBundle.getInstance().get("ExportFileDirectoryPrompt")); //$NON-NLS-1$
			String directory = directoryDialog.open();
			if (directory != null) {
				getDirectoryText().setText(directory);
			}
		}
	});
}
 
Example 8
Project: Hydrograph   File: ELTComponentNameWidget.java   View Source Code Vote up 4 votes
@Override
public void attachToPropertySubGroup(AbstractELTContainerWidget container) {

	ELTDefaultSubgroupComposite eltDefaultSubgroupComposite = new ELTDefaultSubgroupComposite(
			container.getContainerControl());
	eltDefaultSubgroupComposite.createContainerWidget();

	AbstractELTWidget eltDefaultLable = new ELTDefaultLable(NAME);
	eltDefaultSubgroupComposite.attachWidget(eltDefaultLable);
	setPropertyHelpWidget((Control) eltDefaultLable.getSWTWidgetControl());

	AbstractELTWidget eltDefaultTextBox = new ELTDefaultTextBox().defaultText("Hello")
			.grabExcessHorizontalSpace(true);
	eltDefaultSubgroupComposite.attachWidget(eltDefaultTextBox);

	text = (Text) eltDefaultTextBox.getSWTWidgetControl();
	text.setFocus();
	text.setTextLimit(256);
	firstTextWidget = text;
	txtDecorator = WidgetUtility.addDecorator(text, Messages.FIELD_LABEL_ERROR);
	txtDecorator.setMarginWidth(3);
	ListenerHelper listenerHelper = new ListenerHelper();
	listenerHelper.put(HelperType.CONTROL_DECORATION, txtDecorator);
	listenerHelper.put(HelperType.CURRENT_COMPONENT, getComponent());
	try {
		listener = (ELTVerifyComponentNameListener) ListenerFactory.Listners.VERIFY_COMPONENT_NAME.getListener();
		listener.setNames((ArrayList<String>) super.componentMiscellaneousProperties
				.getComponentMiscellaneousProperty(COMPONENT_NAMES));
		eltDefaultTextBox.attachListener(listener, propertyDialogButtonBar, listenerHelper,
				eltDefaultTextBox.getSWTWidgetControl());

		focusOutListener = (ELTNormalFocusOutListener) ListenerFactory.Listners.NORMAL_FOCUS_OUT.getListener();
		listener.setNames((ArrayList<String>) super.componentMiscellaneousProperties
				.getComponentMiscellaneousProperty(COMPONENT_NAMES));
		eltDefaultTextBox.attachListener(focusOutListener, propertyDialogButtonBar, listenerHelper,
				eltDefaultTextBox.getSWTWidgetControl());

	} catch (Exception exception) {
		logger.error("Exception occured", exception);
	}

	populateWidget();

}