Java Code Examples for org.eclipse.swt.widgets.Composite#isDisposed()
The following examples show how to use
org.eclipse.swt.widgets.Composite#isDisposed() .
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: BaseCombo.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * A recursive method to find out if a composite is an ancestor of a * control. * * @param control * @param composite * @return true if the composite is an ancestor, false otherwise. */ protected static boolean containsControl(Control control, Composite composite) { if (composite != null && !composite.isDisposed()) { Control[] children = composite.getChildren(); for (Control child : children) { if (!child.isDisposed()) { if (child == control) { return true; } else if (child instanceof Composite) { return containsControl(control, (Composite) child); } } } } return false; }
Example 2
Source File: TableCellPainted.java From BiglyBT with GNU General Public License v2.0 | 6 votes |
@Override public Rectangle getBoundsOnDisplay() { if (isDisposed() || tableRow == null) { return null; } Rectangle bounds = getBoundsRaw(); if (bounds == null) { return null; } TableViewPainted tv = ((TableViewPainted) tableRow.getView()); if (tv == null) { return null; } Composite c = tv.getTableComposite(); if (c == null || c.isDisposed()) { return null; } Point pt = c.toDisplay(bounds.x, bounds.y); bounds.x = pt.x; bounds.y = pt.y; bounds.height = getHeight(); bounds.width = getWidthRaw(); return bounds; }
Example 3
Source File: SimpleInstallUI.java From BiglyBT with GNU General Public License v2.0 | 6 votes |
protected void build() { Composite parent = (Composite)instance.getProperty( UpdateCheckInstance.PT_UI_PARENT_SWT_COMPOSITE ); if ( parent != null ){ if (parent.isDisposed()) { throw( new RuntimeException( "cancelled" )); } build( parent ); }else{ throw( new RuntimeException( "borkeroo" )); } }
Example 4
Source File: SWTSkinObjectContainer.java From BiglyBT with GNU General Public License v2.0 | 6 votes |
private void obfuscatedImage(Composite c, Image image) { if (c == null || c.isDisposed() || !c.isVisible()) { return; } Control[] children = c.getChildren(); for (Control childControl : children) { if (!childControl.isVisible()) { continue; } ObfuscateImage oi = (ObfuscateImage) childControl.getData("ObfuscateImage"); if (oi != null) { oi.obfuscatedImage(image); continue; } if (childControl instanceof Composite) { obfuscatedImage((Composite) childControl, image); } } }
Example 5
Source File: ParameterExpandItem.java From gama with GNU General Public License v3.0 | 6 votes |
/** * Sets the control that is shown when the item is expanded. * * @param control * the new control (or null) * * @exception IllegalArgumentException * <ul> * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li> * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void setControl(final Composite control) { if (control != null) { if (control.isDisposed()) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } if (control.getParent() != parent) { SWT.error(SWT.ERROR_INVALID_PARENT); } } this.control = control; if (control != null) { control.setVisible(expanded); final int headerHeight = parent.bandHeight; control.setBounds(x + BORDER, y + headerHeight, Math.max(0, width - 2 * BORDER), Math.max(0, height + BORDER)); control.setBackground(IGamaColors.PARAMETERS_BACKGROUND.color()); } }
Example 6
Source File: VControl.java From nebula with Eclipse Public License 2.0 | 5 votes |
protected final static boolean containsControl(Control control, Composite composite) { if(composite != null && !composite.isDisposed()) { Control[] children = composite.getChildren(); for(Control child : children) { if(!child.isDisposed()) { if(child == control) { return true; } else if(child instanceof Composite){ return containsControl(control, (Composite) child); } } } } return false; }
Example 7
Source File: TmfAlignmentSynchronizer.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static boolean isTimeAlignedView(IViewPart view) { if (view instanceof TmfView && view instanceof ITmfTimeAligned) { Composite parentComposite = ((TmfView) view).getParentComposite(); if (parentComposite != null && !parentComposite.isDisposed()) { return true; } } return view instanceof TmfView && view instanceof ITmfTimeAligned; }
Example 8
Source File: ParameterExpandBar.java From gama with GNU General Public License v3.0 | 5 votes |
void showItem(final ParameterExpandItem item) { final Composite control = item.control; if (control != null && !control.isDisposed()) { item.setImage(item.expanded ? GamaIcons.create(IGamaIcons.SMALL_COLLAPSE).image() : GamaIcons.create(IGamaIcons.SMALL_EXPAND).image()); control.setVisible(item.expanded); } item.redraw(); final int index = indexOf(item); layoutItems(index + 1, true); final Event ev = new Event(); ev.item = this; notifyListeners(SWT.Resize, ev); }
Example 9
Source File: SwtRendererImpl.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Free all allocated system resources. */ public void dispose( ) { cleanUpTriggers( ); if ( _iun != null ) { Object obj = _iun.peerInstance( ); if ( obj instanceof Composite ) { Composite jc = (Composite) obj; if ( _eh != null ) { if ( !jc.isDisposed( ) ) { // We can't promise to remove all the old // swtEventHandler // due to SWT limitation here, so be sure to just attach // the // update_notifier only to one renderer. jc.removeMouseListener( _eh ); jc.removeMouseMoveListener( _eh ); jc.removeMouseTrackListener( _eh ); jc.removeKeyListener( _eh ); jc.removeFocusListener( _eh ); } _eh.dispose( ); _eh = null; } } } }
Example 10
Source File: BaseMdiEntry.java From BiglyBT with GNU General Public License v2.0 | 4 votes |
public void show() { SelectedContentManager.clearCurrentlySelectedContent(); UIFunctionsSWT uif = UIFunctionsManagerSWT.getUIFunctionsSWT(); if (uif != null) { //uif.refreshIconBar(); // needed? uif.refreshTorrentMenu(); } SWTSkinObject skinObject = getSkinObjectMaster(); if (skinObject == null) { return; } skinObject.setVisible(true); if (skinObject instanceof SWTSkinObjectContainer) { SWTSkinObjectContainer container = (SWTSkinObjectContainer) skinObject; Composite composite = container.getComposite(); if (composite != null && !composite.isDisposed()) { composite.setVisible(true); composite.moveAbove(null); //composite.setFocus(); //container.getParent().relayout(); composite.getParent().layout(); } // This causes double show because createSkinObject already calls show //container.triggerListeners(SWTSkinObjectListener.EVENT_SHOW); } Composite c = getComposite(); if (c != null && !c.isDisposed()) { c.setData("BaseMDIEntry", this); c.setVisible(true); c.getParent().layout(); } try { // In theory, c.setVisible() will trigger TYPE_SHOWN, but let's // call it anyway (it will be ignored if focus is already gained) triggerEvent(UISWTViewEvent.TYPE_SHOWN, null); } catch (Exception e) { Debug.out(e); } setToolbarVisibility(hasToolbarEnableers()); }
Example 11
Source File: TmfAlignmentSynchronizer.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
private static boolean isDisposedView(TmfView view) { Composite parentComposite = (view).getParentComposite(); return parentComposite != null && parentComposite.isDisposed(); }
Example 12
Source File: RecentBlocksPart.java From offspring with MIT License | 4 votes |
@PostConstruct public void postConstruct(Composite parent, INxtService nxt, IUserService userService, IStylingEngine engine, UISynchronize sync) { /* Interval that checks for needs_refresh flag */ refreshPoll = new Runnable() { @Override public void run() { if (needs_refresh) { if (mainComposite != null && !mainComposite.isDisposed() && mainComposite.isVisible()) { needs_refresh = false; refresh(); } } Display display = Display.getCurrent(); if (display != null && !display.isDisposed()) { display.timerExec(REFRESH_INTERVAL, this); } } }; mainComposite = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(1).spacing(5, 2).margins(0, 0) .applyTo(mainComposite); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true) .applyTo(mainComposite); paginationContainer = new PaginationContainer(mainComposite, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true) .applyTo(paginationContainer); viewer = new RecentBlocksViewer(paginationContainer.getViewerParent(), nxt, engine, userService, sync, ContactsService.getInstance()); paginationContainer.setTableViewer(viewer, 100); /* If Nxt is scanning we can wait for TOPIC_BLOCK_SCANNER_FINISHED */ if (!nxt.isScanning()) { needs_refresh = true; } /* Start the poller */ parent.getDisplay().timerExec(10, refreshPoll); }
Example 13
Source File: RecentTransactionsPart.java From offspring with MIT License | 4 votes |
@PostConstruct public void postConstruct(Composite parent, INxtService nxt, IUserService userService, IStylingEngine engine, UISynchronize sync) { /* Interval that checks for needs_refresh flag */ refreshPoll = new Runnable() { @Override public void run() { if (needs_refresh) { if (mainComposite != null && !mainComposite.isDisposed() && mainComposite.isVisible()) { needs_refresh = false; refresh(); } } Display display = Display.getCurrent(); if (display != null && !display.isDisposed()) { display.timerExec(REFRESH_INTERVAL, this); } } }; mainComposite = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(1).spacing(5, 2).margins(0, 0) .applyTo(mainComposite); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true) .applyTo(mainComposite); paginationContainer = new PaginationContainer(mainComposite, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true) .applyTo(paginationContainer); viewer = new RecentTransactionsViewer( paginationContainer.getViewerParent(), nxt, engine, userService, sync, ContactsService.getInstance()); paginationContainer.setTableViewer(viewer, 100); /* If Nxt is scanning we can wait for TOPIC_BLOCK_SCANNER_FINISHED */ if (!nxt.isScanning()) { needs_refresh = true; } /* Start the poller */ parent.getDisplay().timerExec(10, refreshPoll); }