diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/DelegatingDropAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/DelegatingDropAdapter.java
index 102ccc8b967..c6c5333db5d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/DelegatingDropAdapter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/DelegatingDropAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2005 QNX Software Systems and others.
+ * Copyright (c) 2002, 2006 QNX Software Systems 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
@@ -11,7 +11,7 @@
package org.eclipse.cdt.internal.ui.dnd;
-import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.swt.dnd.DND;
@@ -79,7 +79,7 @@ public class DelegatingDropAdapter implements DropTargetListener {
// operation change. otherwise the new listener would get a dragEnter
// followed by a dragOperationChanged with the exact same event.
if (newListener != null && newListener == oldListener) {
- Platform.run(new SafeRunnable() {
+ SafeRunner.run(new SafeRunnable() {
public void run() throws Exception {
newListener.dragOperationChanged(event);
}
@@ -105,7 +105,7 @@ public class DelegatingDropAdapter implements DropTargetListener {
// drag over. otherwise the new listener would get a dragEnter
// followed by a dragOver with the exact same event.
if (newListener != null && newListener == oldListener) {
- Platform.run(new SafeRunnable() {
+ SafeRunner.run(new SafeRunnable() {
public void run() throws Exception {
newListener.dragOver(event);
}
@@ -123,7 +123,7 @@ public class DelegatingDropAdapter implements DropTargetListener {
public void drop(final DropTargetEvent event) {
updateCurrentListener(event);
if (getCurrentListener() != null) {
- Platform.run(new SafeRunnable() {
+ SafeRunner.run(new SafeRunnable() {
public void run() throws Exception {
getCurrentListener().drop(event);
}
@@ -140,7 +140,7 @@ public class DelegatingDropAdapter implements DropTargetListener {
*/
public void dropAccept(final DropTargetEvent event) {
if (getCurrentListener() != null) {
- Platform.run(new SafeRunnable() {
+ SafeRunner.run(new SafeRunnable() {
public void run() throws Exception {
getCurrentListener().dropAccept(event);
}
@@ -203,7 +203,7 @@ public class DelegatingDropAdapter implements DropTargetListener {
if (fCurrentListener == listener)
return false;
if (fCurrentListener != null) {
- Platform.run(new SafeRunnable() {
+ SafeRunner.run(new SafeRunnable() {
public void run() throws Exception {
fCurrentListener.dragLeave(event);
}
@@ -211,7 +211,7 @@ public class DelegatingDropAdapter implements DropTargetListener {
}
fCurrentListener= listener;
if (fCurrentListener != null) {
- Platform.run(new SafeRunnable() {
+ SafeRunner.run(new SafeRunnable() {
public void run() throws Exception {
fCurrentListener.dragEnter(event);
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java
index c253cd0c730..c74a89d9109 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java
@@ -128,8 +128,6 @@ public class AddIncludeOnSelectionAction extends Action implements IUpdate {
* Extract the includes for the given selection. This can be both used to perform
* the work as well as being invoked when there is a change. The actual results
* can and should be cached as the lookup process could be potentially costly.
- *
- * @return IRequiredInclude [] An array of the required includes, or null if this action is invalid.
*/
private void extractIncludes(ITextEditor editor) {
if (editor == null) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java
index 8eef208b54d..211b3a37aa2 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java
@@ -155,9 +155,9 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
}
/**
- * Returns the CEditor corresponding to this CContentOutlinePage.
- * @param return
- */
+ * Provide access to the CEditor corresponding to this CContentOutlinePage.
+ * @returns the CEditor corresponding to this CContentOutlinePage.
+ */
public CEditor getEditor() {
return fEditor;
}
@@ -364,7 +364,7 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
/**
* Fires a selection changed event.
*
- * @param selction the new selection
+ * @param selection the new selection
*/
protected void fireSelectionChanged(ISelection selection) {
// create an event
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java
index 77925084abe..430a616e7ed 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java
@@ -126,11 +126,7 @@ public class CContentOutlinerProvider extends BaseCElementContentProvider {
* Called after CEditor contents is changed.
* Existing elements can change their offset and length.
*
- * @param offset
- * position where source was changed
- * @param size
- * length of ins
- * ertion (negaive for deletion)
+ * @param sdata delta information
*/
public void contentShift(CShiftData sdata) {
try {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
index ce9e7c8a81e..8a7217d77c7 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
@@ -15,17 +15,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.IProblemRequestor;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.core.model.IWorkingCopy;
-import org.eclipse.cdt.core.parser.IProblem;
-import org.eclipse.cdt.internal.core.model.IBufferFactory;
-import org.eclipse.cdt.internal.ui.CFileElementWorkingCopy;
-import org.eclipse.cdt.internal.ui.CPluginImages;
-import org.eclipse.cdt.internal.ui.text.IProblemRequestorExtension;
-import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.cdt.ui.PreferenceConstants;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
@@ -55,7 +44,6 @@ import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.editors.text.TextFileDocumentProvider;
@@ -65,6 +53,20 @@ import org.eclipse.ui.texteditor.MarkerAnnotation;
import org.eclipse.ui.texteditor.MarkerUtilities;
import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.IProblemRequestor;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.core.model.IWorkingCopy;
+import org.eclipse.cdt.core.parser.IProblem;
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.PreferenceConstants;
+
+import org.eclipse.cdt.internal.core.model.IBufferFactory;
+
+import org.eclipse.cdt.internal.ui.CFileElementWorkingCopy;
+import org.eclipse.cdt.internal.ui.CPluginImages;
+import org.eclipse.cdt.internal.ui.text.IProblemRequestorExtension;
+
/**
* CDocumentProvider2
*/
@@ -162,7 +164,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
private void initializeImages() {
// http://bugs.eclipse.org/bugs/show_bug.cgi?id=18936
if (!fQuickFixImagesInitialized) {
- if (isProblem() && indicateQuixFixableProblems() /*&& JavaCorrectionProcessor.hasCorrections(this)*/) { // no light bulb for tasks
+ if (isProblem() && indicateQuixFixableProblems()) { // no light bulb for tasks
if (!fgQuickFixImagesInitialized) {
fgQuickFixImage= CPluginImages.get(CPluginImages.IMG_OBJS_FIXABLE_PROBLEM);
fgQuickFixErrorImage= CPluginImages.get(CPluginImages.IMG_OBJS_FIXABLE_ERROR);
@@ -180,9 +182,9 @@ public class CDocumentProvider extends TextFileDocumentProvider {
private boolean indicateQuixFixableProblems() {
return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CORRECTION_INDICATION);
}
-
+
/*
- * @see Annotation#paint
+ * @see org.eclipse.jface.text.source.IAnnotationPresentation#paint(org.eclipse.swt.graphics.GC, org.eclipse.swt.widgets.Canvas, org.eclipse.swt.graphics.Rectangle)
*/
public void paint(GC gc, Canvas canvas, Rectangle r) {
initializeImages();
@@ -191,14 +193,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
}
}
- /*
- * @see ICAnnotation#getImage(Display)
- */
- public Image getImage(Display display) {
- initializeImages();
- return fImage;
- }
-
/*
* @see ICAnnotation#getMessage()
*/
@@ -766,8 +760,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
/** Preference key for temporary problems */
private final static String HANDLE_TEMPORARY_PROBLEMS= PreferenceConstants.EDITOR_EVALUATE_TEMPORARY_PROBLEMS;
- /** Indicates whether the save has been initialized by this provider */
- private boolean fIsAboutToSave = false;
/** Internal property changed listener */
private IPropertyChangeListener fPropertyListener;
/** Annotation model listener added to all created CU annotation models */
@@ -903,7 +895,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
// fSavePolicy.preSave(info.fCopy);
try {
- fIsAboutToSave = true;
//info.fCopy.commit(overwrite, monitor);
commitFileBuffer(monitor, info, overwrite);
} catch (CoreException x) {
@@ -915,7 +906,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
fireElementStateChangeFailed(element);
throw x;
} finally {
- fIsAboutToSave = false;
}
// If here, the dirty state of the editor will change to "not dirty".
@@ -1021,7 +1011,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
/**
* Returns the underlying resource for the given element.
*
- * @param the element
+ * @param element the element
* @return the underlying resource of the given element
*/
public IResource getUnderlyingResource(Object element) {
@@ -1032,20 +1022,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
return null;
}
- /*
- * @see org.eclipse.jdt.internal.ui.javaeditor.ICompilationUnitDocumentProvider#saveDocumentContent(org.eclipse.core.runtime.IProgressMonitor,
- * java.lang.Object, org.eclipse.jface.text.IDocument, boolean)
- */
- public void saveDocumentContent(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite)
- throws CoreException {
- if (!fIsAboutToSave)
- return;
- super.saveDocument(monitor, element, document, overwrite);
- }
-
- /*
- * @see org.eclipse.jdt.internal.ui.javaeditor.ICompilationUnitDocumentProvider#createLineTracker(java.lang.Object)
- */
public ILineTracker createLineTracker(Object element) {
return new DefaultLineTracker();
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
index 912759edf2b..c13708e47de 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
@@ -8,50 +8,16 @@
* Contributors:
* IBM Corporation - initial API and implementation
* QNX Software System
- * Anton Leherbauer, Wind River Systems, Inc.
+ * Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.editor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.Iterator;
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.CCorePreferenceConstants;
-import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ISourceRange;
-import org.eclipse.cdt.core.model.ISourceReference;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.internal.ui.ICHelpContextIds;
-import org.eclipse.cdt.internal.ui.IContextMenuConstants;
-import org.eclipse.cdt.internal.ui.actions.AddBlockCommentAction;
-import org.eclipse.cdt.internal.ui.actions.FoldingActionGroup;
-import org.eclipse.cdt.internal.ui.actions.GoToNextPreviousMemberAction;
-import org.eclipse.cdt.internal.ui.actions.JoinLinesAction;
-import org.eclipse.cdt.internal.ui.actions.RemoveBlockCommentAction;
-import org.eclipse.cdt.internal.ui.dnd.TextEditorDropAdapter;
-import org.eclipse.cdt.internal.ui.dnd.TextViewerDragAdapter;
-import org.eclipse.cdt.internal.ui.search.actions.OpenDeclarationsAction;
-import org.eclipse.cdt.internal.ui.search.actions.OpenDefinitionAction;
-import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
-import org.eclipse.cdt.internal.ui.text.CPairMatcher;
-import org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration;
-import org.eclipse.cdt.internal.ui.text.CTextTools;
-import org.eclipse.cdt.internal.ui.text.contentassist.ContentAssistPreference;
-import org.eclipse.cdt.internal.ui.util.CUIHelp;
-import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.cdt.ui.IWorkingCopyManager;
-import org.eclipse.cdt.ui.PreferenceConstants;
-import org.eclipse.cdt.ui.actions.ShowInCViewAction;
-import org.eclipse.cdt.ui.text.folding.ICFoldingStructureProvider;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
@@ -86,7 +52,6 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.search.ui.actions.TextSearchGroup;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.dnd.DND;
@@ -104,30 +69,57 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPartService;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.part.EditorActionBarContributor;
import org.eclipse.ui.part.IShowInSource;
import org.eclipse.ui.part.IShowInTargetList;
import org.eclipse.ui.part.ShowInContext;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
-import org.eclipse.ui.texteditor.AnnotationPreference;
import org.eclipse.ui.texteditor.ContentAssistAction;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.IEditorStatusLine;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.ITextEditorDropTargetListener;
-import org.eclipse.ui.texteditor.MarkerAnnotation;
import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
import org.eclipse.ui.texteditor.TextOperationAction;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.CCorePreferenceConstants;
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ISourceRange;
+import org.eclipse.cdt.core.model.ISourceReference;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.IWorkingCopyManager;
+import org.eclipse.cdt.ui.PreferenceConstants;
+import org.eclipse.cdt.ui.actions.ShowInCViewAction;
+import org.eclipse.cdt.ui.text.folding.ICFoldingStructureProvider;
+
+import org.eclipse.cdt.internal.ui.ICHelpContextIds;
+import org.eclipse.cdt.internal.ui.IContextMenuConstants;
+import org.eclipse.cdt.internal.ui.actions.AddBlockCommentAction;
+import org.eclipse.cdt.internal.ui.actions.FoldingActionGroup;
+import org.eclipse.cdt.internal.ui.actions.GoToNextPreviousMemberAction;
+import org.eclipse.cdt.internal.ui.actions.JoinLinesAction;
+import org.eclipse.cdt.internal.ui.actions.RemoveBlockCommentAction;
+import org.eclipse.cdt.internal.ui.dnd.TextEditorDropAdapter;
+import org.eclipse.cdt.internal.ui.dnd.TextViewerDragAdapter;
+import org.eclipse.cdt.internal.ui.search.actions.OpenDeclarationsAction;
+import org.eclipse.cdt.internal.ui.search.actions.OpenDefinitionAction;
+import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
+import org.eclipse.cdt.internal.ui.text.CPairMatcher;
+import org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration;
+import org.eclipse.cdt.internal.ui.text.CTextTools;
+import org.eclipse.cdt.internal.ui.text.contentassist.ContentAssistPreference;
+import org.eclipse.cdt.internal.ui.util.CUIHelp;
+
/**
* C specific text editor.
@@ -206,21 +198,9 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
/**
* The action group for folding.
- *
*/
private FoldingActionGroup fFoldingGroup;
- /**
- * Indicates whether this editor is about to update any annotation views.
- * @since 3.0
- */
- private boolean fIsUpdatingAnnotationViews= false;
- /**
- * The marker that served as last target for a goto marker request.
- * @since 3.0
- */
- private IMarker fLastMarkerTarget= null;
-
/**
* Default constructor.
*/
@@ -868,43 +848,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
dragSource.addDragListener(dragSourceListener);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#gotoMarker(org.eclipse.core.resources.IMarker)
- */
- public void gotoMarker(IMarker marker) {
- fLastMarkerTarget= marker;
- if (!fIsUpdatingAnnotationViews) {
- super.gotoMarker(marker);
- }
- }
-
- /**
- * Jumps to the next enabled annotation according to the given direction.
- * An annotation type is enabled if it is configured to be in the
- * Next/Previous tool bar drop down menu and if it is checked.
- *
- * @param forward true
if search direction is forward, false
if backward
- */
- public Annotation gotoAnnotation(boolean forward) {
- Annotation annotation = null;
- ITextSelection selection= (ITextSelection) getSelectionProvider().getSelection();
- Position position= new Position(0, 0);
- if (false /* delayed - see bug 18316 */) {
- getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position);
- selectAndReveal(position.getOffset(), position.getLength());
- } else /* no delay - see bug 18316 */ {
- annotation= getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position);
- setStatusLineErrorMessage(null);
- setStatusLineMessage(null);
- if (annotation != null) {
- updateAnnotationViews(annotation);
- selectAndReveal(position.getOffset(), position.getLength());
- setStatusLineMessage(annotation.getText());
- }
- }
- return annotation;
- }
-
/**
* Jumps to the matching bracket.
*/
@@ -969,161 +912,18 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
sourceViewer.revealRange(targetOffset, selection.getLength());
}
-
- /**
- * Returns whether the given annotation is configured as a target for the
- * "Go to Next/Previous Annotation" actions
- *
- * @param annotation the annotation
- * @return true
if this is a target, false
- * otherwise
- * @since 3.0
- */
- protected boolean isNavigationTarget(Annotation annotation) {
- Preferences preferences= EditorsUI.getPluginPreferences();
- AnnotationPreference preference= getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
-// See bug 41689
-// String key= forward ? preference.getIsGoToNextNavigationTargetKey() : preference.getIsGoToPreviousNavigationTargetKey();
- String key= preference == null ? null : preference.getIsGoToNextNavigationTargetKey();
- return (key != null && preferences.getBoolean(key));
- }
-
- /**
- * Returns the annotation closest to the given range respecting the given
- * direction. If an annotation is found, the annotations current position
- * is copied into the provided annotation position.
- *
- * @param offset the region offset
- * @param length the region length
- * @param forward true
for forwards, false
for backward
- * @param annotationPosition the position of the found annotation
- * @return the found annotation
- */
- private Annotation getNextAnnotation(final int offset, final int length, boolean forward, Position annotationPosition) {
-
- Annotation nextAnnotation= null;
- Position nextAnnotationPosition= null;
- Annotation containingAnnotation= null;
- Position containingAnnotationPosition= null;
- boolean currentAnnotation= false;
-
- IDocument document= getDocumentProvider().getDocument(getEditorInput());
- int endOfDocument= document.getLength();
- int distance= Integer.MAX_VALUE;
-
- IAnnotationModel model= getDocumentProvider().getAnnotationModel(getEditorInput());
- Iterator e= new CAnnotationIterator(model, true, true);
- while (e.hasNext()) {
- Annotation a= (Annotation) e.next();
- if ((a instanceof ICAnnotation) && ((ICAnnotation)a).hasOverlay() || !isNavigationTarget(a))
- continue;
-
- Position p= model.getPosition(a);
- if (p == null)
- continue;
-
- if (forward && p.offset == offset || !forward && p.offset + p.getLength() == offset + length) {// || p.includes(offset)) {
- if (containingAnnotation == null || (forward && p.length >= containingAnnotationPosition.length || !forward && p.length >= containingAnnotationPosition.length)) {
- containingAnnotation= a;
- containingAnnotationPosition= p;
- currentAnnotation= (p.length == length) || (p.length - 1 == length);
- }
- } else {
- int currentDistance= 0;
-
- if (forward) {
- currentDistance= p.getOffset() - offset;
- if (currentDistance < 0)
- currentDistance= endOfDocument + currentDistance;
-
- if (currentDistance < distance || currentDistance == distance && p.length < nextAnnotationPosition.length) {
- distance= currentDistance;
- nextAnnotation= a;
- nextAnnotationPosition= p;
- }
- } else {
- currentDistance= offset + length - (p.getOffset() + p.length);
- if (currentDistance < 0)
- currentDistance= endOfDocument + currentDistance;
-
- if (currentDistance < distance || currentDistance == distance && p.length < nextAnnotationPosition.length) {
- distance= currentDistance;
- nextAnnotation= a;
- nextAnnotationPosition= p;
- }
- }
- }
- }
- if (containingAnnotationPosition != null && (!currentAnnotation || nextAnnotation == null)) {
- annotationPosition.setOffset(containingAnnotationPosition.getOffset());
- annotationPosition.setLength(containingAnnotationPosition.getLength());
- return containingAnnotation;
- }
- if (nextAnnotationPosition != null) {
- annotationPosition.setOffset(nextAnnotationPosition.getOffset());
- annotationPosition.setLength(nextAnnotationPosition.getLength());
- }
-
- return nextAnnotation;
- }
-
protected void updateStatusLine() {
ITextSelection selection= (ITextSelection) getSelectionProvider().getSelection();
Annotation annotation= getAnnotation(selection.getOffset(), selection.getLength());
setStatusLineErrorMessage(null);
setStatusLineMessage(null);
if (annotation != null) {
- try {
- fIsUpdatingAnnotationViews= true;
- updateAnnotationViews(annotation);
- } finally {
- fIsUpdatingAnnotationViews= false;
- }
+ updateMarkerViews(annotation);
if (annotation instanceof ICAnnotation && ((ICAnnotation) annotation).isProblem())
setStatusLineMessage(annotation.getText());
}
}
- /**
- * Updates the annotation views that show the given annotation.
- *
- * @param annotation the annotation
- */
- private void updateAnnotationViews(Annotation annotation) {
- IMarker marker= null;
- if (annotation instanceof MarkerAnnotation)
- marker= ((MarkerAnnotation) annotation).getMarker();
- else if (annotation instanceof ICAnnotation) {
- Iterator e= ((ICAnnotation) annotation).getOverlaidIterator();
- if (e != null) {
- while (e.hasNext()) {
- Object o= e.next();
- if (o instanceof MarkerAnnotation) {
- marker= ((MarkerAnnotation) o).getMarker();
- break;
- }
- }
- }
- }
-
- if (marker != null && !marker.equals(fLastMarkerTarget)) {
- try {
- boolean isProblem= marker.isSubtypeOf(IMarker.PROBLEM);
- IWorkbenchPage page= getSite().getPage();
- IViewPart view= page.findView(isProblem ? IPageLayout.ID_PROBLEM_VIEW: IPageLayout.ID_TASK_LIST);
- if (view != null) {
- Method method= view.getClass().getMethod("setSelection", new Class[] { IStructuredSelection.class, boolean.class}); //$NON-NLS-1$
- method.invoke(view, new Object[] {new StructuredSelection(marker), Boolean.TRUE });
- }
- } catch (CoreException x) {
- } catch (NoSuchMethodException x) {
- } catch (IllegalAccessException x) {
- } catch (InvocationTargetException x) {
- }
- // ignore exceptions, don't update any of the lists, just set status line
- }
- }
-
/**
* Returns the annotation overlapping with the given range or null
.
*
@@ -1151,7 +951,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
* @see org.eclipse.ui.part.IShowInSource#getShowInContext()
*
* This is required by the IShowInSource interface for the "ShowIn"
- * navigation menu generalized in Eclipse.
+ * navigation menu generalized in Eclipse.
*/
public ShowInContext getShowInContext() {
return new ShowInContext( getEditorInput(), null );
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java
index 335bc1612cb..ef05572321d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
+ * Copyright (c) 2005, 2006 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
@@ -75,9 +75,9 @@ public class CEditorActionContributor extends TextEditorActionContributor {
boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode));
setEnabled(isEnabled);
}
-
- /**
- * @see Action#run()
+
+ /*
+ * @see org.eclipse.jface.action.Action#run()
*/
public void run() {
if (fOperationCode != -1 && fOperationTarget != null)
@@ -134,9 +134,8 @@ public class CEditorActionContributor extends TextEditorActionContributor {
}
-
- /**
- * @see IActionBarContributor#contributeToMenu(MenuManager)
+ /*
+ * @see org.eclipse.ui.texteditor.BasicTextEditorActionContributor#contributeToMenu(org.eclipse.jface.action.IMenuManager)
*/
public void contributeToMenu(IMenuManager menu) {
@@ -178,8 +177,8 @@ public class CEditorActionContributor extends TextEditorActionContributor {
}
- /**
- * @see IEditorActionBarContributor#setActiveEditor(IEditorPart)
+ /*
+ * @see org.eclipse.ui.editors.text.TextEditorActionContributor#setActiveEditor(org.eclipse.ui.IEditorPart)
*/
public void setActiveEditor(IEditorPart part) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CMarkerAnnotation.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CMarkerAnnotation.java
index 80dbf3167fc..e7eab6f494e 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CMarkerAnnotation.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CMarkerAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
+ * Copyright (c) 2005, 2006 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
@@ -8,26 +8,21 @@
* Contributors:
* IBM Corporation - initial API and implementation
* QNX Software System
+ * Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.editor;
import java.util.Iterator;
-import java.util.Map;
-import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.texteditor.MarkerAnnotation;
+import org.eclipse.ui.texteditor.MarkerUtilities;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICModelMarker;
import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.search.ui.SearchUI;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.texteditor.MarkerAnnotation;
-import org.eclipse.ui.texteditor.MarkerUtilities;
public class CMarkerAnnotation extends MarkerAnnotation implements IProblemAnnotation, ICAnnotation {
@@ -39,159 +34,12 @@ public class CMarkerAnnotation extends MarkerAnnotation implements IProblemAnnot
public static final String TASK_ANNOTATION_TYPE= "org.eclipse.ui.workbench.texteditor.task"; //$NON-NLS-1$
private boolean fIsProblemMarker;
- private IDocument fDocument;
- private int error_start = -1;
- private int error_length = 0;
private ICAnnotation fOverlay;
public CMarkerAnnotation(IMarker marker, IDocument document) {
super(marker);
- fDocument = document;
- if (MarkerUtilities.isMarkerType(getMarker(), ICModelMarker.C_MODEL_PROBLEM_MARKER)) {
- fIsProblemMarker = true;
- try {
- String var = (String) getMarker().getAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE);
- if(var != null && fDocument != null) {
- int line = getMarker().getAttribute(IMarker.LOCATION, -1) - 1;
- if(line >= 0) {
- int position = fDocument.getLineOffset(line);
- String text = fDocument.get(position, fDocument.getLineLength(line));
- int start = 0, end, pos;
- pos = 0;
- while(start != -1) {
- start = getStart(text, var, pos);
- if(start >= 0) {
- if(Character.isJavaIdentifierStart(text.charAt(start + var.length())) == false) {
- break;
- }
- }
- pos += var.length();
- }
- //start = text.indexOf(var);
- if(start >= 0) {
- end = start + var.length();
- // We cannot just update the marker attributes as the workspace resource tree is locked
- Map map = marker.getAttributes();
- MarkerUtilities.setCharStart(map, position+start);
- MarkerUtilities.setCharEnd(map, position+end);
- error_start = position+start;
- error_length = end-start;
-
- //getMarker().setAttribute(IMarker.CHAR_START, position+start);
- //getMarker().setAttribute(IMarker.CHAR_END, position+end);
- }
- }
- }
- } catch (CoreException e) {
- } catch (BadLocationException e) {
- }
- }
- }
- /**
- * Ensures that we return a value that is not encased in a String
- */
- private int getStart(String text, String var, int pos){
-
- // determine if there are more than one instance of var in this text
- int count = 0;
- int currentPosition = pos;
- while(currentPosition != -1){
- currentPosition = text.indexOf(var, currentPosition);
- if (currentPosition != -1){
- // found one!
- count++;
- currentPosition += var.length();
- }
- }
- // only one occurrence return its index
- if (count == 1){
- return text.indexOf(var, pos);
- }
-
- // otherwise we need to find the first one not inside of quotes
- int indexOfStringStart = pos;
-
- final String QUOTE = "\""; //$NON-NLS-1$
- indexOfStringStart = text.indexOf(QUOTE, indexOfStringStart);
- int newPosition = -1;
- currentPosition = pos; // reinitialize currentPosition
-
- if (indexOfStringStart == -1) {
- // No Strings ... return the first occurrence of var
- newPosition = text.indexOf(var, currentPosition);
- } else {
- // we have Strings
- StringTokenizer tokens = new StringTokenizer(text.substring(currentPosition), QUOTE, true);
- String nextToken = null;
- int quoteCount = 0;
- int potentialStart = -1;
- boolean found = false;
-
- while (tokens.hasMoreTokens() && !found){
- nextToken = tokens.nextToken();
- if(QUOTE.equals(nextToken)){
- quoteCount++;
- } else {
- if ((quoteCount % 2) == 0){
- // no open quotes .. we can check this token
- potentialStart = nextToken.indexOf(var, 0);
- if (potentialStart != -1){
- found = true;
- currentPosition += potentialStart;
- newPosition = currentPosition;
- break;
- }
- }// else ... we have an open quote and must
- // throw away this non-quote token
- }
- currentPosition += nextToken.length();
- }
- }
-
- return newPosition;
- }
-
- /**
- * Initializes the annotation's icon representation and its drawing layer
- * based upon the properties of the underlying marker.
- */
- protected void initialize() {
- try {
- IMarker marker= getMarker();
-
- if (MarkerUtilities.isMarkerType(marker, SearchUI.SEARCH_MARKER)) {
- setLayer(2);
- setImage(SearchUI.getSearchMarkerImage());
- fIsProblemMarker= false;
- return;
- } else if (MarkerUtilities.isMarkerType(getMarker(), ICModelMarker.C_MODEL_PROBLEM_MARKER)) {
- fIsProblemMarker = true;
- String var = (String) marker.getAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE);
- if(var != null && fDocument != null) {
- int line = marker.getAttribute(IMarker.LOCATION, -1);
- if(line >= 0 && line == -1) {
- try {
- int position = fDocument.getLineOffset(line);
- System.out.println("offset " + position); //$NON-NLS-1$
- String text = fDocument.get(position, fDocument.getLineLength(line));
- System.out.println("text:" + text); //$NON-NLS-1$
- } catch (BadLocationException e) {}
- }
- }
- } else {
- if(marker.isSubtypeOf(ICModelMarker.C_MODEL_PROBLEM_MARKER)) { //|| getMarker().isSubtypeOf(IMarker.SEVERITY_WARNING)) {
- fIsProblemMarker= true;
- } else if (marker.isSubtypeOf(IMarker.TASK) || marker.isSubtypeOf(ICModelMarker.TASK_MARKER)) {
- fIsProblemMarker= false;
- } else
- fIsProblemMarker = true;
- }
-
- } catch (CoreException e) {
- }
-
- super.initialize();
+ fIsProblemMarker = MarkerUtilities.isMarkerType(getMarker(), ICModelMarker.C_MODEL_PROBLEM_MARKER);
}
/**
@@ -252,20 +100,13 @@ public class CMarkerAnnotation extends MarkerAnnotation implements IProblemAnnot
return 0;
}
- /**
- * @see IProblemAnnotation#isProblem()
+ /*
+ * @see org.eclipse.cdt.internal.ui.editor.IProblemAnnotation#isProblem()
*/
public boolean isProblem() {
return fIsProblemMarker;
}
- public int getErrorStart() {
- return error_start;
- }
- public int getErrorLength() {
- return error_length;
- }
-
/**
* Overlays this annotation with the given cAnnotation.
*
@@ -329,12 +170,4 @@ public class CMarkerAnnotation extends MarkerAnnotation implements IProblemAnnot
}
return null;
}
-
- /*
- * @see org.eclipse.cdt.internal.ui.editor.ICAnnotation#getImage(org.eclipse.swt.widgets.Display)
- */
- public Image getImage(Display display) {
- return super.getImage(display);
- }
-
}
\ No newline at end of file
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java
index e79311779b4..edf96d85a2f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
+ * Copyright (c) 2002, 2006 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
@@ -242,14 +242,14 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#append(char)
+ * @see org.eclipse.cdt.core.model.IBuffer#append(char[])
*/
public void append(char[] text) {
append(new String(text));
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#append(java.lang.String)
+ * @see org.eclipse.cdt.core.model.IBuffer#append(java.lang.String)
*/
public void append(String text) {
if (DEBUG_LINE_DELIMITERS) {
@@ -260,7 +260,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#close()
+ * @see org.eclipse.cdt.core.model.IBuffer#close()
*/
public void close() {
@@ -286,7 +286,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#getChar(int)
+ * @see org.eclipse.cdt.core.model.IBuffer#getChar(int)
*/
public char getChar(int position) {
try {
@@ -297,7 +297,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#getCharacters()
+ * @see org.eclipse.cdt.core.model.IBuffer#getCharacters()
*/
public char[] getCharacters() {
String content= getContents();
@@ -305,28 +305,28 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#getContents()
+ * @see org.eclipse.cdt.core.model.IBuffer#getContents()
*/
public String getContents() {
return fDocument.get();
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#getLength()
+ * @see org.eclipse.cdt.core.model.IBuffer#getLength()
*/
public int getLength() {
return fDocument.getLength();
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#getOwner()
+ * @see org.eclipse.cdt.core.model.IBuffer#getOwner()
*/
public IOpenable getOwner() {
return fOwner;
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#getText(int, int)
+ * @see org.eclipse.cdt.core.model.IBuffer#getText(int, int)
*/
public String getText(int offset, int length) {
try {
@@ -337,28 +337,28 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#getUnderlyingResource()
+ * @see org.eclipse.cdt.core.model.IBuffer#getUnderlyingResource()
*/
public IResource getUnderlyingResource() {
return fFile;
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#hasUnsavedChanges()
+ * @see org.eclipse.cdt.core.model.IBuffer#hasUnsavedChanges()
*/
public boolean hasUnsavedChanges() {
return fTextFileBuffer != null ? fTextFileBuffer.isDirty() : false;
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#isClosed()
+ * @see org.eclipse.cdt.core.model.IBuffer#isClosed()
*/
public boolean isClosed() {
return fDocument == null;
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#isReadOnly()
+ * @see org.eclipse.cdt.core.model.IBuffer#isReadOnly()
*/
public boolean isReadOnly() {
IResource resource= getUnderlyingResource();
@@ -372,14 +372,14 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#replace(int, int, char)
+ * @see org.eclipse.cdt.core.model.IBuffer#replace(int, int, char[])
*/
public void replace(int position, int length, char[] text) {
replace(position, length, new String(text));
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#replace(int, int, java.lang.String)
+ * @see org.eclipse.cdt.core.model.IBuffer#replace(int, int, java.lang.String)
*/
public void replace(int position, int length, String text) {
if (DEBUG_LINE_DELIMITERS) {
@@ -389,7 +389,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#save(org.eclipse.core.runtime.IProgressMonitor, boolean)
+ * @see org.eclipse.cdt.core.model.IBuffer#save(org.eclipse.core.runtime.IProgressMonitor, boolean)
*/
public void save(IProgressMonitor progress, boolean force) throws CModelException {
try {
@@ -401,14 +401,14 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#setContents(char)
+ * @see org.eclipse.cdt.core.model.IBuffer#setContents(char[])
*/
public void setContents(char[] contents) {
setContents(new String(contents));
}
/**
- * @see org.eclipse.cdt.internal.core.model.IBuffer#setContents(java.lang.String)
+ * @see org.eclipse.cdt.core.model.IBuffer#setContents(java.lang.String)
*/
public void setContents(String contents) {
int oldLength= fDocument.getLength();
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ExternalSearchDocumentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ExternalSearchDocumentProvider.java
index 1da21333f9e..6212f1a9261 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ExternalSearchDocumentProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ExternalSearchDocumentProvider.java
@@ -48,7 +48,7 @@ public class ExternalSearchDocumentProvider extends FileDocumentProvider {
/**
* @param externalInput
- * @return
+ * @return a new annotation model for the editor input
*/
private IAnnotationModel createExternalSearchAnnotationModel(ExternalEditorInput externalInput) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ICAnnotation.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ICAnnotation.java
index 6a541b55eb7..5b1251d78e9 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ICAnnotation.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ICAnnotation.java
@@ -14,8 +14,6 @@ package org.eclipse.cdt.internal.ui.editor;
import java.util.Iterator;
import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
/**
* ICAnnotation
@@ -24,7 +22,7 @@ import org.eclipse.swt.widgets.Display;
* and problems.
*
* @see org.eclipse.core.resources.IMarker
- * @see org.eclipse.jdt.core.compiler.IProblem
+ * @see org.eclipse.cdt.core.parser.IProblem
*/
public interface ICAnnotation {
@@ -103,6 +101,4 @@ public interface ICAnnotation {
String[] getArguments();
int getId();
-
- Image getImage(Display display);
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmCodeScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmCodeScanner.java
index c9d6fa228ab..88fc5653086 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmCodeScanner.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmCodeScanner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
+ * Copyright (c) 2005, 2006 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
@@ -8,28 +8,29 @@
* Contributors:
* IBM Corporation - initial API and implementation
* QNX Software System
+ * Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.editor.asm;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.cdt.internal.ui.text.AbstractCScanner;
-import org.eclipse.cdt.internal.ui.text.ICColorConstants;
-import org.eclipse.cdt.internal.ui.text.IColorManager;
-import org.eclipse.cdt.internal.ui.text.util.CWhitespaceDetector;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.rules.EndOfLineRule;
import org.eclipse.jface.text.rules.ICharacterScanner;
import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.SingleLineRule;
import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.text.rules.WhitespaceRule;
import org.eclipse.jface.text.rules.WordPatternRule;
import org.eclipse.jface.text.rules.WordRule;
import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.cdt.internal.ui.text.AbstractCScanner;
+import org.eclipse.cdt.internal.ui.text.ICColorConstants;
+import org.eclipse.cdt.internal.ui.text.IColorManager;
+import org.eclipse.cdt.internal.ui.text.util.CWhitespaceDetector;
+
/**
* A C code scanner.
@@ -79,17 +80,11 @@ public final class AsmCodeScanner extends AbstractCScanner {
List rules= new ArrayList();
- // Add rule for strings
Token token= getToken(ICColorConstants.C_SINGLE_LINE_COMMENT);
// Add rule for single line comments.
rules.add(new EndOfLineRule("#", token)); //$NON-NLS-1$
- token= getToken(ICColorConstants.C_STRING);
- // Add rule for strings and character constants.
- rules.add(new SingleLineRule("'", "'", token, '\\')); //$NON-NLS-1$ //$NON-NLS-2$
- //rules.add(new SingleLineRule("\"", "\"", token, '\\'));
-
Token other= getToken(ICColorConstants.C_DEFAULT);
// Add generic whitespace rule.
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmPartitionScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmPartitionScanner.java
deleted file mode 100644
index b42fccf0ed0..00000000000
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmPartitionScanner.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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
- * QNX Software System
- *******************************************************************************/
-package org.eclipse.cdt.internal.ui.editor.asm;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.internal.ui.text.ICColorConstants;
-import org.eclipse.cdt.internal.ui.text.ICPartitions;
-import org.eclipse.jface.text.rules.EndOfLineRule;
-import org.eclipse.jface.text.rules.ICharacterScanner;
-import org.eclipse.jface.text.rules.IPredicateRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.IWordDetector;
-import org.eclipse.jface.text.rules.MultiLineRule;
-import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
-import org.eclipse.jface.text.rules.SingleLineRule;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.rules.WordRule;
-
-
-/**
- * This scanner recognizes comments
- */
-public class AsmPartitionScanner extends RuleBasedPartitionScanner {
-
-
- //private final static String SKIP= "__skip";
-
-
- public final static String ASM_MULTILINE_COMMENT= ICColorConstants.C_MULTI_LINE_COMMENT;
- public final static String ASM_SINGLE_LINE_COMMENT= ICColorConstants.C_SINGLE_LINE_COMMENT;
- public final static String ASM_STRING= ICColorConstants.C_STRING;
-
-
- /**
- * Detector for empty comments.
- */
- static class EmptyCommentDetector implements IWordDetector {
-
-
- /**
- * @see IWordDetector#isWordStart
- */
- public boolean isWordStart(char c) {
- return (c == '/');
- }
-
-
- /**
- * @see IWordDetector#isWordPart
- */
- public boolean isWordPart(char c) {
- return (c == '*' || c == '/');
- }
- }
-
- /**
- * Word rule for empty comments.
- */
- static class EmptyCommentRule extends WordRule implements IPredicateRule {
-
- private IToken fSuccessToken;
- /**
- * Constructor for EmptyCommentRule.
- * @param defaultToken
- */
- public EmptyCommentRule(IToken successToken) {
- super(new EmptyCommentDetector());
- fSuccessToken= successToken;
- addWord("/**/", fSuccessToken); //$NON-NLS-1$
- }
-
- /*
- * @see IPredicateRule#evaluate(ICharacterScanner, boolean)
- */
- public IToken evaluate(ICharacterScanner scanner, boolean resume) {
- return evaluate(scanner);
- }
-
- /*
- * @see IPredicateRule#getSuccessToken()
- */
- public IToken getSuccessToken() {
- return fSuccessToken;
- }
- }
-
- /**
- * Creates the partitioner and sets up the appropriate rules.
- */
- public AsmPartitionScanner() {
- super();
-
- IToken comment= new Token(ICPartitions.C_MULTILINE_COMMENT);
- IToken single_comment= new Token(ICPartitions.C_SINGLE_LINE_COMMENT);
- IToken string= new Token(ICPartitions.C_STRING);
- // IToken skip= new Token(SKIP);
-
-
-
- List rules= new ArrayList();
-
-
- // Minimize the number of rules, since we have duplicate rules
- // in the CCodeScanner...
-
-
- // Add rule for single line comments.
- rules.add(new EndOfLineRule("//", single_comment)); //$NON-NLS-1$
- rules.add(new EndOfLineRule("#", single_comment)); //$NON-NLS-1$
-
- // Add rule for strings and character constants.
- rules.add(new SingleLineRule("\"", "\"", string, '\\')); //$NON-NLS-1$ //$NON-NLS-2$
- rules.add(new SingleLineRule("'", "'", string, '\\')); //$NON-NLS-1$ //$NON-NLS-2$
-
- EmptyCommentRule wordRule= new EmptyCommentRule(comment);
- rules.add(wordRule);
-
-
- // Add rules for multi-line comments.
- rules.add(new MultiLineRule("/*", "*/", comment)); //$NON-NLS-1$ //$NON-NLS-2$
-
-
- IPredicateRule[] result= new IPredicateRule[rules.size()];
- rules.toArray(result);
- setPredicateRules(result);
- }
-}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmSourceViewerConfiguration.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmSourceViewerConfiguration.java
index eb347635428..32fef301e91 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmSourceViewerConfiguration.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmSourceViewerConfiguration.java
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
+ * Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.editor.asm;
@@ -17,23 +18,32 @@ import org.eclipse.jface.text.presentation.PresentationReconciler;
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
import org.eclipse.jface.text.rules.RuleBasedScanner;
import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
+import org.eclipse.cdt.ui.CUIPlugin;
+
+import org.eclipse.cdt.internal.ui.text.ICPartitions;
+
public class AsmSourceViewerConfiguration extends TextSourceViewerConfiguration {
-
- private AsmTextEditor fEditor;
- private AsmTextTools fTextTools;
+ private AsmTextTools fAsmTextTools;
+ /**
+ * Constructor for AsmSourceViewerConfiguration
+ */
+ public AsmSourceViewerConfiguration(AsmTextTools tools) {
+ super();
+ fAsmTextTools = tools;
+ }
+
/**
* Returns the ASM multiline comment scanner for this configuration.
*
* @return the ASM multiline comment scanner
*/
protected RuleBasedScanner getMultilineCommentScanner() {
- return fTextTools.getMultilineCommentScanner();
+ return fAsmTextTools.getMultilineCommentScanner();
}
/**
@@ -42,7 +52,7 @@ public class AsmSourceViewerConfiguration extends TextSourceViewerConfiguration
* @return the ASM singleline comment scanner
*/
protected RuleBasedScanner getSinglelineCommentScanner() {
- return fTextTools.getSinglelineCommentScanner();
+ return fAsmTextTools.getSinglelineCommentScanner();
}
/**
@@ -51,60 +61,59 @@ public class AsmSourceViewerConfiguration extends TextSourceViewerConfiguration
* @return the ASM string scanner
*/
protected RuleBasedScanner getStringScanner() {
- return fTextTools.getStringScanner();
+ return fAsmTextTools.getStringScanner();
}
+
- /**
- * Constructor for AsmSourceViewerConfiguration
+ /*
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning(org.eclipse.jface.text.source.ISourceViewer)
*/
- public AsmSourceViewerConfiguration(AsmTextTools tools, AsmTextEditor editor) {
- super();
- fEditor = editor;
- fTextTools = tools;
+ public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
+ // the ASM editor also uses the CDocumentPartitioner
+ return CUIPlugin.getDefault().getTextTools().getDocumentPartitioning();
}
-
- /**
- * @see ISourceViewerConfiguration#getPresentationReconciler(ISourceViewer)
+
+ /*
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
*/
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
-
-
- // CColorManager manager= fTextTools.getColorManager();
PresentationReconciler reconciler= new PresentationReconciler();
-
-
- DefaultDamagerRepairer dr= new DefaultDamagerRepairer(fTextTools.getCodeScanner());
+ DefaultDamagerRepairer dr= new DefaultDamagerRepairer(fAsmTextTools.getCodeScanner());
reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
-
-
dr= new DefaultDamagerRepairer(getMultilineCommentScanner());
- reconciler.setDamager(dr, AsmPartitionScanner.ASM_MULTILINE_COMMENT);
- reconciler.setRepairer(dr, AsmPartitionScanner.ASM_MULTILINE_COMMENT);
+ reconciler.setDamager(dr, ICPartitions.C_MULTILINE_COMMENT);
+ reconciler.setRepairer(dr, ICPartitions.C_MULTILINE_COMMENT);
dr= new DefaultDamagerRepairer(getSinglelineCommentScanner());
- reconciler.setDamager(dr, AsmPartitionScanner.ASM_SINGLE_LINE_COMMENT);
- reconciler.setRepairer(dr, AsmPartitionScanner.ASM_SINGLE_LINE_COMMENT);
+ reconciler.setDamager(dr, ICPartitions.C_SINGLE_LINE_COMMENT);
+ reconciler.setRepairer(dr, ICPartitions.C_SINGLE_LINE_COMMENT);
dr= new DefaultDamagerRepairer(getStringScanner());
- reconciler.setDamager(dr, AsmPartitionScanner.ASM_STRING);
- reconciler.setRepairer(dr, AsmPartitionScanner.ASM_STRING);
+ reconciler.setDamager(dr, ICPartitions.C_STRING);
+ reconciler.setRepairer(dr, ICPartitions.C_STRING);
+ dr= new DefaultDamagerRepairer(getStringScanner());
+ reconciler.setDamager(dr, ICPartitions.C_CHARACTER);
+ reconciler.setRepairer(dr, ICPartitions.C_CHARACTER);
+ reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
return reconciler;
}
- /**
- * @see SourceViewerConfiguration#getConfiguredContentTypes(ISourceViewer)
+ /*
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredContentTypes(org.eclipse.jface.text.source.ISourceViewer)
*/
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- return new String[] { IDocument.DEFAULT_CONTENT_TYPE,
- AsmPartitionScanner.ASM_MULTILINE_COMMENT,
- AsmPartitionScanner.ASM_SINGLE_LINE_COMMENT,
- AsmPartitionScanner.ASM_STRING };
+ return new String[] {
+ IDocument.DEFAULT_CONTENT_TYPE,
+ ICPartitions.C_MULTILINE_COMMENT,
+ ICPartitions.C_SINGLE_LINE_COMMENT,
+ ICPartitions.C_STRING,
+ ICPartitions.C_CHARACTER };
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmTextEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmTextEditor.java
index 7d838dc0e9d..7a52834d4e2 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmTextEditor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmTextEditor.java
@@ -32,7 +32,7 @@ public class AsmTextEditor extends TextEditor {
*/
protected void initializeEditor() {
AsmTextTools textTools= CUIPlugin.getDefault().getAsmTextTools();
- setSourceViewerConfiguration(new AsmSourceViewerConfiguration(textTools, this));
+ setSourceViewerConfiguration(new AsmSourceViewerConfiguration(textTools));
setDocumentProvider(CUIPlugin.getDefault().getDocumentProvider());
// FIXME: Should this editor have a different preference store ?
// For now we are sharing with the CEditor and any changes will in the
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmTextTools.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmTextTools.java
index b293c1d8c34..0f0c2e9b20e 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmTextTools.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmTextTools.java
@@ -12,20 +12,19 @@
*******************************************************************************/
package org.eclipse.cdt.internal.ui.editor.asm;
-import org.eclipse.cdt.internal.ui.text.ICColorConstants;
-import org.eclipse.cdt.internal.ui.text.CCommentScanner;
-import org.eclipse.cdt.internal.ui.text.SingleTokenCScanner;
-import org.eclipse.cdt.internal.ui.text.util.CColorManager;
-import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.IDocumentPartitioner;
-import org.eclipse.jface.text.rules.FastPartitioner;
-import org.eclipse.jface.text.rules.IPartitionTokenScanner;
import org.eclipse.jface.text.rules.RuleBasedScanner;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.cdt.ui.CUIPlugin;
+
+import org.eclipse.cdt.internal.ui.text.CCommentScanner;
+import org.eclipse.cdt.internal.ui.text.ICColorConstants;
+import org.eclipse.cdt.internal.ui.text.SingleTokenCScanner;
+import org.eclipse.cdt.internal.ui.text.util.CColorManager;
+
/**
* This type shares all scanners and the color manager between
@@ -46,8 +45,6 @@ public class AsmTextTools {
private CColorManager fColorManager;
/** The Asm source code scanner */
private AsmCodeScanner fCodeScanner;
- /** The Asm partitions scanner */
- private AsmPartitionScanner fPartitionScanner;
/** The ASM multiline comment scanner */
private CCommentScanner fMultilineCommentScanner;
/** The ASM singleline comment scanner */
@@ -83,7 +80,6 @@ public class AsmTextTools {
fColorManager= new CColorManager();
fCodeScanner= new AsmCodeScanner(fColorManager, store);
- fPartitionScanner= new AsmPartitionScanner();
fMultilineCommentScanner= new CCommentScanner(fColorManager, store, coreStore, ICColorConstants.C_MULTI_LINE_COMMENT);
fSinglelineCommentScanner= new CCommentScanner(fColorManager, store, coreStore, ICColorConstants.C_SINGLE_LINE_COMMENT);
@@ -111,7 +107,6 @@ public class AsmTextTools {
public void dispose() {
fCodeScanner= null;
- fPartitionScanner= null;
fMultilineCommentScanner= null;
fSinglelineCommentScanner= null;
@@ -148,30 +143,7 @@ public class AsmTextTools {
public RuleBasedScanner getCodeScanner() {
return fCodeScanner;
}
-
- /**
- * Gets the partition scanner used.
- */
- public IPartitionTokenScanner getPartitionScanner() {
- return fPartitionScanner;
- }
-
- /**
- * Gets the document provider used.
- */
- public IDocumentPartitioner createDocumentPartitioner() {
- String[] types= new String[] {
- AsmPartitionScanner.ASM_MULTILINE_COMMENT,
- AsmPartitionScanner.ASM_SINGLE_LINE_COMMENT,
- AsmPartitionScanner.ASM_STRING
- };
-
- //return new RuleBasedPartitioner(getPartitionScanner(), types);
- //return new DefaultPartitioner(getPartitionScanner(), types);
- return new FastPartitioner(getPartitionScanner(), types);
- }
-
/**
* Returns a scanner which is configured to scan Java multiline comments.
*
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmWordDetector.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmWordDetector.java
index 73ca930f675..b687af5ed4c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmWordDetector.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/asm/AsmWordDetector.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
+ * Copyright (c) 2005, 2006 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
@@ -37,8 +37,8 @@ public class AsmWordDetector implements IWordDetector {
fPrefix = prefix;
fExtra = extra;
}
- /**
- * @see IWordDetector#isWordIdentifierStart
+ /*
+ * @see org.eclipse.jface.text.rules.IWordDetector#isWordStart(char)
*/
public boolean isWordStart(char c) {
if(fPrefix != 0) {
@@ -49,9 +49,8 @@ public class AsmWordDetector implements IWordDetector {
}
return (Character.isJavaIdentifierPart(c) || (c == fExtra));
}
-
- /**
- * @see IWordDetector#isWordIdentifierPart
+ /*
+ * @see org.eclipse.jface.text.rules.IWordDetector#isWordPart(char)
*/
public boolean isWordPart(char c) {
return Character.isJavaIdentifierPart(c);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDragAdapterAssistant.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDragAdapterAssistant.java
index 7f5b75f5a0b..f7ce4fbc26a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDragAdapterAssistant.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDragAdapterAssistant.java
@@ -26,7 +26,6 @@ import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
* ISourceReference
s.
*
* @see org.eclipse.cdt.internal.ui.cview.SelectionTransferDragAdapter
- * @see org.eclipse.cdt.internal.ui.cview.CView#initDrag()
*/
public class CNavigatorDragAdapterAssistant extends CommonDragAdapterAssistant {
@@ -45,7 +44,7 @@ public class CNavigatorDragAdapterAssistant extends CommonDragAdapterAssistant {
*/
public boolean setDragData(DragSourceEvent event,
IStructuredSelection selection) {
- if (selection instanceof IStructuredSelection) {
+ if (selection != null) {
for (Iterator iter= (selection).iterator(); iter.hasNext();) {
Object element= iter.next();
if (element instanceof ICElement) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java
index 5f1f45be50e..6c0391f68ff 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java
@@ -41,7 +41,6 @@ import org.eclipse.ui.navigator.CommonDropAdapterAssistant;
* A Common Navigator drop adapter assistant handling dropping of ICElement
s.
*
* @see org.eclipse.cdt.internal.ui.cview.SelectionTransferDropAdapter
- * @see org.eclipse.cdt.internal.ui.cview.CView#initDrop()
*/
public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorLabelProvider.java
index 3ef26de5c2a..536b5265aa0 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorLabelProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorLabelProvider.java
@@ -30,14 +30,13 @@ import org.eclipse.ui.navigator.ICommonLabelProvider;
* A label provider suitable for the Common Navigator providing also
* status message text for the current selected item.
*
- * @see org.eclipse.cdt.internal.ui.cview.CView#getStatusLineMessage()
+ * @see org.eclipse.cdt.internal.ui.cview.CView#createLabelProvider
+ * @see org.eclipse.cdt.internal.ui.cview.CView#getStatusLineMessage
*/
public class CNavigatorLabelProvider extends CViewLabelProvider implements ICommonLabelProvider {
/**
* Create a default label provider.
- *
- * @see org.eclipse.cdt.internal.ui.cview.CView#createLabelProvider()
*/
public CNavigatorLabelProvider() {
super(AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS,
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorOpenEditorActionGroup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorOpenEditorActionGroup.java
index ffffc8ac152..762c35bf3a1 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorOpenEditorActionGroup.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorOpenEditorActionGroup.java
@@ -30,7 +30,7 @@ import org.eclipse.ui.navigator.ICommonMenuConstants;
/**
- * This is basically a clone of {@link org.eclipse.cdt.internal.ui.OpenFileGroup},
+ * This is basically a clone of {@link org.eclipse.cdt.internal.ui.cview.OpenFileGroup},
* but without explicit dependency on CView. This opens it up for use in the
* Common Navigator framework.
*
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorWorkingSetActionProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorWorkingSetActionProvider.java
index c8fe93080b5..a27dc33aa5f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorWorkingSetActionProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorWorkingSetActionProvider.java
@@ -32,7 +32,7 @@ import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
* A Common Navigator action provider adding standard working set filter support.
*
* @see CNavigatorWorkingSetActionGroup
- * @see org.eclipse.cdt.internal.ui.workingsets.WorkingSetFilter
+ * @see ResourceWorkingSetFilter
*/
public class CNavigatorWorkingSetActionProvider extends CommonActionProvider {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CAnnotationHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CAnnotationHover.java
index 23f42e2da81..802a951412b 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CAnnotationHover.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CAnnotationHover.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2006 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
@@ -15,7 +15,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.cdt.internal.ui.CUIMessages;
import org.eclipse.core.resources.IMarker;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
@@ -23,10 +22,10 @@ import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.IAnnotationHover;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.texteditor.MarkerAnnotation;
+import org.eclipse.cdt.internal.ui.CUIMessages;
+
public class CAnnotationHover implements IAnnotationHover {
/**
@@ -128,16 +127,6 @@ public class CAnnotationHover implements IAnnotationHover {
}
- private int getHoverWidth(Display display) {
- Rectangle displayBounds= display.getBounds();
- int hoverWidth= displayBounds.width - (display.getCursorLocation().x - displayBounds.x);
- hoverWidth-= 12; // XXX: Add some space to the border, Revisit
- if (hoverWidth < 200) {
- hoverWidth= 200;
- }
- return hoverWidth;
- }
-
/*
* Formats a message as HTML text.
*/
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CAutoIndentStrategy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CAutoIndentStrategy.java
index 2915d2dcfe6..6efa1b17908 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CAutoIndentStrategy.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CAutoIndentStrategy.java
@@ -218,9 +218,8 @@ public class CAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
return false;
}
-
- /**
- * @see IAutoIndentStrategy#customizeDocumentCommand
+ /*
+ * @see org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy#customizeDocumentCommand(org.eclipse.jface.text.IDocument, org.eclipse.jface.text.DocumentCommand)
*/
public void customizeDocumentCommand(IDocument d, DocumentCommand c) {
if (c.length == 0 && c.text != null && endsWithDelimiter(d, c.text)) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCodeScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCodeScanner.java
index 6df9b6002f1..a71bcca4e73 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCodeScanner.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCodeScanner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2006 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
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* QNX Software System
+ * Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text;
@@ -15,17 +16,18 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.cdt.core.parser.KeywordSetKey;
-import org.eclipse.cdt.core.parser.ParserFactory;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.internal.ui.text.util.CWordDetector;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.SingleLineRule;
import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.text.rules.WordRule;
import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.cdt.core.parser.KeywordSetKey;
+import org.eclipse.cdt.core.parser.ParserFactory;
+import org.eclipse.cdt.core.parser.ParserLanguage;
+
+import org.eclipse.cdt.internal.ui.text.util.CWordDetector;
+
/**
* A C code scanner.
@@ -72,12 +74,7 @@ public final class CCodeScanner extends AbstractCScanner {
protected List createRules() {
List rules= new ArrayList();
-
- // Add rule for strings
- Token token= getToken(ICColorConstants.C_STRING);
- // Add rule for strings and character constants.
- rules.add(new SingleLineRule("'", "'", token, '\\')); //$NON-NLS-1$ //$NON-NLS-2$
-
+ Token token;
// Add generic white space rule.
//rules.add(new WhitespaceRule(new CWhitespaceDetector()));
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CFormattingStrategy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CFormattingStrategy.java
index 4692fc6793c..fd0626daa1a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CFormattingStrategy.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CFormattingStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 QNX Software Systems and others.
+ * Copyright (c) 2000, 2006 QNX Software Systems 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
@@ -65,7 +65,6 @@ public class CFormattingStrategy extends ContextBasedFormattingStrategy {
final TypedPosition partition= (TypedPosition)fPartitions.removeFirst();
if (document != null && partition != null) {
- Map options = getPreferences();
try {
final TextEdit edit= CodeFormatterUtil.format(CodeFormatter.K_COMPILATION_UNIT,
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CHelpProviderDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CHelpProviderDescriptor.java
index f4feaa7d7cf..3309bc2c0ef 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CHelpProviderDescriptor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CHelpProviderDescriptor.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2004, 2005 Intel Corporation and others.
+ * Copyright (c) 2004, 2006 Intel 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
@@ -15,17 +15,18 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.cdt.ui.ICHelpBook;
-import org.eclipse.cdt.ui.ICHelpProvider;
-import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SafeRunner;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
+import org.eclipse.cdt.ui.ICHelpBook;
+import org.eclipse.cdt.ui.ICHelpProvider;
+import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
+
/**
* This class represents the CHelpProvider settings
*
@@ -55,7 +56,6 @@ public class CHelpProviderDescriptor {
if(parentElement == null)
return;
- NodeList nodes = parentElement.getElementsByTagName(ELEMENT_PROVIDER);
Element projectElement = getDescriptorElement(parentElement);
if(projectElement == null)
@@ -108,7 +108,7 @@ public class CHelpProviderDescriptor {
public void handleException(Throwable exception) {
}
};
- Platform.run(runnable);
+ SafeRunner.run(runnable);
}
return provider;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPartitionScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPartitionScanner.java
index 29be0be5104..59a0ff351e0 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPartitionScanner.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CPartitionScanner.java
@@ -61,7 +61,7 @@ public class CPartitionScanner extends RuleBasedPartitionScanner implements ICPa
private IToken fSuccessToken;
/**
* Constructor for EmptyCommentRule.
- * @param defaultToken
+ * @param successToken
*/
public EmptyCommentRule(IToken successToken) {
super(new EmptyCommentDetector());
@@ -94,13 +94,8 @@ public class CPartitionScanner extends RuleBasedPartitionScanner implements ICPa
IToken single_comment= new Token(C_SINGLE_LINE_COMMENT);
IToken string= new Token(C_STRING);
IToken character = new Token(C_CHARACTER);
- IToken skip= new Token(SKIP);
-
-
-
List rules= new ArrayList();
-
// Minimize the number of rules, since we have duplicate rules
// in the CCodeScanner...
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CReconcilingStrategy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CReconcilingStrategy.java
index ca4b68191f1..5c4e06bbe97 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CReconcilingStrategy.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CReconcilingStrategy.java
@@ -38,9 +38,9 @@ public class CReconcilingStrategy implements IReconcilingStrategy {
fEditor= editor;
fManager= CUIPlugin.getDefault().getWorkingCopyManager();
}
-
- /**
- * @see IReconcilingStrategy#reconcile(document)
+
+ /*
+ * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#setDocument(org.eclipse.jface.text.IDocument)
*/
public void setDocument(IDocument document) {
}
@@ -53,16 +53,16 @@ public class CReconcilingStrategy implements IReconcilingStrategy {
fProgressMonitor= monitor;
}
- /**
- * @see IReconcilingStrategy#reconcile(region)
+ /*
+ * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.IRegion)
*/
public void reconcile(IRegion region) {
reconcile();
}
- /**
- * @see IReconcilingStrategy#reconcile(dirtyRegion, reion)
+ /*
+ * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.reconciler.DirtyRegion, org.eclipse.jface.text.IRegion)
*/
public void reconcile(DirtyRegion dirtyRegion, IRegion region) {
// consistent data needs not further checks !
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java
index 1761ffab1e5..55a27cd2072 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java
@@ -255,22 +255,6 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
return new String[] { "//", "" }; //$NON-NLS-1$ //$NON-NLS-2$
}
- /**
- * @see SourceViewerConfiguration#getDefaultPrefix(ISourceViewer, String)
- */
- public String getDefaultPrefix(ISourceViewer sourceViewer, String contentType) {
- if(IDocument.DEFAULT_CONTENT_TYPE.equals(contentType))
- return "//"; //$NON-NLS-1$
- if(ICPartitions.C_SINGLE_LINE_COMMENT.equals(contentType)) {
- return "//"; //$NON-NLS-1$
- }
- if(ICPartitions.C_MULTILINE_COMMENT.equals(contentType)) {
- return "//"; //$NON-NLS-1$
- }
- return null;
- }
-
-
/*
* @see SourceViewerConfiguration#getIndentPrefixes(ISourceViewer, String)
*/
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CWordFinder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CWordFinder.java
index e72183b2cb7..b06c94aa2cb 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CWordFinder.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CWordFinder.java
@@ -215,10 +215,6 @@ public class CWordFinder {
* @return
* true
if there is no function body around offset
* false
otherwise
- *
- * @param document
- * @param offset
- * @return
*/
public static boolean isGlobal(IDocument document, int offset) {
try {
@@ -237,7 +233,7 @@ public class CWordFinder {
do {
c = document.getChar(pos--);
if (c == BRACE_R) return false;
- } while (Character.isSpace(c));
+ } while (Character.isWhitespace(c));
// container block seems to be not a function or statement body
pos++; // step back one symbol
bracketcount = 0; // let's search for upper block
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CppCodeScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CppCodeScanner.java
index e24756312ea..99628c52023 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CppCodeScanner.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CppCodeScanner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2006 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
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* QNX Software System
+ * Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text;
@@ -15,17 +16,18 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.cdt.core.parser.KeywordSetKey;
-import org.eclipse.cdt.core.parser.ParserFactory;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.internal.ui.text.util.CWordDetector;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.SingleLineRule;
import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.text.rules.WordRule;
import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.cdt.core.parser.KeywordSetKey;
+import org.eclipse.cdt.core.parser.ParserFactory;
+import org.eclipse.cdt.core.parser.ParserLanguage;
+
+import org.eclipse.cdt.internal.ui.text.util.CWordDetector;
+
/**
* A C code scanner.
@@ -68,13 +70,7 @@ public final class CppCodeScanner extends AbstractCScanner {
protected List createRules() {
List rules= new ArrayList();
-
- // Add rule for strings
- Token token= getToken(ICColorConstants.C_STRING);
- // Add rule for strings and character constants.
- rules.add(new SingleLineRule("'", "'", token, '\\')); //$NON-NLS-1$ //$NON-NLS-2$
-
-
+ Token token;
// Add generic whitespace rule.
//rules.add(new WhitespaceRule(new CWhitespaceDetector()));
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/IColorManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/IColorManager.java
index 20b42536e04..86ef029c6c9 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/IColorManager.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/IColorManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2006 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
@@ -24,7 +24,7 @@ import org.eclipse.swt.graphics.RGB;
* This interface may be implemented by clients.
*
null
*
- * @see #addWord
+ * @see WordRule#addWord
*/
public PreprocessorRule(IWordDetector detector) {
this(detector, Token.UNDEFINED);
@@ -50,7 +50,7 @@ public class PreprocessorRule extends WordRule implements IRule {
* @param defaultToken the default token to be returned on success
* if nothing else is specified, may not be null
*
- * @see #addWord
+ * @see WordRule#addWord
*/
public PreprocessorRule(IWordDetector detector, IToken defaultToken) {
super(detector, defaultToken);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/SingleCharReader.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/SingleCharReader.java
index 65847174c19..ce3c2746e5d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/SingleCharReader.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/SingleCharReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2006 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
@@ -18,7 +18,7 @@ import java.io.Reader;
public abstract class SingleCharReader extends Reader {
/**
- * @see Reader#read(char)
+ * @see Reader#read()
*/
public abstract int read() throws IOException;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AbstractCEditorTextHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AbstractCEditorTextHover.java
index 0f20c690926..d040ff205d7 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AbstractCEditorTextHover.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AbstractCEditorTextHover.java
@@ -11,12 +11,6 @@
package org.eclipse.cdt.internal.ui.text.c.hover;
-import java.util.List;
-
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.internal.ui.text.CWordFinder;
-import org.eclipse.cdt.internal.ui.text.HTMLTextPresenter;
-import org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover;
import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
@@ -28,33 +22,24 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.commands.ICommand;
-import org.eclipse.ui.commands.IKeySequenceBinding;
-import org.eclipse.ui.keys.KeySequence;
+
+import org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover;
+
+import org.eclipse.cdt.internal.ui.text.CWordFinder;
+import org.eclipse.cdt.internal.ui.text.HTMLTextPresenter;
/**
* AbstractCEditorTextHover Abstract class for providing hover information for C
* elements.
*
*/
-public class AbstractCEditorTextHover implements ICEditorTextHover,
+public abstract class AbstractCEditorTextHover implements ICEditorTextHover,
ITextHoverExtension {
private IEditorPart fEditor;
- private ICommand fCommand;
-
- // {
- // ICommandManager commandManager=
- // PlatformUI.getWorkbench().getCommandSupport().getCommandManager();
- // fCommand=
- // commandManager.getCommand(ICEditorActionDefinitionIds.SHOW_JAVADOC);
- // if (!fCommand.isDefined())
- // fCommand= null;
- // }
-
/*
- * @see IJavaEditorTextHover#setEditor(IEditorPart)
+ * @see ICEditorTextHover#setEditor(IEditorPart)
*/
public void setEditor(IEditorPart editor) {
fEditor = editor;
@@ -85,63 +70,10 @@ public class AbstractCEditorTextHover implements ICEditorTextHover,
return null;
}
- // protected ICodeAssist getCodeAssist() {
- // if (fEditor != null) {
- // IEditorInput input= fEditor.getEditorInput();
- // if (input instanceof IClassFileEditorInput) {
- // IClassFileEditorInput cfeInput= (IClassFileEditorInput) input;
- // return cfeInput.getClassFile();
- // }
- //
- // IWorkingCopyManager manager=
- // CUIPlugin.getDefault().getWorkingCopyManager();
- // return manager.getWorkingCopy(input);
- // }
- //
- // return null;
- // }
-
/*
* @see ITextHover#getHoverInfo(ITextViewer, IRegion)
*/
- public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
-
- // ICodeAssist resolve= getCodeAssist();
- // if (resolve != null) {
- // try {
- // ICElement[] result= null;
- //
- // synchronized (resolve) {
- // result= resolve.codeSelect(hoverRegion.getOffset(),
- // hoverRegion.getLength());
- // }
- //
- // if (result == null)
- // return null;
- //
- // int nResults= result.length;
- // if (nResults == 0)
- // return null;
- //
- // return getHoverInfo(result);
- //
- // } catch (CModelException x) {
- // CUIPlugin.log(x.getStatus());
- // }
- // }
- return null;
- }
-
- /**
- * Provides hover information for the given C elements.
- *
- * @param cElements
- * the C elements for which to provide hover information
- * @return the hover information string
- */
- protected String getHoverInfo(ICElement[] cElements) {
- return null;
- }
+ public abstract String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion);
/*
* @see ITextHoverExtension#getHoverControlCreator()
@@ -165,41 +97,8 @@ public class AbstractCEditorTextHover implements ICEditorTextHover,
* @since 3.0
*/
protected String getTooltipAffordanceString() {
- // if
- // (!CUIPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE))
- // return null;
- //
- // KeySequence[] sequences= getKeySequences();
- // if (sequences == null)
- // return null;
- //
- // String keySequence= sequences[0].format();
- // return
- // CHoverMessages.getFormattedString("JavaTextHover.makeStickyHint",
- // keySequence); //$NON-NLS-1$
- return null;
- }
-
- /**
- * Returns the array of valid key sequence bindings for the show tool tip
- * description command.
- *
- * @return the array with the {@link KeySequence}s
- *
- * @since 3.0
- */
- private KeySequence[] getKeySequences() {
- if (fCommand != null) {
- List list = fCommand.getKeySequenceBindings();
- if (!list.isEmpty()) {
- KeySequence[] keySequences = new KeySequence[list.size()];
- for (int i = 0; i < keySequences.length; i++) {
- keySequences[i] = ((IKeySequenceBinding) list.get(i))
- .getKeySequence();
- }
- return keySequences;
- }
- }
+ //TLETODO [hover] provide affordance string
+ // @see org.eclipse.jdt.internal.ui.text.java.hover.AbstractJavaEditorTextHover
return null;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverDescriptor.java
index 11424b3ce2a..3e9218ca46e 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverDescriptor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverDescriptor.java
@@ -93,7 +93,7 @@ public class CEditorTextHoverDescriptor implements Comparable {
}
/**
- * Creates a new Java Editor text hover descriptor from the given configuration element.
+ * Creates a new C Editor text hover descriptor from the given configuration element.
*/
private CEditorTextHoverDescriptor(IConfigurationElement element) {
Assert.isNotNull(element);
@@ -101,10 +101,10 @@ public class CEditorTextHoverDescriptor implements Comparable {
}
/**
- * Creates the Java editor text hover.
+ * Creates the C editor text hover.
*/
public ICEditorTextHover createTextHover() {
- String pluginId = fElement.getDeclaringExtension().getNamespace();
+ String pluginId = fElement.getDeclaringExtension().getContributor().getName();
boolean isHoversPlugInActivated= Platform.getBundle(pluginId).getState() == Bundle.ACTIVE;
if (isHoversPlugInActivated || canActivatePlugIn()) {
try {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProposal.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProposal.java
index 7aee7254d89..22f4539d578 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProposal.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProposal.java
@@ -209,25 +209,21 @@ public class CCompletionProposal implements ICCompletionProposal, ICompletionPro
if (fTextViewer != null && string != null) {
int index= string.indexOf("()"); //$NON-NLS-1$
if (index != -1 && index + 1 == fCursorPosition) {
- IPreferenceStore preferenceStore= CUIPlugin.getDefault().getPreferenceStore();
-// if (preferenceStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_BRACKETS)) {
- if(true){
- int newOffset= fReplacementOffset + fCursorPosition;
-
- LinkedPositionGroup group= new LinkedPositionGroup();
- group.addPosition(new LinkedPosition(document, newOffset, 0, LinkedPositionGroup.NO_STOP));
-
- LinkedModeModel model= new LinkedModeModel();
- model.addGroup(group);
- model.forceInstall();
-
- LinkedModeUI ui= new EditorLinkedModeUI(model, fTextViewer);
- ui.setSimpleMode(true);
- ui.setExitPolicy(new ExitPolicy(')'));
- ui.setExitPosition(fTextViewer, newOffset + 1, 0, Integer.MAX_VALUE);
- ui.setCyclingMode(LinkedModeUI.CYCLE_NEVER);
- ui.enter();
- }
+ int newOffset= fReplacementOffset + fCursorPosition;
+
+ LinkedPositionGroup group= new LinkedPositionGroup();
+ group.addPosition(new LinkedPosition(document, newOffset, 0, LinkedPositionGroup.NO_STOP));
+
+ LinkedModeModel model= new LinkedModeModel();
+ model.addGroup(group);
+ model.forceInstall();
+
+ LinkedModeUI ui= new EditorLinkedModeUI(model, fTextViewer);
+ ui.setSimpleMode(true);
+ ui.setExitPolicy(new ExitPolicy(')'));
+ ui.setExitPosition(fTextViewer, newOffset + 1, 0, Integer.MAX_VALUE);
+ ui.setCyclingMode(LinkedModeUI.CYCLE_NEVER);
+ ui.enter();
}
}
@@ -663,19 +659,14 @@ public class CCompletionProposal implements ICCompletionProposal, ICompletionPro
return null;
}
- /**
- * {@inheritDoc}
- */
public void updateReplacementOffset(int newOffset) {
setReplacementOffset(newOffset);
}
- /**
- * {@inheritDoc}
- */
public void updateReplacementLength(int length) {
setReplacementLength(length);
}
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/CFoldingStructureProviderDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/CFoldingStructureProviderDescriptor.java
index b4bfb9b50b9..dc82afb9f94 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/CFoldingStructureProviderDescriptor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/folding/CFoldingStructureProviderDescriptor.java
@@ -51,17 +51,17 @@ public final class CFoldingStructureProviderDescriptor {
*/
CFoldingStructureProviderDescriptor(IConfigurationElement element) {
fElement= element;
- fId= element.getAttributeAsIs(ID);
+ fId= element.getAttribute(ID);
Assert.isLegal(fId != null);
fName= element.getAttribute(NAME);
if (fName == null)
fName= fId;
- fClass= element.getAttributeAsIs(CLASS);
+ fClass= element.getAttribute(CLASS);
Assert.isLegal(fClass != null);
- if (element.getAttributeAsIs(PREFERENCES_CLASS) == null)
+ if (element.getAttribute(PREFERENCES_CLASS) == null)
fHasPreferences= false;
else
fHasPreferences= true;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateEngine.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateEngine.java
index 3ddd76db028..d285e0ff621 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateEngine.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateEngine.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2006 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
@@ -14,18 +14,6 @@ package org.eclipse.cdt.internal.ui.text.template;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.core.model.IWorkingCopy;
-import org.eclipse.cdt.internal.corext.template.c.CContextType;
-import org.eclipse.cdt.internal.corext.template.c.TranslationUnitContext;
-import org.eclipse.cdt.internal.corext.template.c.TranslationUnitContextType;
-import org.eclipse.cdt.internal.ui.CPluginImages;
-import org.eclipse.cdt.internal.ui.text.c.hover.SourceViewerInformationControl;
-import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.cdt.ui.text.ICCompletionProposal;
-import org.eclipse.cdt.ui.text.contentassist.ICompletionContributor;
-import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
@@ -42,6 +30,20 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.core.model.IWorkingCopy;
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.text.ICCompletionProposal;
+import org.eclipse.cdt.ui.text.contentassist.ICompletionContributor;
+
+import org.eclipse.cdt.internal.corext.template.c.CContextType;
+import org.eclipse.cdt.internal.corext.template.c.TranslationUnitContext;
+import org.eclipse.cdt.internal.corext.template.c.TranslationUnitContextType;
+
+import org.eclipse.cdt.internal.ui.CPluginImages;
+import org.eclipse.cdt.internal.ui.text.c.hover.SourceViewerInformationControl;
+
public class TemplateEngine implements ICompletionContributor {
private TemplateContextType fContextType;
@@ -98,9 +100,6 @@ public class TemplateEngine implements ICompletionContributor {
/**
* Empties the collector.
- *
- * @param viewer the text viewer
- * @param unit the compilation unit (may be null
)
*/
public void reset() {
fProposals.clear();
@@ -119,7 +118,7 @@ public class TemplateEngine implements ICompletionContributor {
* and feeds the collector with proposals.
* @param viewer the text viewer
* @param completionPosition the context position in the document of the text viewer
- * @param compilationUnit the compilation unit (may be null
)
+ * @param translationUnit the translation unit (may be null
)
*/
public void complete(ITextViewer viewer, int completionPosition, ITranslationUnit translationUnit)
{
@@ -130,14 +129,6 @@ public class TemplateEngine implements ICompletionContributor {
Point selection= viewer.getSelectedRange();
- // remember selected text
- String selectedText= null;
- if (selection.y != 0) {
- try {
- selectedText= document.get(selection.x, selection.y);
- } catch (BadLocationException e) {}
- }
-
((TranslationUnitContextType) fContextType).setContextParameters(document.get(), completionPosition, translationUnit);
TranslationUnitContext context= ((TranslationUnitContextType) fContextType).createContext(document, completionPosition, selection.y, translationUnit);
int start= context.getStart();
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/util/CWordDetector.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/util/CWordDetector.java
index e5dfd3a5e87..c5a182fd20c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/util/CWordDetector.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/util/CWordDetector.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2006 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
@@ -18,16 +18,16 @@ import org.eclipse.jface.text.rules.IWordDetector;
* A C aware word detector.
*/
public class CWordDetector implements IWordDetector {
-
- /**
- * @see IWordDetector#isWordIdentifierStart
+
+ /*
+ * @see org.eclipse.jface.text.rules.IWordDetector#isWordStart(char)
*/
public boolean isWordStart(char c) {
return Character.isJavaIdentifierStart(c);
}
-
- /**
- * @see IWordDetector#isWordIdentifierPart
+
+ /*
+ * @see org.eclipse.jface.text.rules.IWordDetector#isWordPart(char)
*/
public boolean isWordPart(char c) {
return Character.isJavaIdentifierPart(c);