Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.TreeViewer


   *            the parent <code>Composite</code>.
   * @return the <code>TreeViewer</code>.
   * @since 3.0
   */
  protected TreeViewer createTreeViewer(Composite parent) {
    final TreeViewer viewer = new TreeViewer(parent, SWT.NONE);
    addListeners(viewer);
    viewer.setLabelProvider(new PreferenceLabelProvider());
    viewer.setContentProvider(new PreferenceContentProvider());
    return viewer;
  }
View Full Code Here


        final Composite container = new Composite(parent, SWT.NONE);
        container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        container.setLayout(new GridLayout());

        // treeViewer = new TreeViewer(container, SWT.VIRTUAL);
        treeViewer = new TreeViewer(container, SWT.SINGLE);
        treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

        // providers
        treeViewer.setContentProvider(new TreeContentProvider(treeViewer, true));
        treeViewer.setLabelProvider(new TreeLabelProvider());
View Full Code Here

    try {
      if (viewer != null) {
        viewer.getControl().dispose();
      }
      this.config = configuration;
      viewer = new TreeViewer(owner);
      listener = new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
          if (event.getProperty().equals(
              IPreferenceConstants.SHOW_PATH)) {
View Full Code Here

    super(viewer, column, columnComparator, defaultDesc);
    column.addSelectionListener(this);
  }

  public void stateChanged() {
    TreeViewer viewer = (TreeViewer)getViewer();
    Tree tree = viewer.getTree();
   
    tree.setSortColumn((TreeColumn)getColumn());
    tree.setSortDirection(getSortDirection());
    update();
  }
View Full Code Here

  {
    /*GridLayout myLayout = new GridLayout();
    myLayout.numColumns = 1;
    parent.setLayout(myLayout);*/
   
    viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    viewer.setContentProvider(provider);
    viewer.setLabelProvider(new ViewLabelProvider());
    viewer.setInput(getViewSite());
   
    viewer.addDoubleClickListener(mydbllistener);
View Full Code Here

        ViewerPane viewerPane =
          new ViewerPane(getSite().getPage(), URMLEditor.this) {
            @Override
            public Viewer createViewer(Composite composite) {
              Tree tree = new Tree(composite, SWT.MULTI);
              TreeViewer newTreeViewer = new TreeViewer(tree);
              return newTreeViewer;
            }
            @Override
            public void requestActivation() {
              super.requestActivation();
              setCurrentViewerPane(this);
            }
          };
        viewerPane.createControl(getContainer());

        selectionViewer = (TreeViewer)viewerPane.getViewer();
        selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));

        selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
        selectionViewer.setInput(editingDomain.getResourceSet());
        selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
        viewerPane.setTitle(editingDomain.getResourceSet());

        new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);

        createContextMenuFor(selectionViewer);
        int pageIndex = addPage(viewerPane.getControl());
        setPageText(pageIndex, getString("_UI_SelectionPage_label"));
      }

      // Create a page for the parent tree view.
      //
      {
        ViewerPane viewerPane =
          new ViewerPane(getSite().getPage(), URMLEditor.this) {
            @Override
            public Viewer createViewer(Composite composite) {
              Tree tree = new Tree(composite, SWT.MULTI);
              TreeViewer newTreeViewer = new TreeViewer(tree);
              return newTreeViewer;
            }
            @Override
            public void requestActivation() {
              super.requestActivation();
              setCurrentViewerPane(this);
            }
          };
        viewerPane.createControl(getContainer());

        parentViewer = (TreeViewer)viewerPane.getViewer();
        parentViewer.setAutoExpandLevel(30);
        parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory));
        parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));

        createContextMenuFor(parentViewer);
        int pageIndex = addPage(viewerPane.getControl());
        setPageText(pageIndex, getString("_UI_ParentPage_label"));
      }

      // This is the page for the list viewer
      //
      {
        ViewerPane viewerPane =
          new ViewerPane(getSite().getPage(), URMLEditor.this) {
            @Override
            public Viewer createViewer(Composite composite) {
              return new ListViewer(composite);
            }
            @Override
            public void requestActivation() {
              super.requestActivation();
              setCurrentViewerPane(this);
            }
          };
        viewerPane.createControl(getContainer());
        listViewer = (ListViewer)viewerPane.getViewer();
        listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
        listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));

        createContextMenuFor(listViewer);
        int pageIndex = addPage(viewerPane.getControl());
        setPageText(pageIndex, getString("_UI_ListPage_label"));
      }

      // This is the page for the tree viewer
      //
      {
        ViewerPane viewerPane =
          new ViewerPane(getSite().getPage(), URMLEditor.this) {
            @Override
            public Viewer createViewer(Composite composite) {
              return new TreeViewer(composite);
            }
            @Override
            public void requestActivation() {
              super.requestActivation();
              setCurrentViewerPane(this);
            }
          };
        viewerPane.createControl(getContainer());
        treeViewer = (TreeViewer)viewerPane.getViewer();
        treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
        treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));

        new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory);

        createContextMenuFor(treeViewer);
        int pageIndex = addPage(viewerPane.getControl());
        setPageText(pageIndex, getString("_UI_TreePage_label"));
      }

      // This is the page for the table viewer.
      //
      {
        ViewerPane viewerPane =
          new ViewerPane(getSite().getPage(), URMLEditor.this) {
            @Override
            public Viewer createViewer(Composite composite) {
              return new TableViewer(composite);
            }
            @Override
            public void requestActivation() {
              super.requestActivation();
              setCurrentViewerPane(this);
            }
          };
        viewerPane.createControl(getContainer());
        tableViewer = (TableViewer)viewerPane.getViewer();

        Table table = tableViewer.getTable();
        TableLayout layout = new TableLayout();
        table.setLayout(layout);
        table.setHeaderVisible(true);
        table.setLinesVisible(true);

        TableColumn objectColumn = new TableColumn(table, SWT.NONE);
        layout.addColumnData(new ColumnWeightData(3, 100, true));
        objectColumn.setText(getString("_UI_ObjectColumn_label"));
        objectColumn.setResizable(true);

        TableColumn selfColumn = new TableColumn(table, SWT.NONE);
        layout.addColumnData(new ColumnWeightData(2, 100, true));
        selfColumn.setText(getString("_UI_SelfColumn_label"));
        selfColumn.setResizable(true);

        tableViewer.setColumnProperties(new String [] {"a", "b"});
        tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
        tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));

        createContextMenuFor(tableViewer);
        int pageIndex = addPage(viewerPane.getControl());
        setPageText(pageIndex, getString("_UI_TablePage_label"));
      }

      // This is the page for the table tree viewer.
      //
      {
        ViewerPane viewerPane =
          new ViewerPane(getSite().getPage(), URMLEditor.this) {
            @Override
            public Viewer createViewer(Composite composite) {
              return new TreeViewer(composite);
            }
            @Override
            public void requestActivation() {
              super.requestActivation();
              setCurrentViewerPane(this);
View Full Code Here

        ViewerPane viewerPane =
          new ViewerPane(getSite().getPage(), OntoUMLEditor.this) {
            @Override
            public Viewer createViewer(Composite composite) {
              Tree tree = new Tree(composite, SWT.MULTI);
              TreeViewer newTreeViewer = new TreeViewer(tree);
              return newTreeViewer;
            }
            @Override
            public void requestActivation() {
              super.requestActivation();
              setCurrentViewerPane(this);
            }
          };
        viewerPane.createControl(getContainer());

        selectionViewer = (TreeViewer)viewerPane.getViewer();
        selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));

        selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
        selectionViewer.setInput(editingDomain.getResourceSet());
        selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
        viewerPane.setTitle(editingDomain.getResourceSet());

        new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);

        createContextMenuFor(selectionViewer);
        int pageIndex = addPage(viewerPane.getControl());
        setPageText(pageIndex, getString("_UI_SelectionPage_label"));
      }

      // Create a page for the parent tree view.
      //
      {
        ViewerPane viewerPane =
          new ViewerPane(getSite().getPage(), OntoUMLEditor.this) {
            @Override
            public Viewer createViewer(Composite composite) {
              Tree tree = new Tree(composite, SWT.MULTI);
              TreeViewer newTreeViewer = new TreeViewer(tree);
              return newTreeViewer;
            }
            @Override
            public void requestActivation() {
              super.requestActivation();
              setCurrentViewerPane(this);
            }
          };
        viewerPane.createControl(getContainer());

        parentViewer = (TreeViewer)viewerPane.getViewer();
        parentViewer.setAutoExpandLevel(30);
        parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory));
        parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));

        createContextMenuFor(parentViewer);
        int pageIndex = addPage(viewerPane.getControl());
        setPageText(pageIndex, getString("_UI_ParentPage_label"));
      }

      // This is the page for the list viewer
      //
      {
        ViewerPane viewerPane =
          new ViewerPane(getSite().getPage(), OntoUMLEditor.this) {
            @Override
            public Viewer createViewer(Composite composite) {
              return new ListViewer(composite);
            }
            @Override
            public void requestActivation() {
              super.requestActivation();
              setCurrentViewerPane(this);
            }
          };
        viewerPane.createControl(getContainer());
        listViewer = (ListViewer)viewerPane.getViewer();
        listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
        listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));

        createContextMenuFor(listViewer);
        int pageIndex = addPage(viewerPane.getControl());
        setPageText(pageIndex, getString("_UI_ListPage_label"));
      }

      // This is the page for the tree viewer
      //
      {
        ViewerPane viewerPane =
          new ViewerPane(getSite().getPage(), OntoUMLEditor.this) {
            @Override
            public Viewer createViewer(Composite composite) {
              return new TreeViewer(composite);
            }
            @Override
            public void requestActivation() {
              super.requestActivation();
              setCurrentViewerPane(this);
            }
          };
        viewerPane.createControl(getContainer());
        treeViewer = (TreeViewer)viewerPane.getViewer();
        treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
        treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));

        new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory);

        createContextMenuFor(treeViewer);
        int pageIndex = addPage(viewerPane.getControl());
        setPageText(pageIndex, getString("_UI_TreePage_label"));
      }

      // This is the page for the table viewer.
      //
      {
        ViewerPane viewerPane =
          new ViewerPane(getSite().getPage(), OntoUMLEditor.this) {
            @Override
            public Viewer createViewer(Composite composite) {
              return new TableViewer(composite);
            }
            @Override
            public void requestActivation() {
              super.requestActivation();
              setCurrentViewerPane(this);
            }
          };
        viewerPane.createControl(getContainer());
        tableViewer = (TableViewer)viewerPane.getViewer();

        Table table = tableViewer.getTable();
        TableLayout layout = new TableLayout();
        table.setLayout(layout);
        table.setHeaderVisible(true);
        table.setLinesVisible(true);

        TableColumn objectColumn = new TableColumn(table, SWT.NONE);
        layout.addColumnData(new ColumnWeightData(3, 100, true));
        objectColumn.setText(getString("_UI_ObjectColumn_label"));
        objectColumn.setResizable(true);

        TableColumn selfColumn = new TableColumn(table, SWT.NONE);
        layout.addColumnData(new ColumnWeightData(2, 100, true));
        selfColumn.setText(getString("_UI_SelfColumn_label"));
        selfColumn.setResizable(true);

        tableViewer.setColumnProperties(new String [] {"a", "b"});
        tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
        tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));

        createContextMenuFor(tableViewer);
        int pageIndex = addPage(viewerPane.getControl());
        setPageText(pageIndex, getString("_UI_TablePage_label"));
      }

      // This is the page for the table tree viewer.
      //
      {
        ViewerPane viewerPane =
          new ViewerPane(getSite().getPage(), OntoUMLEditor.this) {
            @Override
            public Viewer createViewer(Composite composite) {
              return new TreeViewer(composite);
            }
            @Override
            public void requestActivation() {
              super.requestActivation();
              setCurrentViewerPane(this);
View Full Code Here

    Label label = new Label(plate, SWT.NONE);
    label.setText(getSelectionTitle());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));

    modelViewer = new TreeViewer(plate, SWT.SINGLE | SWT.H_SCROLL
        | SWT.V_SCROLL | SWT.BORDER);
    GridData layoutData = new GridData(GridData.FILL_BOTH);
    layoutData.heightHint = 300;
    layoutData.widthHint = 300;
    modelViewer.getTree().setLayoutData(layoutData);
View Full Code Here

    given(contentProvider.getChildren(path))
        .willReturn(new Object[0]);
    given(contentProvider.getParents(path.getLastSegment()))
        .willReturn(new TreePath[]{path.getParentPath()});

    TreeViewer v = mock(TreeViewer.class);
    given(v.getContentProvider()).willReturn(contentProvider);

    filter.setPattern("not a match");
    assertThat(filter.isElementVisible(v, path.getLastSegment()), is(FALSE));
  }
View Full Code Here

    given(contentProvider.getChildren(path.getParentPath()))
        .willReturn(new Object[]{path.getLastSegment()});
    given(contentProvider.getParents(path.getLastSegment()))
        .willReturn(new TreePath[]{path.getParentPath()});

    TreeViewer v = mock(TreeViewer.class);
    given(v.getContentProvider()).willReturn(contentProvider);

    filter.setPattern("child");
    assertThat(filter.isElementVisible(v, path.getLastSegment()), is(TRUE));
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.viewers.TreeViewer

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.