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

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


  public void outlineNodeExpanded(String target) {
    if (_collapsedIDs.contains(target)) {
      _collapsedIDs.remove(target);

      FuzzyXMLNode selectedNode = _idToNodeMap.get(target);
      ProjectionAnnotationModel model = ((ProjectionViewer) _editor.getViewer()).getProjectionAnnotationModel();
      ProjectionAnnotation lastAnnotation = getAnnotationForNode(selectedNode, model);
      if (lastAnnotation != null) {
        model.expand(lastAnnotation);
      }
    }
  }
View Full Code Here


  public void update() {
    if (getControl() == null || getControl().isDisposed()) {
      return;
    }

    ProjectionAnnotationModel model = ((ProjectionViewer) _editor.getViewer()).getProjectionAnnotationModel();
    model.removeAnnotationModelListener(this);
    model.addAnnotationModelListener(this);

    try {
      _doc = createParser(_editor.getParserCache().getProject()).parse(_editor.getHTMLSource());
    }
    catch (Exception e) {
View Full Code Here

    try {
      ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
      if (viewer == null) {
        return;
      }
      ProjectionAnnotationModel model = viewer.getProjectionAnnotationModel();
      if (model == null) {
        return;
      }

      List<FoldingInfo> list = new ArrayList<FoldingInfo>();
View Full Code Here

        IClassFileEditorInput editorInput = (IClassFileEditorInput) editor.getEditorInput();
        input = editorInput.getClassFile();
      }

      if (input != null) {
        ProjectionAnnotationModel model = (ProjectionAnnotationModel) editor.getAdapter(ProjectionAnnotationModel.class);
        reconciler.initialize(model, (IJavaElement) input);
      }

    }
    finally {
View Full Code Here

  }

  private class ElementChangedListener implements IElementChangedListener {

    public void elementChanged(ElementChangedEvent event) {
      ProjectionAnnotationModel model = (ProjectionAnnotationModel) editor.getAdapter(ProjectionAnnotationModel.class);
     
      if (!isInstalled() ||  model == null || !isValidEvent(event.getDelta()))
        return;
      try {
        IDocumentProvider provider = editor.getDocumentProvider();
View Full Code Here

        IClassFileEditorInput editorInput = (IClassFileEditorInput) editor.getEditorInput();
        input = editorInput.getClassFile();
      }

      if (input != null) {
        ProjectionAnnotationModel model = (ProjectionAnnotationModel) editor.getAdapter(ProjectionAnnotationModel.class);
        reconciler.initialize(model, (IJavaElement) input);
      }

    }
    finally {
View Full Code Here

  }

  private class ElementChangedListener implements IElementChangedListener {

    public void elementChanged(ElementChangedEvent event) {
      ProjectionAnnotationModel model = (ProjectionAnnotationModel) editor.getAdapter(ProjectionAnnotationModel.class);
     
      if (!isInstalled() ||  model == null || !isValidEvent(event.getDelta()))
        return;
      try {
        IDocumentProvider provider = editor.getDocumentProvider();
View Full Code Here

        IDocument document = viewer.getDocument();

        try
        {
            ProjectionAnnotationModel projectionAnnotationModel = ( ProjectionAnnotationModel ) editor
                .getAdapter( ProjectionAnnotationModel.class );
            if ( projectionAnnotationModel == null )
                return;

            // create folding regions of current LDIF model; mark comments
            // and
            // folded lines as collapsed
            Map positionToAnnotationMap = createFoldingRegions( editor.getLdifModel(), document );

            // compare with current annotation model (--> toAdd, toDelete)
            List annotationsToDeleteList = new ArrayList();
            Map annotationsToAddMap = new HashMap();
            this.computeDifferences( projectionAnnotationModel, positionToAnnotationMap, annotationsToDeleteList,
                annotationsToAddMap );
            Annotation[] annotationsToDelete = ( Annotation[] ) annotationsToDeleteList
                .toArray( new Annotation[annotationsToDeleteList.size()] );

            // update annotation model
            if ( !annotationsToDeleteList.isEmpty() || !annotationsToAddMap.isEmpty() )
            {
                projectionAnnotationModel.modifyAnnotations( annotationsToDelete, annotationsToAddMap,
                    new Annotation[0] );
            }

        }
        catch ( BadLocationException e )
View Full Code Here

     * (non-Javadoc)
     *
     * @see org.python.pydev.editor.model.IModelListener#modelChanged(org.python.pydev.editor.model.AbstractNode)
     */
    public synchronized void modelChanged(final SimpleNode root2) {
        ProjectionAnnotationModel model = (ProjectionAnnotationModel) editor
                .getAdapter(ProjectionAnnotationModel.class);

        if (model == null) {
            //we have to get the model to do it... so, start a thread and try until get it...
            //this had to be done because sometimes we get here and we still are unable to get the
            //projection annotation model. (there should be a better way, but this solves it...
            //even if it looks like a hack...)
            Thread t = new Thread() {
                public void run() {
                    ProjectionAnnotationModel modelT = null;
                    for (int i = 0; i < 10 && modelT == null; i++) { //we will try it for 10 secs...
                        try {
                            sleep(100);
                        } catch (InterruptedException e) {
                            Log.log(e);
View Full Code Here

     * @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);
        try {
            if (model != null) {
                //put annotations in array list.
                Iterator iter = model.getAnnotationIterator();
                while (iter != null && iter.hasNext()) {
                    PyProjectionAnnotation element = (PyProjectionAnnotation) iter.next();
                    Position position = model.getPosition(element);

                    int line = ps.getDoc().getLineOfOffset(position.offset);

                    int start = ps.getStartLineIndex();
                    int end = ps.getEndLineIndex();

                    for (int i = start; i <= end; i++) {
                        if (i == line) {
                            model.collapse(element);
                            break;
                        }
                    }
                }

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.