org.eclipse.swt.events.FocusEvent Java Examples
The following examples show how to use
org.eclipse.swt.events.FocusEvent.
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: StyledTextXtextAdapter.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@Override public void focusLost(FocusEvent e) { if (SWT.getPlatform().equals("gtk")) { if (isIgnoreNextFocusLost()) { setIgnoreNextFocusLost(false); return; } if (text.getMenu().isVisible()) { setIgnoreNextFocusLost(true); return; } } if (this.selectionProviderOnFocusLost != null) { this.site.setSelectionProvider(this.selectionProviderOnFocusLost); } text.setSelection(text.getCaretOffset()); }
Example #3
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 #4
Source File: SWTNumberAxisEditor.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
public void focusLost(FocusEvent e) { if (e.getSource() == this.minimumRangeValue) { // verify min value if (!validateMinimum(this.minimumRangeValue.getText())) this.minimumRangeValue.setText(String.valueOf( this.minimumValue)); else this.minimumValue = Double.parseDouble( this.minimumRangeValue.getText()); } else if (e.getSource() == this.maximumRangeValue) { // verify max value if (!validateMaximum(this.maximumRangeValue.getText())) this.maximumRangeValue.setText(String.valueOf( this.maximumValue)); else this.maximumValue = Double.parseDouble( this.maximumRangeValue.getText()); } }
Example #5
Source File: FindBarActions.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public void focusGained(FocusEvent e) { if (listening) { return; } if (firstActivation) { firstActivation = false; // On the first activation we update the commands to bindings because we want its side-effect // which is updating the tooltips to match the command. updateCommandToBinding(); } listening = true; display = PlatformUI.getWorkbench().getDisplay(); display.addFilter(SWT.KeyDown, this); display.addFilter(SWT.Traverse, this); setFindBarContextActive(true); }
Example #6
Source File: MonthCalendar.java From nebula with Eclipse Public License 2.0 | 6 votes |
public void focusGained(FocusEvent e) { Day day = (Day) e.widget; if (lastSelectedDay != null && lastSelectedDay != day) { lastSelectedDay.setFocusState(Day.NO_FOCUS); lastSelectedDay.redraw(); } Point coordinates = day.getMonthPosition(); selectedDay = new MonthCalendarSelectedDay(day.getDate(), coordinates); e.data = selectedDay; lastSelectedDay = day; for (Iterator<FocusListener> focusListenersIter = focusListeners.iterator(); focusListenersIter.hasNext();) { FocusListener listener = (FocusListener) focusListenersIter.next(); listener.focusGained(e); } }
Example #7
Source File: InternalCompositeTable.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Handle focusGained events on any child control. * * FIXME: Needs to automatically scroll horizontally if the newly-focused * control is fully or partially occluded. * * @param sender * The row containing the sending control. * @param e * The SWT FocusEvent. */ public void focusGained(TableRow sender, FocusEvent e) { boolean rowChanged = false; int senderRowNumber = getRowNumber(sender); if (senderRowNumber != currentRow) { if (needToRequestRC) { if (!fireRequestRowChangeEvent()) { // Go back if we're not allowed to be here deferredSetFocus(getControl(currentColumn, currentRow), false); } } else { needToRequestRC = true; } rowChanged = true; } currentRow = senderRowNumber; currentColumn = sender.getColumnNumber((Control) e.widget); if (rowChanged) fireRowArriveEvent(); }
Example #8
Source File: ContentAssistant.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
private void focusChanged(FocusEvent e) { Control control = fControl; if (Helper.okToUse(control)) { Display d = control.getDisplay(); if (d != null) { d.asyncExec(new Runnable() { public void run() { if (!fProposalPopup.hasFocus() && (fContextInfoPopup == null || !fContextInfoPopup.hasFocus())) { hide(); } } }); } } }
Example #9
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 #10
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 #11
Source File: BaseFocusControlListener.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent) */ @Override public void focusGained(final FocusEvent e) { if (isFilled()) { // Widget not empty PromptSupport.setPromptDisplayed(control, false); return; } applyInitialLook(); PromptSupport.setPromptDisplayed(control, true); if (PromptSupport.getFocusBehavior(control) == FocusBehavior.HIDE_PROMPT) { hidePrompt(); } else { highLightPrompt(); } }
Example #12
Source File: AggregateEditorComposite.java From birt with Eclipse Public License 1.0 | 6 votes |
public void handleEvent( Event event ) { switch ( event.type ) { case SWT.FocusOut : focusLost( new FocusEvent( event ) ); break; case SWT.Traverse : switch ( event.detail ) { case SWT.TRAVERSE_TAB_NEXT : case SWT.TRAVERSE_TAB_PREVIOUS : // Indicates getting focus control rather than // cursor control event.doit = true; isPressingKey = true; } break; } }
Example #13
Source File: SWTNumberAxisEditor.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
public void focusLost(FocusEvent e) { if (e.getSource() == this.minimumRangeValue) { // verify min value if (!validateMinimum(this.minimumRangeValue.getText())) this.minimumRangeValue.setText(String.valueOf( this.minimumValue)); else this.minimumValue = Double.parseDouble( this.minimumRangeValue.getText()); } else if (e.getSource() == this.maximumRangeValue) { // verify max value if (!validateMaximum(this.maximumRangeValue.getText())) this.maximumRangeValue.setText(String.valueOf( this.maximumValue)); else this.maximumValue = Double.parseDouble( this.maximumRangeValue.getText()); } }
Example #14
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 #15
Source File: SWTNumberAxisEditor.java From openstock with GNU General Public License v3.0 | 6 votes |
public void focusLost(FocusEvent e) { if (e.getSource() == this.minimumRangeValue) { // verify min value if (!validateMinimum(this.minimumRangeValue.getText())) this.minimumRangeValue.setText(String.valueOf( this.minimumValue)); else this.minimumValue = Double.parseDouble( this.minimumRangeValue.getText()); } else if (e.getSource() == this.maximumRangeValue) { // verify max value if (!validateMaximum(this.maximumRangeValue.getText())) this.maximumRangeValue.setText(String.valueOf( this.maximumValue)); else this.maximumValue = Double.parseDouble( this.maximumRangeValue.getText()); } }
Example #16
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 #17
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 #18
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 #19
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 #20
Source File: SWTChartEditor.java From gama with GNU General Public License v3.0 | 6 votes |
@Override public void focusLost(final FocusEvent e) { if (e.getSource() == this.minimumRangeValue) { // verify min value if (!validateMinimum(this.minimumRangeValue.getText())) { this.minimumRangeValue.setText(String.valueOf(this.minimumValue)); } else { this.minimumValue = Double.parseDouble(this.minimumRangeValue.getText()); } } else if (e.getSource() == this.maximumRangeValue) { // verify max value if (!validateMaximum(this.maximumRangeValue.getText())) { this.maximumRangeValue.setText(String.valueOf(this.maximumValue)); } else { this.maximumValue = Double.parseDouble(this.maximumRangeValue.getText()); } } }
Example #21
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 #22
Source File: ExpressionControl.java From gama with GNU General Public License v3.0 | 6 votes |
@Override public void focusLost(final FocusEvent e) { if (e.widget == null || !e.widget.equals(text)) { return; } widgetDefaultSelected(null); /* async is needed to wait until focus reaches its new Control */ removeTooltip(); // SwtGui.getDisplay().timerExec(100, new Runnable() { // // @Override // public void run() { // if ( SwtGui.getDisplay().isDisposed() ) { return; } // final Control control = SwtGui.getDisplay().getFocusControl(); // if ( control != text ) { // widgetDefaultSelected(null); // } // } // }); }
Example #23
Source File: SWTNumberAxisEditor.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
public void focusLost(FocusEvent e) { if (e.getSource() == this.minimumRangeValue) { // verify min value if (!validateMinimum(this.minimumRangeValue.getText())) this.minimumRangeValue.setText(String.valueOf( this.minimumValue)); else this.minimumValue = Double.parseDouble( this.minimumRangeValue.getText()); } else if (e.getSource() == this.maximumRangeValue) { // verify max value if (!validateMaximum(this.maximumRangeValue.getText())) this.maximumRangeValue.setText(String.valueOf( this.maximumValue)); else this.maximumValue = Double.parseDouble( this.maximumRangeValue.getText()); } }
Example #24
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 #25
Source File: StyledTextSelectionListener.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected void hookActions(FocusEvent e) { if (actionHandler == null) { final IActionBars bars = saveDiagramActions(); actionHandler = new StyledTextActionHandler(bars); } if (!actionHandler.isHooked()) { actionHandler.adaptStyledText((StyledText) e.widget); restoreDiagramActions(); } }
Example #26
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 #27
Source File: ExpressionControl.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public void focusGained(final FocusEvent e) { // if ( editor != null ) { // DEBUG.LOG("Focus gained:" + editor.getParam().getName()); // } // // if ( e.widget == null || !e.widget.equals(text) ) { return; } // computeValue(); }
Example #28
Source File: DayEditor.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void focusGained(FocusEvent e) { TimeSlice sendingRow = (TimeSlice) ((Composite) e.widget).getParent(); int day = sendingRow.getControlColumn(e.widget); int row = compositeTable.getControlRow(sendingRow); if (selectCalendarableControlOnSetFocus) { setSelectionByDayAndRow(day, row, null); } else { selectCalendarableControlOnSetFocus = true; } }
Example #29
Source File: TextEditorComposite.java From birt with Eclipse Public License 1.0 | 5 votes |
public void focusLost( FocusEvent e ) { if ( bTextModified ) { fireEvent( ); } }
Example #30
Source File: TimeGraphControl.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public void focusLost(FocusEvent e) { fIsInFocus = false; if (DRAG_NONE != fDragState) { setCapture(false); fDragState = DRAG_NONE; } redraw(); updateStatusLine(NO_STATUS); }