org.eclipse.swt.widgets.Event Java Examples
The following examples show how to use
org.eclipse.swt.widgets.Event.
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 Project: tmxeditor8 Author: heartsome File: StyledTextCellEditor.java License: GNU General Public License v2.0 | 6 votes |
/** * 添加标记样式改变监听 ; */ private void addTagStyleChangeListener() { final TagStyleManager tagStyleManager = xliffEditor.getTagStyleManager(); final Listener tagStyleChangeListener = new Listener() { public void handleEvent(Event event) { if (event.data != null && event.data instanceof TagStyle) { viewer.setTagStyle((TagStyle) event.data); } } }; tagStyleManager.addTagStyleChangeListener(tagStyleChangeListener); viewer.getTextWidget().addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { tagStyleManager.removeTagStyleChangeListener(tagStyleChangeListener); } }); }
Example #2
Source Project: statecharts Author: Yakindu File: StyledTextActionHandler.java License: Eclipse Public License 1.0 | 6 votes |
public void handleEvent(Event event) { switch (event.type) { case SWT.Activate : styledText = (StyledText) event.widget; updateActionsEnableState(); break; case SWT.Deactivate : styledText = null; updateActionsEnableState(); break; default : break; } }
Example #3
Source Project: pmTrans Author: juanerasmoe File: FindReplaceDialog.java License: GNU Lesser General Public License v3.0 | 6 votes |
private void renderTransparency(final Shell shell) { Group group = new Group(shell, SWT.NONE); group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 6, 1)); group.setLayout(new GridLayout(1, false)); group.setText("Transparency"); final Scale transparencySlider = new Scale(group, SWT.HORIZONTAL); transparencySlider.setMinimum(20); transparencySlider.setMaximum(100); transparencySlider.setPageIncrement(90); transparencySlider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); transparencySlider.setSelection(100); transparencySlider.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { shell.setAlpha(255 * transparencySlider.getSelection() / 100); } }); }
Example #4
Source Project: BiglyBT Author: BiglySoftware File: SpeedGraphic.java License: GNU General Public License v2.0 | 6 votes |
@Override public void initialize(Canvas canvas) { super.initialize(canvas); drawCanvas.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { if (bufferImage != null && !bufferImage.isDisposed()) { Rectangle bounds = bufferImage.getBounds(); if (bounds.width >= ( e.width + e.x ) && bounds.height >= ( e.height + e.y )) { e.gc.drawImage(bufferImage, e.x, e.y, e.width, e.height, e.x, e.y, e.width, e.height); } } } }); drawCanvas.addListener(SWT.Resize, new Listener() { @Override public void handleEvent(Event event) { drawChart(true); } }); }
Example #5
Source Project: uima-uimaj Author: apache File: ResourceDependencySection.java License: Apache License 2.0 | 6 votes |
@Override public void handleEvent(Event event) { if (event.widget == addButton) { handleAdd(); } else if (event.widget == removeButton || (event.type == SWT.KeyUp && event.character == SWT.DEL)) { handleRemove(); } else if (event.widget == editButton || event.type == SWT.MouseDoubleClick) { handleEdit(); } // else if (event.type == SWT.MouseDown && event.button == 3) { // handleTableContextMenuRequest(event); // } else if (event.type == SWT.MouseHover) { handleTableHoverHelp(event); } else if (event.type == SWT.Selection) { editor.getResourcesPage().getResourceBindingsSection().enable(); } enable(); }
Example #6
Source Project: saros Author: saros-project File: ContextMenuHelper.java License: GNU General Public License v2.0 | 6 votes |
private static void click(final MenuItem menuItem) { final Event event = new Event(); event.time = (int) System.currentTimeMillis(); event.widget = menuItem; event.display = menuItem.getDisplay(); event.type = SWT.Selection; UIThreadRunnable.asyncExec( menuItem.getDisplay(), new VoidResult() { @Override public void run() { menuItem.notifyListeners(SWT.Selection, event); } }); }
Example #7
Source Project: APICloud-Studio Author: apicloudcom File: KeyBindingHelper.java License: GNU General Public License v3.0 | 6 votes |
public static void handleEvent(Event e) { IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class); Listener keyDownFilter = ((BindingService) bindingService).getKeyboard().getKeyDownFilter(); boolean enabled = bindingService.isKeyFilterEnabled(); Control focusControl = e.display.getFocusControl(); try { bindingService.setKeyFilterEnabled(true); keyDownFilter.handleEvent(e); } finally { if (focusControl == e.display.getFocusControl()) // $codepro.audit.disable useEquals { bindingService.setKeyFilterEnabled(enabled); } } }
Example #8
Source Project: tesb-studio-se Author: Talend File: JavaCamelJobScriptsExportWSWizardPage.java License: Apache License 2.0 | 6 votes |
@Override public void handleEvent(Event e) { super.handleEvent(e); Widget source = e.widget; if (source == destinationBrowseButton) { handleDestinationBrowseButtonPressed(); } if (source instanceof Combo) { String destination = ((Combo) source).getText(); if (getDialogSettings() != null) { IDialogSettings section = getDialogSettings().getSection(DESTINATION_FILE); if (section == null) { section = getDialogSettings().addNewSection(DESTINATION_FILE); } section.put(DESTINATION_FILE, destination); } } }
Example #9
Source Project: ermaster-b Author: naoki-iwami File: ExportToDDLAction.java License: Apache License 2.0 | 6 votes |
@Override public void execute(Event event) { ERDiagram diagram = this.getDiagram(); ExportToDDLDialog dialog = new ExportToDDLDialog(PlatformUI .getWorkbench().getActiveWorkbenchWindow().getShell(), diagram, this.getEditorPart(), this.getGraphicalViewer()); dialog.open(); this.refreshProject(); if (dialog.getExportSetting() != null && !diagram.getDiagramContents().getSettings() .getExportSetting().equals(dialog.getExportSetting())) { Settings newSettings = (Settings) diagram.getDiagramContents() .getSettings().clone(); newSettings.setExportSetting(dialog.getExportSetting()); ChangeSettingsCommand command = new ChangeSettingsCommand(diagram, newSettings); this.execute(command); } }
Example #10
Source Project: bonita-studio Author: bonitasoft File: OpenUIDesignerCoolBarItemTest.java License: GNU General Public License v2.0 | 6 votes |
@Test public void call_open_ui_designer_command_on_selection() throws Exception { final OpenUIDesignerCoolBarItem openUIDesignerCoolBarItem = spy(new OpenUIDesignerCoolBarItem()); doReturn(openDesignerHandler).when(openUIDesignerCoolBarItem).getHandler(); doReturn(prefStore).when(openUIDesignerCoolBarItem).getPreferenceStore(); doReturn(eclipsePref).when(openUIDesignerCoolBarItem).getEclipsePreferences(); doReturn(true).when(eclipsePref).getBoolean(eq(OpenUIDesignerCoolBarItem.HIDE_UIDESIGNER_INFO_DIALOG), anyBoolean()); final Shell shell = realmWithDisplay.getShell(); doReturn(shell).when(openUIDesignerCoolBarItem).getShell(); final ToolBar toolbar = new ToolBar(realmWithDisplay.createComposite(), SWT.NONE); openUIDesignerCoolBarItem.fill(toolbar, 0, -1); final ToolItem toolItem = toolbar.getItem(0); toolItem.notifyListeners(SWT.Selection, new Event()); verify(openDesignerHandler).execute(); }
Example #11
Source Project: nebula Author: eclipse File: VButton.java License: Eclipse Public License 2.0 | 6 votes |
private Event createEvent(Event event) { Event e = new Event(); e.type = SWT.Selection; e.data = VButton.this; e.button = event.button; e.detail = event.detail; e.display = event.display; e.gc = event.gc; e.height = event.height; e.stateMask = event.stateMask; e.time = event.time; e.width = event.width; e.x = event.x; e.y = event.y; return e; }
Example #12
Source Project: nebula Author: eclipse File: PGroupToolItem.java License: Eclipse Public License 2.0 | 6 votes |
void onMouseDown(Event e) { if ((getStyle() & SWT.DROP_DOWN) == 0) { setSelection(!getSelection()); notifyListeners(SWT.Selection, new Event()); } else { if ( ((getStyle() & SWT.PUSH) == SWT.PUSH) && ( dropdownArea == null || !dropdownArea.contains(e.x, e.y))) { notifyListeners(SWT.Selection, new Event()); } else { Event event = new Event(); event.detail = SWT.ARROW; event.x = bounds.x; event.y = bounds.y + bounds.height; notifyListeners(SWT.Selection, event); } } }
Example #13
Source Project: ice Author: eclipse File: ToolItemMenuListener.java License: Eclipse Public License 1.0 | 6 votes |
/** * This function should only make the Menu visible if necessary. Nothing * inside the Menu will be changed. */ @Override public void handleEvent(Event event) { // We want to align the menu with the bottom-left corner of the ToolItem // arrow. // event.detail == SWT.ARROW means the arrow has been clicked. // event.detail == SWT.NONE means the button has been clicked. if (event.detail == SWT.ARROW || event.detail == SWT.NONE) { Rectangle r = toolItem.getBounds(); Point p = new Point(r.x, r.y + r.height); p = toolItem.getParent().toDisplay(p.x, p.y); menu.setLocation(p.x, p.y); menu.setVisible(true); } return; }
Example #14
Source Project: nebula Author: eclipse File: MoveScrollBarEffect.java License: Eclipse Public License 2.0 | 6 votes |
public void applyEffect(final long currentTime) { current = (int) (start + step * easingFunction.getValue((int) currentTime)); if (!scrollBar.isDisposed()) { scrollBar.setSelection(current); Event event = new Event(); event.detail = step < 0 ? SWT.PAGE_UP : SWT.PAGE_DOWN; event.data = this; event.display = scrollBar.getDisplay(); event.widget = scrollBar; event.doit = true; scrollBar.notifyListeners(SWT.Selection, event); } }
Example #15
Source Project: nebula Author: eclipse File: VButtonImageBak.java License: Eclipse Public License 2.0 | 6 votes |
public void handleEvent(Event e) { GC gc = new GC(b); Image image = new Image(b.getDisplay(), e.width, e.height); gc.copyArea(image, 0, 0); ImageData data = image.getImageData(); gc.dispose(); image.dispose(); images.put(key, data); keys.put(data, key); if(requests.containsKey(key)) { for(Iterator<VButton> iter = requests.get(key).iterator(); iter.hasNext();) { iter.next().redraw(); iter.remove(); } requests.remove(key); } Display.getDefault().asyncExec(new Runnable() { public void run() { if(!b.isDisposed() && b == b.getDisplay().getFocusControl()) { b.getParent().forceFocus(); } b.dispose(); } }); }
Example #16
Source Project: SWET Author: sergueik File: Breadcrumb.java License: MIT License | 6 votes |
private void addMouseDownListener() { addListener(SWT.MouseDown, new Listener() { @Override public void handleEvent(final Event event) { for (final BreadcrumbItem item : Breadcrumb.this.items) { if (item.getBounds().contains(event.x, event.y)) { final boolean isToggle = (item.getStyle() & SWT.TOGGLE) != 0; final boolean isPush = (item.getStyle() & SWT.PUSH) != 0; if (isToggle || isPush) { item.setSelection(!item.getSelection()); redraw(); update(); } item.setData(IS_BUTTON_PRESSED, "*"); return; } } } }); }
Example #17
Source Project: uima-uimaj Author: apache File: MetaDataSection.java License: Apache License 2.0 | 5 votes |
@Override public void handleEvent(Event event) { valueChanged = false; dmd.setName(setValueChanged(nameText.getText(), dmd.getName())); dmd.setVersion(setValueChanged(versionText.getText(), dmd.getVersion())); dmd.setVendor(setValueChanged(vendorText.getText(), dmd.getVendor())); dmd.setDescription(setValueChanged(multiLineFix(descriptionText.getText()), dmd .getDescription())); if (valueChanged) setFileDirty(); }
Example #18
Source Project: birt Author: eclipse File: LevelPropertyDialog.java License: Eclipse Public License 1.0 | 5 votes |
private IDialogHelper createHyperLinkPart( Composite parent ) { Object[] helperProviders = ElementAdapterManager.getAdapters( input, IDialogHelperProvider.class ); if ( helperProviders != null ) { for ( int i = 0; i < helperProviders.length; i++ ) { IDialogHelperProvider helperProvider = (IDialogHelperProvider) helperProviders[i]; if ( helperProvider != null ) { final IDialogHelper hyperLinkHelper = helperProvider.createHelper( this, BuilderConstants.HYPERLINK_HELPER_KEY ); if ( hyperLinkHelper != null ) { hyperLinkHelper.setProperty( BuilderConstants.HYPERLINK_LABEL, Messages.getString( "LevelPropertyDialog.Label.LinkTo" ) ); //$NON-NLS-1$ hyperLinkHelper.setProperty( BuilderConstants.HYPERLINK_BUTTON_TEXT, Messages.getString( "LevelPropertyDialog.Button.Text.Edit" ) ); //$NON-NLS-1$ hyperLinkHelper.setProperty( BuilderConstants.HYPERLINK_REPORT_ITEM_HANDLE, input ); hyperLinkHelper.setProperty( BuilderConstants.HYPERLINK_REPORT_ITEM_PROVIDER, new LinkToCubeExpressionProvider( input ) ); hyperLinkHelper.createContent( parent ); hyperLinkHelper.addListener( SWT.Modify, new Listener( ) { public void handleEvent( Event event ) { hyperLinkHelper.update( false ); } } ); hyperLinkHelper.update( true ); return hyperLinkHelper; } } } } return null; }
Example #19
Source Project: pentaho-kettle Author: pentaho File: ScriptValuesModDialog.java License: Apache License 2.0 | 5 votes |
private void addRenameTowTreeScriptItems() { lastItem = new TreeItem[1]; editor = new TreeEditor( wTree ); wTree.addListener( SWT.Selection, new Listener() { public void handleEvent( Event event ) { final TreeItem item = (TreeItem) event.item; renameFunction( item ); } } ); }
Example #20
Source Project: xtext-eclipse Author: eclipse File: AbstractLinkedEditingIntegrationTest.java License: Eclipse Public License 2.0 | 5 votes |
protected void pressKey(XtextEditor editor, char c) throws Exception { StyledText textWidget = editor.getInternalSourceViewer().getTextWidget(); Event e = new Event(); e.character = c; e.type = SWT.KeyDown; e.doit = true; //XXX Hack! if (c == SWT.ESC) { e.keyCode = 27; } textWidget.notifyListeners(SWT.KeyDown, e); }
Example #21
Source Project: birt Author: eclipse File: PatternImageEditorDialog.java License: Eclipse Public License 1.0 | 5 votes |
public void notifyListeners( ) { Event event = new Event( ); event.type = SWT.Modify; for ( Listener listener : listeners ) { listener.handleEvent( event ); } }
Example #22
Source Project: translationstudio8 Author: heartsome File: XLIFFEditorActionHandler.java License: GNU General Public License v2.0 | 5 votes |
public void runWithEvent(Event event) { if (viewer != null && !viewer.getTextWidget().isDisposed()) { StyledTextCellEditor editor = HsMultiActiveCellEditor.getFocusCellEditor(); boolean isSrc = false; if (editor != null && editor.getCellType().equals(NatTableConstant.SOURCE)) { isSrc = true; } StyledText styledText = viewer.getTextWidget(); String text = styledText.getText(); String selectionText = styledText.getSelectionText(); // 当选择源文时,要判断是否是删除所有源文 if (isSrc) { if (selectionText != null && text != null && text.equals(selectionText)) { MessageDialog.openInformation(viewer.getTextWidget().getShell(), Messages.getString("editor.XLIFFEditorActionHandler.msgTitle"), Messages.getString("editor.XLIFFEditorActionHandler.msg")); return; } } viewer.doOperation(ITextOperationTarget.DELETE); updateActionsEnableState(); return; } if (deleteAction != null) { deleteAction.runWithEvent(event); return; } }
Example #23
Source Project: erflute Author: dbflute-session File: ChangeFreeLayoutAction.java License: Apache License 2.0 | 5 votes |
@Override public void execute(Event event) { final ERDiagram diagram = getDiagram(); final ChangeFreeLayoutCommand command = new ChangeFreeLayoutCommand(diagram, isChecked()); execute(command); }
Example #24
Source Project: pentaho-kettle Author: pentaho File: ScriptDialog.java License: Apache License 2.0 | 5 votes |
private void addRenameTowTreeScriptItems() { lastItem = new TreeItem[1]; editor = new TreeEditor( wTree ); wTree.addListener( SWT.Selection, new Listener() { public void handleEvent( Event event ) { final TreeItem item = (TreeItem) event.item; renameFunction( item ); } } ); }
Example #25
Source Project: nebula Author: eclipse File: MessageArea.java License: Eclipse Public License 2.0 | 5 votes |
/** * Create a text box */ private void createTextBox() { final Text textbox = new Text(composite, SWT.BORDER | SWT.WRAP); textbox.setText(textBoxValue); final GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true, 1, 1); textbox.setLayoutData(gd); textbox.addListener(SWT.Modify, e -> { textBoxValue = textbox.getText(); }); textbox.addListener(SWT.KeyUp, e -> { if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { MessageArea.this.parent.shell.dispose(); MessageArea.this.parent.getFooterArea().selectedButtonIndex = 0; } }); textbox.getShell().addListener(SWT.Activate, new Listener() { @Override public void handleEvent(final Event arg0) { textbox.forceFocus(); textbox.setSelection(textbox.getText().length()); textbox.getShell().removeListener(SWT.Activate, this); } }); }
Example #26
Source Project: EasyShell Author: anb0s File: MenuPage.java License: Eclipse Public License 2.0 | 5 votes |
@Override protected Control createContents(Composite parent) { // main page composite Composite pageComponent = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(3, false); pageComponent.setLayout(layout); //parent.setLayout(layout); // search createSearchField(pageComponent); // get the native commands list commandList = CommandDataDefaultCollection.getCommandsNativeAll(new CommandDataList(CommandDataStore.instance().getDataList())); // table viewer createTableViewer(pageComponent); // buttons createButtons(pageComponent); // refresh the viewer refreshTableViewer(); // send event to refresh tableViewer selection Event event = new Event(); event.item = null; tableViewer.getTable().notifyListeners(SWT.Selection, event); return pageComponent; }
Example #27
Source Project: translationstudio8 Author: heartsome File: GridColumn.java License: GNU General Public License v2.0 | 5 votes |
/** * Fires resized event. */ void fireResized() { Event e = new Event(); e.display = this.getDisplay(); e.item = this; e.widget = parent; this.notifyListeners(SWT.Resize, e); }
Example #28
Source Project: Pydev Author: fabioz File: TableCombo.java License: Eclipse Public License 1.0 | 5 votes |
/** * Handle Combo events * @param event */ private void comboEvent(Event event) { switch (event.type) { case SWT.Dispose: removeListener(SWT.Dispose, listener); notifyListeners(SWT.Dispose, event); event.type = SWT.None; if (popup != null && !popup.isDisposed()) { table.removeListener(SWT.Dispose, listener); popup.dispose(); } Shell shell = getShell(); shell.removeListener(SWT.Deactivate, listener); Display display = getDisplay(); display.removeFilter(SWT.FocusIn, focusFilter); popup = null; text = null; table = null; arrow = null; selectedImage = null; break; case SWT.FocusIn: Control focusControl = getDisplay().getFocusControl(); if (focusControl == arrow || focusControl == table) return; if (isDropped()) { table.setFocus(); } else { text.setFocus(); } break; case SWT.Move: dropDown(false); break; case SWT.Resize: internalLayout(false); break; } }
Example #29
Source Project: tmxeditor8 Author: heartsome File: FileCoverMsgDialog.java License: GNU General Public License v2.0 | 5 votes |
public void handleEvent(Event event) { Widget resource = event.widget; if (resource == cancelBtn) { cancelPressed(); }else if (resource == skipBtn) { setReturnCode(SKIP); ALWAYS = alwaysBtn.getSelection(); close(); }else if (resource == overBtn) { setReturnCode(OVER); ALWAYS = alwaysBtn.getSelection(); close(); } }
Example #30
Source Project: BiglyBT Author: BiglySoftware File: TransferStatsView.java License: GNU General Public License v2.0 | 5 votes |
protected zoneView( SpeedManagerPingMapper _mapper, Canvas _canvas, String[] _labels, ValueFormater[] _formatters ) { mapper = _mapper; canvas = _canvas; labels = _labels; formatters = _formatters; canvas.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { if (buffer_image != null && !buffer_image.isDisposed()) { Rectangle bounds = buffer_image.getBounds(); if (bounds.width >= ( e.width + e.x ) && bounds.height >= ( e.height + e.y )) { e.gc.drawImage(buffer_image, e.x, e.y, e.width, e.height, e.x, e.y, e.width, e.height); } } } }); canvas.addListener(SWT.Resize, new Listener() { @Override public void handleEvent(Event event) { refresh(true); } }); COConfigurationManager.addAndFireParameterListener( "Graphics Update", this ); }