mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-15 04:05:38 +02:00
Bug 320561 - Override markers in C++ editor, contribution from Tomasz Wesolowski
This commit is contained in:
parent
1b4cb4d213
commit
67f3e3b559
12 changed files with 606 additions and 3 deletions
BIN
core/org.eclipse.cdt.ui/icons/obj16/implm_co.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/obj16/implm_co.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 104 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/over_co.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/obj16/over_co.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 131 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/shad_co.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/obj16/shad_co.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 100 B |
|
@ -2525,6 +2525,31 @@
|
||||||
textStylePreferenceKey="org.eclipse.cdt.ui.occurrenceTextStyle"
|
textStylePreferenceKey="org.eclipse.cdt.ui.occurrenceTextStyle"
|
||||||
textStylePreferenceValue="NONE">
|
textStylePreferenceValue="NONE">
|
||||||
</specification>
|
</specification>
|
||||||
|
<specification
|
||||||
|
annotationType="org.eclipse.cdt.ui.overrideIndicator"
|
||||||
|
label="C/C++ Override indicators"
|
||||||
|
annotationImageProvider ="org.eclipse.cdt.internal.ui.editor.OverrideIndicatorImageProvider"
|
||||||
|
textPreferenceKey="overrideIndicator"
|
||||||
|
textPreferenceValue="false"
|
||||||
|
highlightPreferenceKey="overrideIndicatorHighlighting"
|
||||||
|
highlightPreferenceValue="false"
|
||||||
|
contributesToHeader="false"
|
||||||
|
overviewRulerPreferenceKey="overrideIndicatorInOverviewRuler"
|
||||||
|
overviewRulerPreferenceValue="false"
|
||||||
|
verticalRulerPreferenceKey="overrideIndicatorInVerticalRuler"
|
||||||
|
verticalRulerPreferenceValue="true"
|
||||||
|
colorPreferenceKey="overrideIndicatorColor"
|
||||||
|
colorPreferenceValue="180,207,205"
|
||||||
|
presentationLayer="3"
|
||||||
|
showInNextPrevDropdownToolbarActionKey="showoverrideIndicatorInNextPrevDropdownToolbarAction"
|
||||||
|
showInNextPrevDropdownToolbarAction="false"
|
||||||
|
isGoToNextNavigationTargetKey="isOverrideIndicatorGoToNextNavigationTarget"
|
||||||
|
isGoToNextNavigationTarget="false"
|
||||||
|
isGoToPreviousNavigationTargetKey="isOverrideIndicatorGoToPreviousNavigationTarget"
|
||||||
|
isGoToPreviousNavigationTarget="false"
|
||||||
|
textStylePreferenceKey="overrideIndicatorTextStyle"
|
||||||
|
textStylePreferenceValue="SQUIGGLES">
|
||||||
|
</specification>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.search.searchResultViewPages">
|
point="org.eclipse.search.searchResultViewPages">
|
||||||
|
@ -2676,6 +2701,7 @@
|
||||||
<type
|
<type
|
||||||
name="org.eclipse.cdt.ui.occurrences">
|
name="org.eclipse.cdt.ui.occurrences">
|
||||||
</type>
|
</type>
|
||||||
|
<type name="org.eclipse.cdt.ui.overrideIndicator"/>
|
||||||
</extension>
|
</extension>
|
||||||
<extension point="org.eclipse.ui.workbench.texteditor.spellingEngine">
|
<extension point="org.eclipse.ui.workbench.texteditor.spellingEngine">
|
||||||
<engine
|
<engine
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
* Anton Leherbauer (Wind River Systems)
|
* Anton Leherbauer (Wind River Systems)
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
* Dmitry Kozlov (CodeSourcery)
|
* Dmitry Kozlov (CodeSourcery)
|
||||||
|
* Tomasz Wesolowski
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui;
|
package org.eclipse.cdt.internal.ui;
|
||||||
|
|
||||||
|
@ -216,6 +217,10 @@ public class CPluginImages {
|
||||||
public static final ImageDescriptor DESC_OBJS_EXPORT_SETTINGS = createManaged(T_OBJ, IMG_OBJS_EXPORT_SETTINGS);
|
public static final ImageDescriptor DESC_OBJS_EXPORT_SETTINGS = createManaged(T_OBJ, IMG_OBJS_EXPORT_SETTINGS);
|
||||||
public static final ImageDescriptor DESC_OVR_PATH_INHERIT= create(T_OVR, "path_inherit_co.gif"); //$NON-NLS-1$
|
public static final ImageDescriptor DESC_OVR_PATH_INHERIT= create(T_OVR, "path_inherit_co.gif"); //$NON-NLS-1$
|
||||||
public static final ImageDescriptor DESC_OVR_FOCUS= create(T_OVR, "focus_ovr.gif"); //$NON-NLS-1$
|
public static final ImageDescriptor DESC_OVR_FOCUS= create(T_OVR, "focus_ovr.gif"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static final ImageDescriptor DESC_OBJS_OVERRIDES = create(T_OBJ, "over_co.gif"); //$NON-NLS-1$
|
||||||
|
public static final ImageDescriptor DESC_OBJS_IMPLEMENTS = create(T_OBJ, "implm_co.gif"); //$NON-NLS-1$
|
||||||
|
public static final ImageDescriptor DESC_OBJS_SHADOWS= create(T_OBJ, "shad_co.gif"); //$NON-NLS-1$
|
||||||
|
|
||||||
public static final ImageDescriptor DESC_OBJS_FIXABLE_PROBLEM= createManaged(T_OBJ, IMG_OBJS_FIXABLE_PROBLEM);
|
public static final ImageDescriptor DESC_OBJS_FIXABLE_PROBLEM= createManaged(T_OBJ, IMG_OBJS_FIXABLE_PROBLEM);
|
||||||
public static final ImageDescriptor DESC_OBJS_FIXABLE_ERROR= createManaged(T_OBJ, IMG_OBJS_FIXABLE_ERROR);
|
public static final ImageDescriptor DESC_OBJS_FIXABLE_ERROR= createManaged(T_OBJ, IMG_OBJS_FIXABLE_ERROR);
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
* Axel Mueller - [289339] Surround with
|
* Axel Mueller - [289339] Surround with
|
||||||
|
* Tomasz Wesolowski - [320561] Override indicators
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.editor;
|
package org.eclipse.cdt.internal.ui.editor;
|
||||||
|
|
||||||
|
@ -2039,6 +2040,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
// cancel possible running computation
|
// cancel possible running computation
|
||||||
fMarkOccurrenceAnnotations= false;
|
fMarkOccurrenceAnnotations= false;
|
||||||
uninstallOccurrencesFinder();
|
uninstallOccurrencesFinder();
|
||||||
|
uninstallOverrideIndicator();
|
||||||
|
|
||||||
uninstallSemanticHighlighting();
|
uninstallSemanticHighlighting();
|
||||||
|
|
||||||
|
@ -2235,7 +2237,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
action = new TextOperationAction(bundle, "OpenMacroExplorer.", this, CSourceViewer.SHOW_MACRO_EXPLORER, true); //$NON-NLS-1$
|
action = new TextOperationAction(bundle, "OpenMacroExplorer.", this, CSourceViewer.SHOW_MACRO_EXPLORER, true); //$NON-NLS-1$
|
||||||
action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_QUICK_MACRO_EXPLORER);
|
action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_QUICK_MACRO_EXPLORER);
|
||||||
setAction("OpenMacroExplorer", action); //$NON-NLS-1$*/
|
setAction("OpenMacroExplorer", action); //$NON-NLS-1$*/
|
||||||
|
|
||||||
// Assorted action groupings
|
// Assorted action groupings
|
||||||
fSelectionSearchGroup = createSelectionSearchGroup();
|
fSelectionSearchGroup = createSelectionSearchGroup();
|
||||||
fTextSearchGroup= new TextSearchGroup(this);
|
fTextSearchGroup= new TextSearchGroup(this);
|
||||||
|
@ -2408,6 +2410,9 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
|
|
||||||
if (isMarkingOccurrences())
|
if (isMarkingOccurrences())
|
||||||
installOccurrencesFinder(false);
|
installOccurrencesFinder(false);
|
||||||
|
|
||||||
|
installOverrideIndicator(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2741,6 +2746,8 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
private OccurrencesFinderJobCanceler fOccurrencesFinderJobCanceler;
|
private OccurrencesFinderJobCanceler fOccurrencesFinderJobCanceler;
|
||||||
private ISelectionListenerWithAST fPostSelectionListenerWithAST;
|
private ISelectionListenerWithAST fPostSelectionListenerWithAST;
|
||||||
|
|
||||||
|
private OverrideIndicatorManager fOverrideIndicatorManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the outliner's context menu ID.
|
* Sets the outliner's context menu ID.
|
||||||
*/
|
*/
|
||||||
|
@ -3452,4 +3459,33 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
public boolean shouldProcessLocalParsingCompletions() {
|
public boolean shouldProcessLocalParsingCompletions() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void uninstallOverrideIndicator() {
|
||||||
|
if (fOverrideIndicatorManager != null) {
|
||||||
|
fOverrideIndicatorManager.removeAnnotations();
|
||||||
|
removeReconcileListener(fOverrideIndicatorManager);
|
||||||
|
fOverrideIndicatorManager= null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void installOverrideIndicator(boolean provideAST) {
|
||||||
|
uninstallOverrideIndicator();
|
||||||
|
IAnnotationModel model= getDocumentProvider().getAnnotationModel(getEditorInput());
|
||||||
|
|
||||||
|
if (model == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fOverrideIndicatorManager= new OverrideIndicatorManager(model);
|
||||||
|
|
||||||
|
addReconcileListener(fOverrideIndicatorManager);
|
||||||
|
|
||||||
|
if (provideAST) {
|
||||||
|
ASTProvider.getASTProvider().runOnAST(getInputCElement(), ASTProvider.WAIT_NO, getProgressMonitor(), new ASTRunnable() {
|
||||||
|
public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) throws CoreException {
|
||||||
|
if (ast != null)
|
||||||
|
fOverrideIndicatorManager.reconciled(ast, true, getProgressMonitor());
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2009 QNX Software Systems and others.
|
* Copyright (c) 2000, 2010 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
|
* Tomasz Wesolowski
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.editor;
|
package org.eclipse.cdt.internal.ui.editor;
|
||||||
|
|
||||||
|
@ -44,6 +45,10 @@ public final class CEditorMessages extends NLS {
|
||||||
public static String OpenDeclarations_dialog_title;
|
public static String OpenDeclarations_dialog_title;
|
||||||
public static String OpenDeclarations_label;
|
public static String OpenDeclarations_label;
|
||||||
public static String OpenDeclarations_tooltip;
|
public static String OpenDeclarations_tooltip;
|
||||||
|
public static String OverrideIndicatorManager_implements;
|
||||||
|
public static String OverrideIndicatorManager_overrides;
|
||||||
|
public static String OverrideIndicatorManager_shadows;
|
||||||
|
public static String OverrideIndicatorManager_via;
|
||||||
public static String DefaultCEditorTextHover_html_name;
|
public static String DefaultCEditorTextHover_html_name;
|
||||||
public static String DefaultCEditorTextHover_html_prototype;
|
public static String DefaultCEditorTextHover_html_prototype;
|
||||||
public static String DefaultCEditorTextHover_html_description;
|
public static String DefaultCEditorTextHover_html_description;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#########################################
|
#########################################
|
||||||
# Copyright (c) 2005, 2009 IBM Corporation and others.
|
# Copyright (c) 2005, 2010 IBM Corporation and others.
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
# which accompanies this distribution, and is available at
|
# which accompanies this distribution, and is available at
|
||||||
|
@ -11,6 +11,7 @@
|
||||||
# Anton Leherbauer (Wind River Systems)
|
# Anton Leherbauer (Wind River Systems)
|
||||||
# Markus Schorn (Wind River Systems)
|
# Markus Schorn (Wind River Systems)
|
||||||
# Sergey Prigogin (Google)
|
# Sergey Prigogin (Google)
|
||||||
|
# Tomasz Wesolowski
|
||||||
#########################################
|
#########################################
|
||||||
|
|
||||||
AddIncludeOnSelection_label=Add Include
|
AddIncludeOnSelection_label=Add Include
|
||||||
|
@ -30,6 +31,10 @@ OpenDeclarationsAction_selectMessage=Select one element from the list
|
||||||
OpenDeclarations_dialog_title=Open Declaration
|
OpenDeclarations_dialog_title=Open Declaration
|
||||||
OpenDeclarations_label=&Open Declaration
|
OpenDeclarations_label=&Open Declaration
|
||||||
OpenDeclarations_tooltip=Open an editor on the selected element's declaration
|
OpenDeclarations_tooltip=Open an editor on the selected element's declaration
|
||||||
|
OverrideIndicatorManager_implements=Implements
|
||||||
|
OverrideIndicatorManager_overrides=Overrides
|
||||||
|
OverrideIndicatorManager_shadows=Shadows
|
||||||
|
OverrideIndicatorManager_via=via
|
||||||
|
|
||||||
DefaultCEditorTextHover_html_name=<b>Name:</b>
|
DefaultCEditorTextHover_html_name=<b>Name:</b>
|
||||||
DefaultCEditorTextHover_html_prototype=<br><b>Prototype:</b>
|
DefaultCEditorTextHover_html_prototype=<br><b>Prototype:</b>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
# Anton Leherbauer (Wind River Systems)
|
# Anton Leherbauer (Wind River Systems)
|
||||||
# Markus Schorn (Wind River Systems)
|
# Markus Schorn (Wind River Systems)
|
||||||
# Sergey Prigogin (Google)
|
# Sergey Prigogin (Google)
|
||||||
|
# Tomasz Wesolowski
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
AddIncludeOnSelection.description=Add include statement for selected name
|
AddIncludeOnSelection.description=Add include statement for selected name
|
||||||
|
@ -131,3 +132,8 @@ CSelectAnnotationRulerAction.GotoAnnotation.label= &Go to Annotation
|
||||||
CSelectAnnotationRulerAction.GotoAnnotation.tooltip= Go to Annotation
|
CSelectAnnotationRulerAction.GotoAnnotation.tooltip= Go to Annotation
|
||||||
CSelectAnnotationRulerAction.GotoAnnotation.description= Selects the annotation in the editor
|
CSelectAnnotationRulerAction.GotoAnnotation.description= Selects the annotation in the editor
|
||||||
CSelectAnnotationRulerAction.GotoAnnotation.image=
|
CSelectAnnotationRulerAction.GotoAnnotation.image=
|
||||||
|
|
||||||
|
CSelectAnnotationRulerAction.OpenSuperImplementation.label= &Open Super Implementation
|
||||||
|
CSelectAnnotationRulerAction.OpenSuperImplementation.tooltip= Open Super Implementation
|
||||||
|
CSelectAnnotationRulerAction.OpenSuperImplementation.description= Opens the super implementation
|
||||||
|
CSelectAnnotationRulerAction.OpenSuperImplementation.image=
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2010 Tomasz Wesolowski and others
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Tomasz Wesolowski - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.ui.editor;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
|
import org.eclipse.jface.text.source.Annotation;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
import org.eclipse.ui.texteditor.IAnnotationImageProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Tomasz Wesolowski
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class OverrideIndicatorImageProvider implements
|
||||||
|
IAnnotationImageProvider {
|
||||||
|
|
||||||
|
private static final String OVERRIDE_IMG_DESC_ID = "CPluginImages.DESC_OBJS_OVERRIDES";
|
||||||
|
private static final String IMPLEMENT_IMG_DESC_ID = "CPluginImages.DESC_OBJS_IMPLEMENTS";
|
||||||
|
private static final String SHADOW_IMG_DESC_ID = "CPluginImages.DESC_OBJS_SHADOWS";
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.texteditor.IAnnotationImageProvider#getManagedImage(org.eclipse.jface.text.source.Annotation)
|
||||||
|
*/
|
||||||
|
public Image getManagedImage(Annotation annotation) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.texteditor.IAnnotationImageProvider#getImageDescriptorId(org.eclipse.jface.text.source.Annotation)
|
||||||
|
*/
|
||||||
|
public String getImageDescriptorId(Annotation annotation) {
|
||||||
|
if (!isImageProviderFor(annotation)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
switch (getAnnotationType(annotation)) {
|
||||||
|
case OverrideIndicatorManager.RESULT_OVERRIDES:
|
||||||
|
return OVERRIDE_IMG_DESC_ID;
|
||||||
|
case OverrideIndicatorManager.RESULT_IMPLEMENTS:
|
||||||
|
return IMPLEMENT_IMG_DESC_ID;
|
||||||
|
case OverrideIndicatorManager.RESULT_SHADOWS:
|
||||||
|
return SHADOW_IMG_DESC_ID;
|
||||||
|
}
|
||||||
|
assert false;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.texteditor.IAnnotationImageProvider#getImageDescriptor(java.lang.String)
|
||||||
|
*/
|
||||||
|
public ImageDescriptor getImageDescriptor(String imageDescritporId) {
|
||||||
|
if (imageDescritporId.equals(OVERRIDE_IMG_DESC_ID)) {
|
||||||
|
return CPluginImages.DESC_OBJS_OVERRIDES;
|
||||||
|
} else if (imageDescritporId.equals(IMPLEMENT_IMG_DESC_ID)) {
|
||||||
|
return CPluginImages.DESC_OBJS_IMPLEMENTS;
|
||||||
|
} else if (imageDescritporId.equals(SHADOW_IMG_DESC_ID)) {
|
||||||
|
return CPluginImages.DESC_OBJS_SHADOWS;
|
||||||
|
}
|
||||||
|
assert false;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isImageProviderFor(Annotation annotation) {
|
||||||
|
return annotation != null && OverrideIndicatorManager.OverrideIndicator.ANNOTATION_TYPE_ID.equals(annotation.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getAnnotationType(Annotation annotation) {
|
||||||
|
return ((OverrideIndicatorManager.OverrideIndicator)annotation).getIndicationType();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,426 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2010 Tomasz Wesolowski and others
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Tomasz Wesolowski - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.ui.editor;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.jface.text.ISynchronizable;
|
||||||
|
import org.eclipse.jface.text.Position;
|
||||||
|
import org.eclipse.jface.text.source.Annotation;
|
||||||
|
import org.eclipse.jface.text.source.IAnnotationModel;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
|
import org.eclipse.cdt.ui.CDTUITools;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
||||||
|
import org.eclipse.cdt.internal.core.model.ASTStringUtil;
|
||||||
|
import org.eclipse.cdt.internal.core.model.ext.ICElementHandle;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.text.ICReconcilingListener;
|
||||||
|
import org.eclipse.cdt.internal.ui.viewsupport.IndexUI;
|
||||||
|
|
||||||
|
public class OverrideIndicatorManager implements ICReconcilingListener {
|
||||||
|
|
||||||
|
private static final String MESSAGE_SEPARATOR = ";\n"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static class OverrideInfo {
|
||||||
|
|
||||||
|
public int nodeOffset;
|
||||||
|
public int resultType;
|
||||||
|
public String message;
|
||||||
|
public int nodeLength;
|
||||||
|
|
||||||
|
public IBinding binding;
|
||||||
|
|
||||||
|
public OverrideInfo(int nodeOffset, int nodeLength, int markerType, String message, IBinding binding) {
|
||||||
|
this.nodeOffset = nodeOffset;
|
||||||
|
this.resultType = markerType;
|
||||||
|
this.message = message;
|
||||||
|
this.binding = binding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final int RESULT_OVERRIDES = 0;
|
||||||
|
public static final int RESULT_IMPLEMENTS = 1;
|
||||||
|
public static final int RESULT_SHADOWS = 2;
|
||||||
|
|
||||||
|
public class OverrideIndicator extends Annotation {
|
||||||
|
|
||||||
|
public static final String ANNOTATION_TYPE_ID = "org.eclipse.cdt.ui.overrideIndicator"; //$NON-NLS-1$
|
||||||
|
private int type;
|
||||||
|
private ICElementHandle declaration;
|
||||||
|
|
||||||
|
public OverrideIndicator(int resultType, String message, IBinding binding, IIndex index) {
|
||||||
|
super(ANNOTATION_TYPE_ID, false, message);
|
||||||
|
this.type = resultType;
|
||||||
|
try {
|
||||||
|
declaration = IndexUI.findAnyDeclaration(index, null, binding);
|
||||||
|
if (declaration == null) {
|
||||||
|
ICElementHandle[] allDefinitions = IndexUI.findAllDefinitions(index, binding);
|
||||||
|
if (allDefinitions.length > 0) {
|
||||||
|
declaration = allDefinitions[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndicationType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void open() {
|
||||||
|
try {
|
||||||
|
CDTUITools.openInEditor(declaration, true, true);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private IAnnotationModel fAnnotationModel;
|
||||||
|
private Vector<OverrideIndicator> fOverrideAnnotations = new Vector<OverrideIndicator>();
|
||||||
|
private Object fAnnotationModelLockObject;
|
||||||
|
|
||||||
|
public OverrideIndicatorManager(IAnnotationModel annotationModel) {
|
||||||
|
fAnnotationModel = annotationModel;
|
||||||
|
fAnnotationModelLockObject = getLockObject(fAnnotationModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleResult(OverrideInfo info, IIndex index) {
|
||||||
|
|
||||||
|
Position position = new Position(info.nodeOffset, info.nodeLength);
|
||||||
|
|
||||||
|
OverrideIndicator indicator = new OverrideIndicator(info.resultType, info.message, info.binding, index);
|
||||||
|
synchronized (fAnnotationModelLockObject) {
|
||||||
|
fAnnotationModel.addAnnotation(indicator, position);
|
||||||
|
}
|
||||||
|
fOverrideAnnotations.add(indicator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all override indicators from this manager's annotation model.
|
||||||
|
*/
|
||||||
|
public void removeAnnotations() {
|
||||||
|
if (fOverrideAnnotations == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
synchronized (fAnnotationModelLockObject) {
|
||||||
|
for (Annotation i : fOverrideAnnotations)
|
||||||
|
fAnnotationModel.removeAnnotation(i);
|
||||||
|
fOverrideAnnotations.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generateAnnotations(IASTTranslationUnit ast, final IIndex index) {
|
||||||
|
|
||||||
|
class MethodDeclarationFinder extends ASTVisitor {
|
||||||
|
{
|
||||||
|
shouldVisitDeclarations = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int visit(IASTDeclaration declaration) {
|
||||||
|
try {
|
||||||
|
IBinding binding = null;
|
||||||
|
ICPPMethod method = null;
|
||||||
|
if (isFunctionDeclaration(declaration)) {
|
||||||
|
binding = getDeclarationBinding(declaration);
|
||||||
|
} else if (declaration instanceof IASTFunctionDefinition) {
|
||||||
|
binding = getDefinitionBinding((IASTFunctionDefinition) declaration);
|
||||||
|
}
|
||||||
|
if (binding instanceof ICPPMethod) {
|
||||||
|
method = (ICPPMethod) binding;
|
||||||
|
OverrideInfo overrideInfo = testForOverride(method, declaration.getFileLocation());
|
||||||
|
if (overrideInfo != null) {
|
||||||
|
handleResult(overrideInfo, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (DOMException e) {
|
||||||
|
}
|
||||||
|
// go to next declaration
|
||||||
|
return PROCESS_SKIP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class CompositeTypeFinder extends ASTVisitor {
|
||||||
|
{
|
||||||
|
shouldVisitDeclSpecifiers = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int visit(IASTDeclSpecifier declSpec) {
|
||||||
|
if (declSpec instanceof ICPPASTCompositeTypeSpecifier) {
|
||||||
|
declSpec.accept(new MethodDeclarationFinder());
|
||||||
|
}
|
||||||
|
return PROCESS_CONTINUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MethodDefinitionFinder extends ASTVisitor {
|
||||||
|
{
|
||||||
|
shouldVisitDeclarations = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int visit(IASTDeclaration declaration) {
|
||||||
|
try {
|
||||||
|
if (!(declaration instanceof IASTFunctionDefinition)) {
|
||||||
|
return PROCESS_SKIP;
|
||||||
|
}
|
||||||
|
IASTFunctionDefinition definition = (IASTFunctionDefinition) declaration;
|
||||||
|
IBinding definitionBinding = getDefinitionBinding(definition);
|
||||||
|
if (!(definitionBinding instanceof ICPPMethod)) {
|
||||||
|
return PROCESS_SKIP;
|
||||||
|
}
|
||||||
|
ICPPMethod method = (ICPPMethod) definitionBinding;
|
||||||
|
OverrideInfo overrideInfo = testForOverride(method, definition.getFileLocation());
|
||||||
|
if (overrideInfo != null) {
|
||||||
|
handleResult(overrideInfo, index);
|
||||||
|
}
|
||||||
|
} catch (DOMException e) {
|
||||||
|
}
|
||||||
|
return PROCESS_SKIP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ast.accept(new CompositeTypeFinder());
|
||||||
|
ast.accept(new MethodDefinitionFinder());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static OverrideInfo testForOverride(ICPPMethod testedOverride, IASTFileLocation location) throws DOMException {
|
||||||
|
|
||||||
|
testedOverride.getClassOwner().getBases();
|
||||||
|
|
||||||
|
boolean onlyPureVirtual = true;
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
Set<ICPPMethod> overridenMethods = new HashSet<ICPPMethod>();
|
||||||
|
Set<ICPPMethod> shadowedMethods = new HashSet<ICPPMethod>();
|
||||||
|
|
||||||
|
Set<ICPPClassType> alreadyTestedBases = new HashSet<ICPPClassType>();
|
||||||
|
|
||||||
|
ICPPBase[] bases = testedOverride.getClassOwner().getBases();
|
||||||
|
|
||||||
|
// Don't override 'self' in cyclic inheritance
|
||||||
|
alreadyTestedBases.add(testedOverride.getClassOwner());
|
||||||
|
|
||||||
|
for (ICPPBase base : bases) {
|
||||||
|
ICPPClassType testedClass;
|
||||||
|
if (!(base.getBaseClass() instanceof ICPPClassType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
testedClass = (ICPPClassType) base.getBaseClass();
|
||||||
|
|
||||||
|
overridenMethods.clear();
|
||||||
|
shadowedMethods.clear();
|
||||||
|
handleBaseClass(testedClass, testedOverride, overridenMethods, shadowedMethods, alreadyTestedBases);
|
||||||
|
|
||||||
|
for (ICPPMethod overriddenMethod : overridenMethods) {
|
||||||
|
|
||||||
|
if (sb.length() > 0) {
|
||||||
|
sb.append(MESSAGE_SEPARATOR);
|
||||||
|
}
|
||||||
|
if (overriddenMethod.isPureVirtual()) {
|
||||||
|
sb.append(CEditorMessages.OverrideIndicatorManager_implements);
|
||||||
|
} else {
|
||||||
|
sb.append(CEditorMessages.OverrideIndicatorManager_overrides);
|
||||||
|
onlyPureVirtual = false;
|
||||||
|
}
|
||||||
|
sb.append(' ');
|
||||||
|
sb.append(getQualifiedNameString(overriddenMethod));
|
||||||
|
|
||||||
|
if (bases.length > 1 && overriddenMethod.getClassOwner() != testedClass) {
|
||||||
|
sb.append(' ');
|
||||||
|
sb.append(CEditorMessages.OverrideIndicatorManager_via);
|
||||||
|
sb.append(' ');
|
||||||
|
sb.append(getQualifiedNameString(testedClass));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (ICPPMethod shadowedMethod : shadowedMethods) {
|
||||||
|
if (sb.length() > 0) {
|
||||||
|
sb.append(MESSAGE_SEPARATOR);
|
||||||
|
}
|
||||||
|
sb.append(CEditorMessages.OverrideIndicatorManager_shadows);
|
||||||
|
sb.append(' ');
|
||||||
|
sb.append(getQualifiedNameString(shadowedMethod));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int markerType;
|
||||||
|
if (overridenMethods.size() > 0) {
|
||||||
|
markerType = onlyPureVirtual ? RESULT_IMPLEMENTS : RESULT_OVERRIDES;
|
||||||
|
} else {
|
||||||
|
markerType = RESULT_SHADOWS;
|
||||||
|
}
|
||||||
|
|
||||||
|
IBinding bindingToOpen = null;
|
||||||
|
if (overridenMethods.size() > 0) {
|
||||||
|
bindingToOpen = overridenMethods.iterator().next();
|
||||||
|
} else if (shadowedMethods.size() > 0) {
|
||||||
|
bindingToOpen = shadowedMethods.iterator().next();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sb.length() > 0) {
|
||||||
|
OverrideInfo info = new OverrideInfo(location.getNodeOffset(), location.getNodeLength(), markerType,
|
||||||
|
sb.toString(), bindingToOpen);
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the class directly has a valid override for testedOverride, it is added to foundBindings. Otherwise
|
||||||
|
* each base class is added to handleBaseClass.
|
||||||
|
*
|
||||||
|
* @param shadowedMethods
|
||||||
|
* @param alreadyTestedBases
|
||||||
|
*
|
||||||
|
* @throws DOMException
|
||||||
|
*/
|
||||||
|
private static void handleBaseClass(ICPPClassType aClass, ICPPMethod testedOverride,
|
||||||
|
Set<ICPPMethod> foundMethods, Set<ICPPMethod> shadowedMethods, Set<ICPPClassType> alreadyTestedBases) throws DOMException {
|
||||||
|
|
||||||
|
if (alreadyTestedBases.contains(aClass)) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
alreadyTestedBases.add(aClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector<ICPPMethod> validOverrides = new Vector<ICPPMethod>();
|
||||||
|
for (ICPPMethod method : aClass.getDeclaredMethods()) {
|
||||||
|
if (testedOverride.getName().equals(method.getName())) {
|
||||||
|
if (ClassTypeHelper.isOverrider(testedOverride, method)) {
|
||||||
|
validOverrides.add(method);
|
||||||
|
} else if (sameParameters(testedOverride, method)) {
|
||||||
|
shadowedMethods.add(method);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (validOverrides.size() > 1) {
|
||||||
|
/* System.err.println("Found many valid overrides"); */
|
||||||
|
}
|
||||||
|
if (validOverrides.size() >= 1) {
|
||||||
|
foundMethods.addAll(validOverrides);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ICPPBase b : aClass.getBases()) {
|
||||||
|
if (!(b.getBaseClass() instanceof ICPPClassType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ICPPClassType baseClass = (ICPPClassType) b.getBaseClass();
|
||||||
|
handleBaseClass(baseClass, testedOverride, foundMethods, shadowedMethods, alreadyTestedBases);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean sameParameters(ICPPMethod a, ICPPMethod b) throws DOMException {
|
||||||
|
ICPPFunctionType aType = a.getType();
|
||||||
|
ICPPFunctionType bType = b.getType();
|
||||||
|
if (aType.getParameterTypes().length != bType.getParameterTypes().length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < aType.getParameterTypes().length; ++i) {
|
||||||
|
IType overrideParamType = aType.getParameterTypes()[i];
|
||||||
|
IType methodParamType = bType.getParameterTypes()[i];
|
||||||
|
if (!overrideParamType.isSameType(methodParamType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getQualifiedNameString(ICPPBinding binding) throws DOMException {
|
||||||
|
String methodQualifiedName = ASTStringUtil.join(binding.getQualifiedName(), "::"); //$NON-NLS-1$
|
||||||
|
return methodQualifiedName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isFunctionDeclaration(IASTDeclaration declaration) {
|
||||||
|
if (!(declaration instanceof IASTSimpleDeclaration)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
IASTSimpleDeclaration simpleDecl = (IASTSimpleDeclaration) declaration;
|
||||||
|
IASTDeclarator[] declarators = simpleDecl.getDeclarators();
|
||||||
|
if (declarators.length < 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
IASTDeclarator declarator = ASTQueries.findInnermostDeclarator(declarators[0]);
|
||||||
|
return (declarator instanceof IASTFunctionDeclarator);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IBinding getDefinitionBinding(IASTFunctionDefinition definition) {
|
||||||
|
IASTDeclarator declarator = ASTQueries.findInnermostDeclarator(definition.getDeclarator());
|
||||||
|
return declarator.getName().resolveBinding();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IBinding getDeclarationBinding(IASTDeclaration declaration) {
|
||||||
|
for (IASTNode node : declaration.getChildren()) {
|
||||||
|
if (node instanceof IASTDeclarator) {
|
||||||
|
IASTDeclarator decl = ASTQueries.findInnermostDeclarator((IASTDeclarator) node);
|
||||||
|
return decl.getName().resolveBinding();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void aboutToBeReconciled() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconciled(IASTTranslationUnit ast, boolean force, IProgressMonitor progressMonitor) {
|
||||||
|
if (ast == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IIndex index = ast.getIndex();
|
||||||
|
removeAnnotations();
|
||||||
|
generateAnnotations(ast, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the lock object for the given annotation model.
|
||||||
|
*
|
||||||
|
* @param annotationModel
|
||||||
|
* the annotation model
|
||||||
|
* @return the annotation model's lock object
|
||||||
|
*/
|
||||||
|
private Object getLockObject(IAnnotationModel annotationModel) {
|
||||||
|
if (annotationModel instanceof ISynchronizable) {
|
||||||
|
Object lock = ((ISynchronizable) annotationModel).getLockObject();
|
||||||
|
if (lock != null)
|
||||||
|
return lock;
|
||||||
|
}
|
||||||
|
return annotationModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -33,6 +33,8 @@ import org.eclipse.ui.texteditor.SelectMarkerRulerAction;
|
||||||
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.editor.OverrideIndicatorManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action which gets triggered when selecting (annotations) in the vertical ruler.
|
* Action which gets triggered when selecting (annotations) in the vertical ruler.
|
||||||
* based upon org.eclipse.jdt.internal.ui.javaeditor.JavaSelectMarkerRulerAction
|
* based upon org.eclipse.jdt.internal.ui.javaeditor.JavaSelectMarkerRulerAction
|
||||||
|
@ -45,6 +47,7 @@ public class CSelectAnnotationRulerAction extends SelectMarkerRulerAction {
|
||||||
private IPreferenceStore fStore;
|
private IPreferenceStore fStore;
|
||||||
private boolean fHasCorrection;
|
private boolean fHasCorrection;
|
||||||
private ResourceBundle fBundle;
|
private ResourceBundle fBundle;
|
||||||
|
private Annotation fAnnotation;
|
||||||
|
|
||||||
public CSelectAnnotationRulerAction(ResourceBundle bundle, String prefix, ITextEditor editor, IVerticalRulerInfo ruler) {
|
public CSelectAnnotationRulerAction(ResourceBundle bundle, String prefix, ITextEditor editor, IVerticalRulerInfo ruler) {
|
||||||
super(bundle, prefix, editor, ruler);
|
super(bundle, prefix, editor, ruler);
|
||||||
|
@ -69,6 +72,11 @@ public class CSelectAnnotationRulerAction extends SelectMarkerRulerAction {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void runWithEvent(Event event) {
|
public void runWithEvent(Event event) {
|
||||||
|
if (fAnnotation instanceof OverrideIndicatorManager.OverrideIndicator) {
|
||||||
|
((OverrideIndicatorManager.OverrideIndicator)fAnnotation).open();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (fHasCorrection) {
|
if (fHasCorrection) {
|
||||||
ITextOperationTarget operation= (ITextOperationTarget) fTextEditor.getAdapter(ITextOperationTarget.class);
|
ITextOperationTarget operation= (ITextOperationTarget) fTextEditor.getAdapter(ITextOperationTarget.class);
|
||||||
final int opCode= ISourceViewer.QUICK_ASSIST;
|
final int opCode= ISourceViewer.QUICK_ASSIST;
|
||||||
|
@ -91,6 +99,10 @@ public class CSelectAnnotationRulerAction extends SelectMarkerRulerAction {
|
||||||
findCAnnotation();
|
findCAnnotation();
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
|
|
||||||
|
if (fAnnotation instanceof OverrideIndicatorManager.OverrideIndicator) {
|
||||||
|
initialize(fBundle, "CSelectAnnotationRulerAction.OpenSuperImplementation."); //$NON-NLS-1$
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (fHasCorrection) {
|
if (fHasCorrection) {
|
||||||
initialize(fBundle, "CSelectAnnotationRulerAction.QuickFix."); //$NON-NLS-1$
|
initialize(fBundle, "CSelectAnnotationRulerAction.QuickFix."); //$NON-NLS-1$
|
||||||
return;
|
return;
|
||||||
|
@ -102,6 +114,7 @@ public class CSelectAnnotationRulerAction extends SelectMarkerRulerAction {
|
||||||
|
|
||||||
private void findCAnnotation() {
|
private void findCAnnotation() {
|
||||||
fPosition= null;
|
fPosition= null;
|
||||||
|
fAnnotation = null;
|
||||||
fHasCorrection= false;
|
fHasCorrection= false;
|
||||||
|
|
||||||
AbstractMarkerAnnotationModel model= getAnnotationModel();
|
AbstractMarkerAnnotationModel model= getAnnotationModel();
|
||||||
|
@ -135,6 +148,7 @@ public class CSelectAnnotationRulerAction extends SelectMarkerRulerAction {
|
||||||
if (!isReadOnly && CCorrectionProcessor.hasCorrections(annotation)) {
|
if (!isReadOnly && CCorrectionProcessor.hasCorrections(annotation)) {
|
||||||
|
|
||||||
fPosition= position;
|
fPosition= position;
|
||||||
|
fAnnotation = annotation;
|
||||||
fHasCorrection= true;
|
fHasCorrection= true;
|
||||||
layer= annotationLayer;
|
layer= annotationLayer;
|
||||||
continue;
|
continue;
|
||||||
|
@ -149,6 +163,7 @@ public class CSelectAnnotationRulerAction extends SelectMarkerRulerAction {
|
||||||
|
|
||||||
if (fStore.getBoolean(key)) {
|
if (fStore.getBoolean(key)) {
|
||||||
fPosition= position;
|
fPosition= position;
|
||||||
|
fAnnotation = annotation;
|
||||||
fHasCorrection= false;
|
fHasCorrection= false;
|
||||||
layer= annotationLayer;
|
layer= annotationLayer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue