mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
b36b8e6f80
commit
c2678fecf6
1 changed files with 46 additions and 62 deletions
|
@ -282,8 +282,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
IRegion lineInfo= document.getLineInformationOfOffset(start);
|
IRegion lineInfo= document.getLineInformationOfOffset(start);
|
||||||
start= lineInfo.getOffset();
|
start= lineInfo.getOffset();
|
||||||
end= start + lineInfo.getLength();
|
end= start + lineInfo.getLength();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
line= MarkerUtilities.getLineNumber(marker);
|
line= MarkerUtilities.getLineNumber(marker);
|
||||||
// Marker line numbers are 1-based
|
// Marker line numbers are 1-based
|
||||||
-- line;
|
-- line;
|
||||||
|
@ -321,7 +320,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void doOperation(int operation) {
|
public void doOperation(int operation) {
|
||||||
|
|
||||||
if (getTextWidget() == null)
|
if (getTextWidget() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -424,7 +422,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
* @see org.eclipse.jface.text.link.LinkedModeUI$IExitPolicy#doExit(org.eclipse.jface.text.link.LinkedModeModel, org.eclipse.swt.events.VerifyEvent, int, int)
|
* @see org.eclipse.jface.text.link.LinkedModeUI$IExitPolicy#doExit(org.eclipse.jface.text.link.LinkedModeModel, org.eclipse.swt.events.VerifyEvent, int, int)
|
||||||
*/
|
*/
|
||||||
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)) {
|
||||||
if (event.character == fExitCharacter) {
|
if (event.character == fExitCharacter) {
|
||||||
BracketLevel level = fStack.peek();
|
BracketLevel level = fStack.peek();
|
||||||
|
@ -571,8 +568,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAngularIntroducer(String identifier) {
|
private boolean isAngularIntroducer(String identifier) {
|
||||||
return identifier.length() > 0
|
return identifier.length() > 0 && (Character.isUpperCase(identifier.charAt(0))
|
||||||
&& (Character.isUpperCase(identifier.charAt(0))
|
|
||||||
|| angularIntroducers.contains(identifier)
|
|| angularIntroducers.contains(identifier)
|
||||||
|| identifier.endsWith("_ptr") //$NON-NLS-1$
|
|| identifier.endsWith("_ptr") //$NON-NLS-1$
|
||||||
|| identifier.endsWith("_cast")); //$NON-NLS-1$
|
|| identifier.endsWith("_cast")); //$NON-NLS-1$
|
||||||
|
@ -711,7 +707,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
sourceViewer.setSelectedRange(newSelection.getOffset(), newSelection.getLength());
|
sourceViewer.setSelectedRange(newSelection.getOffset(), newSelection.getLength());
|
||||||
|
|
||||||
event.doit = false;
|
event.doit = false;
|
||||||
|
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
CUIPlugin.log(e);
|
CUIPlugin.log(e);
|
||||||
} catch (BadPositionCategoryException e) {
|
} catch (BadPositionCategoryException e) {
|
||||||
|
@ -756,8 +751,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
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)
|
||||||
&& !level.fSecondPosition.isDeleted
|
&& !level.fSecondPosition.isDeleted
|
||||||
&& level.fSecondPosition.offset == level.fFirstPosition.offset)
|
&& level.fSecondPosition.offset == level.fFirstPosition.offset) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
document.replace(level.fSecondPosition.offset,
|
document.replace(level.fSecondPosition.offset,
|
||||||
level.fSecondPosition.length,
|
level.fSecondPosition.length,
|
||||||
|
@ -1328,7 +1322,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
angularIntroducers.add("include"); //$NON-NLS-1$
|
angularIntroducers.add("include"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -1486,6 +1479,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
public boolean isSaveAsAllowed() {
|
public boolean isSaveAsAllowed() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the outline page of the c-editor.
|
* Gets the outline page of the c-editor.
|
||||||
* @return Outline page.
|
* @return Outline page.
|
||||||
|
@ -1507,15 +1501,13 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
public Object getAdapter(Class required) {
|
public Object getAdapter(Class required) {
|
||||||
if (IContentOutlinePage.class.equals(required)) {
|
if (IContentOutlinePage.class.equals(required)) {
|
||||||
return getOutlinePage();
|
return getOutlinePage();
|
||||||
}
|
} else if (required == IShowInTargetList.class) {
|
||||||
else if (required == IShowInTargetList.class) {
|
|
||||||
return new IShowInTargetList() {
|
return new IShowInTargetList() {
|
||||||
public String[] getShowInTargetIds() {
|
public String[] getShowInTargetIds() {
|
||||||
return new String[] { IPageLayout.ID_PROJECT_EXPLORER, IPageLayout.ID_OUTLINE, IPageLayout.ID_RES_NAV };
|
return new String[] { IPageLayout.ID_PROJECT_EXPLORER, IPageLayout.ID_OUTLINE, IPageLayout.ID_RES_NAV };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
} else if (required == IShowInSource.class) {
|
||||||
else if (required == IShowInSource.class) {
|
|
||||||
ICElement ce= null;
|
ICElement ce= null;
|
||||||
ce= getElementAt(getSourceViewer().getSelectedRange().x, false);
|
ce= getElementAt(getSourceViewer().getSelectedRange().x, false);
|
||||||
if (ce instanceof ITranslationUnit) {
|
if (ce instanceof ITranslationUnit) {
|
||||||
|
@ -1527,22 +1519,18 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
return new ShowInContext(getEditorInput(), selection);
|
return new ShowInContext(getEditorInput(), selection);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
} else if (ProjectionAnnotationModel.class.equals(required)) {
|
||||||
else if (ProjectionAnnotationModel.class.equals(required)) {
|
|
||||||
if (fProjectionSupport != null) {
|
if (fProjectionSupport != null) {
|
||||||
Object adapter = fProjectionSupport.getAdapter(getSourceViewer(), required);
|
Object adapter = fProjectionSupport.getAdapter(getSourceViewer(), required);
|
||||||
if (adapter != null)
|
if (adapter != null)
|
||||||
return adapter;
|
return adapter;
|
||||||
}
|
}
|
||||||
}
|
} else if (IContextProvider.class.equals(required)) {
|
||||||
else if (IContextProvider.class.equals(required)) {
|
|
||||||
return new CUIHelp.CUIHelpContextProvider(this);
|
return new CUIHelp.CUIHelpContextProvider(this);
|
||||||
}
|
} else if (IGotoMarker.class.equals(required)) {
|
||||||
else if (IGotoMarker.class.equals(required)) {
|
|
||||||
IGotoMarker gotoMarker= new GotoMarkerAdapter();
|
IGotoMarker gotoMarker= new GotoMarkerAdapter();
|
||||||
return gotoMarker;
|
return gotoMarker;
|
||||||
}
|
} else if (ITemplatesPage.class.equals(required)) {
|
||||||
else if (ITemplatesPage.class.equals(required)) {
|
|
||||||
if (fTemplatesPage == null) {
|
if (fTemplatesPage == null) {
|
||||||
fTemplatesPage = new CTemplatesPage(this);
|
fTemplatesPage = new CTemplatesPage(this);
|
||||||
return fTemplatesPage;
|
return fTemplatesPage;
|
||||||
|
@ -1732,10 +1720,11 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
ITextHover textHover= configuration.getTextHover(sourceViewer, t);
|
ITextHover textHover= configuration.getTextHover(sourceViewer, t);
|
||||||
((ITextViewerExtension2) sourceViewer).setTextHover(textHover, t, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
|
((ITextViewerExtension2) sourceViewer).setTextHover(textHover, t, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
sourceViewer.setTextHover(configuration.getTextHover(sourceViewer, t), t);
|
sourceViewer.setTextHover(configuration.getTextHover(sourceViewer, t), t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* React to changed selection in the editor.
|
* React to changed selection in the editor.
|
||||||
|
@ -1831,7 +1820,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* React to changed selection in the outline view.
|
* React to changed selection in the outline view.
|
||||||
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
|
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
|
||||||
|
@ -1986,8 +1974,9 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
if (provider instanceof CDocumentProvider) {
|
if (provider instanceof CDocumentProvider) {
|
||||||
CDocumentProvider cProvider= (CDocumentProvider) provider;
|
CDocumentProvider cProvider= (CDocumentProvider) provider;
|
||||||
tabToSpacesConverter.setLineTracker(cProvider.createLineTracker(getEditorInput()));
|
tabToSpacesConverter.setLineTracker(cProvider.createLineTracker(getEditorInput()));
|
||||||
} else
|
} else {
|
||||||
tabToSpacesConverter.setLineTracker(new DefaultLineTracker());
|
tabToSpacesConverter.setLineTracker(new DefaultLineTracker());
|
||||||
|
}
|
||||||
((ITextViewerExtension7) sourceViewer).setTabsToSpacesConverter(tabToSpacesConverter);
|
((ITextViewerExtension7) sourceViewer).setTabsToSpacesConverter(tabToSpacesConverter);
|
||||||
updateIndentationMode();
|
updateIndentationMode();
|
||||||
}
|
}
|
||||||
|
@ -2256,7 +2245,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected ActionGroup createSelectionSearchGroup() {
|
protected ActionGroup createSelectionSearchGroup() {
|
||||||
return new SelectionSearchGroup(this);
|
return new SelectionSearchGroup(this);
|
||||||
}
|
}
|
||||||
|
@ -2265,8 +2253,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
return new OpenViewActionGroup(this);
|
return new OpenViewActionGroup(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
|
* @see org.eclipse.ui.texteditor.AbstractTextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
|
||||||
*/
|
*/
|
||||||
|
@ -2981,7 +2967,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
for (int i = 0, length= listeners.length; i < length; ++i) {
|
for (int i = 0, length= listeners.length; i < length; ++i) {
|
||||||
((ICReconcilingListener) listeners[i]).reconciled(ast, force, progressMonitor);
|
((ICReconcilingListener) listeners[i]).reconciled(ast, force, progressMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3133,7 +3118,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
||||||
int length= fLocations.length;
|
int length= fLocations.length;
|
||||||
Map<Annotation, Position> annotationMap= new HashMap<Annotation, Position>(length);
|
Map<Annotation, Position> annotationMap= new HashMap<Annotation, Position>(length);
|
||||||
for (int i= 0; i < length; i++) {
|
for (int i= 0; i < length; i++) {
|
||||||
|
|
||||||
if (isCanceled(progressMonitor))
|
if (isCanceled(progressMonitor))
|
||||||
return Status.CANCEL_STATUS;
|
return Status.CANCEL_STATUS;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue