diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java
index 8b88bfda1b4..60cded12cfd 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java
@@ -27,9 +27,7 @@ import org.eclipse.jface.text.FindReplaceDocumentAdapter;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextViewerExtension;
import org.eclipse.jface.text.rules.IWordDetector;
-import org.eclipse.jface.text.source.IOverviewRuler;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.IVerticalRuler;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
@@ -68,32 +66,6 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
*/
private ListenerList fReconcilingListeners= new ListenerList(ListenerList.IDENTITY);
- /**
- * Adapted source viewer for CEditor
- */
-
- public class AdaptedSourceViewer extends ProjectionViewer implements ITextViewerExtension {
-
-
- public AdaptedSourceViewer(Composite parent, IVerticalRuler ruler,
- IOverviewRuler overviewRuler, boolean showsAnnotation, int styles) {
- super(parent, ruler, overviewRuler, showsAnnotation, styles);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.source.ISourceViewer#setRangeIndication(int, int, boolean)
- */
- public void setRangeIndication(int offset, int length, boolean moveCursor) {
- // Fixin a bug in the ProjectViewer implemenation
- // PR: https://bugs.eclipse.org/bugs/show_bug.cgi?id=72914
- if (isProjectionMode()) {
- super.setRangeIndication(offset, length, moveCursor);
- } else {
- super.setRangeIndication(offset, length, false);
- }
- }
- }
-
MakefileSourceConfiguration getMakefileSourceConfiguration() {
SourceViewerConfiguration configuration = getSourceViewerConfiguration();
@@ -169,7 +141,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
}
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
- ISourceViewer viewer = new AdaptedSourceViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);
+ ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);
// ensure decoration support has been created and configured.
getSourceViewerDecorationSupport(viewer);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/Resources.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/util/Resources.java
similarity index 99%
rename from core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/Resources.java
rename to core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/util/Resources.java
index 533d8e75bb2..8d0bb327eba 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/Resources.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/util/Resources.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.internal.ui.util;
+package org.eclipse.cdt.internal.corext.util;
import java.util.ArrayList;
import java.util.HashMap;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/TextEditorDropAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/TextEditorDropAdapter.java
deleted file mode 100644
index 94b9ad7d0cf..00000000000
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dnd/TextEditorDropAdapter.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Wind River Systems, Inc. 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:
- * Anton Leherbauer (Wind River Systems) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.ui.dnd;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension5;
-import org.eclipse.jface.text.Position;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.custom.StyledTextContent;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetAdapter;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.part.MarkerTransfer;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorDropTargetListener;
-import org.eclipse.ui.texteditor.ITextEditorExtension;
-
-import org.eclipse.cdt.ui.CUIPlugin;
-
-import org.eclipse.cdt.internal.ui.CUIMessages;
-import org.eclipse.cdt.internal.ui.util.EditorUtility;
-import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
-
-/**
- * A drop adapter which supports dragging a non-workspace file from some
- * external tool (e.g. explorer) into the editor area. The adaptor also supports
- * text and marker transfer.
- *
- * @since 4.0
- */
-public class TextEditorDropAdapter extends DropTargetAdapter implements
- ITextEditorDropTargetListener {
-
- /**
- * Adapter factory for text editor drop target listeners. Can be registered
- * to add text, file and marker drop support for all
- * ITextEditor
s.
- *
- * @see ITextEditorDropTargetListener
- */
- public static class Factory implements IAdapterFactory {
- private static final Class>[] CLASSES= { ITextEditorDropTargetListener.class };
-
- /*
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object,
- * java.lang.Class)
- */
- @SuppressWarnings("unchecked")
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof ITextEditor)
- return TextEditorDropAdapter.create((ITextEditor) adaptableObject);
- return null;
- }
-
- /*
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- @SuppressWarnings("unchecked")
- public Class[] getAdapterList() {
- return CLASSES;
- }
-
- }
-
- /** The text viewer target */
- private ITextViewer fViewer;
- /** The editor containing the viewer (can be null) */
- private ITextEditor fEditor;
- /** Cached selection of styled text widget upon dragEnter */
- private Point fDropSelection;
-
- /**
- * Create an EditorDropAdapter for the given text viewer and (optional)
- * editor.
- *
- * @param viewer
- * the text viewer, may not be null
- * @param editor
- * the text editor, may be null
- */
- public TextEditorDropAdapter(ITextViewer viewer, ITextEditor editor) {
- super();
- fViewer= viewer;
- fEditor= editor;
- }
-
- /*
- * @see org.eclipse.swt.dnd.DropTargetListener#drop(org.eclipse.swt.dnd.DropTargetEvent)
- */
- @Override
- public void drop(final DropTargetEvent event) {
- try {
- TransferData dataType= event.currentDataType;
- if (isFileDataType(dataType)) {
- // event.data is an array of strings which represent the
- // absolute file pathes
- assert event.data instanceof String[];
- dropFiles((String[]) event.data);
- } else if (isMarkerDataType(dataType)) {
- assert event.data instanceof IMarker[];
- dropMarkers((IMarker[]) event.data);
- } else if (isTextDataType(dataType)) {
- // event.data is a string
- assert event.data instanceof String;
- int offset= getOffsetAtLocation(event.x, event.y, true);
- dropText((String) event.data, offset);
- }
- } catch (CoreException exc) {
- ExceptionHandler.handle(exc,
- CUIMessages.getString("TextEditorDropAdapter.error.title"), //$NON-NLS-1$
- CUIMessages.getString("TextEditorDropAdapter.error.message")); //$NON-NLS-1$
- }
- }
-
- /*
- * @see org.eclipse.swt.dnd.DropTargetListener#dragEnter(org.eclipse.swt.dnd.DropTargetEvent)
- */
- @Override
- public void dragEnter(DropTargetEvent event) {
- TransferData dataType= event.currentDataType;
- if (isFileDataType(dataType)) {
- // make sure the file is never moved; always do a copy
- event.detail= DND.DROP_COPY;
- event.feedback= DND.FEEDBACK_NONE;
- } else if (isMarkerDataType(dataType)) {
- event.detail= DND.DROP_COPY;
- event.feedback= DND.FEEDBACK_NONE;
- } else if (isTextDataType(dataType)) {
- if (isDocumentEditable()) {
- if (event.detail == DND.DROP_DEFAULT) {
- event.detail= getAcceptableOperation(event.operations);
- }
- // workaround for
- // Bug 162198: DnD removes selection and moves caret
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=162198
- fDropSelection= fViewer.getTextWidget().getSelection();
- } else {
- event.detail= DND.DROP_NONE;
- }
- }
- }
-
- /*
- * @see org.eclipse.swt.dnd.DropTargetListener#dragOver(org.eclipse.swt.dnd.DropTargetEvent)
- */
- @Override
- public void dragOver(DropTargetEvent event) {
- TransferData dataType= event.currentDataType;
- if (isFileDataType(dataType)) {
- // make sure the file is never moved; always do a copy
- event.detail= DND.DROP_COPY;
- event.feedback= DND.FEEDBACK_NONE;
- } else if (isMarkerDataType(dataType)) {
- event.detail= DND.DROP_COPY;
- event.feedback= DND.FEEDBACK_NONE;
- } else if (isTextDataType(dataType)) {
- if (isDocumentEditable()) {
- if ((event.operations & event.detail) == 0) {
- event.detail= getAcceptableOperation(event.operations);
- }
- int offset= getOffsetAtLocation(event.x, event.y, true);
- if (offset < 0) {
- event.detail= DND.DROP_NONE;
- }
- } else {
- event.detail= DND.DROP_NONE;
- }
- event.feedback |= DND.FEEDBACK_SCROLL;
- }
- }
-
- private static boolean isFileDataType(TransferData dataType) {
- return FileTransfer.getInstance().isSupportedType(dataType);
- }
-
- private static boolean isTextDataType(TransferData dataType) {
- return TextTransfer.getInstance().isSupportedType(dataType);
- }
-
- private static boolean isMarkerDataType(TransferData dataType) {
- return MarkerTransfer.getInstance().isSupportedType(dataType);
- }
-
- /*
- * @see org.eclipse.swt.dnd.DropTargetListener#dropAccept(org.eclipse.swt.dnd.DropTargetEvent)
- */
- @Override
- public void dropAccept(DropTargetEvent event) {
- TransferData dataType= event.currentDataType;
- if (isTextDataType(dataType)) {
- // check if the offset is inside the drag source selection
- IDocument doc= fViewer.getDocument();
- if (doc.containsPositionCategory(TextViewerDragAdapter.DRAG_SELECTION_CATEGORY)) {
- int widgetOffset= getOffsetAtLocation(event.x, event.y, true);
- if (widgetOffset != -1) {
- int documentOffset= getDocumentOffset(widgetOffset);
- try {
- Position[] dragSource= doc.getPositions(TextViewerDragAdapter.DRAG_SELECTION_CATEGORY);
- if (dragSource.length == 0
- || event.detail == DND.DROP_MOVE
- && dragSource[0].includes(documentOffset)) {
- // do not drop-move on the drag source
- event.detail = DND.DROP_NONE;
- }
- } catch (BadPositionCategoryException e) {
- event.detail= DND.DROP_NONE;
- }
- }
- }
- }
- }
-
- /*
- * @see org.eclipse.swt.dnd.DropTargetListener#dragOperationChanged(org.eclipse.swt.dnd.DropTargetEvent)
- */
- @Override
- public void dragOperationChanged(DropTargetEvent event) {
- TransferData dataType= event.currentDataType;
- if (isFileDataType(dataType)) {
- // make sure the file is never moved; always do a copy
- event.detail= DND.DROP_COPY;
- event.feedback= DND.FEEDBACK_NONE;
- } else if (isMarkerDataType(dataType)) {
- event.detail= DND.DROP_COPY;
- event.feedback= DND.FEEDBACK_NONE;
- } else if (isTextDataType(dataType)) {
- if (isDocumentEditable()) {
- if (event.detail == DND.DROP_DEFAULT) {
- event.detail= getAcceptableOperation(event.operations);
- }
- } else {
- event.detail= DND.DROP_NONE;
- }
- }
- }
-
- /**
- * Get preferred operation out of allowed set.
- *
- * @param operations
- * a bitset of allowed operations
- * @return operation the preferred operation
- */
- private int getAcceptableOperation(int operations) {
- if ((operations & DND.DROP_MOVE) != 0 && isDocumentEditable()) {
- return DND.DROP_MOVE;
- }
- if ((operations & DND.DROP_COPY) != 0) {
- return DND.DROP_COPY;
- }
- return DND.DROP_NONE;
- }
-
- /*
- * @see org.eclipse.swt.dnd.DropTargetListener#dragLeave(org.eclipse.swt.dnd.DropTargetEvent)
- */
- @Override
- public void dragLeave(DropTargetEvent event) {
- fDropSelection= null;
- }
-
- /**
- * Drop text data at offset.
- *
- * @param text
- * @param offset
- * @throws CoreException
- */
- private void dropText(String text, int offset) throws CoreException {
- IDocument d= fViewer.getDocument();
- try {
- int docOffset;
- int docLength;
- Point selection= fDropSelection;
- if (selection != null && selection.x <= offset && offset < selection.y) {
- // drop inside selection - replace selected text
- docOffset= getDocumentOffset(selection.x);
- docLength= getDocumentOffset(selection.y) - docOffset;
- } else {
- docOffset= getDocumentOffset(offset);
- docLength= 0;
- }
- d.replace(docOffset, docLength, text);
- fViewer.setSelectedRange(docOffset, text.length());
- } catch (BadLocationException e) {
- // should not happen
- throw new CoreException(
- new Status(IStatus.ERROR, CUIPlugin.getPluginId(), 0,
- e.getLocalizedMessage(), e));
- }
- }
-
- /**
- * Drop (external) files.
- *
- * @param fileNames
- */
- private void dropFiles(String[] fileNames) throws CoreException {
- for (String fileName : fileNames) {
- Path path= new Path(fileName);
- java.io.File file= path.toFile();
- if (!file.isFile()) {
- throw new CoreException(new Status(IStatus.ERROR, CUIPlugin
- .getPluginId(), 0, CUIMessages.getFormattedString(
- "TextEditorDropAdapter.noFile", fileName), //$NON-NLS-1$
- null));
- }
- if (file.canRead()) {
- EditorUtility.openInEditor(path, null);
- } else {
- throw new CoreException(new Status(IStatus.ERROR, CUIPlugin
- .getPluginId(), 0, CUIMessages.getFormattedString(
- "TextEditorDropAdapter.unreadableFile", fileName), //$NON-NLS-1$
- null));
- }
- }
- }
-
- /**
- * Drop markers (open editor and navigate to marker).
- *
- * @param markers
- * @throws PartInitException
- */
- private void dropMarkers(IMarker[] markers) throws PartInitException {
- for (IMarker marker : markers) {
- IDE.openEditor(getPage(), marker);
- }
- }
-
- private IWorkbenchPage getPage() {
- if (fEditor != null) {
- return ((IWorkbenchPart) fEditor).getSite().getPage();
- }
- return CUIPlugin.getActivePage();
- }
-
- /**
- * Convert mouse screen coordinates to a StyledText
offset.
- *
- * @param x
- * screen X-coordinate
- * @param y
- * screen Y-coordinate
- * @param absolute
- * if true
, coordinates are expected to be
- * absolute screen coordinates
- * @return text offset
- *
- * @see StyledText#getOffsetAtLocation()
- */
- private int getOffsetAtLocation(int x, int y, boolean absolute) {
- StyledText textWidget= fViewer.getTextWidget();
- StyledTextContent content= textWidget.getContent();
- Point location;
- if (absolute) {
- location= textWidget.toControl(x, y);
- } else {
- location= new Point(x, y);
- }
- int line= (textWidget.getTopPixel() + location.y)
- / textWidget.getLineHeight();
- if (line >= content.getLineCount()) {
- return content.getCharCount();
- }
- int lineOffset= content.getOffsetAtLine(line);
- String lineText= content.getLine(line);
- Point endOfLine= textWidget.getLocationAtOffset(lineOffset
- + lineText.length());
- if (location.x >= endOfLine.x) {
- return lineOffset + lineText.length();
- }
- try {
- return textWidget.getOffsetAtLocation(location);
- } catch (IllegalArgumentException iae) {
- // we are expecting this
- return -1;
- }
- }
-
- /**
- * Convert a widget offset to the corresponding document offset.
- *
- * @param widgetOffset
- * @return document offset
- */
- private int getDocumentOffset(int widgetOffset) {
- if (fViewer instanceof ITextViewerExtension5) {
- ITextViewerExtension5 extension= (ITextViewerExtension5) fViewer;
- return extension.widgetOffset2ModelOffset(widgetOffset);
- }
- IRegion visible= fViewer.getVisibleRegion();
- if (widgetOffset > visible.getLength()) {
- return -1;
- }
- return widgetOffset + visible.getOffset();
- }
-
- /**
- * @return true if the document may be changed by the drag.
- */
- private boolean isDocumentEditable() {
- if (fEditor instanceof ITextEditorExtension) {
- return !((ITextEditorExtension) fEditor).isEditorInputReadOnly();
- }
- return fViewer.isEditable();
- }
-
- /*
- * @see org.eclipse.ui.texteditor.ITextEditorDropTargetListener#getTransfers()
- */
- public Transfer[] getTransfers() {
- return new Transfer[] { TextTransfer.getInstance(),
- FileTransfer.getInstance(), MarkerTransfer.getInstance() };
- }
-
- /**
- * Factory method to create a drop target listener for the given text
- * editor.
- *
- * @param textEditor
- * @return a drop target listener or null
- */
- protected static ITextEditorDropTargetListener create(ITextEditor textEditor) {
- ITextViewer textViewer= (ITextViewer) textEditor
- .getAdapter(ITextViewer.class);
- if (textViewer == null) {
- // this is a little trick to get the viewer from a text editor
- ITextOperationTarget target= (ITextOperationTarget) textEditor
- .getAdapter(ITextOperationTarget.class);
- if (target instanceof ITextViewer) {
- textViewer= (ITextViewer) target;
- }
- }
- if (textViewer == null) {
- return null;
- }
- return new TextEditorDropAdapter(textViewer, textEditor);
- }
-}
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 f8d295ce58c..5d86d5bcd49 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
@@ -111,15 +111,10 @@ import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.custom.ST;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.custom.VerifyKeyListener;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSource;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionBars;
@@ -133,7 +128,6 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.dnd.IDragAndDropService;
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.ide.IGotoMarker;
@@ -151,7 +145,6 @@ 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.IUpdate;
import org.eclipse.ui.texteditor.MarkerUtilities;
import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
@@ -200,8 +193,6 @@ import org.eclipse.cdt.internal.ui.actions.GoToNextPreviousMemberAction;
import org.eclipse.cdt.internal.ui.actions.GotoNextBookmarkAction;
import org.eclipse.cdt.internal.ui.actions.IndentAction;
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.OccurrencesFinder;
import org.eclipse.cdt.internal.ui.search.IOccurrencesFinder.OccurrenceLocation;
import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
@@ -1230,12 +1221,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
*/
private SemanticHighlightingManager fSemanticManager;
- /**
- * Custom text drag source listener overriding platform implementation.
- * @since 4.0
- */
- private TextViewerDragAdapter fTextViewerDragAdapter;
-
/**
* True if editor is opening a large file.
* @since 5.0
@@ -2303,44 +2288,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
installOccurrencesFinder(false);
}
- /*
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#installTextDragAndDrop(org.eclipse.jface.text.source.ISourceViewer)
- */
- @Override
- protected void installTextDragAndDrop(ISourceViewer viewer) {
- if (fTextViewerDragAdapter != null) {
- // already installed, enable it
- fTextViewerDragAdapter.setEnabled(true);
- return;
- }
- final IDragAndDropService dndService= (IDragAndDropService)getSite().getService(IDragAndDropService.class);
- if (dndService == null || viewer == null) {
- return;
- }
- Control control = viewer.getTextWidget();
- int operations = DND.DROP_MOVE | DND.DROP_COPY;
-
- DragSource dragSource = new DragSource(control, operations);
- Transfer[] dragTypes = new Transfer[] { TextTransfer.getInstance() };
- dragSource.setTransfer(dragTypes);
- fTextViewerDragAdapter = new TextViewerDragAdapter(viewer, this);
- dragSource.addDragListener(fTextViewerDragAdapter);
-
- ITextEditorDropTargetListener dropTargetListener = new TextEditorDropAdapter(viewer, this);
- dndService.addMergedDropTarget(control, operations, dropTargetListener.getTransfers(), dropTargetListener);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#uninstallTextDragAndDrop(org.eclipse.jface.text.source.ISourceViewer)
- */
- @Override
- protected void uninstallTextDragAndDrop(ISourceViewer viewer) {
- if (fTextViewerDragAdapter != null) {
- // uninstall not possible, disable instead
- fTextViewerDragAdapter.setEnabled(false);
- }
- }
-
/*
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#getSourceViewerDecorationSupport(org.eclipse.jface.text.source.ISourceViewer)
*/
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java
index c845ba0c522..3a632b5aa16 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java
@@ -74,9 +74,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
shouldVisitDeclarators= true;
shouldVisitNamespaces= true;
}
-// tletodo
-// private boolean shouldVisitCatchHandlers= true;
-
+
/** The semantic token */
private SemanticToken fToken= new SemanticToken();
private int fMinLocation;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/TogglePresentationAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/TogglePresentationAction.java
index 8e0e764dc01..5c220172280 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/TogglePresentationAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/TogglePresentationAction.java
@@ -42,7 +42,6 @@ public class TogglePresentationAction extends TextEditorAction implements IPrope
public TogglePresentationAction() {
super(CEditorMessages.getResourceBundle(), "TogglePresentation.", null); //$NON-NLS-1$
CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, CPluginImages.IMG_MENU_SEGMENT_EDIT);
- setToolTipText(CEditorMessages.getString("TogglePresentation.tooltip")); //$NON-NLS-1$
setActionDefinitionId(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY);
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.TOGGLE_PRESENTATION_ACTION);
update();
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalCategory.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalCategory.java
index 8c85e268911..81c1cdf8093 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalCategory.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalCategory.java
@@ -15,11 +15,11 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@@ -59,7 +59,7 @@ public final class CompletionProposalCategory {
private int fSortOrder= 0x10000;
private String fLastError= null;
- CompletionProposalCategory(IConfigurationElement element, CompletionProposalComputerRegistry registry) {
+ CompletionProposalCategory(IConfigurationElement element, CompletionProposalComputerRegistry registry) throws CoreException {
fElement= element;
fRegistry= registry;
IExtension parent= (IExtension) element.getParent();
@@ -100,18 +100,19 @@ public final class CompletionProposalCategory {
}
/**
- * Checks an element that must be defined according to the extension
- * point schema. Throws an
- * InvalidRegistryObjectException
if obj
- * is null
.
+ * Checks that the given attribute value is not null
.
+ *
+ * @param value the element to be checked
+ * @param attribute the attribute
+ * @throws CoreException if value
is null
*/
- private void checkNotNull(Object obj, String attribute) throws InvalidRegistryObjectException {
+ private void checkNotNull(Object obj, String attribute) throws CoreException {
if (obj == null) {
Object[] args= { getId(), fElement.getContributor().getName(), attribute };
String message= Messages.format(ContentAssistMessages.CompletionProposalComputerDescriptor_illegal_attribute_message, args);
IStatus status= new Status(IStatus.WARNING, CUIPlugin.getPluginId(), IStatus.OK, message, null);
CUIPlugin.log(status);
- throw new InvalidRegistryObjectException();
+ throw new CoreException(status);
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java
index 024d32a00cc..7bfe8c7ed5c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java
@@ -126,8 +126,11 @@ final class CompletionProposalComputerDescriptor {
*
* @param element the configuration element to read
* @param registry the computer registry creating this descriptor
+ * @param categories the categories
+ * @throws InvalidRegistryObjectException if this extension is no longer valid
+ * @throws CoreException if the configuration element is invalid
*/
- CompletionProposalComputerDescriptor(IConfigurationElement element, CompletionProposalComputerRegistry registry, List categories) throws InvalidRegistryObjectException {
+ CompletionProposalComputerDescriptor(IConfigurationElement element, CompletionProposalComputerRegistry registry, List categories) throws InvalidRegistryObjectException, CoreException {
Assert.isNotNull(registry);
Assert.isNotNull(element);
@@ -182,18 +185,19 @@ final class CompletionProposalComputerDescriptor {
}
/**
- * Checks an element that must be defined according to the extension
- * point schema. Throws an
- * InvalidRegistryObjectException
if obj
- * is null
.
+ * Checks that the given attribute value is not null
.
+ *
+ * @param value the element to be checked
+ * @param attribute the attribute
+ * @throws CoreException if value
is null
*/
- private void checkNotNull(Object obj, String attribute) throws InvalidRegistryObjectException {
+ private void checkNotNull(Object obj, String attribute) throws CoreException {
if (obj == null) {
Object[] args= { getId(), fElement.getContributor().getName(), attribute };
String message= Messages.format(ContentAssistMessages.CompletionProposalComputerDescriptor_illegal_attribute_message, args);
IStatus status= new Status(IStatus.WARNING, CUIPlugin.getPluginId(), IStatus.OK, message, null);
CUIPlugin.log(status);
- throw new InvalidRegistryObjectException();
+ throw new CoreException(status);
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java
index 3ff5ff9c663..6074ce793c8 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java
@@ -23,11 +23,11 @@ import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -228,7 +228,7 @@ public final class CompletionProposalComputerRegistry {
}
all.add(desc);
- } catch (InvalidRegistryObjectException x) {
+ } catch (CoreException x) {
/*
* Element is not valid any longer as the contributing plug-in was unloaded or for
* some other reason. Do not include the extension in the list and inform the user
@@ -300,7 +300,7 @@ public final class CompletionProposalComputerRegistry {
category.setSortOrder(r);
}
}
- } catch (InvalidRegistryObjectException x) {
+ } catch (CoreException x) {
/*
* Element is not valid any longer as the contributing plug-in was unloaded or for
* some other reason. Do not include the extension in the list and inform the user
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/proposals/TUCorrectionProposal.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/proposals/TUCorrectionProposal.java
index 9ee54cefd6b..1bfcabeb2df 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/proposals/TUCorrectionProposal.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/proposals/TUCorrectionProposal.java
@@ -47,6 +47,7 @@ import org.eclipse.cdt.ui.refactoring.CTextFileChange;
import org.eclipse.cdt.internal.corext.codemanipulation.StubUtility;
import org.eclipse.cdt.internal.corext.fix.LinkedProposalModel;
import org.eclipse.cdt.internal.corext.fix.LinkedProposalPositionGroup;
+import org.eclipse.cdt.internal.corext.util.Resources;
import org.eclipse.cdt.internal.corext.util.Strings;
import org.eclipse.cdt.internal.ui.CUIStatus;
@@ -54,7 +55,6 @@ import org.eclipse.cdt.internal.ui.editor.CEditor;
import org.eclipse.cdt.internal.ui.text.correction.CorrectionMessages;
import org.eclipse.cdt.internal.ui.util.EditorUtility;
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
-import org.eclipse.cdt.internal.ui.util.Resources;
import org.eclipse.cdt.internal.ui.viewsupport.LinkedProposalModelPresenter;
/**