Package org.eclipse.jface.text.source.projection

Examples of org.eclipse.jface.text.source.projection.ProjectionAnnotationModel


     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
     */
    public void run(IAction action) {
        PySelection ps = new PySelection(getTextEditor());

        ProjectionAnnotationModel model = (ProjectionAnnotationModel) getTextEditor().getAdapter(
                ProjectionAnnotationModel.class);

        if (model != null) {
            model.expandAll(ps.getAbsoluteCursorOffset(), ps.getSelLength());
        }

    }
View Full Code Here


     * (non-Javadoc)
     *
     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
     */
    public void run(IAction action) {
        final ProjectionAnnotationModel model = getModel();

        if (model != null) {

            Iterator iter = getAnnotationsIterator(model, false);

            if (iter != null) {
                //we just want to collapse the leafs, and we are working only with the not collapsed sorted by offset.

                List elements = new ArrayList(); //used to know the context
                while (iter.hasNext()) {
                    PyProjectionAnnotation element = (PyProjectionAnnotation) iter.next();

                    //special case, we have none in our context
                    if (elements.size() == 0) {
                        elements.add(element);

                    } else {
                        if (isInsideLast(element, elements, model)) {
                            elements.add(element);

                        } else {
                            //ok, the one in the top has to be collapsed ( and this one added )
                            PyProjectionAnnotation top = (PyProjectionAnnotation) elements.remove(elements.size() - 1);
                            model.collapse(top);
                            elements.add(element);
                        }
                    }
                }
                if (elements.size() > 0) {
                    PyProjectionAnnotation top = (PyProjectionAnnotation) elements.remove(elements.size() - 1);
                    model.collapse(top);
                }
            }
        }
    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
     */
    public void run(IAction action) {
        final ProjectionAnnotationModel model = getModel();

        if (model != null) {

            Iterator iter = getAnnotationsIterator(model, true);

            if (iter != null) {
                //we just want to expand the roots, and we are working only with the collapsed sorted by offset.

                List elements = new ArrayList(); //used to know the context
                while (iter.hasNext()) {
                    PyProjectionAnnotation element = (PyProjectionAnnotation) iter.next();

                    //special case, we have none in our context
                    if (elements.size() == 0) {
                        model.expand(element);
                        elements.add(element);

                    } else {
                        if (isInsideLast(element, elements, model)) {
                            //ignore

                        } else {
                            //ok, the one in the top has to be collapsed ( and this one added )
                            model.expand(element);
                            elements.add(element);
                        }
                    }
                }
            }
View Full Code Here

    /**
     * @return
     */
    protected ProjectionAnnotationModel getModel() {
        final ProjectionAnnotationModel model = (ProjectionAnnotationModel) getTextEditor().getAdapter(
                ProjectionAnnotationModel.class);
        return model;
    }
View Full Code Here

  }

  private FoldingStructureComputationContext createContext(boolean allowCollapse) {
    if (!isInstalled())
      return null;
    ProjectionAnnotationModel model = getModel();
    if (model == null)
      return null;
    IDocument doc = getDocument();
    if (doc == null)
      return null;
View Full Code Here

    return null;
  }

  private Map computeCurrentStructure(FoldingStructureComputationContext ctx) {
    Map<IJavaElement, List<Tuple>> map = new HashMap<IJavaElement, List<Tuple>>();
    ProjectionAnnotationModel model = ctx.getModel();
    Iterator e = model.getAnnotationIterator();
    while (e.hasNext()) {
      Object annotation = e.next();
      if (annotation instanceof JavaProjectionAnnotation) {
        JavaProjectionAnnotation java = (JavaProjectionAnnotation) annotation;
        Position position = model.getPosition(java);
        Assert.isNotNull(position);
        List<Tuple> list = map.get(java.getElement());
        if (list == null) {
          list = new ArrayList<Tuple>(2);
          map.put(java.getElement(), list);
View Full Code Here

   */
  private void modifyFiltered(Filter filter, boolean expand) {
    if (!isInstalled())
      return;

    ProjectionAnnotationModel model = getModel();
    if (model == null)
      return;

    List<Annotation> modified = new ArrayList<Annotation>();
    Iterator iter = model.getAnnotationIterator();
    while (iter.hasNext()) {
      Object annotation = iter.next();
      if (annotation instanceof JavaProjectionAnnotation) {
        JavaProjectionAnnotation java = (JavaProjectionAnnotation) annotation;

        if (expand == java.isCollapsed() && filter.match(java)) {
          if (expand)
            java.markExpanded();
          else
            java.markCollapsed();
          modified.add(java);
        }

      }
    }

    model.modifyAnnotations(null, null, modified.toArray(new Annotation[modified.size()]));
  }
View Full Code Here

  }

  private FoldingStructureComputationContext createContext(boolean allowCollapse) {
    if (!isInstalled())
      return null;
    ProjectionAnnotationModel model = getModel();
    if (model == null)
      return null;
    IDocument doc = getDocument();
    if (doc == null)
      return null;
View Full Code Here

    return null;
  }

  private Map computeCurrentStructure(FoldingStructureComputationContext ctx) {
    Map<IJavaElement, List<Tuple>> map = new HashMap<IJavaElement, List<Tuple>>();
    ProjectionAnnotationModel model = ctx.getModel();
    Iterator e = model.getAnnotationIterator();
    while (e.hasNext()) {
      Object annotation = e.next();
      if (annotation instanceof JavaProjectionAnnotation) {
        JavaProjectionAnnotation java = (JavaProjectionAnnotation) annotation;
        Position position = model.getPosition(java);
        Assert.isNotNull(position);
        List<Tuple> list = map.get(java.getElement());
        if (list == null) {
          list = new ArrayList<Tuple>(2);
          map.put(java.getElement(), list);
View Full Code Here

   */
  private void modifyFiltered(Filter filter, boolean expand) {
    if (!isInstalled())
      return;

    ProjectionAnnotationModel model = getModel();
    if (model == null)
      return;

    List<Annotation> modified = new ArrayList<Annotation>();
    Iterator iter = model.getAnnotationIterator();
    while (iter.hasNext()) {
      Object annotation = iter.next();
      if (annotation instanceof JavaProjectionAnnotation) {
        JavaProjectionAnnotation java = (JavaProjectionAnnotation) annotation;

        if (expand == java.isCollapsed() && filter.match(java)) {
          if (expand)
            java.markExpanded();
          else
            java.markCollapsed();
          modified.add(java);
        }

      }
    }

    model.modifyAnnotations(null, null, modified.toArray(new Annotation[modified.size()]));
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.source.projection.ProjectionAnnotationModel

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.