org.eclipse.swt.events.FocusAdapter Java Examples
The following examples show how to use
org.eclipse.swt.events.FocusAdapter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModelPropertiesDialog.java From erflute with Apache License 2.0 | 7 votes |
private void edit(final TableItem item, final TableEditor tableEditor) { final Text text = new Text(table, SWT.NONE); text.setText(item.getText(targetColumn)); text.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { item.setText(targetColumn, text.getText()); text.dispose(); } }); tableEditor.setEditor(text, item, targetColumn); text.setFocus(); text.selectAll(); }
Example #2
Source File: ErDiagramInformationControl.java From ermaster-b with Apache License 2.0 | 6 votes |
public ErDiagramInformationControl(ERDiagram diagram, Shell shell, Control composite) { super(shell, true); this.diagram = diagram; create(); int width = 300; int height = 300; Point loc = composite.toDisplay(0, 0); Point size = composite.getSize(); int x = (size.x - width) / 2 + loc.x; int y = (size.y - height) / 2 + loc.y; setSize(width, height); setLocation(new Point(x, y)); addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { dispose(); } }); }
Example #3
Source File: ModelPropertiesDialog.java From ermaster-b with Apache License 2.0 | 6 votes |
private void edit(final TableItem item, final TableEditor tableEditor) { final Text text = new Text(table, SWT.NONE); text.setText(item.getText(targetColumn)); text.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { item.setText(targetColumn, text.getText()); text.dispose(); } }); tableEditor.setEditor(text, item, targetColumn); text.setFocus(); text.selectAll(); }
Example #4
Source File: TeraFastDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
/** * @param factory * factory to use. */ protected void buildTableLine( final PluginWidgetFactory factory ) { final Control topControl = this.wConnection; this.wlTable = factory.createRightLabel( BaseMessages.getString( PKG, "TeraFastDialog.TargetTable.Label" ) ); this.props.setLook( this.wlTable ); this.wlTable.setLayoutData( factory.createLabelLayoutData( topControl ) ); this.wTable = factory.createSingleTextVarLeft(); this.props.setLook( this.wTable ); this.wTable.setLayoutData( factory.createControlLayoutData( topControl ) ); this.wTable.addFocusListener( new FocusAdapter() { @Override public void focusLost( final FocusEvent event ) { setTableFieldCombo(); } } ); }
Example #5
Source File: ETFTextPlugin.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
public Composite createContainer(Composite parent, ICallback h){ handler = h; etf = new EnhancedTextField(parent); etf.text.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e){ if (bSaveOnFocusLost) { if (handler != null) { handler.save(); } } } }); ike = new ExternalLink(); ike.connect(etf); etf.setText(StringTool.leer); return etf; }
Example #6
Source File: BonitaContentProposalAdapter.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected Control createDialogArea(final Composite parent) { text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP | SWT.NO_FOCUS); // Use the compact margins employed by PopupDialog. final GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH); gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING; gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING; text.setLayoutData(gd); text.setText(contents); // since SWT.NO_FOCUS is only a hint... text.addFocusListener(new FocusAdapter() { @Override public void focusGained(final FocusEvent event) { ContentProposalPopup.this.close(); } }); return text; }
Example #7
Source File: AutoCompleteTextCellEditor.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public void setProposalProvider(IContentProposalProvider proposalProvider) { final TextContentAdapter controlContentAdapter = new TextContentAdapter(); proposalAdapter = new ContentProposalAdapter(getControl(), controlContentAdapter, proposalProvider, contentAssistKeyStroke, null); proposalAdapter.setPropagateKeys(true); proposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); proposalAdapter.setAutoActivationDelay(0); proposalAdapter.getControl().addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { AutoCompleteTextCellEditor.this.focusLost(); } }); proposalAdapter.addContentProposalListener(new IContentProposalListener() { @Override public void proposalAccepted(IContentProposal proposal) { fireApplyEditorValue(); } }); }
Example #8
Source File: EquivalentPage.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 验证用户输入的加权系数的正确性 * @param equiTxt */ private void validEquiTxt(final Text equiTxt){ final String defaultStr = "0.50"; equiTxt.setText(defaultStr); equiTxt.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { String textStr = equiTxt.getText().trim(); if (textStr == null || textStr.trim().length() == 0) { equiTxt.setText(defaultStr); }else { String regular = "1\\.(0){0,2}|0\\.\\d{0,2}"; if (!textStr.matches(regular)) { MessageDialog.openInformation(getShell(), Messages.getString("preference.EquivalentPage.msgTitle"), Messages.getString("preference.EquivalentPage.msg5")); equiTxt.setText(defaultStr); } } } }); }
Example #9
Source File: EquivalentPage.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 验证用户输入的加权系数的正确性 * @param equiTxt */ private void validEquiTxt(final Text equiTxt){ final String defaultStr = "0.50"; equiTxt.setText(defaultStr); equiTxt.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { String textStr = equiTxt.getText().trim(); if (textStr == null || textStr.trim().length() == 0) { equiTxt.setText(defaultStr); }else { String regular = "1\\.(0){0,2}|0\\.\\d{0,2}"; if (!textStr.matches(regular)) { MessageDialog.openInformation(getShell(), Messages.getString("preference.EquivalentPage.msgTitle"), Messages.getString("preference.EquivalentPage.msg5")); equiTxt.setText(defaultStr); } } } }); }
Example #10
Source File: RelationSetDescriptorEditor.java From depan with Apache License 2.0 | 6 votes |
/** * In a future world, this might provide access to a complete set * of {@code ResourceDocument} properties. * @return */ @SuppressWarnings("unused") private Composite setupProperties(Composite parent) { Composite result = Widgets.buildGridContainer(parent, 2); Label label = Widgets.buildCompactLabel(result, "&Name:"); relSetName = new Text(result, SWT.BORDER | SWT.SINGLE); relSetName.setLayoutData(Widgets.buildHorzFillData()); relSetName.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { if (relSetInfo.getName().equals(relSetName.getText())) { return; } setDirtyState(true); handleDocumentChange(); } }); return result; }
Example #11
Source File: EdgeMatcherEditor.java From depan with Apache License 2.0 | 6 votes |
/** * In a future world, this might provide access to a complete set * of {@code ResourceDocument} properties. */ @SuppressWarnings("unused") private Composite setupProperties(Composite parent) { Composite result = Widgets.buildGridContainer(parent, 2); Label label = Widgets.buildCompactLabel(result, "&Name:"); matcherName = new Text(result, SWT.BORDER | SWT.SINGLE); matcherName.setLayoutData(Widgets.buildHorzFillData()); if (null != matcherInfo) { matcherName.setText(matcherInfo.getName()); } matcherName.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { if (matcherInfo.getName().equals(matcherName.getText())) { return; } setDirtyState(true); handleDocumentChange(); } }); return result; }
Example #12
Source File: RelationDisplayEditor.java From depan with Apache License 2.0 | 6 votes |
/** * In a future world, this might provide access to a complete set * of {@code ResourceDocument} properties. */ @SuppressWarnings("unused") private Composite setupProperties(Composite parent) { Composite result = Widgets.buildGridContainer(parent, 2); Label label = Widgets.buildCompactLabel(result, "&Name:"); relSetName = new Text(result, SWT.BORDER | SWT.SINGLE); relSetName.setLayoutData(Widgets.buildHorzFillData()); relSetName.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { if (propInfo.getName().equals(relSetName.getText())) { return; } setDirtyState(true); handleDocumentChange(); } }); return result; }
Example #13
Source File: ModelPropertiesDialog.java From ermasterr with Apache License 2.0 | 6 votes |
private void edit(final TableItem item, final TableEditor tableEditor) { final Text text = new Text(table, SWT.NONE); text.setText(item.getText(targetColumn)); text.addFocusListener(new FocusAdapter() { @Override public void focusLost(final FocusEvent e) { item.setText(targetColumn, text.getText()); text.dispose(); } }); tableEditor.setEditor(text, item, targetColumn); text.setFocus(); text.selectAll(); }
Example #14
Source File: TexlipseProjectFilesWizardPage.java From texlipse with Eclipse Public License 1.0 | 5 votes |
/** * Create the output file name field. * @param composite the parent container */ private void createTempDirControl(Composite composite) { // add label Label mainLabel = new Label(composite, SWT.LEFT); mainLabel.setText(TexlipsePlugin.getResourceString("projectWizardTempDirLabel")); mainLabel.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTempDirTooltip")); mainLabel.setLayoutData(new GridData()); // add text field tempDirNameField = new Text(composite, SWT.SINGLE | SWT.BORDER); tempDirNameField.setText(attributes.getTempDir()); tempDirNameField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTempDirTooltip")); tempDirNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); tempDirNameField.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent event) { if (tempDirItem != null) { dirTree.setSelection(new TreeItem[] { tempDirItem }); } }}); tempDirNameField.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (!tempDirNameField.isDisposed()) { String t = tempDirNameField.getText(); attributes.setTempDir(t); validateDirName(tempDirNameField, t); if (t == null || t.length() == 0) { recreateSubTree(); } else if (tempDirItem == null) { recreateSubTree(); } if (tempDirItem != null) { tempDirItem.setText(t); } } }}); }
Example #15
Source File: TexlipseProjectFilesWizardPage.java From texlipse with Eclipse Public License 1.0 | 5 votes |
/** * Create main file settings box. * @param composite the parent container */ private void createMainFileControl(Composite composite) { // add label Label mainLabel = new Label(composite, SWT.LEFT); mainLabel.setText(TexlipsePlugin.getResourceString("projectWizardMainFileLabel")); mainLabel.setToolTipText(TexlipsePlugin.getResourceString("projectWizardMainFileTooltip")); mainLabel.setLayoutData(new GridData()); // add text field sourceFileNameField = new Text(composite, SWT.SINGLE | SWT.BORDER); sourceFileNameField.setText(attributes.getSourceFile()); sourceFileNameField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardMainFileTooltip")); sourceFileNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); sourceFileNameField.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent event) { dirTree.setSelection(new TreeItem[] { sourceFileItem }); }}); sourceFileNameField.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (!sourceFileNameField.isDisposed()) { String t = sourceFileNameField.getText(); sourceFileItem.setText(t); tempFileItem.setText(t.substring(0, t.lastIndexOf('.')+1) + "aux"); validateMainFileName(t); } }}); }
Example #16
Source File: TexlipseProjectFilesWizardPage.java From texlipse with Eclipse Public License 1.0 | 5 votes |
/** * Create the output file name field. * @param composite the parent container */ private void createMainDirControl(Composite composite) { // add label Label mainLabel = new Label(composite, SWT.LEFT); mainLabel.setText(TexlipsePlugin.getResourceString("projectWizardMainDirLabel")); mainLabel.setToolTipText(TexlipsePlugin.getResourceString("projectWizardMainDirTooltip")); mainLabel.setLayoutData(new GridData()); // add text field sourceDirNameField = new Text(composite, SWT.SINGLE | SWT.BORDER); sourceDirNameField.setText(attributes.getSourceDir()); sourceDirNameField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardMainDirTooltip")); sourceDirNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); sourceDirNameField.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent event) { if (sourceDirItem != null) { dirTree.setSelection(new TreeItem[] { sourceDirItem }); } }}); sourceDirNameField.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (!sourceDirNameField.isDisposed()) { String t = sourceDirNameField.getText(); attributes.setSourceDir(t); validateDirName(sourceDirNameField, t); if (t == null || t.length() == 0) { recreateSubTree(); } else if (sourceDirItem == null) { recreateSubTree(); } if (sourceDirItem != null) { sourceDirItem.setText(t); } } }}); }
Example #17
Source File: TexlipseProjectFilesWizardPage.java From texlipse with Eclipse Public License 1.0 | 5 votes |
/** * Create the output file name field. * @param composite the parent container */ private void createOutputFileControl(Composite composite) { // add label Label mainLabel = new Label(composite, SWT.LEFT); mainLabel.setText(TexlipsePlugin.getResourceString("projectWizardOutputFileLabel")); mainLabel.setToolTipText(TexlipsePlugin.getResourceString("projectWizardOutputFileTooltip")); mainLabel.setLayoutData(new GridData()); // add text field outputFileNameField = new Text(composite, SWT.SINGLE | SWT.BORDER); outputFileNameField.setText(attributes.getOutputFile()); outputFileNameField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardOutputFileTooltip")); outputFileNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); outputFileNameField.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent event) { dirTree.setSelection(new TreeItem[] { outputFileItem }); }}); outputFileNameField.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (!outputFileNameField.isDisposed()) { String t = outputFileNameField.getText(); outputFileItem.setText(t); validateOutputFileName(t); } }}); }
Example #18
Source File: ActiveControl.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
protected void setControl(Control control){ ctl = control; ctl.setLayoutData(SWTHelper.getFillGridData(2, true, 1, false)); ctl.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e){ if (isValid()) { } } }); }
Example #19
Source File: MoneyInput.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void prepare(){ text.addFocusListener(new FocusAdapter() { @Override public void focusLost(final FocusEvent e){ try { String t = text.getText(); if (t.length() == 0) { text.setText(new ch.rgw.tools.Money().getAmountAsString()); } else { ch.rgw.tools.Money.checkInput(t); } for (SelectionListener lis : listeners) { Event ev = new Event(); ev.widget = e.widget; ev.display = e.display; lis.widgetSelected(new SelectionEvent(ev)); } } catch (ParseException px) { SWTHelper.alert(Messages.MoneyInput_InvalidAmountCaption, //$NON-NLS-1$ Messages.MoneyInput_InvalidAmountContents); //$NON-NLS-1$ } } }); /* * text.addVerifyListener(new VerifyListener(){ public void verifyText(VerifyEvent e) { * if(e.character==SWT.DEL || e.character==SWT.BS){ e.doit=true; }else{ String * t=text.getText()+e.character; if(t.length()<2 || t.matches("[0-9]+[\\.,]?[0-9]{0,2}")){ * e.doit=true; }else{ e.doit=false; } } }}); */ }
Example #20
Source File: TexlipseProjectFilesWizardPage.java From texlipse with Eclipse Public License 1.0 | 5 votes |
/** * Create the output file name field. * @param composite the parent container */ private void createOutputDirControl(Composite composite) { // add label Label mainLabel = new Label(composite, SWT.LEFT); mainLabel.setText(TexlipsePlugin.getResourceString("projectWizardOutputDirLabel")); mainLabel.setToolTipText(TexlipsePlugin.getResourceString("projectWizardOutputDirTooltip")); mainLabel.setLayoutData(new GridData()); // add text field outputDirNameField = new Text(composite, SWT.SINGLE | SWT.BORDER); outputDirNameField.setText(attributes.getOutputDir()); outputDirNameField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardOutputDirTooltip")); outputDirNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); outputDirNameField.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent event) { if (outputDirItem != null) { dirTree.setSelection(new TreeItem[] { outputDirItem }); } }}); outputDirNameField.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (!outputDirNameField.isDisposed()) { String t = outputDirNameField.getText(); attributes.setOutputDir(t); validateDirName(outputDirNameField, t); if (t == null || t.length() == 0) { recreateSubTree(); } else if (outputDirItem == null) { recreateSubTree(); } if (outputDirItem != null) { outputDirItem.setText(t); } } }}); }
Example #21
Source File: CompositeForCodeTab.java From CogniCrypt with Eclipse Public License 2.0 | 5 votes |
public CompositeForCodeTab(final Composite parent, final int style, final Answer answer) { super(parent, style); // Non-editable text box containing answer value final Text txtBoxAnswers = new Text(this, SWT.BORDER); txtBoxAnswers.setBounds(5, 5, 210, 25); txtBoxAnswers.setEditable(false); txtBoxAnswers.setText(answer.getValue()); // Code dependency text field final Text txtValue = new Text(this, SWT.BORDER); txtValue.setBounds(220, 5, 200, 25); txtValue.setVisible(true); final CodeDependency codeDependency = new CodeDependency(); if (answer.getCodeDependencies() != null) { for (final CodeDependency cd : answer.getCodeDependencies()) { if (cd.getValue() != null) { txtValue.setText(cd.getValue()); codeDependency.setValue(txtValue.getText()); } } } txtValue.addFocusListener(new FocusAdapter() { @Override public void focusLost(final FocusEvent e) { codeDependency.setValue(txtValue.getText()); } }); final ArrayList<CodeDependency> codeDependencies = new ArrayList<CodeDependency>(); codeDependencies.add(codeDependency); answer.setCodeDependencies(codeDependencies); }
Example #22
Source File: StyledTextComp.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public void addFocusListener( FocusAdapter focusAdapter ) { styledText.addFocusListener( focusAdapter ); }
Example #23
Source File: StyledTextComp.java From hop with Apache License 2.0 | 4 votes |
public void addFocusListener( FocusAdapter focusAdapter ) { styledText.addFocusListener( focusAdapter ); }