Examples of TreeSelection


Examples of org.eclipse.jface.viewers.TreeSelection

    @Override
    public IStatus validateDrop(final Object target, final int operation,
            final TransferData transferType) {
        final ISelection sel = (ISelection) LocalSelectionTransfer.getTransfer()
                .nativeToJava(transferType);
        final TreeSelection s = (TreeSelection) sel;
        final IErlElement e = (IErlElement) s.getFirstElement();

        if (e instanceof IErlFunctionClause) {
            if (target instanceof IErlElement || target instanceof IFile) {
                return Status.OK_STATUS;
            }
View Full Code Here

Examples of org.eclipse.jface.viewers.TreeSelection

        // get the source data
        final TransferData td = dropAdapter.getCurrentTransfer();
        final ISelection sel = (ISelection) LocalSelectionTransfer.getTransfer()
                .nativeToJava(td);
        final TreeSelection s = (TreeSelection) sel;
        try {
            GlobalParameters.setSelection(s);
        } catch (final WranglerException e1) {
            e1.printStackTrace();
        }
View Full Code Here

Examples of org.eclipse.jface.viewers.TreeSelection

    testResultsTree.addSelectionChangedListener(new ISelectionChangedListener() {

      @Override
      public void selectionChanged(SelectionChangedEvent event) {
        testDetailsText.setText("");
        TreeSelection selection = (TreeSelection) event.getSelection();
        currentSelection = selection.getFirstElement();
        if (currentSelection instanceof EclipseJstdTestResult) {
          EclipseJstdTestResult result = (EclipseJstdTestResult) currentSelection;
          StringBuilder details = new StringBuilder();
          result.writeDetails(details);
          testDetailsText.setText(details.toString());
View Full Code Here

Examples of org.eclipse.jface.viewers.TreeSelection

  }

  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    if (part instanceof AnnotationCheckView) {
      if (selection instanceof TreeSelection) {
        TreeSelection ts = (TreeSelection) selection;
        if (ts.getFirstElement() instanceof AnnotationCheckTreeNode) {
          AnnotationCheckTreeNode firstElement = (AnnotationCheckTreeNode) ts.getFirstElement();
          CheckElement element = firstElement.getElement();
          int begin = 0;
          int end = 0;
          CheckDocument newDoc = null;
          if (element instanceof CheckAnnotation) {
View Full Code Here

Examples of org.eclipse.jface.viewers.TreeSelection

  public void setSelectedTypes(List<String> selection) {
    this.selectedTypes = selection;
  }

  public void reject() {
    TreeSelection selection = (TreeSelection) treeView.getSelection();
    AnnotationCheckTreeNode firstElement = (AnnotationCheckTreeNode) selection.getFirstElement();
    if (firstElement == null) {
      return;
    }
    firstElement.getElement().checked = true;
    firstElement.getElement().keep = false;
View Full Code Here

Examples of org.eclipse.jface.viewers.TreeSelection

    moveToNext();
    treeView.refresh();
  }

  public void accept() {
    TreeSelection selection = (TreeSelection) treeView.getSelection();
    AnnotationCheckTreeNode firstElement = (AnnotationCheckTreeNode) selection.getFirstElement();
    if (firstElement == null) {
      return;
    }
    firstElement.getElement().checked = true;
    firstElement.getElement().keep = true;
View Full Code Here

Examples of org.eclipse.jface.viewers.TreeSelection

    moveToNext();
    treeView.refresh();
  }

  public void moveToNext() {
    TreeSelection selection = (TreeSelection) treeView.getSelection();
    AnnotationCheckTreeNode firstElement = (AnnotationCheckTreeNode) selection.getFirstElement();
    if (firstElement == null) {
      return;
    }
    IAnnotationCheckTreeNode parent = firstElement.getParent();
    AnnotationCheckTreeNode[] children = parent.getChildren();
    List<AnnotationCheckTreeNode> list = Arrays.asList(children);
    int indexOf = list.indexOf(firstElement);
    IAnnotationCheckTreeNode brother = null;
    IAnnotationCheckTreeNode uncle = parent;
    if (list == null || list.isEmpty()) {

    } else if (indexOf == -1) {
      brother = list.get(0);
    } else if (firstElement.getElement() instanceof CheckDocument && indexOf < list.size() - 1) {
      uncle = list.get(indexOf + 1);
      if (uncle.getChildren().length > 0) {
        brother = uncle.getChildren()[0];
      }
    } else if (indexOf < list.size() - 1) {
      brother = list.get(indexOf + 1);
    } else if (firstElement.getElement() instanceof CheckAnnotation) {
      brother = null;
      AnnotationCheckTreeNode[] children2 = parent.getParent().getChildren();
      List<AnnotationCheckTreeNode> list2 = Arrays.asList(children2);
      int indexOf2 = list2.indexOf(parent);
      if (list2 == null || list2.isEmpty()) {

      } else if (indexOf2 == -1) {
        uncle = list2.get(0);
      } else if (indexOf2 < list2.size() - 1) {
        uncle = list2.get(indexOf2 + 1);
        if (uncle.getChildren().length != 0) {
          brother = uncle.getChildren()[0];
        }
      }
    }
    TreePath treePath = null;
    if (brother == null) {
      treePath = new TreePath(new Object[] { treeView.getInput(), uncle });
    } else {
      treePath = new TreePath(new Object[] { treeView.getInput(), uncle, brother });

    }
    final TreeSelection newSelection = new TreeSelection(treePath);
    treeView.setSelection(newSelection, true);

    if (firstElement.getElement() instanceof CheckAnnotation) {
      boolean allChecked = true;
      boolean oneKeep = false;
View Full Code Here

Examples of org.eclipse.jface.viewers.TreeSelection

    AnnotationCheckView acView;
    try {
      acView = (AnnotationCheckView) HandlerUtil.getActiveWorkbenchWindow(event).getWorkbench()
              .getActiveWorkbenchWindow().getActivePage().showView(AnnotationCheckView.ID);
      AnnotationCheckComposite composite = (AnnotationCheckComposite) acView.getComposite();
      TreeSelection selection = (TreeSelection) composite.getTreeViewer().getSelection();
      AnnotationCheckTreeNode previousSelection = (AnnotationCheckTreeNode) selection.getFirstElement();
      CheckAnnotationUpdateTaskJob job = new CheckAnnotationUpdateTaskJob(composite, previousSelection);
      job.schedule();
    } catch (Exception e) {
      RutaAddonsPlugin.error(e);
      return Status.CANCEL_STATUS;
View Full Code Here

Examples of org.eclipse.jface.viewers.TreeSelection

        TreePath oldPath = getPathTo(element, root);
        if(oldPath != null) {
          treePath = oldPath;
        }
      }
      final TreeSelection firstSelection = new TreeSelection(treePath);
     
      cas.release();
      composite.setOldDocs(docs);
      composite.getDisplay().asyncExec(new Runnable() {
        public void run() {
View Full Code Here

Examples of org.eclipse.jface.viewers.TreeSelection

   * .jface.viewers.DoubleClickEvent)
   */
  @Override
  public void doubleClick(DoubleClickEvent event) {
    TreeViewer source = (TreeViewer) event.getSource();
    TreeSelection selection = (TreeSelection) event.getSelection();
    BodyDeclaration selectedElement = (BodyDeclaration) selection
        .getFirstElement();

    Object[] expanded = source.getExpandedElements();
    boolean isExpanded = false;
    for (Object elO : expanded) {
      BodyDeclaration el = (BodyDeclaration) elO;
      if (el.getProperty(ResultProperty.URI.name())
          .toString()
          .equals((selectedElement.getProperty(ResultProperty.URI
              .name())).toString())) {
        isExpanded = true;
      }
    }
    if (isExpanded) {
      source.collapseToLevel(selection.getPaths()[0],
          TreeViewer.ALL_LEVELS);
    } else {
      source.expandToLevel(selection.getPaths()[0], TreeViewer.ALL_LEVELS);
    }
    logger.debug("Double clicked URI: "
        + selectedElement.getProperty(ResultProperty.URI.name()));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.