mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
Cosmetics.
This commit is contained in:
parent
4946010ddd
commit
5854ece2d4
5 changed files with 24 additions and 36 deletions
|
@ -6,9 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.ui.callhierarchy;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
@ -24,9 +23,7 @@ import org.eclipse.swt.widgets.Display;
|
|||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
|
||||
|
||||
public class CHDropTargetListener implements DropTargetListener {
|
||||
|
||||
private CHViewPart fCallHierarchy;
|
||||
private ICElement fInput;
|
||||
private boolean fEnabled= true;
|
||||
|
@ -56,7 +53,7 @@ public class CHDropTargetListener implements DropTargetListener {
|
|||
private ICElement checkLocalSelection() {
|
||||
ISelection sel= LocalSelectionTransfer.getTransfer().getSelection();
|
||||
if (sel instanceof IStructuredSelection) {
|
||||
for (Iterator<?> iter = ((IStructuredSelection)sel).iterator(); iter.hasNext();) {
|
||||
for (Iterator<?> iter = ((IStructuredSelection) sel).iterator(); iter.hasNext();) {
|
||||
Object element = iter.next();
|
||||
if (element instanceof ICElement) {
|
||||
return (ICElement) element;
|
||||
|
@ -85,8 +82,7 @@ public class CHDropTargetListener implements DropTargetListener {
|
|||
public void drop(DropTargetEvent event) {
|
||||
if (fInput == null) {
|
||||
Display.getCurrent().beep();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fCallHierarchy.setInput(fInput);
|
||||
}
|
||||
}
|
||||
|
@ -97,8 +93,7 @@ public class CHDropTargetListener implements DropTargetListener {
|
|||
private void checkOperation(DropTargetEvent event) {
|
||||
if (fEnabled && (event.operations & DND.DROP_COPY) != 0) {
|
||||
event.detail= DND.DROP_COPY;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
event.detail= DND.DROP_NONE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.callhierarchy;
|
||||
|
||||
|
@ -101,8 +101,8 @@ public class CHQueries {
|
|||
}
|
||||
|
||||
|
||||
private static void findCalledBy2(IIndex index, IBinding callee, boolean includeOrdinaryCalls, ICProject project, CalledByResult result)
|
||||
throws CoreException {
|
||||
private static void findCalledBy2(IIndex index, IBinding callee, boolean includeOrdinaryCalls,
|
||||
ICProject project, CalledByResult result) throws CoreException {
|
||||
IIndexName[] names= index.findNames(callee, IIndex.FIND_REFERENCES | IIndex.SEARCH_ACROSS_LANGUAGE_BOUNDARIES);
|
||||
for (IIndexName rname : names) {
|
||||
if (includeOrdinaryCalls || rname.couldBePolymorphicMethodCall()) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.callhierarchy;
|
||||
|
||||
|
@ -136,8 +136,7 @@ public class CallHierarchyUI {
|
|||
CHMessages.CallHierarchyUI_openFailureMessage);
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
catch (CoreException e) {
|
||||
} catch (CoreException e) {
|
||||
return e.getStatus();
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +150,8 @@ public class CallHierarchyUI {
|
|||
private static ICElement[] findDefinitions(ICProject project, IEditorInput editorInput, ITextSelection sel)
|
||||
throws CoreException {
|
||||
try {
|
||||
IIndex index= CCorePlugin.getIndexManager().getIndex(project, IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_DEPENDENT);
|
||||
IIndex index= CCorePlugin.getIndexManager().getIndex(project,
|
||||
IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_DEPENDENT);
|
||||
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
|
@ -190,8 +190,7 @@ public class CallHierarchyUI {
|
|||
return NO_ELEMENTS;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
index.releaseReadLock();
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
|
@ -226,7 +225,8 @@ public class CallHierarchyUI {
|
|||
final ITranslationUnit tu= CModelUtil.getTranslationUnit(input);
|
||||
if (tu != null) {
|
||||
final ICProject project= tu.getCProject();
|
||||
final IIndex index= CCorePlugin.getIndexManager().getIndex(project, IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_DEPENDENT);
|
||||
final IIndex index= CCorePlugin.getIndexManager().getIndex(project,
|
||||
IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_DEPENDENT);
|
||||
|
||||
index.acquireReadLock();
|
||||
try {
|
||||
|
@ -242,21 +242,18 @@ public class CallHierarchyUI {
|
|||
IIndexName name= IndexUI.elementToName(index, input);
|
||||
if (name != null) {
|
||||
ICElementHandle handle= IndexUI.getCElementForName(tu, index, name);
|
||||
return new ICElement[] {handle};
|
||||
return new ICElement[] { handle };
|
||||
}
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
index.releaseReadLock();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (CoreException e) {
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
return new ICElement[] {input};
|
||||
return new ICElement[] { input };
|
||||
}
|
||||
|
||||
private static boolean needToFindDefinition(ICElement elem) {
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.eclipse.cdt.ui.actions.SelectionDispatchAction;
|
|||
|
||||
|
||||
public class OpenCallHierarchyAction extends SelectionDispatchAction {
|
||||
|
||||
private ITextEditor fEditor;
|
||||
|
||||
public OpenCallHierarchyAction(IWorkbenchSite site) {
|
||||
|
@ -73,8 +72,7 @@ public class OpenCallHierarchyAction extends SelectionDispatchAction {
|
|||
ICElement elem= (ICElement) getAdapter(selectedObject, ICElement.class);
|
||||
if (elem != null) {
|
||||
setEnabled(isValidElement(elem));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.ui.callhierarchy;
|
||||
|
||||
import org.eclipse.jface.action.IAction;
|
||||
|
@ -31,7 +30,6 @@ import org.eclipse.cdt.core.model.ICElement;
|
|||
import org.eclipse.cdt.internal.ui.browser.opentype.ElementSelectionDialog;
|
||||
|
||||
public class OpenElementInCallHierarchyAction implements IWorkbenchWindowActionDelegate {
|
||||
|
||||
private static final int[] VISIBLE_TYPES = {
|
||||
ICElement.C_FUNCTION, ICElement.C_METHOD, ICElement.C_VARIABLE, ICElement.C_ENUMERATOR,
|
||||
ICElement.C_FUNCTION_DECLARATION, ICElement.C_METHOD_DECLARATION, ICElement.C_VARIABLE_DECLARATION };
|
||||
|
@ -59,10 +57,10 @@ public class OpenElementInCallHierarchyAction implements IWorkbenchWindowActionD
|
|||
}
|
||||
if (elements == null || elements.length == 0) {
|
||||
String title = CHMessages.OpenElementInCallHierarchyAction_errorDlgTitle;
|
||||
String message = NLS.bind(CHMessages.OpenElementInCallHierarchyAction_errorNoDefinition, info.getQualifiedTypeName().toString());
|
||||
String message = NLS.bind(CHMessages.OpenElementInCallHierarchyAction_errorNoDefinition,
|
||||
info.getQualifiedTypeName().toString());
|
||||
MessageDialog.openError(getShell(), title, message);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
CallHierarchyUI.open(fWorkbenchWindow, elements[0]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue