Java Code Examples for org.eclipse.jface.viewers.TableLayout#addColumnData()
The following examples show how to use
org.eclipse.jface.viewers.TableLayout#addColumnData() .
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: IndexControl.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void createIndexViewer(Composite parent) { indexViewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE); indexViewer.getTable() .setLayoutData(GridDataFactory.fillDefaults().grab(false, true).span(2, 1).hint(350, SWT.DEFAULT).create()); indexViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, INDEX_LIST_VIEWER_ID); formPage.getToolkit().adapt(indexViewer.getTable()); ColumnViewerToolTipSupport.enableFor(indexViewer); indexViewer.setUseHashlookup(true); indexViewer.getTable().setHeaderVisible(true); indexViewer.getTable().setLinesVisible(true); indexViewer.addFilter(createSearchFilter()); TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(1, true)); layout.addColumnData(new ColumnWeightData(1, true)); indexViewer.getTable().setLayout(layout); createIndexNameColumn(indexViewer); createAttributesColumn(indexViewer); indexViewer.setContentProvider(new ObservableListContentProvider()); indexViewer.setInput(indexObservable); selectedIndexObservable = ViewerProperties.singleSelection(Index.class).observe(indexViewer); }
Example 2
Source File: WizardUtils.java From XPagesExtensionLibrary with Apache License 2.0 | 6 votes |
public static TableViewer createCheckboxTableViewer(Composite parent, int cols) { TableViewer table = new TableViewer(parent, SWT.CHECK | SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); GridData gd = new GridData(SWT.DEFAULT); gd.horizontalSpan = 1; gd.verticalAlignment = GridData.FILL; gd.grabExcessVerticalSpace = true; gd.horizontalAlignment = GridData.FILL; gd.grabExcessHorizontalSpace = true; table.getTable().setLayoutData(gd); table.getTable().setHeaderVisible(true); table.getTable().setLinesVisible(true); TableLayout tl = new TableLayout(); for (int i=0; i<cols; i++) { tl.addColumnData(new ColumnWeightData(100, false)); } table.getTable().setLayout(tl); return table; }
Example 3
Source File: ContractInputTableViewer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public void initialize() { final TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(100, false)); getTable().setLayout(layout); getTable().setHeaderVisible(true); final TableViewerColumn columnViewer = new TableViewerColumn(this, SWT.NONE); final TableColumn column = columnViewer.getColumn(); column.setText(Messages.name); columnViewer.setLabelProvider(new ContractInputLabelProvider()); final TableColumnSorter sorter = new TableColumnSorter(this); sorter.setColumn(column); setContentProvider(ArrayContentProvider.getInstance()); }
Example 4
Source File: BusinessObjectList.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected void createViewer(Composite parent, AbstractBdmFormPage formPage) { viewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION); viewer.getTree().setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, true).create()); formPage.getToolkit().adapt(viewer.getTree()); viewer.getTree().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, BUSINESS_OBJECT_LIST_VIEWER_ID); viewer.addFilter(createSearchFilter()); viewer.addDoubleClickListener(e -> { viewer.setExpandedState(selectionObservable.getValue(), !viewer.getExpandedState(selectionObservable.getValue())); }); ColumnViewerToolTipSupport.enableFor(viewer); TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(1, true)); viewer.getTree().setLayout(layout); viewer.setUseHashlookup(true); createBusinessObjectColumn(viewer, formPage); viewer.setContentProvider(new BusinessObjectTreeContentProvider()); viewer.setComparator(new BusinessObjectViewerComparator()); viewer.setInput(input); addDNDSupport(formPage); selectionObservable = ViewerProperties.singleSelection(Object.class).observe(viewer); }
Example 5
Source File: ParameterEditor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createTableViewer(final Composite parent) { final Label filler = new Label(mainComposite, SWT.NONE); filler.setLayoutData( GridDataFactory.fillDefaults().span(2, 1).indent(0, -LayoutConstants.getSpacing().y + 1).create()); viewer = new TableViewer(mainComposite, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL); final TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(100, false)); viewer.getTable().setLayout(layout); viewer.getTable().setLayoutData( GridDataFactory.fillDefaults().grab(true, true).span(2, 1).create()); final TableViewerColumn columnViewer = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = columnViewer.getColumn(); column.setText(Messages.name); final TableColumnSorter sorter = new TableColumnSorter(viewer); sorter.setColumn(column); viewer.getTable().setHeaderVisible(true); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new ParameterNameLabelProvider()); viewer.addPostSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { if (!event.getSelection().isEmpty()) { ParameterEditor.this.fireSelectionChanged(); } } }); }
Example 6
Source File: AttributesPart.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public void createPart ( final Composite parent ) { super.createPart ( parent ); this.viewer = new TableViewer ( parent, SWT.FULL_SELECTION ); final TableLayout tableLayout = new TableLayout (); final TableViewerColumn col1 = new TableViewerColumn ( this.viewer, SWT.NONE ); col1.getColumn ().setText ( Messages.AttributesPart_NameLabel ); tableLayout.addColumnData ( new ColumnWeightData ( 50 ) ); final TableViewerColumn col2 = new TableViewerColumn ( this.viewer, SWT.NONE ); col2.getColumn ().setText ( Messages.AttributesPart_TypeLabel ); tableLayout.addColumnData ( new ColumnWeightData ( 20 ) ); final TableViewerColumn col3 = new TableViewerColumn ( this.viewer, SWT.NONE ); col3.getColumn ().setText ( Messages.AttributesPart_ValueLabel ); tableLayout.addColumnData ( new ColumnWeightData ( 50 ) ); this.viewer.getTable ().setHeaderVisible ( true ); this.viewer.getTable ().setLayout ( tableLayout ); ViewerSupport.bind ( this.viewer, this.entries, new IValueProperty[] { PojoProperties.value ( "name" ), PojoProperties.value ( "type" ), PojoProperties.value ( "value" ) } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ this.viewer.setComparator ( new ViewerComparator () ); }
Example 7
Source File: AttributeEditionControl.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createAttributeTableViewer(Composite parent) { viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE); viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); viewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, ATTRIBUTE_LIST_VIEWER_ID); formPage.getToolkit().adapt(viewer.getTable()); ColumnViewerToolTipSupport.enableFor(viewer); viewer.setUseHashlookup(true); viewer.getTable().setHeaderVisible(true); viewer.getTable().setLinesVisible(true); viewer.addFilter(new SearchFilter<>(fieldToFilter)); TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(5, true)); layout.addColumnData(new ColumnWeightData(4, true)); layout.addColumnData(new ColumnWeightData(3, true)); layout.addColumnData(new ColumnWeightData(3, true)); viewer.getTable().setLayout(layout); createNameColumn(viewer); createTypeColumn(viewer); createMultipleColumn(viewer); createMandatoryColumn(viewer); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setInput(fieldsObservable); selectedFieldObservable = ViewerProperties.singleSelection(Field.class).observe(viewer); addDragAndDropSupport(); }
Example 8
Source File: SinkView.java From lapse-plus with GNU General Public License v3.0 | 5 votes |
private void createColumns() { TableLayout layout = new TableLayout(); getTable().setLayout(layout); getTable().setHeaderVisible(true); for (int i = 0; i < columnHeaders.length; i++) { layout.addColumnData(columnLayouts[i]); TableColumn tc = new TableColumn(getTable(), SWT.BORDER, i); tc.setResizable(columnLayouts[i].resizable); tc.setText(columnHeaders[i]); tc.pack(); final int j = i; tc.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ViewerSorter oldSorter = viewer.getSorter(); if (oldSorter instanceof ColumnBasedSorter) { ColumnBasedSorter sorter = (ColumnBasedSorter) oldSorter; if (sorter.getColumn() == j) { sorter.toggle(); viewer.refresh(); // System.err.println("Resorting column " + j + // " in order " // + sorter.getOrientation()); return; } } viewer.setSorter(new ColumnBasedSorter(j)); logError("Sorting column " + j + " in order " + 1); viewer.refresh(); } }); } }
Example 9
Source File: TreeExplorer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void setLeftHeader(final String title) { leftTree.getTree().setHeaderVisible(true); final TreeColumn columnName = new TreeColumn(leftTree.getTree(), SWT.NONE); columnName.setText(title); final TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(1, 300)); leftTree.getTree().setLayout(layout); }
Example 10
Source File: XPathExpressionEditor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public Control createExpressionEditor(final Composite parent, final EMFDataBindingContext ctx) { mainComposite = new Composite(parent, SWT.NONE); mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); mainComposite.setLayout(new GridLayout(2, true)); viewer = new TableViewer(mainComposite, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL); final TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(100, false)); viewer.getTable().setLayout(layout); viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); final TableViewerColumn columnViewer = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = columnViewer.getColumn(); column.setText(Messages.name); final TableColumnSorter sorter = new TableColumnSorter(viewer); sorter.setColumn(column); viewer.getTable().setHeaderVisible(true); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new DataStyledTreeLabelProvider()); viewer.addPostSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { if (!event.getSelection().isEmpty()) { xsdViewer.expandAll(); XPathExpressionEditor.this.fireSelectionChanged(); } } }); createXPathChooser(mainComposite); createReturnTypeComposite(parent); return mainComposite; }
Example 11
Source File: TreeConflictsView.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private void setColumnWidth(TableLayout layout, DisposeListener disposeListener, TreeColumn col, int colIndex) { String columnWidth = null; columnWidth = settings.get("TreeConflictsView.col." + col.getText()); //$NON-NLS-1$ //$NON-NLS-1$ if (columnWidth == null || columnWidth.equals("0")) layout.addColumnData(columnLayouts[colIndex]); //$NON-NLS-1$ else layout.addColumnData(new ColumnPixelData(Integer.parseInt(columnWidth), true)); col.addDisposeListener(disposeListener); }
Example 12
Source File: ExpressionCollectionViewer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private TableLayout createTableLayout() { final int weight = (int) ((float) 1 / (float) viewer.getTable() .getColumnCount() * 100); final TableLayout layout = new TableLayout(); for (int i = 0; i < viewer.getTable().getColumns().length; i++) { layout.addColumnData(new ColumnWeightData(weight)); } return layout; }
Example 13
Source File: SmartImportBdmPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private Composite createMergeViewer(Composite parent) { Composite composite = new Composite(parent, SWT.None); composite.setLayout(GridLayoutFactory.fillDefaults().spacing(LayoutConstants.getSpacing().x, 1).create()); composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); viewer = new TreeViewer(composite, SWT.VIRTUAL | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); viewer.getTree().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); viewer.setUseHashlookup(true); ColumnViewerToolTipSupport.enableFor(viewer); viewer.getTree().setHeaderVisible(true); viewer.getTree().setLinesVisible(true); viewer.setContentProvider(new SmartImportBdmTreeContentProvider()); TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(6, true)); layout.addColumnData(new ColumnWeightData(2, true)); viewer.getTree().setLayout(layout); createModelColumn(); createActionColumn(); IViewerObservableValue singleSelectionObservable = ViewerProperties.singleSelection().observe(viewer); viewer.addDoubleClickListener(e -> viewer.setExpandedState(singleSelectionObservable.getValue(), !viewer.getExpandedState(singleSelectionObservable.getValue()))); return composite; }
Example 14
Source File: ContractConstraintsTableViewer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void configureTableLayout() { final TableLayout tableLayout = new TableLayout(); tableLayout.addColumnData(new ColumnWeightData(1)); tableLayout.addColumnData(new ColumnWeightData(2)); tableLayout.addColumnData(new ColumnWeightData(2)); tableLayout.addColumnData(new ColumnWeightData(2)); getTable().setLayout(tableLayout); }
Example 15
Source File: ResolvablePropertiesDialog.java From eclipse-cs with GNU Lesser General Public License v2.1 | 4 votes |
/** * Creates the dialogs main contents. * * @param parent * the parent composite */ @Override protected Control createDialogArea(Composite parent) { // set the logo this.setTitleImage(CheckstyleUIPluginImages.getImage(CheckstyleUIPluginImages.PLUGIN_LOGO)); this.setTitle(Messages.ResolvablePropertiesDialog_titleMessageArea); this.setMessage(Messages.ResolvablePropertiesDialog_msgAdditionalProperties); Composite composite = (Composite) super.createDialogArea(parent); Composite contents = new Composite(composite, SWT.NULL); contents.setLayout(new GridLayout(2, false)); GridData fd = new GridData(GridData.FILL_BOTH); contents.setLayoutData(fd); Table table = new Table(contents, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION); table.setLayoutData(new GridData(GridData.FILL_BOTH)); table.setHeaderVisible(true); table.setLinesVisible(true); TableLayout tableLayout = new TableLayout(); table.setLayout(tableLayout); TableColumn column1 = new TableColumn(table, SWT.NULL); column1.setText(Messages.ResolvablePropertiesDialog_colName); tableLayout.addColumnData(new ColumnWeightData(50)); TableColumn column2 = new TableColumn(table, SWT.NULL); column2.setText(Messages.ResolvablePropertiesDialog_colValue); tableLayout.addColumnData(new ColumnWeightData(50)); mTableViewer = new EnhancedTableViewer(table); PropertiesLabelProvider multiProvider = new PropertiesLabelProvider(); mTableViewer.setLabelProvider(multiProvider); mTableViewer.setTableComparableProvider(multiProvider); mTableViewer.setTableSettingsProvider(multiProvider); mTableViewer.installEnhancements(); mTableViewer.setContentProvider(new ArrayContentProvider()); mTableViewer.addDoubleClickListener(mController); mTableViewer.getTable().addKeyListener(mController); Composite buttonBar = new Composite(contents, SWT.NULL); GridLayout layout = new GridLayout(1, false); layout.marginHeight = 0; layout.marginWidth = 0; buttonBar.setLayout(layout); GridData gd = new GridData(); gd.verticalAlignment = GridData.BEGINNING; buttonBar.setLayoutData(gd); mBtnAdd = new Button(buttonBar, SWT.PUSH); mBtnAdd.setText(Messages.ResolvablePropertiesDialog_btnAdd); mBtnAdd.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mBtnAdd.addSelectionListener(mController); mBtnEdit = new Button(buttonBar, SWT.PUSH); mBtnEdit.setText(Messages.ResolvablePropertiesDialog_btnEdit); mBtnEdit.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mBtnEdit.addSelectionListener(mController); mBtnRemove = new Button(buttonBar, SWT.PUSH); mBtnRemove.setText(Messages.ResolvablePropertiesDialog_btnRemove); mBtnRemove.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mBtnRemove.addSelectionListener(mController); return composite; }
Example 16
Source File: ProblemsDialog.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override protected Control createCustomArea(Composite parent) { Collection<T> input = getInput(); Assert.isNotNull(input); if (input.isEmpty()) { return super.createCustomArea(parent); } if(messageLabel != null) { GridData layoutData = (GridData) messageLabel.getLayoutData(); layoutData.verticalAlignment = SWT.CENTER; } TableViewer problemsViewer = new TableViewer(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION); problemsViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(600, 100).create()); problemsViewer.setContentProvider(ArrayContentProvider.getInstance()); problemsViewer.setComparator(getComparator()); TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(1, false)); problemsViewer.getTable().setLayout(layout); tableViewerColumn = new TableViewerColumn(problemsViewer, SWT.NONE); TypedLabelProvider<T> typedLabelProvider = getTypedLabelProvider(); Assert.isNotNull(typedLabelProvider); tableViewerColumn.setLabelProvider(new LabelProviderBuilder<T>() .withTextProvider(typedLabelProvider::getText) .withImageProvider(typedLabelProvider::getImage) .withTooltipProvider(typedLabelProvider::getToolTipText) .createColumnLabelProvider()); problemsViewer.getTable().getShell().addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { tableViewerColumn.getColumn().pack(); } }); problemsViewer.setInput(input); ColumnViewerToolTipSupport.enableFor(problemsViewer); return problemsViewer.getControl(); }
Example 17
Source File: ManageConnectorJarDialog.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected void createTree(Composite composite) { final Text searchText = new Text(composite,SWT.SEARCH | SWT.ICON_SEARCH | SWT.BORDER | SWT.CANCEL) ; searchText.setMessage(Messages.search) ; searchText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()) ; searchFilter = new ViewerFilter() { @Override public boolean select(Viewer arg0, Object arg1, Object element) { if(!searchText.getText().isEmpty()){ String searchQuery = searchText.getText().toLowerCase() ; IRepositoryFileStore file = (IRepositoryFileStore) element ; return file.getName().toLowerCase().contains(searchQuery) ; } return true; } }; //new Label(composite,SWT.NONE) ; //FILLER languageViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL) ; languageViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 190).create()) ; languageViewer.getTable().setLinesVisible(true) ; languageViewer.getTable().setHeaderVisible(false) ; final TableLayout layout = new TableLayout() ; layout.addColumnData(new ColumnWeightData(65)) ; languageViewer.getTable().setLayout(layout) ; languageViewer.setContentProvider(new ArrayContentProvider()) ; languageViewer.setLabelProvider(new FileStoreLabelProvider()) ; languageViewer.addFilter(searchFilter) ; if(filter != null){ languageViewer.addFilter(filter); } languageViewer.setInput(libStore.getChildren()) ; languageViewer.getTable().setFocus() ; searchText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { languageViewer.refresh() ; } }) ; }
Example 18
Source File: CheckConfigurationWorkingSetEditor.java From eclipse-cs with GNU Lesser General Public License v2.1 | 4 votes |
/** * Creates the table viewer to show the existing check configurations. * * @param parent * the parent composite * @return the table control */ private Control createConfigTable(Composite parent) { Table table = new Table(parent, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); table.setHeaderVisible(true); table.setLinesVisible(true); TableLayout tableLayout = new TableLayout(); table.setLayout(tableLayout); TableColumn column1 = new TableColumn(table, SWT.NULL); column1.setText(Messages.CheckstylePreferencePage_colCheckConfig); tableLayout.addColumnData(new ColumnWeightData(40)); TableColumn column2 = new TableColumn(table, SWT.NULL); column2.setText(Messages.CheckstylePreferencePage_colLocation); tableLayout.addColumnData(new ColumnWeightData(30)); TableColumn column3 = new TableColumn(table, SWT.NULL); column3.setText(Messages.CheckstylePreferencePage_colType); tableLayout.addColumnData(new ColumnWeightData(30)); if (mWorkingSet instanceof GlobalCheckConfigurationWorkingSet) { TableColumn column4 = new TableColumn(table, SWT.NULL); column4.setText(Messages.CheckstylePreferencePage_colDefault); tableLayout.addColumnData(new ColumnWeightData(12)); } mViewer = new EnhancedTableViewer(table); ConfigurationLabelProvider multiProvider = new ConfigurationLabelProvider(); mViewer.setLabelProvider(multiProvider); mViewer.setTableComparableProvider(multiProvider); mViewer.setTableSettingsProvider(multiProvider); mViewer.installEnhancements(); mViewer.setContentProvider(new ArrayContentProvider()); mViewer.setInput(mWorkingSet.getWorkingCopies()); mViewer.addDoubleClickListener(mController); mViewer.addSelectionChangedListener(mController); return table; }
Example 19
Source File: FileSetEditDialog.java From eclipse-cs with GNU Lesser General Public License v2.1 | 4 votes |
private Control createFileMatchPatternPart(Composite parent) { Group composite = new Group(parent, SWT.NONE); composite.setText(Messages.FileSetEditDialog_titlePatternsTable); composite.setLayout(new FormLayout()); final Composite buttons = new Composite(composite, SWT.NULL); FormData fd = new FormData(); fd.top = new FormAttachment(0, 3); fd.right = new FormAttachment(100, -3); fd.bottom = new FormAttachment(100, -3); buttons.setLayoutData(fd); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; buttons.setLayout(layout); final Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.FULL_SELECTION); fd = new FormData(); fd.left = new FormAttachment(0, 3); fd.top = new FormAttachment(0, 3); fd.right = new FormAttachment(buttons, -3, SWT.LEFT); fd.bottom = new FormAttachment(100, -3); table.setLayoutData(fd); TableLayout tableLayout = new TableLayout(); table.setLayout(tableLayout); table.setHeaderVisible(true); table.setLinesVisible(true); TableColumn column1 = new TableColumn(table, SWT.NONE); column1.setText(Messages.FileSetEditDialog_colInclude); tableLayout.addColumnData(new ColumnWeightData(11)); TableColumn column2 = new TableColumn(table, SWT.NONE); column2.setText(Messages.FileSetEditDialog_colRegex); tableLayout.addColumnData(new ColumnWeightData(89)); mPatternViewer = new CheckboxTableViewer(table); mPatternViewer.setLabelProvider(new FileMatchPatternLabelProvider()); mPatternViewer.setContentProvider(new ArrayContentProvider()); mPatternViewer.addDoubleClickListener(mController); mPatternViewer.addCheckStateListener(mController); // // Build the buttons. // mAddButton = createPushButton(buttons, Messages.FileSetEditDialog_btnAdd); mAddButton.addSelectionListener(mController); mEditButton = createPushButton(buttons, Messages.FileSetEditDialog_btnEdit); mEditButton.addSelectionListener(mController); mRemoveButton = createPushButton(buttons, Messages.FileSetEditDialog_btnRemove); mRemoveButton.addSelectionListener(mController); mUpButton = createPushButton(buttons, Messages.FileSetEditDialog_btnUp); mUpButton.addSelectionListener(mController); mDownButton = createPushButton(buttons, Messages.FileSetEditDialog_btnDown); mDownButton.addSelectionListener(mController); return composite; }
Example 20
Source File: JavaExpressionEditor.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public Control createExpressionEditor(final Composite parent, final EMFDataBindingContext ctx) { mainComposite = new Composite(parent, SWT.NONE); mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(true).create()); final Label filler = (new Label(mainComposite, SWT.NONE)); filler.setLayoutData( GridDataFactory.fillDefaults().indent(0, -LayoutConstants.getSpacing().y + 1).span(2, 1).create()); viewer = new TableViewer(mainComposite, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL); final TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(100, false)); viewer.getTable().setLayout(layout); viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); final TableViewerColumn columnViewer = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = columnViewer.getColumn(); column.setText(Messages.name); final TableColumnSorter sorter = new TableColumnSorter(viewer); sorter.setColumn(column); viewer.getTable().setHeaderVisible(true); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new DataStyledTreeLabelProvider()); viewer.addPostSelectionChangedListener(event -> { if (!event.getSelection().isEmpty()) { javaTreeviewer.getTree().setEnabled(true); data = (Data) ((IStructuredSelection) event.getSelection()).getFirstElement(); String className = null; if (data.isMultiple()) { className = List.class.getName(); } else if (data instanceof JavaObjectData) { className = ((JavaObjectData) data).getClassName(); } if (className != null) { javaTreeviewer.setInput(className); if (editorInputExpression != null && editorInputExpression.isReturnTypeFixed()) { javaTreeviewer.addFilter(showOnlyMethodWithReturnType(editorInputExpression.getReturnType())); } javaTreeviewer.expandAll(); javaTreeviewer.getTree().setFocus(); javaTreeviewer.getTree().getShell().layout(true, true); JavaExpressionEditor.this.fireSelectionChanged(); } } }); createBrowseJavaObjectForReadExpression(mainComposite); createReturnTypeComposite(parent); return mainComposite; }