1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-09-16 14:26:26 -07:00
parent 1a13e176e8
commit a6d6e88dc0

View file

@ -103,7 +103,7 @@ class THHierarchyModel {
public Object[] getHierarchyRootElements() { public Object[] getHierarchyRootElements() {
if (fRootNodes == null) { if (fRootNodes == null) {
return new Object[] {"..."}; //$NON-NLS-1$ return new Object[] { "..." }; //$NON-NLS-1$
} }
return fRootNodes; return fRootNodes;
} }
@ -132,8 +132,7 @@ class THHierarchyModel {
IWorkbenchSiteProgressService ps= fView.getProgressService(); IWorkbenchSiteProgressService ps= fView.getProgressService();
if (ps != null) { if (ps != null) {
ps.schedule(fJob, 0L, true); ps.schedule(fJob, 0L, true);
} } else {
else {
fJob.schedule(); fJob.schedule();
} }
} }
@ -161,22 +160,19 @@ class THHierarchyModel {
graph.addSubClasses(index, monitor); graph.addSubClasses(index, monitor);
if (monitor.isCanceled()) if (monitor.isCanceled())
return Status.CANCEL_STATUS; return Status.CANCEL_STATUS;
} } finally {
finally {
index.releaseReadLock(); index.releaseReadLock();
} }
} catch (CoreException e) { } catch (CoreException e) {
CUIPlugin.log(e); CUIPlugin.log(e);
} catch (InterruptedException e) { } catch (InterruptedException e) {
return Status.CANCEL_STATUS; return Status.CANCEL_STATUS;
} } finally {
finally {
onJobDone(graph, job); onJobDone(graph, job);
} }
return Status.OK_STATUS; return Status.OK_STATUS;
} }
protected void computeNodes() { protected void computeNodes() {
if (fGraph == null) { if (fGraph == null) {
return; return;
@ -191,13 +187,11 @@ class THHierarchyModel {
if (fHierarchyKind == TYPE_HIERARCHY) { if (fHierarchyKind == TYPE_HIERARCHY) {
groots= fGraph.getLeaveNodes(); groots= fGraph.getLeaveNodes();
} } else {
else {
THGraphNode node= fGraph.getInputNode(); THGraphNode node= fGraph.getInputNode();
if (node != null) { if (node != null) {
groots= Collections.singleton(node); groots= Collections.singleton(node);
} } else {
else {
groots= Collections.emptySet(); groots= Collections.emptySet();
} }
} }
@ -208,14 +202,13 @@ class THHierarchyModel {
stack.add(node); stack.add(node);
} }
while(!stack.isEmpty()) { while (!stack.isEmpty()) {
THNode node= stack.remove(stack.size()-1); THNode node= stack.remove(stack.size()-1);
THGraphNode gnode= fGraph.getNode(node.getElement()); THGraphNode gnode= fGraph.getNode(node.getElement());
List<THGraphEdge> edges= fwd ? gnode.getOutgoing() : gnode.getIncoming(); List<THGraphEdge> edges= fwd ? gnode.getOutgoing() : gnode.getIncoming();
if (edges.isEmpty()) { if (edges.isEmpty()) {
leafs.add(node); leafs.add(node);
} } else {
else {
for (THGraphEdge edge : edges) { for (THGraphEdge edge : edges) {
THGraphNode gchildNode= fwd ? edge.getEndNode() : edge.getStartNode(); THGraphNode gchildNode= fwd ? edge.getEndNode() : edge.getStartNode();
THNode childNode= createNode(node, gchildNode, inputNode); THNode childNode= createNode(node, gchildNode, inputNode);
@ -271,8 +264,7 @@ class THHierarchyModel {
if (node.equals(fSelectedTypeNode)) { if (node.equals(fSelectedTypeNode)) {
result[0]= node; result[0]= node;
return; return;
} } else if (result[1] == null) {
else if (result[1] == null) {
if (node.getElement().equals(fTypeToSelect)) { if (node.getElement().equals(fTypeToSelect)) {
result[1]= node; result[1]= node;
} }
@ -324,11 +316,9 @@ class THHierarchyModel {
THGraphNode inputNode= fGraph.getInputNode(); THGraphNode inputNode= fGraph.getInputNode();
if (!fGraph.isFileIndexed()) { if (!fGraph.isFileIndexed()) {
fView.setMessage(IndexUI.getFileNotIndexedMessage(fInput)); fView.setMessage(IndexUI.getFileNotIndexedMessage(fInput));
} } else if (inputNode == null) {
else if (inputNode == null) {
fView.setMessage(Messages.THHierarchyModel_errorComputingHierarchy); fView.setMessage(Messages.THHierarchyModel_errorComputingHierarchy);
} } else {
else {
if (fTypeToSelect == fInput) { if (fTypeToSelect == fInput) {
fTypeToSelect= inputNode.getElement(); fTypeToSelect= inputNode.getElement();
} }