本文整理汇总了Java中org.eclipse.jface.text.source.IAnnotationAccessExtension类的典型用法代码示例。如果您正苦于以下问题:Java IAnnotationAccessExtension类的具体用法?Java IAnnotationAccessExtension怎么用?Java IAnnotationAccessExtension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IAnnotationAccessExtension类属于org.eclipse.jface.text.source包,在下文中一共展示了IAnnotationAccessExtension类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findColor
import org.eclipse.jface.text.source.IAnnotationAccessExtension; //导入依赖的package包/类
/**
* Returns the color for the given annotation type
*
* @param annotationType the annotation type
* @return the color
* @since 3.0
*/
private Color findColor(Object annotationType) {
Color color = (Color) fAnnotationTypes2Colors.get(annotationType);
if (color != null) {
return color;
}
if (fAnnotationAccess instanceof IAnnotationAccessExtension) {
IAnnotationAccessExtension extension = (IAnnotationAccessExtension) fAnnotationAccess;
Object[] superTypes = extension.getSupertypes(annotationType);
if (superTypes != null) {
for (int i = 0; i < superTypes.length; i++) {
color = (Color) fAnnotationTypes2Colors.get(superTypes[i]);
if (color != null) {
return color;
}
}
}
}
return null;
}
示例2: XtextAnnotation
import org.eclipse.jface.text.source.IAnnotationAccessExtension; //导入依赖的package包/类
public XtextAnnotation(String type, boolean isPersistent, IXtextDocument document, Issue issue, boolean isQuickfixable) {
super(type, isPersistent, issue.getMessage());
AnnotationPreference preference= lookup.getAnnotationPreference(this);
if (preference != null)
this.layer = preference.getPresentationLayer() + 1;
else
this.layer = IAnnotationAccessExtension.DEFAULT_LAYER + 1;
this.document = document;
this.issue = issue;
this.isQuickfixable = isQuickfixable;
}
示例3: createAnnotationAccess
import org.eclipse.jface.text.source.IAnnotationAccessExtension; //导入依赖的package包/类
@Override
protected IAnnotationAccess createAnnotationAccess() {
return new DefaultMarkerAnnotationAccess() {
@Override
public int getLayer(Annotation annotation) {
if (annotation.isMarkedDeleted()) {
return IAnnotationAccessExtension.DEFAULT_LAYER;
}
return super.getLayer(annotation);
}
};
}
示例4: computeLayer
import org.eclipse.jface.text.source.IAnnotationAccessExtension; //导入依赖的package包/类
private static int computeLayer(String annotationType, AnnotationPreferenceLookup lookup)
{
Annotation annotation = new Annotation(annotationType, false, null);
AnnotationPreference preference = lookup.getAnnotationPreference(annotation);
if (preference != null)
{
return preference.getPresentationLayer() + 1;
}
else
{
return IAnnotationAccessExtension.DEFAULT_LAYER + 1;
}
}
示例5: computeLayer
import org.eclipse.jface.text.source.IAnnotationAccessExtension; //导入依赖的package包/类
private static int computeLayer(String annotationType, AnnotationPreferenceLookup lookup) {
Annotation annotation= new Annotation(annotationType, false, null);
AnnotationPreference preference= lookup.getAnnotationPreference(annotation);
if (preference != null)
return preference.getPresentationLayer() + 1;
else
return IAnnotationAccessExtension.DEFAULT_LAYER + 1;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:CompilationUnitDocumentProvider.java
示例6: getOrder
import org.eclipse.jface.text.source.IAnnotationAccessExtension; //导入依赖的package包/类
protected int getOrder(Annotation annotation) {
if (fAnnotationAccess instanceof IAnnotationAccessExtension) {
IAnnotationAccessExtension extension= (IAnnotationAccessExtension) fAnnotationAccess;
return extension.getLayer(annotation);
}
return IAnnotationAccessExtension.DEFAULT_LAYER;
}
示例7: isSubtype
import org.eclipse.jface.text.source.IAnnotationAccessExtension; //导入依赖的package包/类
private boolean isSubtype(Object annotationType) {
if (fAnnotationAccess instanceof IAnnotationAccessExtension) {
IAnnotationAccessExtension extension = (IAnnotationAccessExtension) fAnnotationAccess;
return extension.isSubtype(annotationType, fType);
}
return fType.equals(annotationType);
}
示例8: isCovered
import org.eclipse.jface.text.source.IAnnotationAccessExtension; //导入依赖的package包/类
/**
* Computes whether the annotations of the given type are covered by the given <code>configured</code>
* set. This is the case if either the type of the annotation or any of its
* super types is contained in the <code>configured</code> set.
*
* @param annotationType the annotation type
* @param configured the set with configured annotation types
* @return <code>true</code> if annotation is covered, <code>false</code>
* otherwise
* @since 3.0
*/
private boolean isCovered(Object annotationType, Set configured) {
if (fAnnotationAccess instanceof IAnnotationAccessExtension) {
IAnnotationAccessExtension extension = (IAnnotationAccessExtension) fAnnotationAccess;
Iterator e = configured.iterator();
while (e.hasNext()) {
if (extension.isSubtype(annotationType, e.next())) {
return true;
}
}
return false;
}
return configured.contains(annotationType);
}
示例9: findJavaAnnotation
import org.eclipse.jface.text.source.IAnnotationAccessExtension; //导入依赖的package包/类
private void findJavaAnnotation() {
fPosition= null;
fAnnotation= null;
fHasCorrection= false;
AbstractMarkerAnnotationModel model= getAnnotationModel();
IAnnotationAccessExtension annotationAccess= getAnnotationAccessExtension();
IDocument document= getDocument();
if (model == null)
return ;
boolean hasAssistLightbulb= fStore.getBoolean(PreferenceConstants.EDITOR_QUICKASSIST_LIGHTBULB);
Iterator<Annotation> iter= model.getAnnotationIterator();
int layer= Integer.MIN_VALUE;
while (iter.hasNext()) {
Annotation annotation= iter.next();
if (annotation.isMarkedDeleted())
continue;
int annotationLayer= layer;
if (annotationAccess != null) {
annotationLayer= annotationAccess.getLayer(annotation);
if (annotationLayer < layer)
continue;
}
Position position= model.getPosition(annotation);
if (!includesRulerLine(position, document))
continue;
AnnotationPreference preference= fAnnotationPreferenceLookup.getAnnotationPreference(annotation);
if (preference == null)
continue;
String key= preference.getVerticalRulerPreferenceKey();
if (key == null)
continue;
if (!fStore.getBoolean(key))
continue;
boolean isReadOnly= fTextEditor instanceof ITextEditorExtension && ((ITextEditorExtension)fTextEditor).isEditorInputReadOnly();
if (!isReadOnly
&& (
((hasAssistLightbulb && annotation instanceof AssistAnnotation)
|| JavaCorrectionProcessor.hasCorrections(annotation)))) {
fPosition= position;
fAnnotation= annotation;
fHasCorrection= true;
layer= annotationLayer;
continue;
} else if (!fHasCorrection) {
fPosition= position;
fAnnotation= annotation;
layer= annotationLayer;
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:62,代码来源:JavaSelectAnnotationRulerAction.java
示例10: AnnotationExpansionControl
import org.eclipse.jface.text.source.IAnnotationAccessExtension; //导入依赖的package包/类
/**
* 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();
}
示例11: getHoverInfoForLine
import org.eclipse.jface.text.source.IAnnotationAccessExtension; //导入依赖的package包/类
@Override
protected Object getHoverInfoForLine(final ISourceViewer viewer, final int line) {
final boolean showTemporaryProblems= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CORRECTION_INDICATION);
IAnnotationModel model= viewer.getAnnotationModel();
IDocument document= viewer.getDocument();
if (model == null)
return null;
List<Annotation> exact= new ArrayList<Annotation>();
HashMap<Position, Object> messagesAtPosition= new HashMap<Position, Object>();
Iterator<Annotation> e= model.getAnnotationIterator();
while (e.hasNext()) {
Annotation annotation= e.next();
if (fAnnotationAccess instanceof IAnnotationAccessExtension)
if (!((IAnnotationAccessExtension)fAnnotationAccess).isPaintable(annotation))
continue;
if (annotation instanceof IJavaAnnotation && !isIncluded((IJavaAnnotation)annotation, showTemporaryProblems))
continue;
AnnotationPreference pref= fLookup.getAnnotationPreference(annotation);
if (pref != null) {
String key= pref.getVerticalRulerPreferenceKey();
if (key != null && !fStore.getBoolean(key))
continue;
}
Position position= model.getPosition(annotation);
if (position == null)
continue;
if (compareRulerLine(position, document, line) == 1) {
if (isDuplicateMessage(messagesAtPosition, position, annotation.getText()))
continue;
exact.add(annotation);
}
}
sort(exact, model);
if (exact.size() > 0)
setLastRulerMouseLocation(viewer, line);
if (exact.size() > 0) {
Annotation first= exact.get(0);
if (!isBreakpointAnnotation(first))
exact.add(0, new NoBreakpointAnnotation());
}
if (exact.size() <= 1)
return null;
AnnotationHoverInput input= new AnnotationHoverInput();
input.fAnnotations= exact.toArray(new Annotation[0]);
input.fViewer= viewer;
input.fRulerInfo= fCompositeRuler;
input.fAnnotationListener= fgListener;
input.fDoubleClickListener= fDblClickListener;
input.redoAction= new AnnotationExpansionControl.ICallback() {
public void run(IInformationControlExtension2 control) {
control.setInput(getHoverInfoForLine(viewer, line));
}
};
input.model= model;
return input;
}
示例12: findJavaAnnotation
import org.eclipse.jface.text.source.IAnnotationAccessExtension; //导入依赖的package包/类
private void findJavaAnnotation() {
fPosition= null;
fAnnotation= null;
fHasCorrection= false;
AbstractMarkerAnnotationModel model= getAnnotationModel();
IAnnotationAccessExtension annotationAccess= getAnnotationAccessExtension();
IDocument document= getDocument();
if (model == null)
return ;
boolean hasAssistLightbulb= fStore.getBoolean(PreferenceConstants.EDITOR_QUICKASSIST_LIGHTBULB);
Iterator<Annotation> iter= model.getAnnotationIterator();
int layer= Integer.MIN_VALUE;
while (iter.hasNext()) {
Annotation annotation= iter.next();
if (annotation.isMarkedDeleted())
continue;
int annotationLayer= layer;
if (annotationAccess != null) {
annotationLayer= annotationAccess.getLayer(annotation);
if (annotationLayer < layer)
continue;
}
Position position= model.getPosition(annotation);
if (!includesRulerLine(position, document))
continue;
boolean isReadOnly= fTextEditor instanceof ITextEditorExtension && ((ITextEditorExtension)fTextEditor).isEditorInputReadOnly();
if (!isReadOnly
&& (
((hasAssistLightbulb && annotation instanceof AssistAnnotation)
|| JavaCorrectionProcessor.hasCorrections(annotation)))) {
fPosition= position;
fAnnotation= annotation;
fHasCorrection= true;
layer= annotationLayer;
continue;
} else if (!fHasCorrection) {
AnnotationPreference preference= fAnnotationPreferenceLookup.getAnnotationPreference(annotation);
if (preference == null)
continue;
String key= preference.getVerticalRulerPreferenceKey();
if (key == null)
continue;
if (fStore.getBoolean(key)) {
fPosition= position;
fAnnotation= annotation;
layer= annotationLayer;
}
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:61,代码来源:JavaSelectAnnotationRulerAction.java
示例13: updateHeaderToolTipText
import org.eclipse.jface.text.source.IAnnotationAccessExtension; //导入依赖的package包/类
/**
* Updates the header tool tip text of this ruler.
*/
private void updateHeaderToolTipText() {
if (fHeader == null || fHeader.isDisposed()) {
return;
}
if (fHeader.getToolTipText() != null) {
return;
}
String overview = ""; //$NON-NLS-1$
for (int i = fAnnotationsSortedByLayer.size() - 1; i >= 0; i--) {
Object annotationType = fAnnotationsSortedByLayer.get(i);
if (skipInHeader(annotationType) || skip(annotationType)) {
continue;
}
int count = 0;
String annotationTypeLabel = null;
Iterator e = new FilterIterator(annotationType, FilterIterator.PERSISTENT | FilterIterator.TEMPORARY
| FilterIterator.IGNORE_BAGS, fCachedAnnotations.iterator());
while (e.hasNext()) {
Annotation annotation = (Annotation) e.next();
if (annotation != null) {
if (annotationTypeLabel == null) {
annotationTypeLabel = ((IAnnotationAccessExtension) fAnnotationAccess).getTypeLabel(annotation);
}
count++;
}
}
if (annotationTypeLabel != null) {
if (overview.length() > 0)
{
overview += "\n"; //$NON-NLS-1$
}
overview += annotationTypeLabel + ":" + count; //$NON-NLS-1$ fabioz change; not user internal formatter
}
}
if (overview.length() > 0) {
fHeader.setToolTipText(overview);
}
}