Java Code Examples for org.eclipse.swt.widgets.Tree#setLayoutData()
The following examples show how to use
org.eclipse.swt.widgets.Tree#setLayoutData() .
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: AbstractSection.java From uima-uimaj with Apache License 2.0 | 6 votes |
/** * New tree. * * @param parent the parent * @param style SWT.SINGLE SWT.MULTI SWT.CHECK SWT.FULL_SELECTION * @return the TableTree */ protected Tree newTree(Composite parent, int style) { Tree tt = new Tree(parent, style); tt.setLayoutData(new GridData(GridData.FILL_BOTH)); toolkit.adapt(tt, true, true); tt.addListener(SWT.Selection, this); tt.addListener(SWT.KeyUp, this); // for delete key tt.addListener(SWT.MouseDoubleClick, this); // for edit tt.addListener(SWT.Expand, this); tt.addListener(SWT.Collapse, this); // Make the TableTree's border visible since TableTree is NOT a widget supported // by FormToolkit. Needed by RedHat Linux tt.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER); return tt; }
Example 2
Source File: MSyncWizardOverviewPage.java From slr-toolkit with Eclipse Public License 1.0 | 6 votes |
@Override public void createControl(Composite parent) { container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); container.setLayout(layout); // required to avoid an error in the system setControl(container); treeViewer = new TreeViewer(container, SWT.BORDER); treeViewer.setContentProvider(new TreeContentProvider()); treeViewer.setLabelProvider(new MendeleyTreeLabelProvider()); Tree tree = treeViewer.getTree(); tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); container.setEnabled(true); treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { treeViewer.getTree().deselect(treeViewer.getTree().getSelection()[0]); } }); }
Example 3
Source File: XViewerCustomizeDialog.java From nebula with Eclipse Public License 2.0 | 6 votes |
private void createHiddenButtonsComposition(Composite parent) { Composite hiddenTableComp = new Composite(parent, SWT.NONE); hiddenTableComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); GridLayout gridLayout_4 = new GridLayout(); gridLayout_4.marginWidth = 0; gridLayout_4.marginHeight = 0; hiddenTableComp.setLayout(gridLayout_4); Label hiddenColumnsLabel = new Label(hiddenTableComp, SWT.NONE); hiddenColumnsLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); hiddenColumnsLabel.setText(XViewerText.get("heading.hidden")); //$NON-NLS-1$ // Hidden Column Table hiddenColTable = new XViewerFilteredTree(hiddenTableComp); Tree table_1 = hiddenColTable.getViewer().getTree(); GridData gd_table_1 = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2); gd_table_1.widthHint = 300; table_1.setLayoutData(gd_table_1); hiddenColTable.getViewer().setLabelProvider(new XViewerColumnLabelProvider()); hiddenColTable.getViewer().setContentProvider(new ArrayTreeContentProvider()); hiddenColTable.getViewer().setSorter(new XViewerColumnSorter()); hiddenColTable.getViewer().addSelectionChangedListener(event -> updateButtonEnablements()); }
Example 4
Source File: CustomElementSelectionForm.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * Create the composite. */ public CustomElementSelectionForm(Composite parent, int style) { super(parent, style); setLayout(new GridLayout(2, false)); treeViewer = new TreeViewer(this, SWT.BORDER); Tree tree = getTreeViewer().getTree(); // Set a minimum height to prevent weird dialog dimensions tree.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).minSize(0, 200).create()); elementLabel = new Label(this, SWT.NONE); elementLabel.setLayoutData(GridDataFactory.swtDefaults().create()); elementLabel.setText("New Label"); elementInput = new SuffixText(this, SWT.BORDER);// new Text(this, SWT.BORDER); elementInput.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); }
Example 5
Source File: TraceTypePreferencePageViewer.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Create the filter area * * @param parent * The parent composite * @return The filter area composite */ public Composite createFilterArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(1, true)); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); CheckboxTreeViewer treeViewer = createTreeViewer(composite); Control buttonComposite = createSelectionButtons(composite); GridData data = new GridData(GridData.FILL_BOTH); Tree treeWidget = treeViewer.getTree(); treeWidget.setLayoutData(data); treeWidget.setFont(parent.getFont()); if (fIsEmpty) { treeWidget.setEnabled(false); buttonComposite.setEnabled(false); } return composite; }
Example 6
Source File: QuickOutlinePopup.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected TreeViewer createTreeViewer(Composite parent, int style) { Tree tree = new Tree(parent, SWT.SINGLE | (style & ~SWT.MULTI)); GridData gd = new GridData(GridData.FILL_BOTH); gd.heightHint = tree.getItemHeight() * 12; tree.setLayoutData(gd); final TreeViewer treeViewer = new TreeViewer(tree); treeViewer.addFilter(new NamePatternFilter()); treeViewer.setContentProvider(contentProvider); filterAndSorter.setComparator(comparator); contentProvider.setFilterAndSorter(filterAndSorter); treeViewer.setLabelProvider(labelProvider); treeViewer.setAutoExpandLevel(2); return treeViewer; }
Example 7
Source File: AbstractSelectImportedObjectDialog.java From ermaster-b with Apache License 2.0 | 5 votes |
private void createAllObjectGroup(Composite composite) { GridData gridData = new GridData(); gridData.heightHint = 300; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.viewer = new ContainerCheckedTreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); Tree tree = this.viewer.getTree(); tree.setLayoutData(gridData); this.viewer.setContentProvider(new TreeNodeContentProvider()); this.viewer.setLabelProvider(new ViewLabelProvider()); }
Example 8
Source File: AbstractDialog.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * New tree. * * @param parent the parent * @param style the style * @return the tree */ protected Tree newTree(Composite parent, int style) { Tree tree = new Tree(parent, style | SWT.BORDER); GridData gd = new GridData(GridData.FILL_BOTH); tree.setLayoutData(gd); tree.addListener(SWT.Selection, this); tree.addListener(SWT.KeyUp, this); // delete key return tree; }
Example 9
Source File: SelectImportedSchemaDialog.java From erflute with Apache License 2.0 | 5 votes |
private void createAllSchemaGroup(Composite composite) { final GridData gridData = new GridData(); gridData.heightHint = 300; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.viewer = new ContainerCheckedTreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); final Tree tree = viewer.getTree(); tree.setLayoutData(gridData); viewer.setContentProvider(new TreeNodeContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); }
Example 10
Source File: AbstractSelectImportedObjectDialog.java From erflute with Apache License 2.0 | 5 votes |
private void createAllObjectGroup(Composite composite) { final GridData gridData = new GridData(); gridData.heightHint = 300; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.viewer = new ContainerCheckedTreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); final Tree tree = viewer.getTree(); tree.setLayoutData(gridData); viewer.setContentProvider(new TreeNodeContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); }
Example 11
Source File: CompositeFactory.java From ermasterr with Apache License 2.0 | 5 votes |
public static ContainerCheckedTreeViewer createCheckedTreeViewer(final AbstractDialog dialog, final Composite parent, final int height, final int span) { final GridData gridData = new GridData(); gridData.heightHint = height; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = span; final ContainerCheckedTreeViewer viewer = new ContainerCheckedTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); final Tree tree = viewer.getTree(); tree.setLayoutData(gridData); viewer.setContentProvider(new TreeNodeContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); if (dialog != null) { viewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(final CheckStateChangedEvent event) { dialog.validate(); } }); } return viewer; }
Example 12
Source File: ChartExamples.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Create the selection tree. * * @param parent * sGroup */ private void createTree( Composite parent ) { Tree tree = new Tree( parent, SWT.SINGLE | SWT.BORDER ); tree.setLayoutData( new GridData( GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL ) ); tree.addSelectionListener( this ); fillTree( tree ); }
Example 13
Source File: M2DocFileSelectionDialog.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
@Override protected Control createCustomArea(Composite parent) { final Composite container = new Composite(parent, parent.getStyle()); container.setLayout(new GridLayout(1, false)); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); fileText = createFilePathComposite(container, defaultFileName); final TreeViewer containerTreeViewer = new TreeViewer(container, SWT.BORDER); Tree tree = containerTreeViewer.getTree(); final GridData gdTable = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); gdTable.minimumWidth = TABLE_MINIMUM_WIDTH; gdTable.minimumHeight = TABLE_MINIMUM_HEIGHT; tree.setLayoutData(gdTable); containerTreeViewer.setContentProvider(new WorkbenchContentProvider() { @Override public Object[] getChildren(Object element) { final List<Object> res = new ArrayList<>(); for (Object obj : super.getChildren(element)) { if (obj instanceof IContainer || (obj instanceof IFile && fileExtension.equals(((IFile) obj).getFileExtension()))) { res.add(obj); } } return res.toArray(); } }); containerTreeViewer.setLabelProvider(new WorkbenchLabelProvider()); containerTreeViewer.addSelectionChangedListener(new ContainerSelectionChangedListener()); containerTreeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot()); if (defaultFileName != null && !defaultFileName.isEmpty()) { final IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(defaultFileName)); containerTreeViewer.setSelection(new StructuredSelection(file)); } return container; }
Example 14
Source File: SelectImportedSchemaDialog.java From ermaster-b with Apache License 2.0 | 5 votes |
private void createAllSchemaGroup(Composite composite) { GridData gridData = new GridData(); gridData.heightHint = 300; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.viewer = new ContainerCheckedTreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); Tree tree = this.viewer.getTree(); tree.setLayoutData(gridData); this.viewer.setContentProvider(new TreeNodeContentProvider()); this.viewer.setLabelProvider(new ViewLabelProvider()); }
Example 15
Source File: AbstractSection.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * New tree. * * @param parent the parent * @return the tree */ protected Tree newTree(Composite parent) { Tree local_tree = toolkit.createTree(parent, SWT.SINGLE); local_tree.setLayoutData(new GridData(GridData.FILL_BOTH)); local_tree.addListener(SWT.Selection, this); local_tree.addListener(SWT.KeyUp, this); return local_tree; }
Example 16
Source File: StaticHTMLViewer.java From birt with Eclipse Public License 1.0 | 4 votes |
private void createTOCSection( Composite parent ) { Composite toc = toolkit.createComposite( parent ); toc.setLayoutData( new GridData( GridData.FILL_BOTH ) ); GridLayout layout = new GridLayout( ); layout.marginHeight = 0; layout.marginWidth = 0; layout.horizontalSpacing = 0; layout.verticalSpacing = 0; layout.numColumns = 1; toc.setLayout( new GridLayout( ) ); toolkit.createLabel( toc, "Table of Contents:" ); //$NON-NLS-1$ Tree t = toolkit.createTree( toc, SWT.NULL ); t.setLayoutData( new GridData( GridData.FILL_BOTH ) ); tocViewer = new TreeViewer( t ); // TODO config viewer tocViewer.setLabelProvider( new TOCLableProvider( ) { } ); tocViewer.setContentProvider( new TOCContentProvider( ) { } ); tocViewer.addSelectionChangedListener( new ISelectionChangedListener( ) { public void selectionChanged( SelectionChangedEvent event ) { if ( reportDocumentFile != null ) { StructuredSelection selection = (StructuredSelection) event.getSelection( ); TOCNode node = (TOCNode) selection.getFirstElement( ); try { IReportDocument document = openReportDocument( reportDocumentFile ); setCurrentPage( document.getPageNumber( node.getBookmark( ) ) ); document.close( ); renderWithoutAskingForParams( ); } catch ( EngineException e ) { ExceptionUtil.handle( e ); } } } } ); toolkit.paintBordersFor( toc ); }
Example 17
Source File: UpdateWizardPage.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
public void createControl(final Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout gridLayout = new GridLayout(); gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; composite.setLayout(gridLayout); treeViewer = new TreeViewer(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); GridData data = new GridData(GridData.FILL_BOTH); Tree tree = treeViewer.getTree(); tree.setLayoutData(data); tree.setHeaderVisible(true); IUColumnConfig[] columns = getColumnConfig(); for (int i = 0; i < columns.length; i++) { TreeColumn tc = new TreeColumn(tree, SWT.LEFT, i); tc.setResizable(true); tc.setText(columns[i].getColumnTitle()); tc.setWidth(columns[i].getWidthInPixels(tree)); } contentProvider = new ProvElementContentProvider(); treeViewer.setContentProvider(contentProvider); labelProvider = new IUDetailsLabelProvider(null, getColumnConfig(), getShell()); treeViewer.setLabelProvider(labelProvider); setControl(composite); final Runnable runnable = new Runnable() { public void run() { // updateStatus(input, operation); setDrilldownElements(input, operation); treeViewer.setInput(input); } }; if (operation != null && !operation.hasResolved()) { try { getContainer().run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { operation.resolveModal(monitor); parent.getDisplay().asyncExec(runnable); } }); } catch (Exception e) { StatusManager.getManager().handle(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e)); } } else { runnable.run(); } }
Example 18
Source File: ServerView.java From RDFS with Apache License 2.0 | 4 votes |
/** * Creates the columns for the view */ @Override public void createPartControl(Composite parent) { Tree main = new Tree(parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); main.setHeaderVisible(true); main.setLinesVisible(false); main.setLayoutData(new GridData(GridData.FILL_BOTH)); TreeColumn serverCol = new TreeColumn(main, SWT.SINGLE); serverCol.setText("Location"); serverCol.setWidth(300); serverCol.setResizable(true); TreeColumn locationCol = new TreeColumn(main, SWT.SINGLE); locationCol.setText("Master node"); locationCol.setWidth(185); locationCol.setResizable(true); TreeColumn stateCol = new TreeColumn(main, SWT.SINGLE); stateCol.setText("State"); stateCol.setWidth(95); stateCol.setResizable(true); TreeColumn statusCol = new TreeColumn(main, SWT.SINGLE); statusCol.setText("Status"); statusCol.setWidth(300); statusCol.setResizable(true); viewer = new TreeViewer(main); viewer.setContentProvider(this); viewer.setLabelProvider(this); viewer.setInput(CONTENT_ROOT); // don't care getViewSite().setSelectionProvider(viewer); getViewSite().getActionBars().setGlobalActionHandler( ActionFactory.DELETE.getId(), deleteAction); getViewSite().getActionBars().getToolBarManager().add(editServerAction); getViewSite().getActionBars().getToolBarManager().add(newLocationAction); createActions(); createContextMenu(); }
Example 19
Source File: LogAnalysis.java From AndroidRobot with Apache License 2.0 | 4 votes |
public void createLogList() { tabFolderLogList = new CTabFolder(sashFormLog, SWT.NONE | SWT.BORDER); tabFolderLogList.setTabHeight(0); tabFolderLogList.marginHeight = 0; tabFolderLogList.marginWidth = 0; tabFolderLogList.setLayout(new FillLayout()); tabFolderLogList.setBounds(5, 5, 200, 465); tabFolderLogList.setSimple(false); tabFolderLogList.setUnselectedCloseVisible(true); CTabItem tabItemLogList = new CTabItem(tabFolderLogList, SWT.NONE | SWT.MULTI | SWT.V_SCROLL); tabFolderLogList.setSelection(tabItemLogList); tabItemLogList.setText("日志浏览"); Composite composite = new Composite(tabFolderLogList, SWT.NONE); composite.setLayout(new GridLayout()); treeLog = new Tree(composite, SWT.BORDER); colorBlack = display.getSystemColor(SWT.COLOR_BLACK); tabItemLogList.setControl(composite); treeLog.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); treeLog.addListener(SWT.MouseDoubleClick, new Listener() { public void handleEvent(Event event) { Point point = new Point(event.x, event.y); TreeItem item = treeLog.getItem(point); if (item != null) { String taskName = (String) item.getData("task"); String loop = String.valueOf(item.getData("loop")); String caseName = (String) item.getData("case"); int index = (Integer) item.getData("index"); //System.out.println("task:"+taskName+" loop:"+loop+" caseName:"+caseName+" index:"+index); if (index != 0) Log.loadLogs(styledTextLog, display, logFile, taskName, loop, caseName, index); } } }); }
Example 20
Source File: XViewerCustomizeDialog.java From nebula with Eclipse Public License 2.0 | 4 votes |
private void createSelectCustomizationSection(Composite comp) { // Customization Table and Buttons final Composite custComp = new Composite(comp, SWT.NONE); final GridData gd_composite_6 = new GridData(SWT.FILL, SWT.FILL, true, true); custComp.setLayoutData(gd_composite_6); final GridLayout gridLayout_1 = new GridLayout(); gridLayout_1.marginWidth = 0; gridLayout_1.marginHeight = 0; custComp.setLayout(gridLayout_1); Label selectCustomizationLabel = new Label(custComp, SWT.NONE); selectCustomizationLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); selectCustomizationLabel.setText(XViewerText.get("XViewerCustomizeDialog.prompt")); //$NON-NLS-1$ // Customization Table custTable = new XViewerFilteredTree(custComp, SWT.BORDER); final Tree table_2 = custTable.getViewer().getTree(); final GridData gd_table_2 = new GridData(SWT.FILL, SWT.FILL, true, true); gd_table_2.heightHint = 270; gd_table_2.widthHint = 200; table_2.setLayoutData(gd_table_2); custTable.getViewer().setLabelProvider(new CustomizeDataLabelProvider(xViewerToCustomize)); custTable.getViewer().setContentProvider(new ArrayTreeContentProvider()); custTable.getViewer().setSorter(new ViewerSorter() { @SuppressWarnings("unchecked") @Override public int compare(Viewer viewer, Object e1, Object e2) { if (((CustomizeData) e1).getName().startsWith("-")) { //$NON-NLS-1$ return -1; } else if (((CustomizeData) e2).getName().startsWith("-")) { //$NON-NLS-1$ return 1; } else { return getComparator().compare(((CustomizeData) e1).getName(), ((CustomizeData) e2).getName()); } } }); custTable.getViewer().addSelectionChangedListener(event -> { handleCustTableSelectionChanged(); updateButtonEnablements(); storeCustTableSelection(); }); // Customization Table Buttons final Composite composite = new Composite(custComp, SWT.NONE); composite.setLayoutData(new GridData()); final GridLayout gridLayout_7 = new GridLayout(); gridLayout_7.numColumns = 4; composite.setLayout(gridLayout_7); setDefaultButton = new Button(composite, SWT.NONE); setDefaultButton.setLayoutData(new GridData()); setDefaultButton.setText(SET_AS_DEFAULT); setDefaultButton.addListener(SWT.Selection, e -> { handleSetDefaultButton(); updateButtonEnablements(); }); deleteButton = new Button(composite, SWT.NONE); deleteButton.setLayoutData(new GridData()); deleteButton.setText(XViewerText.get("button.delete")); //$NON-NLS-1$ deleteButton.addListener(SWT.Selection, e -> { handleDeleteButton(); updateButtonEnablements(); }); }