org.eclipse.jface.text.source.IAnnotationAccess Java Examples

The following examples show how to use org.eclipse.jface.text.source.IAnnotationAccess. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XtextEditor.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected IAnnotationAccess createAnnotationAccess() {
	return new DefaultMarkerAnnotationAccess() {
		@Override
		public int getLayer(Annotation annotation) {
			if (annotation.isMarkedDeleted()) {
				return IAnnotationAccessExtension.DEFAULT_LAYER;
			}
			return super.getLayer(annotation);
		}
	};
}
 
Example #2
Source File: MinimapOverviewRuler.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public MinimapOverviewRuler(IAnnotationAccess annotationAccess, ISharedTextColors sharedColors,
        IOutlineModel outlineModel) {
    super(annotationAccess, MinimapOverviewRulerPreferencesPage.getMinimapWidth(), sharedColors);
    this.fOutlineModel = outlineModel;
    propertyListener = new IPropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            if (MinimapOverviewRulerPreferencesPage.MINIMAP_WIDTH.equals(event.getProperty())) {
                updateWidth();
            }
        }
    };

    if (outlineModel != null) {
        modelListener = new ICallbackListener<IOutlineModel>() {

            @Override
            public Object call(IOutlineModel obj) {
                lastModelChange = System.currentTimeMillis();
                update();
                return null;
            }
        };
        ICallbackWithListeners<IOutlineModel> onModelChangedListener = outlineModel.getOnModelChangedCallback();
        onModelChangedListener.registerListener(modelListener);
    }
}
 
Example #3
Source File: SourceCodeTextEditor.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected IAnnotationAccess createAnnotationAccess() {
	return new InternalMarkerAnnotationAccess();
}
 
Example #4
Source File: AnnotationExpansionControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
	 * Creates a new control.
	 *
	 * @param parent parent shell
	 * @param shellStyle additional style flags
	 * @param access the annotation access
	 */
	public AnnotationExpansionControl(Shell parent, int shellStyle, IAnnotationAccess access) {
		fPaintListener= new MyPaintListener();
		fMouseTrackListener= new MyMouseTrackListener();
		fMouseListener= new MyMouseListener();
		fMenuDetectListener= new MyMenuDetectListener();
		fDisposeListener= new MyDisposeListener();
		fViewportListener= new IViewportListener() {

			public void viewportChanged(int verticalOffset) {
				dispose();
			}

		};
		fLayouter= new LinearLayouter();

		if (access instanceof IAnnotationAccessExtension)
			fAnnotationAccessExtension= (IAnnotationAccessExtension) access;

		fShell= new Shell(parent, shellStyle | SWT.NO_FOCUS | SWT.ON_TOP);
		Display display= fShell.getDisplay();
		fShell.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
		fComposite= new Composite(fShell, SWT.NO_FOCUS | SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM);
//		fComposite= new Composite(fShell, SWT.NO_FOCUS | SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.V_SCROLL);

		GridLayout layout= new GridLayout(1, true);
		layout.marginHeight= 0;
		layout.marginWidth= 0;
		fShell.setLayout(layout);

		GridData data= new GridData(GridData.FILL_BOTH);
		data.heightHint= fLayouter.getAnnotationSize() + 2 * fLayouter.getBorderWidth() + 4;
		fComposite.setLayoutData(data);
		fComposite.addMouseTrackListener(new MouseTrackAdapter() {

			@Override
			public void mouseExit(MouseEvent e) {
				if (fComposite == null)
						return;
				Control[] children= fComposite.getChildren();
				Rectangle bounds= null;
				for (int i= 0; i < children.length; i++) {
					if (bounds == null)
						bounds= children[i].getBounds();
					else
						bounds.add(children[i].getBounds());
					if (bounds.contains(e.x, e.y))
						return;
				}

				// if none of the children contains the event, we leave the popup
				dispose();
			}

		});

//		fComposite.getVerticalBar().addListener(SWT.Selection, new Listener() {
//
//			public void handleEvent(Event event) {
//				Rectangle bounds= fShell.getBounds();
//				int x= bounds.x - fLayouter.getAnnotationSize() - fLayouter.getBorderWidth();
//				int y= bounds.y;
//				fShell.setBounds(x, y, bounds.width, bounds.height);
//			}
//
//		});

		Cursor handCursor= getHandCursor(display);
		fShell.setCursor(handCursor);
		fComposite.setCursor(handCursor);

		setInfoSystemColor();
	}
 
Example #5
Source File: JavaExpandHover.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public JavaExpandHover(CompositeRuler ruler, IAnnotationAccess access, IDoubleClickListener doubleClickListener) {
	super(ruler, access, doubleClickListener);
}
 
Example #6
Source File: CopiedOverviewRuler.java    From Pydev with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Constructs a overview ruler of the given width using the given annotation
 * access and the given color manager.
 *
 * @param annotationAccess the annotation access
 * @param width the width of the vertical ruler
 * @param sharedColors the color manager
 * @param discolorTemporaryAnnotation <code>true</code> if temporary annotations should be discolored
 * @since 3.4
 */
public CopiedOverviewRuler(IAnnotationAccess annotationAccess, int width, ISharedTextColors sharedColors,
        boolean discolorTemporaryAnnotation) {
    fAnnotationAccess = annotationAccess;
    fWidth = width;
    fSharedTextColors = sharedColors;
    fIsTemporaryAnnotationDiscolored = discolorTemporaryAnnotation;
}
 
Example #7
Source File: AnnotationExpandHover.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Creates a new hover instance.
 *
 * @param ruler
 * @param access
 * @param doubleClickListener
 */
public AnnotationExpandHover(CompositeRuler ruler, IAnnotationAccess access, IDoubleClickListener doubleClickListener) {
	fCompositeRuler= ruler;
	fAnnotationAccess= access;
	fDblClickListener= doubleClickListener;
}
 
Example #8
Source File: CopiedOverviewRuler.java    From Pydev with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Constructs a overview ruler of the given width using the given annotation access and the given
 * color manager.
 * <p><strong>Note:</strong> As of 3.4, temporary annotations are no longer discolored.
 * Use {@link #OverviewRuler(IAnnotationAccess, int, ISharedTextColors, boolean)} if you
 * want to keep the old behavior.</p>
 *
 * @param annotationAccess the annotation access
 * @param width the width of the vertical ruler
 * @param sharedColors the color manager
 */
public CopiedOverviewRuler(IAnnotationAccess annotationAccess, int width, ISharedTextColors sharedColors) {
    this(annotationAccess, width, sharedColors, false);
}