Examples of TreeSelection


Examples of org.eclipse.jface.viewers.TreeSelection

  @Override
  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    if (part instanceof AnnotationCheckView) {
      if (selection instanceof TreeSelection) {
        TreeSelection ts = (TreeSelection) selection;
        if (ts.getFirstElement() instanceof FeatureCheckTreeNode) {
          return;
        }
        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 setTypesToCheck(Map<String, Set<String>> typesToCheck) {
    this.typesToCheck = typesToCheck;
  }

  public void reject(boolean doMove) {
    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

    }
    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

    }
    treeView.refresh();
  }

  public void moveToNext() {
    TreeSelection selection = (TreeSelection) treeView.getSelection();
    IAnnotationCheckTreeNode parent = null;
    AnnotationCheckTreeNode firstElement = null;
    if (selection.getFirstElement() instanceof FeatureCheckTreeNode) {
      return;
    }
    firstElement = (AnnotationCheckTreeNode) selection.getFirstElement();
    parent = firstElement.getParent();
    IAnnotationCheckTreeNode[] children = parent.getChildren();
    List<IAnnotationCheckTreeNode> 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;
      IAnnotationCheckTreeNode[] children2 = parent.getParent().getChildren();
      List<IAnnotationCheckTreeNode> 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);
    treeView.expandToLevel(((AnnotationCheckTreeNode) newSelection.getFirstElement()).getParent(),
            TreeViewer.ALL_LEVELS);

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

Examples of org.eclipse.jface.viewers.TreeSelection

  }

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

      if (firstElement instanceof RuleMatchNode) {
        RuleMatchNode match = (RuleMatchNode) firstElement;
        if (match.hasChildren()) {
          inputChange(match.getChildren().get(0));
View Full Code Here

Examples of org.eclipse.jface.viewers.TreeSelection

  }

  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

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

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;
      Object firstElement = s.getFirstElement();
      if (firstElement instanceof RuleApplyNode) {
        RuleApplyNode node = (RuleApplyNode) firstElement;
        FeatureStructure fs = node.getFeatureStructure();
        if (fs.getType().getName().equals(ExplainConstants.RULE_APPLY_TYPE)) {
          Type t = fs.getType();
View Full Code Here

Examples of org.eclipse.jface.viewers.TreeSelection

  }

  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

Examples of org.eclipse.jface.viewers.TreeSelection

    if (this.selection != null && this.selection instanceof TextSelection){
      TextSelection ts = (TextSelection)this.selection;
      this.setTypeName(ts.getText());
     
    } else if (this.selection != null && this.selection instanceof TreeSelection){
      TreeSelection ts = (TreeSelection)this.selection;
      Object element = ts.getFirstElement();
      if (element instanceof ToolAttribute){
        this.setTypeName(((ToolAttribute)element).getType());
      } else if (element instanceof ToolVirtualAttribute){
        this.setTypeName(((ToolAttribute)element).getType());
      } else {
        this.setTypeName(ts.getFirstElement().toString());
      }
    }
  }
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.