Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Tree


  }

  @Test
  public void testDisableBackButtonNavigationShouldSetNullVariantOnOtherTreesWithBackFocusVariant() {
    Shell shell = new Shell( display );
    Tree tree1 = new Tree( shell, SWT.NONE );
    Tree tree2 = new Tree( shell, SWT.NONE );
    Tree tree3 = new Tree( shell, SWT.NONE );
    tree2.setData( BACK_FOCUS.getKey(), Boolean.TRUE );
    tree3.setData( BACK_FOCUS.getKey(), "anyVariant" );

    Widgets.onTree( tree1 ).setBackButtonNavigationEnabled( false );

    assertEquals( Boolean.FALSE, tree1.getData( BACK_FOCUS.getKey() ) );
    assertNotNull( tree2.getData( BACK_FOCUS.getKey() ) );
    assertEquals( "anyVariant", tree3.getData( BACK_FOCUS.getKey() ) );
  }
View Full Code Here


    Widgets.onTree( null );
  }

  @Test
  public void testOnTreeDoesNotCache() {
    Tree widget = mock( Tree.class );

    WidgetDecorator<TreeDecorator> decorator1 = Widgets.onTree( widget );
    WidgetDecorator<TreeDecorator> decorator2 = Widgets.onTree( widget );

    assertNotSame( decorator1, decorator2 );
View Full Code Here

  @Before
  public void setUp() {
    Display display = new Display();
    Shell shell = new Shell( display );
    table = new Table( shell, SWT.NONE );
    tree = new Tree(shell, SWT.NONE);
    parameters = new JsonObject();
    itemHeightService = new TableItemHeightService();
  }
View Full Code Here

    Label orgLabel = new Label(orgTableComposite, SWT.NONE);
    GridDataFactory.fillDefaults().grab(false, false).applyTo(orgLabel);
    orgLabel.setText(Messages.CloudSpacesSelectionPart_TEXT_ORG_AND_SPACE_WITH_COLUMN);

    Tree orgTable = new Tree(orgTableComposite, SWT.BORDER | SWT.SINGLE);

    GridDataFactory.fillDefaults().grab(true, true).applyTo(orgTable);

    orgsSpacesViewer = new TreeViewer(orgTable);
View Full Code Here

    }
  }

  protected void setSelectionInViewer(CloudSpace selectedSpace) {
    // Now set the cloud space in the tree
    Tree tree = orgsSpacesViewer.getTree();
    TreeItem[] orgItems = tree.getItems();
    if (orgItems != null) {
      TreeItem orgItem = null;

      // Find the tree item corresponding to the cloud space's
      // org
      for (TreeItem item : orgItems) {
        Object treeObj = item.getData();
        if (treeObj instanceof CloudOrganization
            && ((CloudOrganization) treeObj).getName().equals(selectedSpace.getOrganization().getName())) {
          orgItem = item;
          break;

        }
      }

      if (orgItem != null) {
        TreeItem[] children = orgItem.getItems();
        if (children != null) {
          for (TreeItem childItem : children) {
            Object treeObj = childItem.getData();
            if (treeObj instanceof CloudSpace
                && ((CloudSpace) treeObj).getName().equals(selectedSpace.getName())) {
              tree.select(childItem);
              break;
            }
          }
        }
      }
View Full Code Here

  }

  protected void refresh() {
    if (orgsSpacesViewer != null) {

      Tree tree = orgsSpacesViewer.getTree();
      TreeItem[] selectedItems = tree.getSelection();
      if (selectedItems != null && selectedItems.length > 0) {
        // It's a single selection tree, so only get the first selection
        Object selectedObj = selectedItems[0].getData();
        CloudSpace selectedSpace = selectedObj instanceof CloudSpace ? (CloudSpace) selectedObj : null;
        setSpaceSelection(selectedSpace);
View Full Code Here

    {
        // components
        Composite control = new Composite(parent, SWT.NONE);
        Table table = new Table(control, SWT.SINGLE);
        table.setHeaderVisible(true);
        Tree tree = new Tree(control, SWT.NONE);

        // layout
        control.setLayout(new GridLayout(1, false));
        table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

        // viewers
        createPropertiesViewer(table);
        createContentsViewer(tree);
    }
View Full Code Here

    Composite wPanel = new Composite(wLeftFolder, SWT.NONE);
    wPanel.setLayout(new FormLayout());
    props.setLook(wPanel);

    wTree = new Tree(wPanel, SWT.H_SCROLL | SWT.V_SCROLL);
    wTree.setHeaderVisible(true);
    TreeColumn column1 = new TreeColumn(wTree, SWT.LEFT);
    column1.setText(BaseMessages.getString(PKG, "RubyStepDialog.TreeColumn.Field"));
    column1.setWidth(180);
    TreeColumn column2 = new TreeColumn(wTree, SWT.LEFT);
View Full Code Here

    Composite wPanel = new Composite(wLeftFolder, SWT.NONE);
    wPanel.setLayout(new FillLayout());
    props.setLook(wPanel);

    wSamplesTree = new Tree(wPanel, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
    wSamplesTree.setLayout(new FillLayout());
    wSamplesTree.setHeaderVisible(true);
    props.setLook(wSamplesTree);

    TreeColumn column1 = new TreeColumn(wSamplesTree, SWT.LEFT);
View Full Code Here

    @Override
    protected Control createDialogArea(Composite parent)
    {
        Composite composite = (Composite) super.createDialogArea(parent);
        new Label(composite, SWT.NONE).setText("Select bundle form file from workspace:");
        Tree tree = new Tree(composite, SWT.SINGLE);

        TreeViewer viewer = new TreeViewer(tree);
        viewer.setContentProvider(new BaseWorkbenchContentProvider());
        viewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
        viewer.addSelectionChangedListener(new ISelectionChangedListener()
        {
            public void selectionChanged(SelectionChangedEvent evt)
            {
                if (evt.getSelection().isEmpty())
                {
                    updateFile(null);
                }
                else
                {
                    StructuredSelection sel = (StructuredSelection) evt.getSelection();
                    IResource r = (IResource) sel.getFirstElement();
                    if (r instanceof IFile)
                    {
                        IFile f = (IFile) r;
                        updateFile(f);
                    }
                    else
                    {
                        updateFile(null);
                    }
                }
            }
        });
        viewer.setLabelProvider(new WorkbenchLabelProvider());

        tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

        return composite;
    }
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.