@Override public void refresh() { if (getContextManager() == null) { disposeInstallMessageComp(); disposeNatTableComp(); if (availableLabelComp == null || (availableLabelComp != null && availableLabelComp.isDisposed())) { createContextNotAvailableGroup(this); } } else { if (!ContextNatTableUtils.checkIsInstallExternalJar()) { disposeUnAvailableContextComp(); if (messageComp == null || (messageComp != null && messageComp.isDisposed())) { createMessageGroup(this); } } else { reInitializeUI(); initializeContextCombo(); checkContextGroupSource(); // dispose the data table composite disposeDataTable(); // create the data table composite createNatTable(); contextTableComp.getParent().layout(); contextTableComp.layout(); treeTable.refresh(); setButtonEnableState(); } } }
private void disposeNatTableComp() { if (contextsSelectComp != null && !contextsSelectComp.isDisposed()) { contextsSelectComp.dispose(); } if (contextTableComp != null && !contextTableComp.isDisposed()) { contextTableComp.dispose(); } if (buttonsComp != null && !buttonsComp.isDisposed()) { buttonsComp.dispose(); } }
private void disposeComposite() { if (summaryComp != null && !summaryComp.isDisposed()) { summaryComp.dispose(); } if (resultComp != null && !resultComp.isDisposed()) { resultComp.dispose(); } if (chartComposite != null && !chartComposite.isDisposed()) { for (Control control : chartComposite.getChildren()) { control.dispose(); } } }
private void disposeDataTable() { if (contextTableComp != null && !contextTableComp.isDisposed()) { for (Control control : contextTableComp.getChildren()) { control.dispose(); } } }
private int QueryContinueDrag(int fEscapePressed, int grfKeyState) { if (topControl != null && topControl.isDisposed()) return COM.DRAGDROP_S_CANCEL; if (fEscapePressed != 0) { if (hwndDrag != 0) OS.ImageList_DragLeave(hwndDrag); return COM.DRAGDROP_S_CANCEL; } /* * Bug in Windows. On some machines that do not have XBUTTONs, * the MK_XBUTTON1 and OS.MK_XBUTTON2 bits are sometimes set, * causing mouse capture to become stuck. The fix is to test * for the extra buttons only when they exist. */ int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON; // if (display.xMouse) mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2; if ((grfKeyState & mask) == 0) { if (hwndDrag != 0) OS.ImageList_DragLeave(hwndDrag); return COM.DRAGDROP_S_DROP; } if (hwndDrag != 0) { POINT pt = new POINT(); OS.GetCursorPos(pt); RECT rect = new RECT(); OS.GetWindowRect(hwndDrag, rect); OS.ImageList_DragMove(pt.x - rect.left, pt.y - rect.top); } return COM.S_OK; }
/** * Accepts the given visitor. * * <p>The visitor's <code>visit</code> method is called on the given composite first, or last, * depending on the value of <code>depthFirst</code>. This will not occur if <code>visitRoot * </code> is set to <code>false</code> The list of children for the given composite will then be * visited. If the <code>visit</code> method returns true for a given child widget, and that * widget is also a composite, the <code>accept</code> method will be called on all children of * that composite as well. * * @param composite The composite to visit * @param visitor The visitor * @param depthFirst Whether to perform depth first or not * @param visitRoot Whether to visit the parent or to proceed directly to the children */ private void accept( Composite composite, IWidgetVisitor visitor, boolean depthFirst, boolean visitRoot) { if (composite == null || composite.isDisposed()) { // Do not visit children if parent is disposed or null, // but do continue with siblings return; } Control children[] = composite.getChildren(); boolean traverseChildren = true; if (!depthFirst && visitRoot) traverseChildren = visitor.visit(composite); if (traverseChildren) { for (int i = 0; i < children.length; i++) { if (children[i] instanceof Composite) { accept(((Composite) children[i]), visitor, depthFirst, true); } else { visitor.visit(children[i]); } } } if (depthFirst && visitRoot) visitor.visit(composite); }
/** Leert die Anzeige. Wird beim Wechsel von einem Dialog auf den naechsten aufgerufen. */ protected void cleanContent() { if (content != null && !content.isDisposed()) content.dispose(); if (scroll != null && !scroll.isDisposed()) scroll.dispose(); if (Customizing.SETTINGS.getBoolean("application.scrollview", false)) { scroll = new ScrolledComposite(view, SWT.V_SCROLL | SWT.H_SCROLL); scroll.setLayoutData(new GridData(GridData.FILL_BOTH)); scroll.setLayout(SWTUtil.createGrid(1, true)); scroll.setExpandHorizontal(true); scroll.setExpandVertical(true); scroll.setMinHeight(Customizing.SETTINGS.getInt("application.scrollview.minheight", 580)); content = new Composite(scroll, SWT.NONE); scroll.setContent(content); } else { content = new Composite(view, SWT.NONE); } content.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout l = new GridLayout(); l.marginHeight = 6; l.marginWidth = 6; content.setLayout(l); if (this.titlePart != null) { this.titlePart.clearButtons(); this.titlePart.addButton(new PanelButtonBack()); // Zurueckbutton ist immer dabei } if (notifications != null) notifications.reset(); setTitle(null); }
/** Validates the content of the fields in this page */ protected boolean validatePage() { boolean valid = true; if (advancedComposite != null && !advancedComposite.isDisposed()) { if (-1 == priorityCombo.getSelectionIndex()) { setErrorMessage(Messages.Local_Palette_Error_Priority); valid = false; } if ("".equals(getEditorID())) { setErrorMessage(Messages.Local_Palette_Error_EditorId); valid = false; } if ("".equals(getPaletteID())) { setErrorMessage(Messages.Local_Palette_Error_PaletteId); valid = false; } } if ("".equals(getPaletteName())) { setErrorMessage(Messages.Local_Palette_Error_Name); valid = false; } if (valid) { setMessage(null); setErrorMessage(null); } return valid; }
/* * (non-Javadoc) Method declared on Layout. */ public void layout(final Composite c, boolean flush) { // System.out.println("manualResizing=" + manualResizing); // System.out.println("layout=" + this.hashCode()); if (manualResizing) { return; } // System.out.println("TableViewerCreatorLayout layout " + toString() + " "+ (i++) ); if (fillHorizontal || continuousLayout) { initColumnsControlListener(); } if (layoutExecutionLimiter == null) { // layoutExecutionLimiter = new ExecutionLimiter(this.timeBetweenTwoLayouts, true) { // // @Override // public void execute(boolean isFinalExecution) { if (c.isDisposed()) { return; } // c.getDisplay().syncExec(new Runnable() { // // /* (non-Javadoc) // * @see java.lang.Runnable#run() // */ // public void run() { // if (!firstTime && !continuousLayout) { return; } try { if (tableViewerCreator.getTable().isDisposed()) { return; } tableViewerCreator.getTable().setLayout(null); layout(c); } finally { if (!tableViewerCreator.getTable().isDisposed()) { tableViewerCreator.getTable().setLayout(TableViewerCreatorLayout.this); } } } // }); // } // // }; // } // layoutExecutionLimiter.startIfExecutable(); }
protected void setSearchFieldsEnablement(boolean enabled) { if (!searchComposite.isDisposed()) { searchComposite.setEnabled(enabled); for (Control c : searchComposite.getChildren()) { c.setEnabled(enabled); } } }
/** need force refresh here after install the external jar */ private void reInitializeUI() { disposeInstallMessageComp(); disposeUnAvailableContextComp(); if (contextTableComp == null || (contextTableComp != null && contextTableComp.isDisposed())) { initializeUI(); contextTableComp.getParent().layout(); contextTableComp.layout(); } }
public void dispose() { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); workbenchWindow.removePerspectiveListener(perspectiveAdapter); Composite parent = getParent(); if (parent != null && !parent.isDisposed()) { parent.dispose(); } }
static void setColor(Composite composite, String indent, Color color, Color foreGorund) { if (composite == null) { return; } try { if (!composite.isDisposed()) { composite.setRedraw(false); if (composite instanceof ToolBar || composite instanceof Shell || composite instanceof CLabel || composite instanceof CTabFolder || composite instanceof CoolBar || composite instanceof CoolBar || composite instanceof CBanner || composite instanceof PageBook || composite instanceof ViewForm || composite instanceof Tree || composite instanceof StyledText || composite instanceof Table || composite.getClass().getName().startsWith("org.eclipse.jface") || composite.getClass().getName().startsWith("org.eclipse.ui.internal.layout") || composite.getClass().getName().startsWith("org.eclipse.ui.internal.FastViewBar") || composite .getClass() .getName() .startsWith("org.eclipse.ui.internal.progress.ProgressRegion") || composite.getClass().getName().startsWith("org.eclipse.swt.widgets.Canvas") || composite.getClass() == Composite.class) { composite.setBackground(color); composite.setForeground(foreGorund); } else { // System.out.println(indent + // composite.getClass().getName()); } Control[] controls = composite.getChildren(); for (Control control : controls) { if (!(control instanceof Composite)) { // System.out.println(indent + "Control " + // control.getClass().getName()); } if (control instanceof Composite) { setColor((Composite) control, indent + " ", color, foreGorund); } else if (control instanceof Label || control instanceof CoolBar || control instanceof Sash || control instanceof ProgressBar || control instanceof Text) { control.setBackground(color); control.setForeground(foreGorund); } } } } finally { composite.setRedraw(true); } }
/** Recreate the receiver given the new side */ private void recreate() { if (region != null && !region.isDisposed()) { Composite parent = region.getParent(); boolean animating = animationItem.animationRunning(); AnimationManager.getInstance().removeItem(animationItem); region.dispose(); createContents(parent, workbenchWindow); if (animating) animationItem.animationStart(); } }
/** * Dispose all the labels inside this composite You should freeze the composite first. * * @param c */ protected void removeLabelsFromHostComposite(Composite c) { if (c.isDisposed()) return; for (Control child : c.getChildren()) { if (child instanceof Label) { child.dispose(); } } }
ToolBar findToolbar(Composite intermediate) { if (!intermediate.isDisposed()) { Control[] children = intermediate.getChildren(); int length = children.length; if (length > 0 && children[length - 1] instanceof ToolBar) { return (ToolBar) children[length - 1]; } } return null; }
@Override public void dispose() { if (this.currentEntity != null) { this.currentEntity.close(top, this); this.currentEntity = null; } if (top != null && !top.isDisposed()) { top.dispose(); } super.dispose(); }
@Override public Object getUIContainer(MUIElement childElement) { Composite intermediate = (Composite) super.getUIContainer(childElement); if (intermediate == null || intermediate.isDisposed()) { return null; } ToolBar toolbar = findToolbar(intermediate); if (toolbar == null) { toolbar = createToolbar(childElement.getParent(), intermediate); } return toolbar; }
@Override public void setEnabled(boolean enabled) { if (configContext != null) { configContext.setEnabled(enabled); } if (contextTableComp != null && !contextTableComp.isDisposed()) { contextTableComp.setEnabled(enabled); } if (messageComp != null) { this.getParent().setEnabled(true); } }
/* * @see org.eclipse.jface.text.source.ISourceViewerExtension#showAnnotationsOverview(boolean) * @since 2.1 */ public void showAnnotationsOverview(boolean show) { boolean old = fIsOverviewRulerVisible; fIsOverviewRulerVisible = (show && fOverviewRuler != null); if (old != fIsOverviewRulerVisible) { if (fComposite != null && !fComposite.isDisposed()) fComposite.layout(); if (fIsOverviewRulerVisible) { ensureOverviewHoverManagerInstalled(); } else if (fOverviewRulerHoveringController != null) { fOverviewRulerHoveringController.dispose(); fOverviewRulerHoveringController = null; } } }
/** Clears the look of the forms body. */ protected void clearFormBody() { if (messageComposite != null && !messageComposite.isDisposed()) { messageComposite.dispose(); } for (TableColumn tableColumn : tableViewer.getTable().getColumns()) { tableColumn.dispose(); } tableViewer.setInput(Collections.emptyList()); tableViewer.getTable().setHeaderVisible(false); tableViewer.getTable().setLinesVisible(false); tableViewer.getTable().setVisible(false); tableViewer.getTable().setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); }
private void checkAllArticlesAreAllocatedOrReversed( Collection<? extends Article> deletedArticles) { ArticleStatusCheckResult articleStatusCheckResult = new ArticleStatusCheckResult(getArticleContainerEdit().getArticles()); articlesWithWrongState.addAll(articleStatusCheckResult.getNotAllocatedNorReversedArticles()); articlesWithWrongState.removeAll(articleStatusCheckResult.getAllocatedOrReversedArticles()); if (deletedArticles != null) articlesWithWrongState.removeAll(deletedArticles); if (buttonComp != null && !buttonComp.isDisposed()) buttonComp.setEnabled(articlesWithWrongState.isEmpty()); }
private void rebuild(Tag tag) { if (panel == null || panel.isDisposed()) { TagType tt = tag.getTagType(); tt.removeTagTypeListener(this); tt.getTagManager().removeTagManagerListener(this); return; } rebuild(); }
/** 关闭模型 */ @Override public void close(Composite top, EntityViewPart view) { if (!top.isDisposed()) { BindingHandler handler = null; String viewID = view.getSite().getId(); // 用户视图 if (viewID.equals(ProductDeployView.ID)) { handler = (ProductDeployViewerBindingHandler) viewerHandlers.get(viewID); } handler.detachListeners(); handler.destroy(); top.dispose(); } }
/* * @see ISourceViewer#showAnnotations(boolean) */ public void showAnnotations(boolean show) { boolean old = fIsVerticalRulerVisible; fIsVerticalRulerVisible = (fVerticalRuler != null && (show || !isVerticalRulerOnlyShowingAnnotations())); if (old != fIsVerticalRulerVisible && fComposite != null && !fComposite.isDisposed()) fComposite.layout(); if (fIsVerticalRulerVisible && show) ensureAnnotationHoverManagerInstalled(); else if (fVerticalRulerHoveringController != null) { fVerticalRulerHoveringController.dispose(); fVerticalRulerHoveringController = null; } }
private void rebuild(TagType tag_type, boolean added) { if (panel == null || panel.isDisposed()) { tag_type.getTagManager().removeTagManagerListener(this); return; } if (added) { tag_type.addTagTypeListener(this, false); } rebuild(); }
/** * @param widget * @return */ private ToolBar getToolbarFrom(Object widget) { if (widget instanceof ToolBar) { return (ToolBar) widget; } if (widget instanceof Composite) { Composite intermediate = (Composite) widget; if (!intermediate.isDisposed()) { Control[] children = intermediate.getChildren(); for (Control control : children) { if (control.getData() instanceof ToolBarManager) { return (ToolBar) control; } } } } return null; }
/** Aktualisiert die Buttons. */ private void updateButtons() { if (panelButtons == null || panelButtons.isDisposed()) return; GUI.getDisplay() .syncExec( new Runnable() { public void run() { if (panelButtons.isDisposed()) return; try { // Kurz ausblenden - sieht beim Aufbau sauberer aus panelButtons.setVisible(false); int size = buttons.size(); // Aktuelle Buttons disposen SWTUtil.disposeChildren(panelButtons); // Neues Layout basierend auf der Anzahl der Buttons anlegen panelButtons.setLayout(SWTUtil.createGrid(size, false)); // Breite errechnen Image background = SWTUtil.getImage(PanelButton.BG_DEFAULT); GridData gd = (GridData) panelButtons.getLayoutData(); gd.widthHint = background.getBounds().width * size; // Alle Buttons zeichnen - von rechts nach links for (int i = size - 1; i >= 0; i--) { buttons.get(i).paint(panelButtons); } // Das Neuberechnen des Parent fuehrt dazu, dass wir mehr Breite fuer die neuen // Buttons kriegen panelButtons.getParent().layout(); // Und wir zeichnen uns selbst neu panelButtons.layout(); } catch (Exception e) { Logger.error("unable to paint panel buttons", e); } finally { panelButtons.setVisible(true); } } }); }
/** * Sent when a new client is selected. The new client can be accessed with {@link * #getCurrentClient()}. */ @Override public void clientSelected() { if (mTop.isDisposed()) return; Client client = getCurrentClient(); Log.d("ddms", "HeapPanel: changed " + client); if (client != null) { ClientData cd = client.getClientData(); if (client.isHeapUpdateEnabled()) { mGcButton.setEnabled(true); mDisplayMode.setEnabled(true); setUpdateStatus(ENABLED); } else { setUpdateStatus(NOT_ENABLED); mGcButton.setEnabled(false); mDisplayMode.setEnabled(false); } fillSummaryTable(cd); int mode = mDisplayMode.getSelectionIndex(); if (mode == 0) { fillDetailedTable(client, false /* forceRedraw */); } else { if (DISPLAY_HEAP_BITMAP) { renderHeapData(cd, mode - 1, false /* forceRedraw */); } } } else { mGcButton.setEnabled(false); mDisplayMode.setEnabled(false); fillSummaryTable(null); fillDetailedTable(null, true); setUpdateStatus(NOT_SELECTED); } // sizes of things change frequently, so redo layout // mScrolledComposite.setMinSize(mDisplayStack.topControl.computeSize(SWT.DEFAULT, // SWT.DEFAULT)); mDisplayBase.layout(); // mScrolledComposite.redraw(); }
/** * Displays the message on the provided composite. * * @param text Text of message. * @param image Image to show. */ protected void displayMessage(String text, Image image) { clearFormBody(); if (null == messageComposite || messageComposite.isDisposed()) { messageComposite = toolkit.createComposite(mainForm.getBody()); } else { for (Control c : messageComposite.getChildren()) { if (!c.isDisposed()) { c.dispose(); } } } messageComposite.setLayout(new GridLayout(2, false)); messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); toolkit.createLabel(messageComposite, null).setImage(image); toolkit .createLabel(messageComposite, text, SWT.WRAP) .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true)); mainForm.getBody().layout(); }