Java Code Examples for org.eclipse.swt.widgets.Button#pack()
The following examples show how to use
org.eclipse.swt.widgets.Button#pack() .
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: MainWalkerGroupManageDialog.java From erflute with Apache License 2.0 | 6 votes |
private void initNodeTable() { nodeTable.removeAll(); nodeCheckMap = new HashMap<>(); for (final DiagramWalker walker : getTableWalkers()) { final TableItem tableItem = new TableItem(nodeTable, SWT.NONE); final Button selectCheckButton = new Button(nodeTable, SWT.CHECK); selectCheckButton.pack(); final TableEditor editor = new TableEditor(nodeTable); editor.minimumWidth = selectCheckButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(selectCheckButton, tableItem, 0); tableItem.setText(1, DisplayMessages.getMessage("label.object.type." + walker.getObjectType())); tableItem.setText(2, walker.getName()); nodeCheckMap.put(walker, editor); } }
Example 2
Source File: CompositeFactory.java From ermaster-b with Apache License 2.0 | 6 votes |
public static TableEditor createCheckBoxTableEditor(TableItem tableItem, boolean selection, int column) { Table table = tableItem.getParent(); final Button checkBox = new Button(table, SWT.CHECK); checkBox.pack(); TableEditor editor = new TableEditor(table); editor.minimumWidth = checkBox.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(checkBox, tableItem, column); checkBox.setSelection(selection); return editor; }
Example 3
Source File: CategoryManageDialog.java From erflute with Apache License 2.0 | 6 votes |
private void initNodeTable() { nodeTable.removeAll(); nodeCheckMap = new HashMap<>(); for (final DiagramWalker nodeElement : diagram.getDiagramContents().getDiagramWalkers()) { final TableItem tableItem = new TableItem(nodeTable, SWT.NONE); final Button selectCheckButton = new Button(nodeTable, SWT.CHECK); selectCheckButton.pack(); final TableEditor editor = new TableEditor(nodeTable); editor.minimumWidth = selectCheckButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(selectCheckButton, tableItem, 0); tableItem.setText(1, DisplayMessages.getMessage("label.object.type." + nodeElement.getObjectType())); tableItem.setText(2, nodeElement.getName()); nodeCheckMap.put(nodeElement, editor); } }
Example 4
Source File: CategoryManageDialog.java From ermaster-b with Apache License 2.0 | 6 votes |
private void initNodeTable() { this.nodeTable.removeAll(); this.nodeCheckMap = new HashMap<NodeElement, TableEditor>(); for (NodeElement nodeElement : this.diagram.getDiagramContents() .getContents()) { TableItem tableItem = new TableItem(this.nodeTable, SWT.NONE); Button selectCheckButton = new Button(this.nodeTable, SWT.CHECK); selectCheckButton.pack(); TableEditor editor = new TableEditor(this.nodeTable); editor.minimumWidth = selectCheckButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(selectCheckButton, tableItem, 0); tableItem.setText(1, ResourceString .getResourceString("label.object.type." + nodeElement.getObjectType())); tableItem.setText(2, nodeElement.getName()); this.nodeCheckMap.put(nodeElement, editor); } }
Example 5
Source File: IndexDialog.java From ermasterr with Apache License 2.0 | 6 votes |
private void setTableEditor(final NormalColumn normalColumn, final TableItem tableItem, final Boolean desc) { final Button descCheckButton = new Button(indexColumnList, SWT.CHECK); descCheckButton.pack(); if (DBManagerFactory.getDBManager(table.getDiagram()).isSupported(DBManager.SUPPORT_DESC_INDEX)) { final TableEditor editor = new TableEditor(indexColumnList); editor.minimumWidth = descCheckButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(descCheckButton, tableItem, 1); columnCheckMap.put(normalColumn, editor); } descCheckBoxMap.put(normalColumn, descCheckButton); descCheckButton.setSelection(desc.booleanValue()); }
Example 6
Source File: AbapGitWizardPageApack.java From ADT_Frontend with MIT License | 6 votes |
private void addThePackageButton(IApackDependency dependency, final int packageColumnIndex, TableItem tableItem) { Button button = new Button(this.table, SWT.NONE); button.setText("..."); //$NON-NLS-1$ button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IAdtPackageServiceUI packageServiceUI = AdtPackageServiceUIFactory.getOrCreateAdtPackageServiceUI(); IAdtObjectReference[] selectedPackages = packageServiceUI.openPackageSelectionDialog(e.display.getActiveShell(), false, AbapGitWizardPageApack.this.destination, tableItem.getText(packageColumnIndex)); if (selectedPackages != null && selectedPackages.length > 0) { setPageComplete(true); setMessage(null); tableItem.setText(packageColumnIndex, selectedPackages[0].getName()); dependency.setTargetPackage(selectedPackages[0]); packTheTable(); } } }); button.pack(); TableEditor editor = new TableEditor(this.table); editor.horizontalAlignment = SWT.RIGHT; editor.minimumWidth = button.getSize().x; editor.setEditor(button, tableItem, packageColumnIndex); editor.layout(); }
Example 7
Source File: VGroupManageDialog.java From ermaster-b with Apache License 2.0 | 6 votes |
private void initNodeTable() { this.nodeTable.removeAll(); this.nodeCheckMap = new HashMap<NodeElement, TableEditor>(); for (ERVirtualTable vtable : erModel.getTables()) { NodeElement nodeElement = vtable; //.getRawTable(); TableItem tableItem = new TableItem(this.nodeTable, SWT.NONE); Button selectCheckButton = new Button(this.nodeTable, SWT.CHECK); selectCheckButton.pack(); TableEditor editor = new TableEditor(this.nodeTable); editor.minimumWidth = selectCheckButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(selectCheckButton, tableItem, 0); tableItem.setText(1, ResourceString .getResourceString("label.object.type." + nodeElement.getObjectType())); tableItem.setText(2, nodeElement.getName()); this.nodeCheckMap.put(nodeElement, editor); } }
Example 8
Source File: CheckBoxGroup.java From nebula with Eclipse Public License 2.0 | 6 votes |
private void createCheckBoxButton() { button = new Button(this, SWT.CHECK); final GridData gdButton = new GridData(GridData.BEGINNING, GridData.CENTER, true, false); gdButton.horizontalIndent = 15; button.setLayoutData(gdButton); button.setSelection(true); button.pack(); button.addSelectionListener(new SelectionAdapter() { /** * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(final SelectionEvent e) { e.doit = fireSelectionListeners(e); if (!e.doit) { return; } if (button.getSelection()) { activate(); } else { deactivate(); } } }); }
Example 9
Source File: HeapManager.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Create the button used to perform GC */ private void createButton() { button = new Button(this, SWT.PUSH); final Image image = SWTGraphicUtil.createImageFromFile("images/trash.png"); button.setImage(image); SWTGraphicUtil.addDisposer(button, image); button.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false)); button.addListener(SWT.Selection, e -> { System.gc(); }); button.setToolTipText(ResourceManager.getLabel(ResourceManager.PERFORM_GC)); button.pack(); }
Example 10
Source File: CommonTransformDialog.java From hop with Apache License 2.0 | 5 votes |
protected Button buildPreviewButton() { wPreview = new Button( shell, SWT.PUSH | SWT.CENTER ); updatePreviewButtonStatus(); wPreview.setText( BaseMessages.getString( PKG, "System.Button.Preview" ) ); //$NON-NLS-1$ wPreview.pack(); props.setLook( wPreview ); wPreview.setLayoutData( new FormDataBuilder().bottom().left( 50, -( wPreview.getBounds().width / 2 ) ).result() ); wPreview.addListener( SWT.Selection, lsPreview ); return wPreview; }
Example 11
Source File: CompositeFactory.java From erflute with Apache License 2.0 | 5 votes |
public static TableEditor createCheckBoxTableEditor(TableItem tableItem, boolean selection, int column) { final Table table = tableItem.getParent(); final Button checkBox = new Button(table, SWT.CHECK); checkBox.pack(); final TableEditor editor = new TableEditor(table); editor.minimumWidth = checkBox.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(checkBox, tableItem, column); checkBox.setSelection(selection); return editor; }
Example 12
Source File: AbstractSection.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * New push button. * * @param parent the parent * @param label the label * @param tip the tip * @param enabled the enabled * @param style the style * @return the button */ public Button newPushButton(Composite parent, String label, String tip, boolean enabled, int style) { Button button = toolkit.createButton(parent, label, SWT.PUSH | style); GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL); button.setLayoutData(gd); button.pack(false); button.setToolTipText(tip); button.setEnabled(enabled); button.addListener(SWT.Selection, this); Point buttonSize = button.getSize(); gd.heightHint = buttonSize.y - 2; gd.widthHint = buttonSize.x - 2; return button; }
Example 13
Source File: AbstractSection.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * New check box. * * @param parent the parent * @param label the label * @param tip the tip * @return the button */ public Button newCheckBox(Composite parent, String label, String tip) { Button button = toolkit.createButton(parent, label, SWT.CHECK); button.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL)); button.pack(); button.setToolTipText(tip); button.addListener(SWT.Selection, this); return button; }
Example 14
Source File: CommonStepDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
protected Button buildPreviewButton() { wPreview = new Button( shell, SWT.PUSH | SWT.CENTER ); updatePreviewButtonStatus(); wPreview.setText( BaseMessages.getString( PKG, "System.Button.Preview" ) ); //$NON-NLS-1$ wPreview.pack(); props.setLook( wPreview ); wPreview.setLayoutData( new FormDataBuilder().bottom().left( 50, -( wPreview.getBounds().width / 2 ) ).result() ); wPreview.addListener( SWT.Selection, lsPreview ); return wPreview; }
Example 15
Source File: CompositeFactory.java From ermasterr with Apache License 2.0 | 4 votes |
public static TableEditor createCheckBoxTableEditor(final TableItem tableItem, final boolean selection, final int column) { final Table table = tableItem.getParent(); final Button checkBox = new Button(table, SWT.CHECK); checkBox.pack(); final TableEditor editor = new TableEditor(table); editor.minimumWidth = checkBox.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(checkBox, tableItem, column); checkBox.setSelection(selection); return editor; }
Example 16
Source File: IndexTabWrapper.java From ermasterr with Apache License 2.0 | 4 votes |
private void setTableData() { final List<Index> indexes = copyData.getIndexes(); final TableItem radioTableItem = new TableItem(indexTable, SWT.NONE); for (int i = 0; i < indexes.size(); i++) { final TableColumn tableColumn = CompositeFactory.createTableColumn(indexTable, "Index" + (i + 1), -1, SWT.CENTER); tableColumn.setResizable(false); final TableEditor editor = new TableEditor(indexTable); final Button radioButton = new Button(indexTable, SWT.RADIO); radioButton.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(final SelectionEvent event) { setButtonEnabled(true); } }); radioButton.pack(); editor.minimumWidth = radioButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(radioButton, radioTableItem, i + 2); checkButtonList.add(radioButton); editorList.add(editor); } for (final NormalColumn normalColumn : copyData.getExpandedColumns()) { final TableItem tableItem = new TableItem(indexTable, SWT.NONE); tableItem.setText(0, Format.null2blank(normalColumn.getName())); for (int i = 0; i < indexes.size(); i++) { final Index index = indexes.get(i); final List<NormalColumn> indexColumns = index.getColumns(); for (int j = 0; j < indexColumns.size(); j++) { final NormalColumn indexColumn = indexColumns.get(j); if (normalColumn.equals(indexColumn)) { tableItem.setText(i + 2, String.valueOf(j + 1)); break; } } } } indexTable.getColumns()[0].pack(); setButtonEnabled(false); }
Example 17
Source File: ThemePreferencePage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
private void createButton(final Table table, final TableItem tableItem, final int index, final RGBa color) { TableEditor editor = new TableEditor(table); Button button = new Button(table, SWT.PUSH | SWT.FLAT); Image image = createColorImage(table, color); button.setImage(image); button.pack(); editor.minimumWidth = button.getSize().x - 4; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(button, tableItem, index); fTableEditors.add(editor); button.setData("color", color); //$NON-NLS-1$ button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ColorDialog colorDialog = new ColorDialog(table.getShell()); Button self = ((Button) e.widget); RGBa theColor = (RGBa) self.getData("color"); //$NON-NLS-1$ if (theColor == null) { theColor = color; } colorDialog.setRGB(theColor.toRGB()); RGB newRGB = colorDialog.open(); if (newRGB == null) { return; } ThemeRule token = (ThemeRule) tableItem.getData(); RGBa newColor = new RGBa(newRGB); if (index == 1) { getTheme().updateRule(table.indexOf(tableItem), token.updateFG(newColor)); } else { getTheme().updateRule(table.indexOf(tableItem), token.updateBG(newColor)); } // Update the image for this button! self.setImage(createColorImage(table, newColor)); self.setData("color", newColor); //$NON-NLS-1$ tableViewer.refresh(); } }); // Allow dragging the button out of it's location to remove the fg/bg for the rule! Transfer[] types = new Transfer[] { TextTransfer.getInstance() }; final DragSource source = new DragSource(button, DND.DROP_MOVE); source.setTransfer(types); source.addDragListener(new DragSourceAdapter() { public void dragSetData(DragSourceEvent event) { event.data = "button:" + table.indexOf(tableItem) + ":" + index; //$NON-NLS-1$ //$NON-NLS-2$ } }); }
Example 18
Source File: IndexTabWrapper.java From erflute with Apache License 2.0 | 4 votes |
private void setTableData() { final List<ERIndex> indexes = copyData.getIndexes(); final TableItem radioTableItem = new TableItem(indexTable, SWT.NONE); for (int i = 0; i < indexes.size(); i++) { final TableColumn tableColumn = new TableColumn(indexTable, SWT.CENTER); tableColumn.setWidth(60); tableColumn.setResizable(false); tableColumn.setText("Index" + (i + 1)); final TableEditor editor = new TableEditor(indexTable); final Button radioButton = new Button(indexTable, SWT.RADIO); radioButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { setButtonEnabled(true); } }); radioButton.pack(); editor.minimumWidth = radioButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(radioButton, radioTableItem, i + 2); checkButtonList.add(radioButton); editorList.add(editor); } for (final NormalColumn normalColumn : copyData.getExpandedColumns()) { final TableItem tableItem = new TableItem(indexTable, SWT.NONE); tableItem.setText(0, Format.null2blank(normalColumn.getName())); for (int i = 0; i < indexes.size(); i++) { final ERIndex index = indexes.get(i); final List<NormalColumn> indexColumns = index.getColumns(); for (int j = 0; j < indexColumns.size(); j++) { final NormalColumn indexColumn = indexColumns.get(j); if (normalColumn.equals(indexColumn)) { tableItem.setText(i + 2, String.valueOf(j + 1)); break; } } } } setButtonEnabled(false); }
Example 19
Source File: IndexTabWrapper.java From ermaster-b with Apache License 2.0 | 4 votes |
private void setTableData() { List<Index> indexes = this.copyData.getIndexes(); TableItem radioTableItem = new TableItem(this.indexTable, SWT.NONE); for (int i = 0; i < indexes.size(); i++) { TableColumn tableColumn = new TableColumn(this.indexTable, SWT.CENTER); tableColumn.setWidth(60); tableColumn.setResizable(false); tableColumn.setText("Index" + (i + 1)); TableEditor editor = new TableEditor(this.indexTable); Button radioButton = new Button(this.indexTable, SWT.RADIO); radioButton.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(SelectionEvent event) { setButtonEnabled(true); } }); radioButton.pack(); editor.minimumWidth = radioButton.getSize().x; editor.horizontalAlignment = SWT.CENTER; editor.setEditor(radioButton, radioTableItem, i + 2); this.checkButtonList.add(radioButton); this.editorList.add(editor); } for (NormalColumn normalColumn : this.copyData.getExpandedColumns()) { TableItem tableItem = new TableItem(this.indexTable, SWT.NONE); tableItem.setText(0, Format.null2blank(normalColumn.getName())); for (int i = 0; i < indexes.size(); i++) { Index index = indexes.get(i); List<NormalColumn> indexColumns = index.getColumns(); for (int j = 0; j < indexColumns.size(); j++) { NormalColumn indexColumn = indexColumns.get(j); if (normalColumn.equals(indexColumn)) { tableItem.setText(i + 2, String.valueOf(j + 1)); break; } } } } setButtonEnabled(false); }
Example 20
Source File: CompositeTableRow.java From dawnsci with Eclipse Public License 1.0 | 4 votes |
public CompositeTableRow(CompositeEntry entry, Table container, CompositingControl control, boolean disableOp) { this.name = entry.getName(); TableItem newItem = new TableItem(container,SWT.DOUBLE_BUFFERED); TableEditor editor0 = new TableEditor(container); editor0.horizontalAlignment = SWT.CENTER; editor0.grabHorizontal = true; chkActive = new Button(container,SWT.CHECK); chkActive.setSelection(true); chkActive.addSelectionListener(control); editor0.setEditor(chkActive,newItem,0); TableEditor editor = new TableEditor(container); editor.horizontalAlignment = SWT.CENTER; editor.grabHorizontal = true; panel = new Composite(container, SWT.NONE); panel.setLayout(new GridLayout(2,true)); slider = new Slider(panel,SWT.HORIZONTAL|SWT.NO_TRIM); slider.setValues((int)(entry.getWeight()*100), 0, 104, 5, 1, 5); slider.addSelectionListener(this); slider.addSelectionListener(control); spinner = new Spinner(panel,SWT.DOUBLE_BUFFERED); spinner.setMinimum(0); spinner.setMaximum(100); spinner.setSelection((int)(entry.getWeight()*100)); spinner.addSelectionListener(control); spinner.addSelectionListener(this); panel.pack(); editor.setEditor(panel,newItem,2); newItem.setText(1,name); TableEditor editor2 = new TableEditor(container); editor2.horizontalAlignment = SWT.CENTER; editor2.grabHorizontal = true; editor2.grabVertical = true; op = new Combo(container,SWT.NONE); op.add("ADD"); op.add("SUBTRACT"); op.add("MULTIPLY"); op.add("DIVIDE"); op.add("MINIMUM"); op.add("MAXIMUM"); op.select(convertOperationToInt(entry.getOperation())); op.pack(); op.addSelectionListener(control); op.setEnabled(!disableOp); editor2.setEditor(op,newItem,3); TableEditor editor3 = new TableEditor(container); editor3.horizontalAlignment = SWT.CENTER; editor3.grabHorizontal = true; editor3.grabVertical = true; chkRed = new Button(container,SWT.CHECK); chkRed.setSelection(true); chkRed.pack(); chkRed.addSelectionListener(control); editor3.setEditor(chkRed,newItem,4); TableEditor editor4 = new TableEditor(container); editor4.horizontalAlignment = SWT.CENTER; editor4.grabHorizontal = true; editor4.grabVertical = true; chkGreen = new Button(container,SWT.CHECK); chkGreen.pack(); chkGreen.setSelection(true); chkGreen.addSelectionListener(control); editor4.setEditor(chkGreen,newItem,5); TableEditor editor5 = new TableEditor(container); editor5.horizontalAlignment = SWT.CENTER; editor5.grabHorizontal = true; editor5.grabVertical = true; chkBlue = new Button(container,SWT.CHECK); chkBlue.pack(); chkBlue.setSelection(true); chkBlue.addSelectionListener(control); editor5.setEditor(chkBlue,newItem,6); }