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