Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 88005 Details for
Bug 216760
No 'Quick Fix' menu item for to CEditor ruler context menu
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to cdt,ui to add the menu item
cdtpatch.txt (text/plain), 11.46 KB, created by
David Perryman
on 2008-01-28 08:45:52 EST
(
hide
)
Description:
Patch to cdt,ui to add the menu item
Filename:
MIME Type:
Creator:
David Perryman
Created:
2008-01-28 08:45:52 EST
Size:
11.46 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.ui >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.ui/plugin.properties,v >retrieving revision 1.155 >diff -u -r1.155 plugin.properties >--- plugin.properties 18 Jan 2008 15:54:16 -0000 1.155 >+++ plugin.properties 28 Jan 2008 12:53:50 -0000 >@@ -173,6 +173,8 @@ > AddTask.tooltip=Add Task... > AddBookmark.label=Add Boo&kmark... > AddBookmark.tooltip=Add Bookmark... >+QuickFix.label=&Quick Fix >+QuickFix.tooltip=Quick Fix > > # C/C++ Search > CSearchPage.label= C/C++ Search >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.ui/plugin.xml,v >retrieving revision 1.312 >diff -u -r1.312 plugin.xml >--- plugin.xml 25 Jan 2008 10:26:49 -0000 1.312 >+++ plugin.xml 28 Jan 2008 12:53:54 -0000 >@@ -907,6 +907,13 @@ > menubarPath="add" > id="org.eclipse.ui.texteditor.BookmarkRulerAction"> > </action> >+ <action >+ label="%QuickFix.label" >+ class="org.eclipse.cdt.internal.ui.text.correction.CSelectRulerAction" >+ menubarPath="additions" >+ tooltip="%QuickFix.tooltip" >+ id="org.eclipse.cdt.internal.ui.text.correction.CSelectRulerAction"> >+ </action> > </viewerContribution> > <viewerContribution > targetID="#ASMEditorRulerContext" >Index: src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties,v >retrieving revision 1.45 >diff -u -r1.45 CEditorMessages.properties >--- src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties 21 Jan 2008 10:15:41 -0000 1.45 >+++ src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties 28 Jan 2008 12:53:54 -0000 >@@ -189,3 +189,13 @@ > OpenMacroExplorer.tooltip= Open a quick view for macro expansion exploration > OpenMacroExplorer.image= > OpenMacroExplorer.description= Opens a quick view for macro expansion exploration >+ >+CSelectAnnotationRulerAction.QuickFix.label= &Quick Fix >+CSelectAnnotationRulerAction.QuickFix.tooltip= Quick Fix >+CSelectAnnotationRulerAction.QuickFix.description= Runs Quick Fix on the annotation's line >+CSelectAnnotationRulerAction.QuickFix.image= >+ >+CSelectAnnotationRulerAction.GotoAnnotation.label= &Go to Annotation >+CSelectAnnotationRulerAction.GotoAnnotation.tooltip= Go to Annotation >+CSelectAnnotationRulerAction.GotoAnnotation.description= Selects the annotation in the editor >+CSelectAnnotationRulerAction.GotoAnnotation.image= >Index: src/org/eclipse/cdt/internal/ui/text/correction/CSelectAnnotationRulerAction.java >=================================================================== >RCS file: src/org/eclipse/cdt/internal/ui/text/correction/CSelectAnnotationRulerAction.java >diff -N src/org/eclipse/cdt/internal/ui/text/correction/CSelectAnnotationRulerAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/internal/ui/text/correction/CSelectAnnotationRulerAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,164 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2007 IBM Corporation 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: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.cdt.internal.ui.text.correction; >+ >+import java.util.Iterator; >+import java.util.ResourceBundle; >+ >+import org.eclipse.cdt.ui.CUIPlugin; >+import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.jface.text.IDocument; >+import org.eclipse.jface.text.ITextOperationTarget; >+import org.eclipse.jface.text.Position; >+import org.eclipse.jface.text.source.Annotation; >+import org.eclipse.jface.text.source.IAnnotationAccessExtension; >+import org.eclipse.jface.text.source.ISourceViewer; >+import org.eclipse.jface.text.source.IVerticalRulerInfo; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.ui.IMarkerHelpRegistry; >+import org.eclipse.ui.editors.text.EditorsUI; >+import org.eclipse.ui.ide.IDE; >+import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel; >+import org.eclipse.ui.texteditor.AnnotationPreference; >+import org.eclipse.ui.texteditor.AnnotationPreferenceLookup; >+import org.eclipse.ui.texteditor.ITextEditor; >+import org.eclipse.ui.texteditor.ITextEditorExtension; >+import org.eclipse.ui.texteditor.SelectMarkerRulerAction; >+import org.eclipse.ui.texteditor.SimpleMarkerAnnotation; >+ >+/** >+ * Action which gets triggered when selecting (annotations) in the vertical ruler. >+ * based upon org.eclipse.jdt.internal.ui.javaeditor.JavaSelectMarkerRulerAction >+ */ >+public class CSelectAnnotationRulerAction extends SelectMarkerRulerAction { >+ >+ private ITextEditor fTextEditor; >+ private Position fPosition; >+ private AnnotationPreferenceLookup fAnnotationPreferenceLookup; >+ private IPreferenceStore fStore; >+ private boolean fHasCorrection; >+ private ResourceBundle fBundle; >+ >+ public CSelectAnnotationRulerAction(ResourceBundle bundle, String prefix, ITextEditor editor, IVerticalRulerInfo ruler) { >+ super(bundle, prefix, editor, ruler); >+ fBundle= bundle; >+ fTextEditor= editor; >+ >+ fAnnotationPreferenceLookup= EditorsUI.getAnnotationPreferenceLookup(); >+ fStore= CUIPlugin.getDefault().getCombinedPreferenceStore(); >+ } >+ >+ public void run() { >+ // is there an equivalent preference for the C Editor? >+ // if (fStore.getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER)) >+ // return; >+ >+ runWithEvent(null); >+ } >+ >+ /* >+ * @see org.eclipse.jface.action.IAction#runWithEvent(org.eclipse.swt.widgets.Event) >+ */ >+ public void runWithEvent(Event event) { >+ if (fHasCorrection) { >+ ITextOperationTarget operation= (ITextOperationTarget) fTextEditor.getAdapter(ITextOperationTarget.class); >+ final int opCode= ISourceViewer.QUICK_ASSIST; >+ if (operation != null && operation.canDoOperation(opCode)) { >+ fTextEditor.selectAndReveal(fPosition.getOffset(), fPosition.getLength()); >+ operation.doOperation(opCode); >+ } >+ return; >+ } >+ >+ super.run(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.ui.texteditor.SelectMarkerRulerAction#update() >+ */ >+ public void update() { >+ findJavaAnnotation(); >+ setEnabled(true); >+ >+ if (fHasCorrection) { >+ initialize(fBundle, "CSelectAnnotationRulerAction.QuickFix."); //$NON-NLS-1$ >+ return; >+ } >+ >+ initialize(fBundle, "CSelectAnnotationRulerAction.GotoAnnotation."); //$NON-NLS-1$; >+ super.update(); >+ } >+ >+ private void findJavaAnnotation() { >+ fPosition= null; >+ fHasCorrection= false; >+ >+ AbstractMarkerAnnotationModel model= getAnnotationModel(); >+ IAnnotationAccessExtension annotationAccess= getAnnotationAccessExtension(); >+ >+ IDocument document= getDocument(); >+ if (model == null) >+ return ; >+ >+ Iterator iter= model.getAnnotationIterator(); >+ int layer= Integer.MIN_VALUE; >+ >+ while (iter.hasNext()) { >+ Annotation 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(); >+ boolean canFix = false; >+ if (annotation instanceof SimpleMarkerAnnotation) { >+ SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) annotation; >+ >+ IMarkerHelpRegistry registry = IDE.getMarkerHelpRegistry(); >+ canFix = registry != null && registry.hasResolutions(markerAnnotation.getMarker()); >+ } >+ >+ if (!isReadOnly && canFix) { >+ >+ fPosition= position; >+ fHasCorrection= true; >+ layer= annotationLayer; >+ continue; >+ } else { >+ AnnotationPreference preference= fAnnotationPreferenceLookup.getAnnotationPreference(annotation); >+ if (preference == null) >+ continue; >+ >+ String key= preference.getVerticalRulerPreferenceKey(); >+ if (key == null) >+ continue; >+ >+ if (fStore.getBoolean(key)) { >+ fPosition= position; >+ fHasCorrection= false; >+ layer= annotationLayer; >+ } >+ } >+ } >+ } >+} >+ >Index: src/org/eclipse/cdt/internal/ui/text/correction/CSelectRulerAction.java >=================================================================== >RCS file: src/org/eclipse/cdt/internal/ui/text/correction/CSelectRulerAction.java >diff -N src/org/eclipse/cdt/internal/ui/text/correction/CSelectRulerAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/internal/ui/text/correction/CSelectRulerAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2005 IBM Corporation 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: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.cdt.internal.ui.text.correction; >+ >+import org.eclipse.cdt.internal.ui.editor.CEditorMessages; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.text.source.IVerticalRulerInfo; >+import org.eclipse.ui.texteditor.AbstractRulerActionDelegate; >+import org.eclipse.ui.texteditor.ITextEditor; >+ >+public class CSelectRulerAction extends AbstractRulerActionDelegate { >+ >+ /* >+ * @see AbstractRulerActionDelegate#createAction(ITextEditor, IVerticalRulerInfo) >+ */ >+ protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) { >+ return new CSelectAnnotationRulerAction(CEditorMessages.getResourceBundle(), "CSelectAnnotationRulerAction.", editor, rulerInfo); //$NON-NLS-1$ >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 216760
:
88005
|
88267