Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Tree


        contributeToActionBars();
    }

    private void createTableTree() {

        final Tree tree = viewer.getTree();

        tree.setLinesVisible(true);
        tree.setHeaderVisible(true);

        colName = new TreeColumn(tree, SWT.LEFT);
        colName.setText("Name");
        colName.setWidth(540);
View Full Code Here


    /**
     * Create this group's tree viewer.
     */
    protected void createTreeViewer(final Composite parent, final boolean useHeightHint) {
        final Tree tree = new Tree(parent, SWT.CHECK | SWT.BORDER);
        final GridData data = new GridData(GridData.FILL_BOTH);
        if (useHeightHint) {
            data.heightHint = PREFERRED_HEIGHT;
        }
        tree.setLayoutData(data);
        tree.setFont(parent.getFont());

        treeViewer = new CheckboxTreeViewer(tree);
        treeViewer.setContentProvider(treeContentProvider);
        treeViewer.setLabelProvider(treeLabelProvider);
        treeViewer.addTreeListener(this);
View Full Code Here

        fTreeViewer = treeViewer;
    }

    @Override
    public void mouseMove(final MouseEvent e) {
        final Tree tree = fTreeViewer.getTree();
        if (tree.equals(e.getSource())) {
            final Object o = tree.getItem(new Point(e.x, e.y));
            if (o != null && !o.equals(fLastItem)) {
                fLastItem = (TreeItem) o;
                tree.setSelection(new TreeItem[] { fLastItem });
            } else if (e.y < tree.getItemHeight() / 4) {
                // Scroll up
                final Point p = tree.toDisplay(e.x, e.y);
                final Item item = fTreeViewer.scrollUp(p.x, p.y);
                if (item instanceof TreeItem) {
                    fLastItem = (TreeItem) item;
                    tree.setSelection(new TreeItem[] { fLastItem });
                }
            } else if (e.y > tree.getBounds().height - tree.getItemHeight() / 4) {
                // Scroll down
                final Point p = tree.toDisplay(e.x, e.y);
                final Item item = fTreeViewer.scrollDown(p.x, p.y);
                if (item instanceof TreeItem) {
                    fLastItem = (TreeItem) item;
                    tree.setSelection(new TreeItem[] { fLastItem });
                }
            }
        }
    }
View Full Code Here

     */
    private void createUIWidgetTreeViewer(final Composite parent) {

        final int style = SWT.H_SCROLL | SWT.V_SCROLL;
        // Create the tree
        final Tree widget = new Tree(parent, style);
        // Configure the layout
        final GridData data = new GridData(GridData.FILL_BOTH);
        data.heightHint = widget.getItemHeight() * 12;
        widget.setLayoutData(data);
        // Create the tree viewer
        fTreeViewer = new TreeViewer(widget);
        // Add member filter, don't show attributes
        final FilterDescriptor filterDescriptor = FilterDescriptor
                .getFilterDescriptor("attributesFilter");
View Full Code Here

    /**
     *
     */
    private void createUIListenersTreeViewer() {
        // Get the underlying tree widget
        final Tree tree = fTreeViewer.getTree();
        // Handle key events
        tree.addKeyListener(new KeyListener() {
            @Override
            public void keyPressed(final KeyEvent e) {
                if (e.character == 0x1B) {
                    // Dispose on ESC key press
                    dispose();
                }
            }

            @Override
            public void keyReleased(final KeyEvent e) {
                // NO-OP
            }
        });
        // Handle mouse clicks
        tree.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseUp(final MouseEvent e) {
                handleTreeViewerMouseUp(tree, e);
            }
        });
        // Handle mouse move events
        tree.addMouseMoveListener(new QuickOutlineMouseMoveListener(fTreeViewer));
        // Handle widget selection events
        tree.addSelectionListener(new SelectionListener() {
            @Override
            public void widgetSelected(final SelectionEvent e) {
                // NO-OP
            }

View Full Code Here

    /**
     * Selects the first element in the tree which matches the current filter
     * pattern.
     */
    private void selectFirstMatch() {
        final Tree tree = fTreeViewer.getTree();
        final Object element = findFirstMatchToPattern(tree.getItems());
        if (element != null) {
            fTreeViewer.setSelection(new StructuredSelection(element), true);
        } else {
            fTreeViewer.setSelection(StructuredSelection.EMPTY);
        }
View Full Code Here

        }
    }

    @Override
    public void createControl(final Composite parent) {
        final Tree tree = new Tree(parent, SWT.MULTI);
        fOutlineViewer = new TreeViewer(tree);
        fOutlineViewer.setAutoExpandLevel(0);
        fOutlineViewer.setUseHashlookup(true);
        if (SystemConfiguration.hasFeatureEnabled(Features.NEW_MODEL)) {
            fOutlineViewer.setContentProvider(new NewErlContentProvider());
            fOutlineViewer.setLabelProvider(new NewErlLabelProvider());
            fOutlineViewer.setInput(computeInput());
        } else {
            fOutlineViewer.setContentProvider(editor.createOutlineContentProvider());
            fOutlineViewer.setLabelProvider(editor.createOutlineLabelProvider());
            fOutlineViewer.setInput(fModule);
        }

        fOutlineViewer.addPostSelectionChangedListener(this);
        final IPageSite site = getSite();
        fLinkHelper = new LinkingHelper();

        final IContextService service = (IContextService) site
                .getService(IContextService.class);
        service.activateContext("org.erlide.ui.erlangOutlineAndNavigatorScope");

        final MenuManager manager = new MenuManager();
        manager.setRemoveAllWhenShown(true);
        manager.addMenuListener(new IMenuListener() {
            @Override
            public void menuAboutToShow(final IMenuManager m) {
                // recursive loop?
                // menuAboutToShow(m);
                contextMenuAboutToShow(m);
            }
        });
        final Menu menu = manager.createContextMenu(tree);
        tree.setMenu(menu);

        site.registerContextMenu(ErlangCore.PLUGIN_ID + ".outline", manager,
                fOutlineViewer);
        fActionGroups = new CompositeActionGroup(
                new ActionGroup[] { new ErlangSearchActionGroup(this) });
View Full Code Here

            }
            btnBrowse.setText("Browse...");
        }
        {
            final TreeViewer treeViewer = new TreeViewer(sourceComposite, SWT.BORDER);
            final Tree sources_tree = treeViewer.getTree();
            {
                final FormData formData = new FormData();
                formData.left = new FormAttachment(0, 10);
                formData.right = new FormAttachment(btnSource, -6);
                formData.top = new FormAttachment(lblSourceFoldersIn, 6);
                formData.bottom = new FormAttachment(btnAllowOutputFolders, -6);
                sources_tree.setLayoutData(formData);
            }
        }

        final Button btnWhenCleaningDelete = new Button(sourceComposite, SWT.CHECK);
        final FormData fd_btnWhenCleaningDelete = new FormData();
        fd_btnWhenCleaningDelete.top = new FormAttachment(output_text, 6);
        fd_btnWhenCleaningDelete.left = new FormAttachment(lblSourceFoldersIn, 0,
                SWT.LEFT);
        btnWhenCleaningDelete.setLayoutData(fd_btnWhenCleaningDelete);
        btnWhenCleaningDelete
                .setText("When cleaning, delete the whole output directory (faster)");
        sourceComposite.setTabList(new Control[] { btnFolder, btnSource, btnEdit,
                btnRemove, btnAllowOutputFolders, output_text, btnBrowse });

        final TabItem includeTab = new TabItem(tabFolder, SWT.NONE);
        includeTab.setText("Include");

        final Composite includeComposite = new Composite(tabFolder, SWT.NONE);
        includeComposite.setLayout(new FormLayout());
        includeComposite.setBounds(0, 0, 443, 305);
        includeTab.setControl(includeComposite);

        final Label lblFoldersWithInclude = new Label(includeComposite, SWT.NONE);
        {
            final FormData formData = new FormData();
            formData.right = new FormAttachment(100, -10);
            formData.top = new FormAttachment(0, 10);
            formData.left = new FormAttachment(0, 10);
            lblFoldersWithInclude.setLayoutData(formData);
        }
        lblFoldersWithInclude.setText("Folders with include files:");

        final Button btnAddFolder = new Button(includeComposite, SWT.NONE);
        {
            final FormData formData = new FormData();
            formData.top = new FormAttachment(lblFoldersWithInclude, 9);
            formData.right = new FormAttachment(lblFoldersWithInclude, 0, SWT.RIGHT);
            btnAddFolder.setLayoutData(formData);
        }
        btnAddFolder.setText("Add folder...");

        final Button btnEdit_1 = new Button(includeComposite, SWT.NONE);
        FormData formData_1;
        {
            formData_1 = new FormData();
            formData_1.right = new FormAttachment(lblFoldersWithInclude, 0, SWT.RIGHT);
            formData_1.width = 77;
            btnEdit_1.setLayoutData(formData_1);
        }
        btnEdit_1.setText("Edit...");

        final Button btnRemove_1 = new Button(includeComposite, SWT.NONE);
        formData_1.bottom = new FormAttachment(100, -216);
        {
            final FormData formData_7 = new FormData();
            formData_7.top = new FormAttachment(btnEdit_1, 7);
            formData_7.right = new FormAttachment(lblFoldersWithInclude, 0, SWT.RIGHT);
            formData_7.width = 77;
            btnRemove_1.setLayoutData(formData_7);
        }
        btnRemove_1.setText("Remove");
        {
            final ListViewer listViewer = new ListViewer(includeComposite, SWT.BORDER);
            final org.eclipse.swt.widgets.List includes_list = listViewer.getList();
            {
                final FormData formData = new FormData();
                formData.right = new FormAttachment(btnAddFolder, -6);
                formData.left = new FormAttachment(0, 10);
                formData.bottom = new FormAttachment(100, -10);
                formData.top = new FormAttachment(lblFoldersWithInclude, 6);
                includes_list.setLayoutData(formData);
            }
        }

        final TabItem projectsTab = new TabItem(tabFolder, SWT.NONE);
        projectsTab.setText("Projects");

        final Composite dependenciesComposite = new Composite(tabFolder, SWT.NONE);
        dependenciesComposite.setLayout(new FormLayout());
        projectsTab.setControl(dependenciesComposite);

        final Label lblProjectsOnThe = new Label(dependenciesComposite, SWT.NONE);
        {
            final FormData formData = new FormData();
            formData.right = new FormAttachment(100, -10);
            formData.top = new FormAttachment(0, 10);
            formData.left = new FormAttachment(0, 10);
            lblProjectsOnThe.setLayoutData(formData);
        }
        lblProjectsOnThe.setText("Required projects on the build path:");

        final Button button = new Button(dependenciesComposite, SWT.NONE);
        {
            final FormData formData = new FormData();
            formData.top = new FormAttachment(lblProjectsOnThe, 6);
            formData.right = new FormAttachment(lblProjectsOnThe, 0, SWT.RIGHT);
            button.setLayoutData(formData);
        }
        button.setText("New Button");

        final Button button_1 = new Button(dependenciesComposite, SWT.NONE);
        FormData formData_8;
        {
            formData_8 = new FormData();
            formData_8.right = new FormAttachment(lblProjectsOnThe, 0, SWT.RIGHT);
            button_1.setLayoutData(formData_8);
        }
        button_1.setText("New Button");

        final Button button_2 = new Button(dependenciesComposite, SWT.NONE);
        formData_8.bottom = new FormAttachment(button_2, -6);
        {
            final FormData formData = new FormData();
            formData.top = new FormAttachment(0, 110);
            formData.right = new FormAttachment(lblProjectsOnThe, 0, SWT.RIGHT);
            button_2.setLayoutData(formData);
        }
        button_2.setText("New Button");
        {
            final ListViewer listViewer = new ListViewer(dependenciesComposite,
                    SWT.BORDER);
            final org.eclipse.swt.widgets.List projects_list = listViewer.getList();
            {
                final FormData formData = new FormData();
                formData.right = new FormAttachment(button, -6);
                formData.left = new FormAttachment(0, 10);
                formData.bottom = new FormAttachment(100, -6);
                formData.top = new FormAttachment(lblProjectsOnThe, 6);
                projects_list.setLayoutData(formData);
            }
        }

        final Collection<RuntimeInfo> rs = BackendCore.getRuntimeInfoCatalog()
                .getRuntimes();
        final List<String[]> vv = new ArrayList<String[]>();
        for (final RuntimeInfo ri : rs) {
            vv.add(new String[] { ri.getName(), ri.getName() });
        }
        @SuppressWarnings("unused")
        final String[][] values = vv.toArray(new String[][] {});

        final TabItem librariesTab = new TabItem(tabFolder, SWT.NONE);
        librariesTab.setText("Libraries");

        final Composite librariesComposite = new Composite(tabFolder, SWT.NONE);
        librariesComposite.setLayout(new FormLayout());
        librariesTab.setControl(librariesComposite);

        final Label lblExternalLibrariesRequired = new Label(librariesComposite, SWT.NONE);
        {
            final FormData formData = new FormData();
            formData.right = new FormAttachment(100, -10);
            formData.top = new FormAttachment(0, 10);
            formData.left = new FormAttachment(0, 10);
            lblExternalLibrariesRequired.setLayoutData(formData);
        }
        lblExternalLibrariesRequired
                .setText("External libraries required on build path:");

        final Button button_3 = new Button(librariesComposite, SWT.NONE);
        {
            final FormData formData = new FormData();
            formData.top = new FormAttachment(lblExternalLibrariesRequired, 6);
            formData.right = new FormAttachment(100, -10);
            button_3.setLayoutData(formData);
        }
        button_3.setText("New Button");

        final Button button_4 = new Button(librariesComposite, SWT.NONE);
        {
            final FormData formData = new FormData();
            formData.top = new FormAttachment(button_3, 6);
            formData.right = new FormAttachment(lblExternalLibrariesRequired, 0,
                    SWT.RIGHT);
            button_4.setLayoutData(formData);
        }
        button_4.setText("New Button");

        final Button button_5 = new Button(librariesComposite, SWT.NONE);
        FormData formData_9;
        {
            formData_9 = new FormData();
            formData_9.right = new FormAttachment(lblExternalLibrariesRequired, 0,
                    SWT.RIGHT);
            button_5.setLayoutData(formData_9);
        }
        button_5.setText("New Button");

        final Button button_6 = new Button(librariesComposite, SWT.NONE);
        formData_9.bottom = new FormAttachment(100, -226);
        {
            final FormData formData = new FormData();
            formData.top = new FormAttachment(button_5, 6);
            formData.right = new FormAttachment(lblExternalLibrariesRequired, 0,
                    SWT.RIGHT);
            button_6.setLayoutData(formData);
        }
        button_6.setText("New Button");
        {
            final TreeViewer treeViewer = new TreeViewer(librariesComposite, SWT.BORDER);
            final Tree libraries_tree = treeViewer.getTree();
            {
                final FormData formData = new FormData();
                formData.right = new FormAttachment(button_3, -6);
                formData.left = new FormAttachment(0, 10);
                formData.top = new FormAttachment(lblExternalLibrariesRequired, 4);
                formData.bottom = new FormAttachment(100, -10);
                libraries_tree.setLayoutData(formData);
            }
        }

        final TabItem orderTab = new TabItem(tabFolder, SWT.NONE);
        orderTab.setText("Codepath order");
View Full Code Here

        label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
        label.setText("");

        treeViewer = new TreeViewer(control, SWT.NONE);
        treeViewer.setSorter(new TestResultSorter());
        final Tree tree = treeViewer.getTree();
        tree.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseDoubleClick(final MouseEvent e) {
                final Object data = tree.getSelection()[0].getData();
                if (data instanceof TestCaseData) {
                    final TestCaseData testData = (TestCaseData) data;
                    openMF(testData.getModule(), testData.getFunction());
                } else if (data instanceof FailStackItem) {
                    final FailStackItem item = (FailStackItem) data;
                    openMF(item.getModule(), item.getFunction());
                } else if (data instanceof FailReason) {
                    final FailReason reason = (FailReason) data;
                    final FailStackItem item = reason.getFirstStackItem();
                    if (item != null) {
                        openMF(item.getModule(), item.getFunction());
                    }
                }
            }
        });
        tree.setLinesVisible(true);
        tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        treeViewer.setLabelProvider(new TestResultsLabelProvider());
        treeViewer.setContentProvider(new TestResultsContentProvider());
        treeViewer.setInput(events);

        initToolbar();
View Full Code Here

        editorComposite.setLayout(layout);
        GridData gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
        editorComposite.setLayoutData(gd);

        fListViewer = new TreeViewer(editorComposite, SWT.SINGLE | SWT.BORDER);
        final Tree tree = fListViewer.getTree();
        final GridData gdTree = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
        gdTree.widthHint = 100;
        tree.setLayoutData(gdTree);
        fListViewer.setLabelProvider(new ColorListLabelProvider());
        fListViewer.setContentProvider(new ColorListContentProvider());
        fListViewer.setInput(fColors);
        fListViewer.setSelection(new StructuredSelection(fErlangCategory));
        fListViewer.setSorter(new ViewerSorter() {
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Tree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.