mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Cosmetics.
This commit is contained in:
parent
1c93d8ad9e
commit
9742045d4a
2 changed files with 27 additions and 38 deletions
|
@ -96,8 +96,7 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
try {
|
try {
|
||||||
return performNavigation(monitor);
|
return performNavigation(monitor);
|
||||||
}
|
} catch (CoreException e) {
|
||||||
catch (CoreException e) {
|
|
||||||
return e.getStatus();
|
return e.getStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +119,6 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
||||||
setDescription(CEditorMessages.OpenDeclarations_description);
|
setDescription(CEditorMessages.OpenDeclarations_description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected IStatus performNavigation(IProgressMonitor monitor) throws CoreException {
|
protected IStatus performNavigation(IProgressMonitor monitor) throws CoreException {
|
||||||
clearStatusLine();
|
clearStatusLine();
|
||||||
|
|
||||||
|
@ -175,8 +173,7 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
boolean found= false;
|
boolean found= false;
|
||||||
final IASTNode parent = searchName.getParent();
|
final IASTNode parent = searchName.getParent();
|
||||||
if (parent instanceof IASTPreprocessorIncludeStatement) {
|
if (parent instanceof IASTPreprocessorIncludeStatement) {
|
||||||
|
@ -196,8 +193,7 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
||||||
IName[] declNames = findDeclNames(ast, isKind, binding);
|
IName[] declNames = findDeclNames(ast, isKind, binding);
|
||||||
if (navigateViaCElements(fWorkingCopy.getCProject(), fIndex, declNames)) {
|
if (navigateViaCElements(fWorkingCopy.getCProject(), fIndex, declNames)) {
|
||||||
found= true;
|
found= true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// leave old method as fallback for local variables, parameters and
|
// leave old method as fallback for local variables, parameters and
|
||||||
// everything else not covered by ICElementHandle.
|
// everything else not covered by ICElementHandle.
|
||||||
found = navigateOneLocation(declNames);
|
found = navigateOneLocation(declNames);
|
||||||
|
@ -221,7 +217,6 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private IName[] findDeclNames(IASTTranslationUnit ast, int isKind, IBinding binding) throws CoreException {
|
private IName[] findDeclNames(IASTTranslationUnit ast, int isKind, IBinding binding) throws CoreException {
|
||||||
IName[] declNames = findNames(fIndex, ast, isKind, binding);
|
IName[] declNames = findNames(fIndex, ast, isKind, binding);
|
||||||
if (declNames.length == 0) {
|
if (declNames.length == 0) {
|
||||||
|
@ -358,7 +353,6 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
||||||
return navigateCElements(elements);
|
return navigateCElements(elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void convertToCElements(ICProject project, IIndex index, IName[] declNames, List<ICElement> elements) {
|
private void convertToCElements(ICProject project, IIndex index, IName[] declNames, List<ICElement> elements) {
|
||||||
for (IName declName : declNames) {
|
for (IName declName : declNames) {
|
||||||
try {
|
try {
|
||||||
|
@ -382,8 +376,7 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
||||||
ISourceReference target= null;
|
ISourceReference target= null;
|
||||||
if (elements.size() == 1) {
|
if (elements.size() == 1) {
|
||||||
target= (ISourceReference) elements.get(0);
|
target= (ISourceReference) elements.get(0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (sIsJUnitTest) {
|
if (sIsJUnitTest) {
|
||||||
throw new RuntimeException("ambiguous input"); //$NON-NLS-1$
|
throw new RuntimeException("ambiguous input"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -491,8 +484,7 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
||||||
private void runInUIThread(Runnable runnable) {
|
private void runInUIThread(Runnable runnable) {
|
||||||
if (Display.getCurrent() != null) {
|
if (Display.getCurrent() != null) {
|
||||||
runnable.run();
|
runnable.run();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Display.getDefault().asyncExec(runnable);
|
Display.getDefault().asyncExec(runnable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -508,15 +500,13 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void computeSelectedWord() {
|
private void computeSelectedWord() {
|
||||||
fTextSelection = getSelectedStringFromEditor();
|
fTextSelection = getSelectedStringFromEditor();
|
||||||
fSelectedText= null;
|
fSelectedText= null;
|
||||||
if (fTextSelection != null) {
|
if (fTextSelection != null) {
|
||||||
if (fTextSelection.getLength() > 0) {
|
if (fTextSelection.getLength() > 0) {
|
||||||
fSelectedText= fTextSelection.getText();
|
fSelectedText= fTextSelection.getText();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
IDocument document= fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput());
|
IDocument document= fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput());
|
||||||
IRegion reg= CWordFinder.findWord(document, fTextSelection.getOffset());
|
IRegion reg= CWordFinder.findWord(document, fTextSelection.getOffset());
|
||||||
if (reg != null && reg.getLength() > 0) {
|
if (reg != null && reg.getLength() > 0) {
|
||||||
|
@ -530,4 +520,3 @@ public class OpenDeclarationsAction extends SelectionParseAction implements ASTR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,7 @@ public class SelectionParseAction extends Action {
|
||||||
protected void showStatusLineMessage(final String message) {
|
protected void showStatusLineMessage(final String message) {
|
||||||
StatusLineHandler.showStatusLineMessage(fSite, message);
|
StatusLineHandler.showStatusLineMessage(fSite, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void clearStatusLine() {
|
protected void clearStatusLine() {
|
||||||
StatusLineHandler.clearStatusLine(fSite);
|
StatusLineHandler.clearStatusLine(fSite);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +81,7 @@ public class SelectionParseAction extends Action {
|
||||||
|
|
||||||
protected ITextSelection getSelectedStringFromEditor() {
|
protected ITextSelection getSelectedStringFromEditor() {
|
||||||
ISelection selection = getSelection();
|
ISelection selection = getSelection();
|
||||||
if( selection == null || !(selection instanceof ITextSelection) )
|
if (!(selection instanceof ITextSelection))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return (ITextSelection) selection;
|
return (ITextSelection) selection;
|
||||||
|
@ -140,5 +141,4 @@ public class SelectionParseAction extends Action {
|
||||||
CSearchMessages.SelectionParseAction_IncludeNotFound_format,
|
CSearchMessages.SelectionParseAction_IncludeNotFound_format,
|
||||||
new Object[] { filename }));
|
new Object[] { filename }));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue