Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.TreeSelection


  }

  public void doubleClick(DoubleClickEvent event) {
    ISelection selection = event.getSelection();
    if (!selection.isEmpty() && selection instanceof TreeSelection) {
      TreeSelection s = (TreeSelection) selection;
      FeatureStructure fs = (FeatureStructure) s.getFirstElement();
      Type t = fs.getType();
      Feature featureId = t.getFeatureByBaseName(CreatedByVisitor.FEATURE_ID);
      Feature featureScript = t.getFeatureByBaseName(CreatedByVisitor.FEATURE_SCRIPT);
      int id = fs.getIntValue(featureId);
      String script = fs.getStringValue(featureScript);
View Full Code Here


  }

  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    if (selection instanceof TreeSelection
            && (part instanceof ApplyView || part instanceof RuleListView || part instanceof ExplainSelectionView)) {
      TreeSelection ts = (TreeSelection) selection;
      Object firstElement = ts.getFirstElement();

      if (firstElement instanceof BlockApplyNode) {
        BlockApplyNode block = (BlockApplyNode) firstElement;
        inputChange(block.getBlockRuleNode().getFailedNode());
      } else if (firstElement instanceof RuleApplyNode) {
View Full Code Here

  }

  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    if (selection instanceof TreeSelection
            && (part instanceof ApplyView || part instanceof RuleListView || part instanceof ExplainSelectionView)) {
      TreeSelection ts = (TreeSelection) selection;
      Object firstElement = ts.getFirstElement();

      if (firstElement instanceof BlockApplyNode) {
        BlockApplyNode block = (BlockApplyNode) firstElement;
        inputChange(block.getBlockRuleNode().getMatchedChild());
      } else if (firstElement instanceof RuleApplyNode) {
View Full Code Here

        navTreeViewer.setInput(examplePaths);
        navTreeViewer.addDoubleClickListener(new IDoubleClickListener() {

            @Override
            public void doubleClick(DoubleClickEvent event) {
                TreeSelection selection = (TreeSelection) event.getSelection();
                for (TreePath path : selection.getPaths()) {
                    // check for item - if node expand/collapse, if child open
                    if (contentProvider.hasChildren(path.getLastSegment()
                            .toString())) {
                        boolean expanded = navTreeViewer.getExpandedState(path);
                        navTreeViewer.setExpandedState(path, !expanded);
View Full Code Here

  }
 
  protected boolean isSupported(Object data) {
    if (data != null) {
      if (data instanceof TreeSelection) {
        TreeSelection sel = (TreeSelection)data;
        Object selItem = sel.getFirstElement();
        return isSupported(selItem);
      } else if (data instanceof IFile) {
        return true;       
      } else {
        System.err.println("[CamelMessageDropAssistant] Unsupported transfer type: " + data.getClass().getName());
View Full Code Here

    }
    ISelection sel = getSelection(ap);
    if (sel == null) {
      refreshViewer(null);
    } else if (sel instanceof TreeSelection) {
      TreeSelection treeSelection = (TreeSelection) sel;
      refreshObjectNode(treeSelection.getFirstElement());
    } else if (sel instanceof StructuredSelection) {
      StructuredSelection ss = (StructuredSelection) sel;
      refreshObjectNode(ss.getFirstElement());
    }
  }
View Full Code Here

   * @param selection
   * @return full path
   */
  public String getSelectedFolderPath(ISelection selection) {
   
    TreeSelection d;
   
   
    if (selection instanceof IStructuredSelection) {
      Object sel = ((IStructuredSelection) selection).getFirstElement();
//
View Full Code Here

                    }
                    paths.add(new TreePath(getCompletPath(resource).toArray()));
                }
            }

            treeViewer.setSelection(new TreeSelection(paths.toArray(new TreePath[0])), true);
        } catch (Exception e) {
            Log.log(e);
        }
    }
View Full Code Here

            TreePath treePath = null;
            if (sel != null && sel.size() > 0) {
                treePath = new TreePath(sel.toArray());
            }
            if (treePath != null) {
                return new TreeSelection(treePath);
            }
        } catch (Exception e) {
            Log.log(e);
        }
        return null;
View Full Code Here

  protected CommonViewer createCommonViewer(Composite aParent) {
    CommonViewer viewer = super.createCommonViewer(aParent);
    // handle the double-click event for tags and branches
    viewer.addDoubleClickListener(new IDoubleClickListener() {
      public void doubleClick(DoubleClickEvent event) {
        TreeSelection sel = (TreeSelection) event.getSelection();
        RepositoryTreeNode element = (RepositoryTreeNode) sel
            .getFirstElement();
        // Disable checkout for bare repositories
        if (element.getRepository().isBare())
          return;
        if (element instanceof RefNode)
          executeOpenCommandWithConfirmation(((RefNode) element)
              .getObject().getName());
        if (element instanceof TagNode)
          executeOpenCommandWithConfirmation(((TagNode) element)
              .getObject().getName());
      }
    });
    // handle open event for the working directory
    viewer.addOpenListener(new IOpenListener() {
      public void open(OpenEvent event) {
        TreeSelection sel = (TreeSelection) event.getSelection();
        RepositoryTreeNode element = (RepositoryTreeNode) sel
            .getFirstElement();
        if (element instanceof FileNode
            || element instanceof StashedCommitNode)
          executeOpenCommand();
      }
View Full Code Here

TOP

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

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.