mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-06 15:55:47 +02:00
Cosmetics.
This commit is contained in:
parent
1e450cdd37
commit
5b9c323d9c
2 changed files with 51 additions and 251 deletions
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
||||||
* Andrew Eidsness - fix and test for bug 278632
|
* Andrew Eidsness - fix and test for bug 278632
|
||||||
* Serge Beauchamp (Freescale Semiconductor) - Bug 417909
|
* Serge Beauchamp (Freescale Semiconductor) - Bug 417909
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests.text;
|
package org.eclipse.cdt.ui.tests.text;
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||||
import org.eclipse.jface.text.DocumentEvent;
|
import org.eclipse.jface.text.DocumentEvent;
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
|
@ -95,27 +94,18 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Bug278632FileSystem extends FileSystem {
|
public static class Bug278632FileSystem extends FileSystem {
|
||||||
public Bug278632FileSystem() {
|
|
||||||
getClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFileStore getStore(URI uri) {
|
public IFileStore getStore(URI uri) {
|
||||||
try {
|
try {
|
||||||
// For the test case, this just return the FS implementation
|
// For the test case, this just returns the FS implementation used for the null
|
||||||
// used for the null filesystem.
|
// filesystem. In a real application this would be a real implementation,
|
||||||
// In a real application this would be a real implementation,
|
// however for the purposes of exposing the bug, any non-"file://" scheme will do.
|
||||||
// however for the purposes
|
return EFS.getStore(
|
||||||
// of exposing the bug, any non-file:// scheme will do.
|
new URI(EFS.getNullFileSystem().getScheme(), uri.getSchemeSpecificPart(), null));
|
||||||
return EFS.getStore(new URI(
|
|
||||||
EFS.getNullFileSystem().getScheme(), uri
|
|
||||||
.getSchemeSpecificPart(), null));
|
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
e.printStackTrace();
|
throw new RuntimeException(e);
|
||||||
return null;
|
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
e.printStackTrace();
|
throw new RuntimeException(e);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +156,8 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpEditor(File file) throws PartInitException, CModelException {
|
private void setUpEditor(File file) throws PartInitException, CModelException {
|
||||||
IEditorPart editor= EditorUtility.openInEditor(new ExternalTranslationUnit(fCProject, file.toURI(), CCorePlugin.CONTENT_TYPE_CXXSOURCE));
|
IEditorPart editor= EditorUtility.openInEditor(
|
||||||
|
new ExternalTranslationUnit(fCProject, file.toURI(), CCorePlugin.CONTENT_TYPE_CXXSOURCE));
|
||||||
assertNotNull(editor);
|
assertNotNull(editor);
|
||||||
assertTrue(editor instanceof CEditor);
|
assertTrue(editor instanceof CEditor);
|
||||||
fEditor= (CEditor) editor;
|
fEditor= (CEditor) editor;
|
||||||
|
@ -226,6 +217,7 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
children= tUnit.getChildren();
|
children= tUnit.getChildren();
|
||||||
assertEquals(3, children.length);
|
assertEquals(3, children.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
//{Point.cpp}
|
//{Point.cpp}
|
||||||
//#include <math.h>
|
//#include <math.h>
|
||||||
//class Point {
|
//class Point {
|
||||||
|
@ -263,16 +255,17 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
|
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
|
||||||
String content= fDocument.get();
|
String content= fDocument.get();
|
||||||
setCaret(0);
|
setCaret(0);
|
||||||
String newText= "/* "+getName()+" */\n";
|
String newText= "/* " + getName() + " */\n";
|
||||||
newText += readTaggedComment("Point.cpp");
|
newText += readTaggedComment("Point.cpp");
|
||||||
String[] lines= newText.split("\\r\\n|\\r|\\n");
|
String[] lines= newText.split("\\r\\n|\\r|\\n");
|
||||||
for (int i = 0; i < lines.length; i++) {
|
for (int i = 0; i < lines.length; i++) {
|
||||||
String line= lines[i].trim();
|
String line= lines[i].trim();
|
||||||
if (line.startsWith("}")) {
|
if (line.startsWith("}")) {
|
||||||
setCaret(fDocument.get().indexOf(line, getCaret())+line.length());
|
setCaret(fDocument.get().indexOf(line, getCaret()) + line.length());
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
} else {
|
} else {
|
||||||
if (i > 0) type('\n');
|
if (i > 0)
|
||||||
|
type('\n');
|
||||||
type(line);
|
type(line);
|
||||||
Thread.sleep(50);
|
Thread.sleep(50);
|
||||||
}
|
}
|
||||||
|
@ -312,7 +305,7 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
|
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
|
||||||
String content= fDocument.get();
|
String content= fDocument.get();
|
||||||
setCaret(0);
|
setCaret(0);
|
||||||
String newtext= "/* "+getName()+" */";
|
String newtext= "/* " + getName() + " */";
|
||||||
type(newtext);
|
type(newtext);
|
||||||
type('\n');
|
type('\n');
|
||||||
String newContent= fDocument.get();
|
String newContent= fDocument.get();
|
||||||
|
@ -340,7 +333,7 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
|
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
|
||||||
String content= fDocument.get();
|
String content= fDocument.get();
|
||||||
setCaret(0);
|
setCaret(0);
|
||||||
String newtext= "/* "+getName()+" */";
|
String newtext= "/* " + getName() + " */";
|
||||||
type(newtext);
|
type(newtext);
|
||||||
type('\n');
|
type('\n');
|
||||||
String newContent= fDocument.get();
|
String newContent= fDocument.get();
|
||||||
|
@ -381,7 +374,7 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
|
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
|
||||||
String content= fDocument.get();
|
String content= fDocument.get();
|
||||||
setCaret(0);
|
setCaret(0);
|
||||||
String newtext= "/* "+getName()+" */";
|
String newtext= "/* " + getName() + " */";
|
||||||
type(newtext);
|
type(newtext);
|
||||||
type('\n');
|
type('\n');
|
||||||
String newContent= fDocument.get();
|
String newContent= fDocument.get();
|
||||||
|
@ -427,12 +420,10 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNonFileEFSResource_Bug278632() {
|
public void testNonFileEFSResource_Bug278632() {
|
||||||
IWorkbenchPage page = PlatformUI.getWorkbench()
|
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||||
.getActiveWorkbenchWindow().getActivePage();
|
|
||||||
assertNotNull(page);
|
assertNotNull(page);
|
||||||
|
|
||||||
IEditorRegistry reg = page.getWorkbenchWindow().getWorkbench()
|
IEditorRegistry reg = page.getWorkbenchWindow().getWorkbench().getEditorRegistry();
|
||||||
.getEditorRegistry();
|
|
||||||
String editorID = reg.getDefaultEditor(".c").getId();
|
String editorID = reg.getDefaultEditor(".c").getId();
|
||||||
|
|
||||||
URI uri = null;
|
URI uri = null;
|
||||||
|
@ -525,13 +516,11 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
assertEquals(offset, newOffset);
|
assertEquals(offset, newOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
// See Bug 417909 - Opening a large file from a progress dialog causes the scalability dialog to disappear
|
// See Bug 417909 - Opening a large file from a progress dialog causes the scalability dialog to
|
||||||
public void testScalabilityDialogNotDismissedInadvertently()
|
// disappear.
|
||||||
throws Exception {
|
public void testScalabilityDialogNotDismissedInadvertently_417909() throws Exception {
|
||||||
|
|
||||||
// 1. Create a project with a very large source file.
|
// 1. Create a project with a very large source file.
|
||||||
fCProject = EditorTestHelper.createCProject("ceditor",
|
fCProject = EditorTestHelper.createCProject("ceditor", "resources/ceditor", false, false);
|
||||||
"resources/ceditor", false, false);
|
|
||||||
|
|
||||||
// 1a. Dynamically create the large source file.
|
// 1a. Dynamically create the large source file.
|
||||||
String originalFile = "/ceditor/src/main.cpp";
|
String originalFile = "/ceditor/src/main.cpp";
|
||||||
|
@ -553,8 +542,7 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
|
|
||||||
// 2. Create and open a progress dialog window.
|
// 2. Create and open a progress dialog window.
|
||||||
IWorkbenchWindow window = EditorTestHelper.getActiveWorkbenchWindow();
|
IWorkbenchWindow window = EditorTestHelper.getActiveWorkbenchWindow();
|
||||||
ProgressMonitorDialog dialog = new ProgressMonitorDialog(
|
ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell());
|
||||||
window.getShell());
|
|
||||||
dialog.open();
|
dialog.open();
|
||||||
|
|
||||||
// 3. Open the large source file in the editor, which should cause the
|
// 3. Open the large source file in the editor, which should cause the
|
||||||
|
@ -579,5 +567,4 @@ public class BasicCEditorTest extends BaseUITestCase {
|
||||||
scalabilityDialog.close();
|
scalabilityDialog.close();
|
||||||
EditorTestHelper.closeEditor(fEditor);
|
EditorTestHelper.closeEditor(fEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
* Axel Mueller - [289339] Surround with
|
* Axel Mueller - [289339] Surround with
|
||||||
* Tomasz Wesolowski - [320561] Override indicators
|
* Tomasz Wesolowski - [320561] Override indicators
|
||||||
* Serge Beauchamp (Freescale Semiconductor) - Bug 417909
|
* Serge Beauchamp (Freescale Semiconductor) - Bug 417909
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.editor;
|
package org.eclipse.cdt.internal.ui.editor;
|
||||||
|
|
||||||
|
@ -126,7 +126,6 @@ import org.eclipse.swt.events.VerifyEvent;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Display;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.IActionBars;
|
import org.eclipse.ui.IActionBars;
|
||||||
import org.eclipse.ui.IEditorActionBarContributor;
|
import org.eclipse.ui.IEditorActionBarContributor;
|
||||||
|
@ -252,9 +251,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
private final class GotoMarkerAdapter implements IGotoMarker {
|
private final class GotoMarkerAdapter implements IGotoMarker {
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#gotoMarker(org.eclipse.core.resources.IMarker)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void gotoMarker(IMarker marker) {
|
public void gotoMarker(IMarker marker) {
|
||||||
if (fIsUpdatingMarkerViews)
|
if (fIsUpdatingMarkerViews)
|
||||||
|
@ -268,21 +264,21 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
|
|
||||||
boolean selectLine= start < 0 || end < 0;
|
boolean selectLine= start < 0 || end < 0;
|
||||||
|
|
||||||
// look up the current range of the marker when the document has been edited
|
// Look up the current range of the marker when the document has been edited.
|
||||||
IAnnotationModel model= getDocumentProvider().getAnnotationModel(getEditorInput());
|
IAnnotationModel model= getDocumentProvider().getAnnotationModel(getEditorInput());
|
||||||
if (model instanceof AbstractMarkerAnnotationModel) {
|
if (model instanceof AbstractMarkerAnnotationModel) {
|
||||||
AbstractMarkerAnnotationModel markerModel= (AbstractMarkerAnnotationModel) model;
|
AbstractMarkerAnnotationModel markerModel= (AbstractMarkerAnnotationModel) model;
|
||||||
Position pos= markerModel.getMarkerPosition(marker);
|
Position pos= markerModel.getMarkerPosition(marker);
|
||||||
if (pos != null && !pos.isDeleted()) {
|
if (pos != null && !pos.isDeleted()) {
|
||||||
// use position instead of marker values
|
// Use position instead of marker values
|
||||||
start= pos.getOffset();
|
start= pos.getOffset();
|
||||||
end= pos.getOffset() + pos.getLength();
|
end= pos.getOffset() + pos.getLength();
|
||||||
// use position as is
|
// Use position as is
|
||||||
selectLine= false;
|
selectLine= false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos != null && pos.isDeleted()) {
|
if (pos != null && pos.isDeleted()) {
|
||||||
// do nothing if position has been deleted
|
// Do nothing if position has been deleted
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,9 +325,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
return fContentAssistant;
|
return fContentAssistant;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ITextOperationTarget#doOperation(int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void doOperation(int operation) {
|
public void doOperation(int operation) {
|
||||||
if (getTextWidget() == null)
|
if (getTextWidget() == null)
|
||||||
|
@ -344,8 +337,8 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
return;
|
return;
|
||||||
case QUICK_ASSIST:
|
case QUICK_ASSIST:
|
||||||
/*
|
/*
|
||||||
* XXX: We can get rid of this once the SourceViewer has a way to update the status line
|
* XXX: We can get rid of this once the SourceViewer has a way to update
|
||||||
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=133787
|
* the status line https://bugs.eclipse.org/bugs/show_bug.cgi?id=133787
|
||||||
*/
|
*/
|
||||||
msg= fQuickAssistAssistant.showPossibleQuickAssists();
|
msg= fQuickAssistAssistant.showPossibleQuickAssists();
|
||||||
setStatusLineErrorMessage(msg);
|
setStatusLineErrorMessage(msg);
|
||||||
|
@ -355,9 +348,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
super.doOperation(operation);
|
super.doOperation(operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IWidgetTokenOwner#requestWidgetToken(IWidgetTokenKeeper)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean requestWidgetToken(IWidgetTokenKeeper requester) {
|
public boolean requestWidgetToken(IWidgetTokenKeeper requester) {
|
||||||
if (PlatformUI.getWorkbench().getHelpSystem().isContextHelpDisplayed())
|
if (PlatformUI.getWorkbench().getHelpSystem().isContextHelpDisplayed())
|
||||||
|
@ -365,10 +355,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
return super.requestWidgetToken(requester);
|
return super.requestWidgetToken(requester);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IWidgetTokenOwnerExtension#requestWidgetToken(IWidgetTokenKeeper, int)
|
|
||||||
* @since 3.0
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean requestWidgetToken(IWidgetTokenKeeper requester, int priority) {
|
public boolean requestWidgetToken(IWidgetTokenKeeper requester, int priority) {
|
||||||
if (PlatformUI.getWorkbench().getHelpSystem().isContextHelpDisplayed())
|
if (PlatformUI.getWorkbench().getHelpSystem().isContextHelpDisplayed())
|
||||||
|
@ -376,10 +362,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
return super.requestWidgetToken(requester, priority);
|
return super.requestWidgetToken(requester, priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.text.source.SourceViewer#createFormattingContext()
|
|
||||||
* @since 3.0
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IFormattingContext createFormattingContext() {
|
public IFormattingContext createFormattingContext() {
|
||||||
IFormattingContext context= new FormattingContext();
|
IFormattingContext context= new FormattingContext();
|
||||||
|
@ -398,7 +380,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
try {
|
try {
|
||||||
language= tu.getLanguage();
|
language= tu.getLanguage();
|
||||||
} catch (CoreException exc) {
|
} catch (CoreException exc) {
|
||||||
// use fallback CPP
|
// Use fallback CPP
|
||||||
language= GPPLanguage.getDefault();
|
language= GPPLanguage.getDefault();
|
||||||
}
|
}
|
||||||
preferences.put(DefaultCodeFormatterConstants.FORMATTER_TRANSLATION_UNIT, tu);
|
preferences.put(DefaultCodeFormatterConstants.FORMATTER_TRANSLATION_UNIT, tu);
|
||||||
|
@ -432,9 +414,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
fSize = fStack.size();
|
fSize = fStack.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.text.link.LinkedModeUI$IExitPolicy#doExit(org.eclipse.jface.text.link.LinkedModeModel, org.eclipse.swt.events.VerifyEvent, int, int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {
|
public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {
|
||||||
if (fSize == fStack.size() && !isMasked(offset)) {
|
if (fSize == fStack.size() && !isMasked(offset)) {
|
||||||
|
@ -446,8 +425,8 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
// don't enter the character if if its the closing peer
|
// don't enter the character if if its the closing peer
|
||||||
return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
|
return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
|
||||||
}
|
}
|
||||||
// when entering an anonymous class between the parenthesis', we don't want
|
// When entering an anonymous class between the parenthesis', we don't want
|
||||||
// to jump after the closing parenthesis when return is pressed
|
// to jump after the closing parenthesis when return is pressed.
|
||||||
if (event.character == SWT.CR && offset > 0) {
|
if (event.character == SWT.CR && offset > 0) {
|
||||||
IDocument document = getSourceViewer().getDocument();
|
IDocument document = getSourceViewer().getDocument();
|
||||||
try {
|
try {
|
||||||
|
@ -471,8 +450,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class BracketLevel {
|
private static class BracketLevel {
|
||||||
// int fOffset;
|
|
||||||
// int fLength;
|
|
||||||
LinkedModeUI fUI;
|
LinkedModeUI fUI;
|
||||||
Position fFirstPosition;
|
Position fFirstPosition;
|
||||||
Position fSecondPosition;
|
Position fSecondPosition;
|
||||||
|
@ -484,7 +461,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
private static class ExclusivePositionUpdater implements IPositionUpdater {
|
private static class ExclusivePositionUpdater implements IPositionUpdater {
|
||||||
|
|
||||||
/** The position category. */
|
/** The position category. */
|
||||||
private final String fCategory;
|
private final String fCategory;
|
||||||
|
|
||||||
|
@ -497,9 +473,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
fCategory = category;
|
fCategory = category;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.text.IPositionUpdater#update(org.eclipse.jface.text.DocumentEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void update(DocumentEvent event) {
|
public void update(DocumentEvent event) {
|
||||||
int eventOffset = event.getOffset();
|
int eventOffset = event.getOffset();
|
||||||
|
@ -563,7 +536,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
|
|
||||||
private class BracketInserter implements VerifyKeyListener, ILinkedModeListener {
|
private class BracketInserter implements VerifyKeyListener, ILinkedModeListener {
|
||||||
|
|
||||||
private boolean fCloseBrackets = true;
|
private boolean fCloseBrackets = true;
|
||||||
private boolean fCloseStrings = true;
|
private boolean fCloseStrings = true;
|
||||||
private boolean fCloseAngularBrackets = true;
|
private boolean fCloseAngularBrackets = true;
|
||||||
|
@ -590,13 +562,9 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
|| identifier.endsWith("_cast")); //$NON-NLS-1$
|
|| identifier.endsWith("_cast")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.swt.custom.VerifyKeyListener#verifyKey(org.eclipse.swt.events.VerifyEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void verifyKey(VerifyEvent event) {
|
public void verifyKey(VerifyEvent event) {
|
||||||
|
// Early pruning to slow down normal typing as little as possible.
|
||||||
// early pruning to slow down normal typing as little as possible
|
|
||||||
if (!event.doit || getInsertMode() != SMART_INSERT)
|
if (!event.doit || getInsertMode() != SMART_INSERT)
|
||||||
return;
|
return;
|
||||||
switch (event.character) {
|
switch (event.character) {
|
||||||
|
@ -681,12 +649,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
final StringBuilder buffer = new StringBuilder(3);
|
final StringBuilder buffer = new StringBuilder(3);
|
||||||
buffer.append(character);
|
buffer.append(character);
|
||||||
buffer.append(closingCharacter);
|
buffer.append(closingCharacter);
|
||||||
// No longer necessary since consecutive closing angular brackets are allowed in C++11.
|
|
||||||
// if (closingCharacter == '>' && nextToken != Symbols.TokenEOF
|
|
||||||
// && document.getChar(offset + length) == '>') {
|
|
||||||
// // Insert a space to avoid two consecutive closing angular brackets.
|
|
||||||
// buffer.append(' ');
|
|
||||||
// }
|
|
||||||
|
|
||||||
document.replace(offset, length, buffer.toString());
|
document.replace(offset, length, buffer.toString());
|
||||||
|
|
||||||
|
@ -701,7 +663,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
model.addGroup(group);
|
model.addGroup(group);
|
||||||
model.forceInstall();
|
model.forceInstall();
|
||||||
|
|
||||||
// Set up position tracking for our magic peers
|
// Set up position tracking for our magic peers.
|
||||||
if (fBracketLevelStack.size() == 1) {
|
if (fBracketLevelStack.size() == 1) {
|
||||||
document.addPositionCategory(CATEGORY);
|
document.addPositionCategory(CATEGORY);
|
||||||
document.addPositionUpdater(fUpdater);
|
document.addPositionUpdater(fUpdater);
|
||||||
|
@ -731,7 +693,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
|
|
||||||
private boolean isInsideStringInPreprocessorDirective(ITypedRegion partition, IDocument document, int offset) throws BadLocationException {
|
private boolean isInsideStringInPreprocessorDirective(ITypedRegion partition, IDocument document, int offset) throws BadLocationException {
|
||||||
if (ICPartitions.C_PREPROCESSOR.equals(partition.getType()) && offset < document.getLength()) {
|
if (ICPartitions.C_PREPROCESSOR.equals(partition.getType()) && offset < document.getLength()) {
|
||||||
// use temporary document to test whether offset is inside non-default partition
|
// Use temporary document to test whether offset is inside non-default partition.
|
||||||
String directive = document.get(partition.getOffset(), offset - partition.getOffset() + 1);
|
String directive = document.get(partition.getOffset(), offset - partition.getOffset() + 1);
|
||||||
int hashIdx = directive.indexOf('#');
|
int hashIdx = directive.indexOf('#');
|
||||||
if (hashIdx >= 0) {
|
if (hashIdx >= 0) {
|
||||||
|
@ -746,9 +708,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.text.link.ILinkedModeListener#left(org.eclipse.jface.text.link.LinkedModeModel, int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void left(LinkedModeModel environment, int flags) {
|
public void left(LinkedModeModel environment, int flags) {
|
||||||
|
|
||||||
|
@ -763,7 +722,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
if (document instanceof IDocumentExtension) {
|
if (document instanceof IDocumentExtension) {
|
||||||
IDocumentExtension extension = (IDocumentExtension) document;
|
IDocumentExtension extension = (IDocumentExtension) document;
|
||||||
extension.registerPostNotificationReplace(null, new IDocumentExtension.IReplace() {
|
extension.registerPostNotificationReplace(null, new IDocumentExtension.IReplace() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(IDocument d, IDocumentListener owner) {
|
public void perform(IDocument d, IDocumentListener owner) {
|
||||||
if ((level.fFirstPosition.isDeleted || level.fFirstPosition.length == 0)
|
if ((level.fFirstPosition.isDeleted || level.fFirstPosition.length == 0)
|
||||||
|
@ -791,16 +749,10 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.text.link.ILinkedModeListener#suspend(org.eclipse.jface.text.link.LinkedModeModel)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void suspend(LinkedModeModel environment) {
|
public void suspend(LinkedModeModel environment) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.text.link.ILinkedModeListener#resume(org.eclipse.jface.text.link.LinkedModeModel, int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void resume(LinkedModeModel environment, int flags) {
|
public void resume(LinkedModeModel environment, int flags) {
|
||||||
}
|
}
|
||||||
|
@ -812,10 +764,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
private class EditorSelectionChangedListener extends AbstractSelectionChangedListener {
|
private class EditorSelectionChangedListener extends AbstractSelectionChangedListener {
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void selectionChanged(SelectionChangedEvent event) {
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
// XXX: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=56161
|
// XXX: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=56161
|
||||||
|
@ -829,7 +777,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
protected abstract class NextSubWordAction extends TextNavigationAction {
|
protected abstract class NextSubWordAction extends TextNavigationAction {
|
||||||
|
|
||||||
protected CWordIterator fIterator = new CWordIterator();
|
protected CWordIterator fIterator = new CWordIterator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -841,9 +788,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
super(getSourceViewer().getTextWidget(), code);
|
super(getSourceViewer().getTextWidget(), code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.action.IAction#run()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// Check whether sub word navigation is enabled.
|
// Check whether sub word navigation is enabled.
|
||||||
|
@ -905,7 +849,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
protected class NavigateNextSubWordAction extends NextSubWordAction {
|
protected class NavigateNextSubWordAction extends NextSubWordAction {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new navigate next sub-word action.
|
* Creates a new navigate next sub-word action.
|
||||||
*/
|
*/
|
||||||
|
@ -913,9 +856,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
super(ST.WORD_NEXT);
|
super(ST.WORD_NEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.CEditor.NextSubWordAction#setCaretPosition(int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void setCaretPosition(final int position) {
|
protected void setCaretPosition(final int position) {
|
||||||
getTextWidget().setCaretOffset(modelOffset2WidgetOffset(getSourceViewer(), position));
|
getTextWidget().setCaretOffset(modelOffset2WidgetOffset(getSourceViewer(), position));
|
||||||
|
@ -928,7 +868,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
protected class DeleteNextSubWordAction extends NextSubWordAction implements IUpdate {
|
protected class DeleteNextSubWordAction extends NextSubWordAction implements IUpdate {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new delete next sub-word action.
|
* Creates a new delete next sub-word action.
|
||||||
*/
|
*/
|
||||||
|
@ -936,9 +875,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
super(ST.DELETE_WORD_NEXT);
|
super(ST.DELETE_WORD_NEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.CEditor.NextSubWordAction#setCaretPosition(int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void setCaretPosition(final int position) {
|
protected void setCaretPosition(final int position) {
|
||||||
if (!validateEditorInputState())
|
if (!validateEditorInputState())
|
||||||
|
@ -975,17 +911,11 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.CEditor.NextSubWordAction#findNextPosition(int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected int findNextPosition(int position) {
|
protected int findNextPosition(int position) {
|
||||||
return fIterator.following(position);
|
return fIterator.following(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.IUpdate#update()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
setEnabled(isEditorInputModifiable());
|
setEnabled(isEditorInputModifiable());
|
||||||
|
@ -998,7 +928,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
protected class SelectNextSubWordAction extends NextSubWordAction {
|
protected class SelectNextSubWordAction extends NextSubWordAction {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new select next sub-word action.
|
* Creates a new select next sub-word action.
|
||||||
*/
|
*/
|
||||||
|
@ -1006,9 +935,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
super(ST.SELECT_WORD_NEXT);
|
super(ST.SELECT_WORD_NEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.CEditor.NextSubWordAction#setCaretPosition(int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void setCaretPosition(final int position) {
|
protected void setCaretPosition(final int position) {
|
||||||
final ISourceViewer viewer = getSourceViewer();
|
final ISourceViewer viewer = getSourceViewer();
|
||||||
|
@ -1034,7 +960,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
protected abstract class PreviousSubWordAction extends TextNavigationAction {
|
protected abstract class PreviousSubWordAction extends TextNavigationAction {
|
||||||
|
|
||||||
protected CWordIterator fIterator = new CWordIterator();
|
protected CWordIterator fIterator = new CWordIterator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1046,9 +971,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
super(getSourceViewer().getTextWidget(), code);
|
super(getSourceViewer().getTextWidget(), code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.action.IAction#run()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// Check whether sub word navigation is enabled.
|
// Check whether sub word navigation is enabled.
|
||||||
|
@ -1118,9 +1040,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
super(ST.WORD_PREVIOUS);
|
super(ST.WORD_PREVIOUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.CEditor.PreviousSubWordAction#setCaretPosition(int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void setCaretPosition(final int position) {
|
protected void setCaretPosition(final int position) {
|
||||||
getTextWidget().setCaretOffset(modelOffset2WidgetOffset(getSourceViewer(), position));
|
getTextWidget().setCaretOffset(modelOffset2WidgetOffset(getSourceViewer(), position));
|
||||||
|
@ -1133,7 +1052,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
protected class DeletePreviousSubWordAction extends PreviousSubWordAction implements IUpdate {
|
protected class DeletePreviousSubWordAction extends PreviousSubWordAction implements IUpdate {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new delete previous sub-word action.
|
* Creates a new delete previous sub-word action.
|
||||||
*/
|
*/
|
||||||
|
@ -1141,9 +1059,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
super(ST.DELETE_WORD_PREVIOUS);
|
super(ST.DELETE_WORD_PREVIOUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.CEditor.PreviousSubWordAction#setCaretPosition(int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void setCaretPosition(int position) {
|
protected void setCaretPosition(int position) {
|
||||||
if (!validateEditorInputState())
|
if (!validateEditorInputState())
|
||||||
|
@ -1179,17 +1094,11 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.CEditor.PreviousSubWordAction#findPreviousPosition(int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected int findPreviousPosition(int position) {
|
protected int findPreviousPosition(int position) {
|
||||||
return fIterator.preceding(position);
|
return fIterator.preceding(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.IUpdate#update()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
setEnabled(isEditorInputModifiable());
|
setEnabled(isEditorInputModifiable());
|
||||||
|
@ -1202,7 +1111,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
protected class SelectPreviousSubWordAction extends PreviousSubWordAction {
|
protected class SelectPreviousSubWordAction extends PreviousSubWordAction {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new select previous sub-word action.
|
* Creates a new select previous sub-word action.
|
||||||
*/
|
*/
|
||||||
|
@ -1210,24 +1118,21 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
super(ST.SELECT_WORD_PREVIOUS);
|
super(ST.SELECT_WORD_PREVIOUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.CEditor.PreviousSubWordAction#setCaretPosition(int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void setCaretPosition(final int position) {
|
protected void setCaretPosition(final int position) {
|
||||||
final ISourceViewer viewer = getSourceViewer();
|
final ISourceViewer viewer = getSourceViewer();
|
||||||
|
|
||||||
final StyledText text = viewer.getTextWidget();
|
final StyledText text = viewer.getTextWidget();
|
||||||
if (text != null && !text.isDisposed()) {
|
if (text != null && !text.isDisposed()) {
|
||||||
|
|
||||||
final Point selection = text.getSelection();
|
final Point selection = text.getSelection();
|
||||||
final int caret = text.getCaretOffset();
|
final int caret = text.getCaretOffset();
|
||||||
final int offset = modelOffset2WidgetOffset(viewer, position);
|
final int offset = modelOffset2WidgetOffset(viewer, position);
|
||||||
|
|
||||||
if (caret == selection.x)
|
if (caret == selection.x) {
|
||||||
text.setSelectionRange(selection.y, offset - selection.y);
|
text.setSelectionRange(selection.y, offset - selection.y);
|
||||||
else
|
} else {
|
||||||
text.setSelectionRange(selection.x, offset - selection.x);
|
text.setSelectionRange(selection.x, offset - selection.x);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1452,16 +1357,10 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
fPostSaveListeners = new ListenerList();
|
fPostSaveListeners = new ListenerList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#initializeEditor()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void initializeEditor() {
|
protected void initializeEditor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#doSetInput(org.eclipse.ui.IEditorInput)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void doSetInput(IEditorInput input) throws CoreException {
|
protected void doSetInput(IEditorInput input) throws CoreException {
|
||||||
ISourceViewer sourceViewer= getSourceViewer();
|
ISourceViewer sourceViewer= getSourceViewer();
|
||||||
|
@ -1580,10 +1479,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#setPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)
|
|
||||||
* @since 5.0
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void setPreferenceStore(IPreferenceStore store) {
|
protected void setPreferenceStore(IPreferenceStore store) {
|
||||||
super.setPreferenceStore(store);
|
super.setPreferenceStore(store);
|
||||||
|
@ -1717,7 +1612,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
final AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
|
final AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
|
||||||
|
|
||||||
if (asv != null) {
|
if (asv != null) {
|
||||||
|
|
||||||
boolean newBooleanValue= false;
|
boolean newBooleanValue= false;
|
||||||
Object newValue= event.getNewValue();
|
Object newValue= event.getNewValue();
|
||||||
if (newValue != null)
|
if (newValue != null)
|
||||||
|
@ -1853,16 +1747,13 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#initializeViewerColors(org.eclipse.jface.text.source.ISourceViewer)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void initializeViewerColors(ISourceViewer viewer) {
|
protected void initializeViewerColors(ISourceViewer viewer) {
|
||||||
// is handled by CSourceViewer
|
// is handled by CSourceViewer
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Update the hovering behavior depending on the preferences.
|
* Updates the hovering behavior depending on the preferences.
|
||||||
*/
|
*/
|
||||||
private void updateHoverBehavior() {
|
private void updateHoverBehavior() {
|
||||||
SourceViewerConfiguration configuration= getSourceViewerConfiguration();
|
SourceViewerConfiguration configuration= getSourceViewerConfiguration();
|
||||||
|
@ -1893,7 +1784,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* React to changed selection in the editor.
|
* Reacts to changed selection in the editor.
|
||||||
*
|
*
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
|
@ -2151,10 +2042,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
return (this == service.getActivePart());
|
return (this == service.getActivePart());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#installTabsToSpacesConverter()
|
|
||||||
* @since 4.0
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void installTabsToSpacesConverter() {
|
protected void installTabsToSpacesConverter() {
|
||||||
ISourceViewer sourceViewer= getSourceViewer();
|
ISourceViewer sourceViewer= getSourceViewer();
|
||||||
|
@ -2188,10 +2075,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
super.updateIndentPrefixes();
|
super.updateIndentPrefixes();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#isTabsToSpacesConversionEnabled()
|
|
||||||
* @since 4.0
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isTabsToSpacesConversionEnabled() {
|
protected boolean isTabsToSpacesConversionEnabled() {
|
||||||
ICElement element= getInputCElement();
|
ICElement element= getInputCElement();
|
||||||
|
@ -2230,7 +2113,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
fProjectionSupport = null;
|
fProjectionSupport = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cancel possible running computation
|
// Cancel possible running computation
|
||||||
fMarkOccurrenceAnnotations= false;
|
fMarkOccurrenceAnnotations= false;
|
||||||
uninstallOccurrencesFinder();
|
uninstallOccurrencesFinder();
|
||||||
uninstallOverrideIndicator();
|
uninstallOverrideIndicator();
|
||||||
|
@ -2295,9 +2178,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#canHandleMove(org.eclipse.ui.IEditorInput, org.eclipse.ui.IEditorInput)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canHandleMove(IEditorInput originalElement, IEditorInput movedElement) {
|
protected boolean canHandleMove(IEditorInput originalElement, IEditorInput movedElement) {
|
||||||
String oldLanguage = ""; //$NON-NLS-1$
|
String oldLanguage = ""; //$NON-NLS-1$
|
||||||
|
@ -2330,9 +2210,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
return oldLanguage.equals(newLanguage);
|
return oldLanguage.equals(newLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void createActions() {
|
protected void createActions() {
|
||||||
super.createActions();
|
super.createActions();
|
||||||
|
@ -2483,9 +2360,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
return new OpenViewActionGroup(this);
|
return new OpenViewActionGroup(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void editorContextMenuAboutToShow(IMenuManager menu) {
|
public void editorContextMenuAboutToShow(IMenuManager menu) {
|
||||||
// marker for contributions to the top
|
// marker for contributions to the top
|
||||||
|
@ -2535,9 +2409,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#rulerContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void rulerContextMenuAboutToShow(IMenuManager menu) {
|
protected void rulerContextMenuAboutToShow(IMenuManager menu) {
|
||||||
super.rulerContextMenuAboutToShow(menu);
|
super.rulerContextMenuAboutToShow(menu);
|
||||||
|
@ -2584,19 +2455,12 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
|
return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.part.WorkbenchPart#getOrientation()
|
|
||||||
* @since 4.0
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int getOrientation() {
|
public int getOrientation() {
|
||||||
// C/C++ editors are always left to right by default
|
// C/C++ editors are always left to right by default
|
||||||
return SWT.LEFT_TO_RIGHT;
|
return SWT.LEFT_TO_RIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createPartControl(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void createPartControl(Composite parent) {
|
public void createPartControl(Composite parent) {
|
||||||
super.createPartControl(parent);
|
super.createPartControl(parent);
|
||||||
|
@ -2641,12 +2505,8 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
|
|
||||||
if(isShowingOverrideIndicators())
|
if(isShowingOverrideIndicators())
|
||||||
installOverrideIndicator(false);
|
installOverrideIndicator(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#getSourceViewerDecorationSupport(org.eclipse.jface.text.source.ISourceViewer)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected SourceViewerDecorationSupport getSourceViewerDecorationSupport(ISourceViewer viewer) {
|
protected SourceViewerDecorationSupport getSourceViewerDecorationSupport(ISourceViewer viewer) {
|
||||||
if (fSourceViewerDecorationSupport == null) {
|
if (fSourceViewerDecorationSupport == null) {
|
||||||
|
@ -2656,9 +2516,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
return fSourceViewerDecorationSupport;
|
return fSourceViewerDecorationSupport;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#configureSourceViewerDecorationSupport(org.eclipse.ui.texteditor.SourceViewerDecorationSupport)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
|
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
|
||||||
super.configureSourceViewerDecorationSupport(support);
|
super.configureSourceViewerDecorationSupport(support);
|
||||||
|
@ -2688,7 +2545,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
* Jumps to the matching bracket.
|
* Jumps to the matching bracket.
|
||||||
*/
|
*/
|
||||||
public void gotoMatchingBracket() {
|
public void gotoMatchingBracket() {
|
||||||
|
|
||||||
ISourceViewer sourceViewer = getSourceViewer();
|
ISourceViewer sourceViewer = getSourceViewer();
|
||||||
IDocument document = sourceViewer.getDocument();
|
IDocument document = sourceViewer.getDocument();
|
||||||
if (document == null)
|
if (document == null)
|
||||||
|
@ -2811,8 +2667,8 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
return annotation;
|
return annotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Get the dektop's StatusLineManager
|
* Returns the dektop's StatusLineManager
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected IStatusLineManager getStatusLineManager() {
|
protected IStatusLineManager getStatusLineManager() {
|
||||||
|
@ -2837,9 +2693,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#createNavigationActions()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void createNavigationActions() {
|
protected void createNavigationActions() {
|
||||||
super.createNavigationActions();
|
super.createNavigationActions();
|
||||||
|
@ -2883,9 +2736,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
return getSourceViewer();
|
return getSourceViewer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createSourceViewer(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.source.IVerticalRuler, int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
|
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
|
||||||
IPreferenceStore store= getPreferenceStore();
|
IPreferenceStore store= getPreferenceStore();
|
||||||
|
@ -2991,17 +2841,11 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
fOutlinerContextMenuId = menuId;
|
fOutlinerContextMenuId = menuId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.editors.text.TextEditor#initializeKeyBindingScopes()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void initializeKeyBindingScopes() {
|
protected void initializeKeyBindingScopes() {
|
||||||
setKeyBindingScopes(new String [] { "org.eclipse.cdt.ui.cEditorScope" }); //$NON-NLS-1$
|
setKeyBindingScopes(new String [] { "org.eclipse.cdt.ui.cEditorScope" }); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see AbstractTextEditor#affectsTextPresentation(PropertyChangeEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean affectsTextPresentation(PropertyChangeEvent event) {
|
protected boolean affectsTextPresentation(PropertyChangeEvent event) {
|
||||||
SourceViewerConfiguration configuration = getSourceViewerConfiguration();
|
SourceViewerConfiguration configuration = getSourceViewerConfiguration();
|
||||||
|
@ -3020,9 +2864,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
return fFoldingGroup;
|
return fFoldingGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#performRevert()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void performRevert() {
|
protected void performRevert() {
|
||||||
ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
|
ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
|
||||||
|
@ -3161,9 +3002,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#collectContextMenuPreferencePages()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] collectContextMenuPreferencePages() {
|
protected String[] collectContextMenuPreferencePages() {
|
||||||
// Add C/C++ Editor relevant pages
|
// Add C/C++ Editor relevant pages
|
||||||
|
@ -3187,10 +3025,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
return prefPageIds;
|
return prefPageIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.text.ICReconcilingListener#aboutToBeReconciled()
|
|
||||||
* @since 4.0
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void aboutToBeReconciled() {
|
public void aboutToBeReconciled() {
|
||||||
fIsReconciling= true;
|
fIsReconciling= true;
|
||||||
|
@ -3205,10 +3039,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.text.ICReconcilingListener#reconciled(IASTTranslationUnit, boolean, IProgressMonitor)
|
|
||||||
* @since 4.0
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void reconciled(IASTTranslationUnit ast, boolean force, IProgressMonitor progressMonitor) {
|
public void reconciled(IASTTranslationUnit ast, boolean force, IProgressMonitor progressMonitor) {
|
||||||
fIsReconciling= false;
|
fIsReconciling= false;
|
||||||
|
@ -3271,7 +3101,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uninstall Semantic Highlighting.
|
* Uninstalls semantic highlighting.
|
||||||
*
|
*
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
|
@ -3294,9 +3124,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
fSurroundWithActionGroup.fillActionBars(actionBars);
|
fSurroundWithActionGroup.fillActionBars(actionBars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#updateStateDependentActions()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateStateDependentActions() {
|
protected void updateStateDependentActions() {
|
||||||
super.updateStateDependentActions();
|
super.updateStateDependentActions();
|
||||||
|
@ -3347,9 +3174,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
|| LinkedModeModel.hasInstalledModel(fDocument);
|
|| LinkedModeModel.hasInstalledModel(fDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see Job#run(org.eclipse.core.runtime.IProgressMonitor)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IStatus run(IProgressMonitor progressMonitor) {
|
public IStatus run(IProgressMonitor progressMonitor) {
|
||||||
if (isCanceled(progressMonitor))
|
if (isCanceled(progressMonitor))
|
||||||
|
@ -3444,25 +3268,16 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void documentAboutToBeChanged(DocumentEvent event) {
|
public void documentAboutToBeChanged(DocumentEvent event) {
|
||||||
if (fOccurrencesAnnotationUpdaterJob != null)
|
if (fOccurrencesAnnotationUpdaterJob != null)
|
||||||
fOccurrencesAnnotationUpdaterJob.doCancel();
|
fOccurrencesAnnotationUpdaterJob.doCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void documentChanged(DocumentEvent event) {
|
public void documentChanged(DocumentEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.text.ITextInputListener#inputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument, org.eclipse.jface.text.IDocument)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
|
public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
|
||||||
if (oldInput == null)
|
if (oldInput == null)
|
||||||
|
@ -3471,9 +3286,6 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
oldInput.removeDocumentListener(this);
|
oldInput.removeDocumentListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.text.ITextInputListener#inputDocumentChanged(org.eclipse.jface.text.IDocument, org.eclipse.jface.text.IDocument)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
|
public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
|
||||||
if (newInput == null)
|
if (newInput == null)
|
||||||
|
@ -3696,10 +3508,11 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isPrefQuickDiffAlwaysOn() {
|
protected boolean isPrefQuickDiffAlwaysOn() {
|
||||||
// enable only if not in scalability mode
|
// Enable only if not in scalability mode.
|
||||||
// workaround for http://bugs.eclipse.org/75555
|
// Workaround for http://bugs.eclipse.org/75555
|
||||||
return super.isPrefQuickDiffAlwaysOn() && !isEnableScalablilityMode();
|
return super.isPrefQuickDiffAlwaysOn() && !isEnableScalablilityMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldProcessLocalParsingCompletions() {
|
public boolean shouldProcessLocalParsingCompletions() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue