Java Code Examples for org.eclipse.swt.widgets.Listener#handleEvent()
The following examples show how to use
org.eclipse.swt.widgets.Listener#handleEvent() .
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: ExpressionCollectionViewer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected void updateTableOrExpressionMode(final boolean isTableMode) { initializeTableOrExpression(isTableMode); final Point defaultSize = mainComposite.getSize(); final Point size = mainComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); mainComposite.setSize(defaultSize.x, size.y); mainComposite.layout(true, true); for (final Listener listener : listeners) { listener.handleEvent(null); } for (final IExpressionModeListener l : modeListeners) { if (isTableMode) { l.useTable(); } else { l.useSimpleExpression(); } } }
Example 2
Source File: PulldownHandler.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
public Object execute(ExecutionEvent event) throws ExecutionException { // open the button's dropdown menu Object trigger = event.getTrigger(); if (trigger instanceof Event) { Widget widget = ((Event) trigger).widget; if (widget instanceof ToolItem) { ToolItem toolItem = (ToolItem) widget; Listener[] listeners = toolItem.getListeners(SWT.Selection); if (listeners.length > 0) { Listener listener = listeners[0]; // should be only one listener // send an event to the widget to open the menu // see CommandContributionItem.openDropDownMenu(Event) Event e = new Event(); e.type = SWT.Selection; e.widget = widget; e.detail = 4; // dropdown detail e.y = toolItem.getBounds().height; // position menu listener.handleEvent(e); } } } return null; }
Example 3
Source File: KeyBindingHelper.java From APICloud-Studio with 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 4
Source File: ChartExpressionButton.java From birt with Eclipse Public License 1.0 | 6 votes |
protected void notifyChangeEvent( ) { String newExpr = eHelper.getExpression( ); String newType = eHelper.getExpressionType( ); Event event = new Event( ); event.widget = eb.getControl( ); event.detail = SWT.Modify; String[] data = new String[4]; data[0] = lastExpr.getExpression( ); data[1] = newExpr; data[2] = lastExpr.getType( ); data[3] = newType; event.data = data; for ( Listener listener : listeners ) { listener.handleEvent( event ); } save( ); }
Example 5
Source File: TagStyleManager.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public void setTagStyle(TagStyle tagStyle) { this.tagStyle = tagStyle; TagStyle.setTagStyle(tagStyle); Event event = new Event(); event.data = tagStyle; for (Listener listener : tagStyleChangeListeners) { listener.handleEvent(event); } }
Example 6
Source File: WarningDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private Listener listenAndDispose( final Listener lsCancel ) { return new Listener() { @Override public void handleEvent( final Event event ) { lsCancel.handleEvent( event ); shell.dispose(); } }; }
Example 7
Source File: ExpressionCollectionViewer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void widgetSelected(final SelectionEvent event) { super.widgetSelected(event); if (viewer != null && viewer.getSelection() != null && !viewer.getSelection().isEmpty()) { final int indexRowToRemove = viewer.getTable() .getSelectionIndex(); removeRow(indexRowToRemove); } for (final Listener l : listeners) { l.handleEvent(new Event()); } }
Example 8
Source File: IDEResourcePageHelper.java From birt with Eclipse Public License 1.0 | 5 votes |
private void notifyTextChange( String text ) { Event event = new Event( ); event.text = text; List<Listener> list = listeners.get( SWT.Selection ); for ( int i = 0; i < list.size( ); i++ ) { Listener listener = list.get( i ); listener.handleEvent( event ); } }
Example 9
Source File: PatternImageEditorDialog.java From birt with 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 10
Source File: Bug459484Test.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Checks what happens if 3/29/2015 is attempted to be changed * into 2/29/2015 which is not a valid date. The {@link Calendar} instance * used internally makes this into 3/1/2015 which should be reflected * in the {@link Text} widget. */ @Test public void dateCorrectionAfterFocusLost() { Shell shell = new Shell(); Locale locale = Locale.US; DateTimeFormatter formatter = new DateFormatter(locale); FormattedText formattedText = new FormattedText(shell); formattedText.setFormatter(formatter); Calendar calendar = Calendar.getInstance(locale); calendar.clear(); calendar.set(2015, Calendar.MARCH, 29, 0, 0, 0); formattedText.setValue(calendar.getTime()); formattedText.getControl().setFocus(); formattedText.getControl().setText("2/29/2015"); for (Listener listener : formattedText.getControl().getListeners(SWT.FocusOut)) { listener.handleEvent(createEvent(SWT.FocusOut, formattedText.getControl())); } calendar.clear(); calendar.set(2015, Calendar.MARCH, 1, 0, 0, 0); assertEquals("Expected corrected date value", calendar.getTime(), formattedText.getValue()); assertEquals("Expected corrected date string", "3/1/2015", formattedText.getControl().getText()); }
Example 11
Source File: StyledTextCellEditor.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public void close() { if (close) { return; } for (Listener listener : closingListeners) { Event event = new Event(); event.data = this; listener.handleEvent(event); } close = true; // 状态改为已经关闭 xliffEditor.getTable().removeDisposeListener(this); StyledText text = viewer.getTextWidget(); if (text != null && !text.isDisposed()) { actionHandler.removeTextViewer(); text.setMenu(null); // dispose前应去掉右键menu,因为右键menu是和nattable共享的 viewer.reset(); text.dispose(); text = null; } // 如果 XLIFF 编辑器仍处于激活状态,则把焦点交给编辑器 try { IWorkbenchPart activepart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getActivePart(); if (xliffEditor.equals(activepart)) { xliffEditor.setFocus(); } } catch (NullPointerException e) { } // NatTable table = xliffEditor.getTable(); // int[] rowPositions = new int[] { hsCellEditor.getRowPosition() }; // table.doCommand(new AutoResizeCurrentRowsCommand(table, rowPositions, table.getConfigRegistry())); }
Example 12
Source File: TagStyleManager.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public void setTagStyle(TagStyle tagStyle) { this.tagStyle = tagStyle; TagStyle.setTagStyle(tagStyle); Event event = new Event(); event.data = tagStyle; for (Listener listener : tagStyleChangeListeners) { listener.handleEvent(event); } }
Example 13
Source File: StyledTextCellEditor.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public void close() { if (close) { return; } for (Listener listener : closingListeners) { Event event = new Event(); event.data = this; listener.handleEvent(event); } close = true; // 状态改为已经关闭 xliffEditor.getTable().removeDisposeListener(this); StyledText text = viewer.getTextWidget(); if (text != null && !text.isDisposed()) { actionHandler.removeTextViewer(); text.setMenu(null); // dispose前应去掉右键menu,因为右键menu是和nattable共享的 viewer.reset(); text.dispose(); text = null; } // 如果 XLIFF 编辑器仍处于激活状态,则把焦点交给编辑器 try { IWorkbenchPart activepart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getActivePart(); if (xliffEditor.equals(activepart)) { xliffEditor.setFocus(); } } catch (NullPointerException e) { } // NatTable table = xliffEditor.getTable(); // int[] rowPositions = new int[] { hsCellEditor.getRowPosition() }; // table.doCommand(new AutoResizeCurrentRowsCommand(table, rowPositions, table.getConfigRegistry())); }
Example 14
Source File: ShellManager.java From BiglyBT with GNU General Public License v2.0 | 5 votes |
/** * <p>Invokes the handleEvent method specified by the SWT listener for each managed shell</p> * <p>The event's widget is set to the reference of the shell invoking it</p> * @param command A command implemented as a SWT Listener */ public final void performForShells(final Listener command) { Iterator iter = shells.iterator(); for(int i = 0; i < shells.size(); i++) { Shell aShell = (Shell)iter.next(); Event evt = new Event(); evt.widget = aShell; evt.data = this; command.handleEvent(evt); } }
Example 15
Source File: VControl.java From nebula with Eclipse Public License 2.0 | 5 votes |
void handleEvent(Event event) { event.data = this; filterEvent(event); if(listeners != null && listeners.containsKey(event.type)) { Listener[] la = listeners.get(event.type).toArray(new Listener[listeners.get(event.type).size()]); for(Listener listener : la) { listener.handleEvent(event); } } }
Example 16
Source File: SelectionAwareExpressionEditor.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected void fireSelectionChanged() { for (final Listener l : listeners) { l.handleEvent(new Event()); } }
Example 17
Source File: VControl.java From nebula with Eclipse Public License 2.0 | 4 votes |
public final void paintControl(Event e) { if(painter != null && bounds.intersects(e.x, e.y, e.width, e.height) && isVisible()) { int alpha = e.gc.getAlpha(); int fullX, fullY, fullW, fullH; fullX = bounds.x - 1; fullY = bounds.y - 1; if(parent != null) { fullW = Math.min(parent.bounds.x + parent.bounds.width - bounds.x, bounds.x + bounds.width) + 1; fullH = Math.min(parent.bounds.y + parent.bounds.height - bounds.y, bounds.y + bounds.height) + 1; } else { fullW = bounds.width; fullH = bounds.height; } int clientX, clientY, clientW, clientH; clientX = fullX + marginLeft; clientY = fullY + marginTop; clientW = fullW - marginLeft - marginRight; clientH = fullH - marginTop - marginBottom; e.gc.setClipping(fullX, fullY, fullW, fullH); setAlpha(e.gc); painter.paintBackground(this, e); if(clientW > 0 && clientH > 0) { e.gc.setClipping(clientX, clientY, clientW, clientH); setAlpha(e.gc); painter.paintContent(this, e); } e.gc.setClipping(fullX, fullY, fullW, fullH); setAlpha(e.gc); painter.paintBorders(this, e); if(!getEnabled()) { setAlpha(e.gc, 25); e.gc.setBackground(e.display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); e.gc.fillRectangle(fullX, fullY, fullW, fullH); } e.gc.setClipping((Rectangle) null); e.gc.setAlpha(alpha); if(listeners.containsKey(SWT.Paint)) { for(Listener listener : listeners.get(SWT.Paint)) { listener.handleEvent(e); } } } }
Example 18
Source File: DropDownMenuFigure.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected void fireVisibilityChanged() { for(Listener l : listeners){ l.handleEvent(new Event()) ; } }