Java Code Examples for org.eclipse.swt.widgets.Control#dispose()
The following examples show how to use
org.eclipse.swt.widgets.Control#dispose() .
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: EditorTextDesign.java From ldparteditor with MIT License | 6 votes |
public void reloadColours() { for (Control ctrl : toolItem_ColourBar.getChildren()) { if (!(ctrl instanceof ToolSeparator)) ctrl.dispose(); } List<GColour> colours = WorkbenchManager.getUserSettingState().getUserPalette(); final int size = colours.size(); for (int i = 0; i < size; i++) { addColorButton(toolItem_ColourBar, colours.get(i), i); } { NButton btn_Palette = new NButton(toolItem_ColourBar, Cocoa.getStyle()); this.btn_Palette[0] = btn_Palette; btn_Palette.setToolTipText(I18n.E3D_More); btn_Palette.setImage(ResourceManager.getImage("icon16_colours.png")); //$NON-NLS-1$ } toolItem_ColourBar.getParent().layout(); toolItem_ColourBar.layout(); toolItem_ColourBar.redraw(); }
Example 2
Source File: DecisionTableWizardPage.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * */ protected void refreshGrid() { if (gridPlaceHolder != null) { for (final Control child : gridPlaceHolder.getChildren()) { child.dispose(); } createGrid(gridPlaceHolder); gridPlaceHolder.pack(); gridPlaceHolder.layout(true); final Point size = gridPlaceHolder.getSize(); size.x = size.x - 15; gridParentScrollable.setExpandHorizontal(true); gridParentScrollable.setExpandVertical(false); gridParentScrollable.setMinSize(size); } }
Example 3
Source File: CustomMatchConditionDialog.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 刷新过滤器设置组件 */ private void refresh() { filterNameTxt.setText(""); andBtn.setSelection(true); orBtn.setSelection(false); btnIsTagged.setSelection(false); btnQT.setSelection(false); btnPT.setSelection(false); if (btnIsRemoveFromSrc != null) { btnIsRemoveFromSrc.setSelection(false); } for (Control ctl : conditionList) { if (!ctl.isDisposed()) { ctl.dispose(); } } conditionList.clear(); new DynaComposite(dynaComp, SWT.NONE); scroll.setMinSize(dynaComp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); dynaComp.layout(); }
Example 4
Source File: ParameterExpandItem.java From gama with GNU General Public License v3.0 | 6 votes |
/** * Sets the expanded state of the receiver. * * @param expanded * the new expanded state * * @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 setExpanded(final boolean expanded) { if (parent == null) { return; } // checkWidget(); this.expanded = expanded; if (onExpandBlock != null) { if (expanded) { onExpandBlock.run(); setHeight(control.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); } else { for (final Control c : control.getChildren()) { c.dispose(); } if (control instanceof ScrolledComposite) { ((ScrolledComposite) control).setContent(null); } } } parent.showItem(this); }
Example 5
Source File: CDateTime.java From nebula with Eclipse Public License 2.0 | 6 votes |
private void disposePicker() { if (content != null) { if (picker != null) { picker.dispose(); picker = null; } if (isDropDown()) { Control c = content; setContent(null); c.dispose(); if (contentShell != null) { Display.getDefault().asyncExec(() -> { if (contentShell != null && !contentShell.isDisposed()) { contentShell.dispose(); contentShell = null; } }); } } } }
Example 6
Source File: CustomFilterDialog.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 销毁除了“过滤器列表控件”之外的其它控件 */ private void disposeChild() { for (Control ctl : this.getChildren()) { if (!"filterName".equals(ctl.getData()) && ctl != null && !ctl.isDisposed()) { ctl.dispose(); } } }
Example 7
Source File: HistogramView.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private void updateLegendArea() { for (Control c: fLegendArea.getChildren()) { c.dispose(); } disposeLegendImages(); if (fFullTraceHistogram.showTraces()) { Collection<ITmfTrace> traces = TmfTraceManager.getTraceSet(fTrace); fLegendImages = new Image[traces.size()]; int traceIndex = 0; for (ITmfTrace trace : traces) { fLegendImages[traceIndex] = new Image(fLegendArea.getDisplay(), 16, 16); GC gc = new GC(fLegendImages[traceIndex]); gc.setBackground(fFullTraceHistogram.getTraceColor(traceIndex)); gc.fillRectangle(0, 0, 15, 15); gc.setForeground(fLegendArea.getDisplay().getSystemColor(SWT.COLOR_BLACK)); gc.drawRectangle(0, 0, 15, 15); gc.dispose(); CLabel label = new CLabel(fLegendArea, SWT.NONE); label.setText(trace.getName()); label.setImage(fLegendImages[traceIndex]); traceIndex++; } } fLegendArea.layout(); fLegendArea.getParent().layout(); }
Example 8
Source File: PageManager.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private void deactivateNode () { for ( final Control control : this.mainArea.getChildren () ) { control.dispose (); } this.currentNode = null; this.currentPage = null; }
Example 9
Source File: JobDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void showLogTypeOptions( int index ) { if ( index != previousLogTableIndex ) { getLogInfo( previousLogTableIndex ); // clean the log options composite... // for ( Control control : wLogOptionsComposite.getChildren() ) { control.dispose(); } previousLogTableIndex = index; LogTableInterface logTable = logTables.get( index ); LogTableUserInterface logTableUserInterface = logTableUserInterfaces.get( index ); if ( logTableUserInterface != null ) { logTableUserInterface.showLogTableOptions( wLogOptionsComposite, logTable ); } else { if ( logTable instanceof JobLogTable ) { showJobLogTableOptions( (JobLogTable) logTable ); } else if ( logTable instanceof ChannelLogTable ) { showChannelLogTableOptions( (ChannelLogTable) logTable ); } if ( logTable instanceof JobEntryLogTable ) { showJobEntryLogTableOptions( (JobEntryLogTable) logTable ); } } wLogOptionsComposite.layout( true, true ); wLogComp.layout( true, true ); } }
Example 10
Source File: CoolbarToolControl.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void maximizeCoolbar() { for (final Control c : toolbarContainer.getChildren()) { c.dispose(); } size = CoolbarSize.NORMAL; createToolbar(toolbarContainer, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()); toolbarContainer.getParent().layout(true, true); }
Example 11
Source File: TmfEventsTableHeader.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Remove a filter from the header. * * @param filter * the filter to remove */ public void removeFilter(ITmfFilter filter) { for (Control control : getChildren()) { if (filter.equals(control.getData())) { control.dispose(); break; } } if (getChildren().length == 0) { fLayout.marginTop = 0; fLayout.marginBottom = 0; } getParent().layout(true, true); }
Example 12
Source File: DynamicAddRemoveLineComposite.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void removeAllLines() { int size = removes.size() ; for(Button remove : removes){ remove.dispose() ; } removes.clear(); for(Control control : controls){ control.dispose() ; } controls.clear(); layoutComposite(); for(int i = 0 ; i< size ; i++) lineRemoved(i); }
Example 13
Source File: SwtUtils.java From xds-ide with Eclipse Public License 1.0 | 4 votes |
public static void dispose(Control c) { if (null != c && !c.isDisposed()) { c.dispose(); } }
Example 14
Source File: Launcher.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * Dispose the content before a redraw */ private void disposePreviousContent() { for (final Control c : getChildren()) { c.dispose(); } }
Example 15
Source File: CustomFilterDialog.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * 编辑 */ private void edit() { String[] filters = customFilterList.getSelection(); if (filters.length > 0) { if (isChange()) { if (!MessageDialog.openConfirm(getShell(), "", Messages.getString("dialog.CustomFilterDialog.msg1"))) { return; } } String key = filters[0]; filterNameTxt.setText(key); String link = XLFHandler.getCustomFilterAdditionMap().get(key); if (link.indexOf("and") != -1) { andBtn.setSelection(true); orBtn.setSelection(false); } else { andBtn.setSelection(false); orBtn.setSelection(true); } for (Control ctl : conditionList) { if (!ctl.isDisposed()) { ctl.dispose(); } } conditionList.clear(); ArrayList<String[]> tmpList = XLFHandler.getCustomFilterIndexMap().get(key); for (String[] tempIndex : tmpList) { String filterIndex = tempIndex[0]; DynaComposite dyna = new DynaComposite(dynaComp, SWT.NONE); dyna.getFilterName().select(Integer.parseInt(filterIndex)); dyna.getFilterName().notifyListeners(SWT.Selection, null); if ("0".equals(filterIndex) || "1".equals(filterIndex)) { // 关键字、批注 dyna.getConditions().select(Integer.parseInt(tempIndex[1])); dyna.getValue().setText(tempIndex[2].replace("0x0020", " ")); dyna.getValue().setForeground(black); } else if ("2".equals(filterIndex)) { // 属性 dyna.getPropName().setText(tempIndex[1]); dyna.getPropValue().setText(tempIndex[2]); dyna.getPropName().setForeground(black); dyna.getPropValue().setForeground(black); } } scroll.setMinSize(dynaComp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); dynaComp.layout(); } else { MessageDialog.openInformation(getShell(), "", Messages.getString("dialog.CustomFilterDialog.msg4")); } }
Example 16
Source File: ListenerAppender.java From erflute with Apache License 2.0 | 4 votes |
private static void setEditValue(Control control, TableItem tableItem, Point xy, EditableTable editableTable) { editableTable.setData(xy, control); if (editableTable.validate()) { control.dispose(); } }
Example 17
Source File: SWTStrategiesUI.java From atdl4j with MIT License | 4 votes |
public void removeAllStrategyPanels() { // remove all strategy panels for ( Control control : strategiesPanel.getChildren() ) control.dispose(); }
Example 18
Source File: BillingProposalWizardDialog.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
private void removeAllChildrens(){ for (Control c : getChildren()) { c.dispose(); } }
Example 19
Source File: DataGridDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private void addDataGrid( boolean refresh ) { if ( refresh ) { // retain changes made in the dialog... // getMetaInfo( dataGridMeta ); } if ( refresh ) { // Retain the data edited in the dialog... // getDataInfo( dataGridMeta ); // Clear out the data composite and redraw it completely... // for ( Control control : wDataComp.getChildren() ) { control.dispose(); } } ColumnInfo[] columns = new ColumnInfo[dataGridMeta.getFieldName().length]; for ( int i = 0; i < columns.length; i++ ) { columns[i] = new ColumnInfo( dataGridMeta.getFieldName()[i], ColumnInfo.COLUMN_TYPE_TEXT, false, false ); } List<List<String>> lines = dataGridMeta.getDataLines(); wData = new TableView( transMeta, wDataComp, SWT.NONE, columns, lines.size(), lsMod, props ); wData.setSortable( false ); for ( int i = 0; i < lines.size(); i++ ) { List<String> line = lines.get( i ); TableItem item = wData.table.getItem( i ); for ( int f = 0; f < line.size(); f++ ) { item.setText( f + 1, Const.NVL( line.get( f ), "" ) ); } } wData.setRowNums(); wData.optWidth( true ); FormData fdData = new FormData(); fdData.left = new FormAttachment( 0, 0 ); fdData.top = new FormAttachment( 0, 0 ); fdData.right = new FormAttachment( 100, 0 ); fdData.bottom = new FormAttachment( 100, 0 ); wData.setLayoutData( fdData ); wTabFolder.layout( true, true ); wFields.nrNonEmpty(); wFields.setTableViewModifyListener( new TableModifyListener() ); wFields.setContentListener( modifyEvent -> wFields.nrNonEmpty() ); }
Example 20
Source File: TableView.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private void edit( int rownr, int colnr, boolean selectText, char extra ) { selectionStart = -1; TableItem row = table.getItem( rownr ); Control oldEditor = editor.getEditor(); if ( oldEditor != null && !oldEditor.isDisposed() ) { try { oldEditor.dispose(); } catch ( SWTException swte ) { // Eat "Widget Is Disposed Exception" : did you ever!!! } } activeTableItem = table.getItem( activeTableRow ); // just to make sure, clean // up afterwards. table.showItem( row ); table.setSelection( new TableItem[]{ row } ); if ( columns.length == 0 ) { return; } switch ( columns[colnr - 1].getType() ) { case ColumnInfo.COLUMN_TYPE_TEXT: isTextButton = false; editText( row, rownr, colnr, selectText, extra, columns[colnr - 1] ); break; case ColumnInfo.COLUMN_TYPE_CCOMBO: case ColumnInfo.COLUMN_TYPE_FORMAT: editCombo( row, rownr, colnr ); break; case ColumnInfo.COLUMN_TYPE_BUTTON: editButton( row, rownr, colnr ); break; case ColumnInfo.COLUMN_TYPE_TEXT_BUTTON: if ( columns[colnr - 1].shouldRenderTextVarButton() ) { isTextButton = true; } else { isTextButton = false; } editText( row, rownr, colnr, selectText, extra, columns[colnr - 1] ); break; default: break; } }