} else if (0 != result) {
String m = "Result of running " + context;
uiBuildMsgHandler.handleMessage(new Message(m,
- IMessage.ERROR, thrown, null));
+ IMessage.ERROR, null, null));
}
if (null != any.fromInPipe) {
String m = "Error processing input pipe for " + context;
}
};
- controller = LangUtil.makeProcess(controller, props.classpath,
- props.mainClass, props.args);
+ controller = LangUtil.makeProcess(controller, props.classpath, props.mainClass, props.args);
command.append(Arrays.asList(controller.getCommand()).toString());
compilerThread.start();
}
- class CompilerThread extends Thread {
+ static class CompilerThread extends Thread {
private AjCompiler compiler;
private boolean buildFresh;
public AjCompiler getCompilerForConfigFile(String configFile) {
if (configFile == null)
return null;
- if ((compiler == null || !compiler.getId().equals(configFile))
- && configFile != null) {
+ if ((compiler == null || !compiler.getId().equals(configFile))) {
if (compiler != null) {
// have to remove the incremental state of the previous
// compiler - this will remove it from the
addFilesToDirTree(model, relativePaths, badEntries);
pruneEmptyDirs(root);
- sortModel((BuildConfigNode)model.getRoot(), ALPHABETICAL_COMPARATOR);
+ sortModel(model.getRoot(), ALPHABETICAL_COMPARATOR);
//addImportedFilesToDirTree(model, importedFiles);
addProblemEntries(root, badEntries);
/**
* @return null if the kind could not be resolved
*/
- protected AbstractIcon getStructureIcon(IProgramElement.Kind kind, IProgramElement.Accessibility accessibility) {
- return getStructureIcon(kind, IProgramElement.Accessibility.PUBLIC);
- }
+ protected abstract AbstractIcon getStructureIcon(IProgramElement.Kind kind, IProgramElement.Accessibility accessibility);
/**
* Assumes "public" visibility for the icon.
return upPathMatch;
} else {
StringTokenizer st = new StringTokenizer(path, "/");
- BuildConfigNode node = (BuildConfigNode)root;
- return getNodeForPathHelper(st, node);
+ return getNodeForPathHelper(st, root);
}
}
public List getActiveNodes(BuildConfigNode.Kind kind) {
List nodes = new ArrayList();
- getActiveNodesHelper((BuildConfigNode)getRoot(), kind, nodes);
+ getActiveNodesHelper(root, kind, nodes);
return nodes;
}
&& ((node.getSourceLocation().getLine() <= lineNumber
&& node.getSourceLocation().getEndLine() >= lineNumber)
||
- (lineNumber <= 1
- && node instanceof BuildConfigNode)
+ (lineNumber <= 1)
);
} catch (IOException ioe) {
return false;
* Comparison is string-name based only.
*/
public int compareTo(Object o) throws ClassCastException {
- if (this == o) {
- return 0;
- } else {
+ if (o instanceof BuildConfigNode) {
BuildConfigNode sn = (BuildConfigNode)o;
return this.getName().compareTo(sn.getName());
}
+ return -1;
}
public String getName() {
return name;
}
- public boolean equals(Object o) {
- return o.equals(name);
- }
+// public boolean equals(Object o) {
+// return (o instanceof Kind? this==o : false);
+//// return o.equals(name);
+// }
+//
+// public int hashCode() {
+// return ordinal;
+//// return name.hashCode();
+// }
public boolean isDeclareKind() {
return name.startsWith("declare");
List matches = new ArrayList();
IHierarchy model = AsmManager.getDefault().getHierarchy();
- if (model.equals(IHierarchy.NO_STRUCTURE)) {
+ if (model.getRoot().equals(IHierarchy.NO_STRUCTURE)) {
return null;
} else {
- return findMatchesHelper((IProgramElement)model.getRoot(), pattern, kind, matches);
+ return findMatchesHelper(model.getRoot(), pattern, kind, matches);
}
}
if (node != null && node.getChildren() != null) {
for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
IProgramElement nextNode = (IProgramElement)it.next();
- if (nextNode instanceof IProgramElement) {
+ if (nextNode!=null) {
findMatchesHelper(
- (IProgramElement)nextNode,
+ nextNode,
pattern,
kind,
matches);
*/
public IStructureViewNode getActiveNode() {
if (activeNode != null
- && activeNode.getStructureNode() instanceof IProgramElement) {
+ && activeNode.getStructureNode()!=null) {
return activeNode;
} else {
return null;
newFilePath,
lineNumber);
- if (currNode instanceof IProgramElement) {
- navigationAction((IProgramElement)currNode, true);
+ if (currNode!=null) {
+ navigationAction(currNode, true);
}
}
StructureView view = (StructureView)it.next();
if (!(view instanceof GlobalStructureView) || !recordHistory || defaultFileView == null) {
if (node.getKind().equals(IProgramElement.Kind.CODE)) {
- IProgramElement parentNode = (IProgramElement)node.getParent();
+ IProgramElement parentNode = node.getParent();
if (parentNode != null) {
IStructureViewNode currNode = view.findCorrespondingViewNode(parentNode);
int lineOffset = node.getSourceLocation().getLine() - parentNode.getSourceLocation().getLine();
}
private boolean acceptNode(IProgramElement node, StructureViewProperties properties) {
- if (node instanceof IProgramElement) {
- IProgramElement pNode = (IProgramElement)node;
+ if (node!=null) {
+ IProgramElement pNode = node;
if (!acceptGranularity(pNode.getKind(), properties.getGranularity())) {
return false;
} else if (pNode.getKind().isMember()) {
}
}
}
-// } else if (node instanceof IRelationship) {
-// IRelationship relation = (IRelationship)node;
-// return properties.getRelations().contains(relation);
- } else {
- return true;
}
return true;
}
IProgramElement sv1 = ((IStructureViewNode)o1).getStructureNode();
IProgramElement sv2 = ((IStructureViewNode)o2).getStructureNode();
- if (sv1 instanceof IProgramElement && sv2 instanceof IProgramElement) {
+ if (sv1!=null && sv2!=null) {
- IProgramElement p1 = (IProgramElement)sv1;
- IProgramElement p2 = (IProgramElement)sv2;
+ if (sv2.getKind() == IProgramElement.Kind.IMPORT_REFERENCE) return 1;
+ if (sv1.getKind() == IProgramElement.Kind.IMPORT_REFERENCE) return -1;
- if (p2.getKind() == IProgramElement.Kind.IMPORT_REFERENCE) return 1;
- if (p1.getKind() == IProgramElement.Kind.IMPORT_REFERENCE) return -1;
-
- return p1.getName().compareTo(p2.getName());
+ return sv1.getName().compareTo(sv2.getName());
} else {
return 0;
}
private static final Comparator DECLARATIONAL_COMPARATOR = new Comparator() {
public int compare(Object o1, Object o2) {
IProgramElement sv1 = ((IStructureViewNode)o1).getStructureNode();
- IProgramElement sv2 = ((IStructureViewNode)o2).getStructureNode();
- if (sv1 instanceof IProgramElement && sv2 instanceof IProgramElement) {
- IProgramElement p1 = (IProgramElement)sv1;
- IProgramElement p2 = (IProgramElement)sv2;
- if (p2.getKind() == IProgramElement.Kind.IMPORT_REFERENCE) return 1;
- if (p1.getKind() == IProgramElement.Kind.IMPORT_REFERENCE) return -1;
- if (p1.getSourceLocation() == null || p2.getSourceLocation() == null) {
+ IProgramElement sv2 = ((IStructureViewNode)o2).getStructureNode();
+ if (sv1!=null && sv2!=null) {
+ if (sv2.getKind() == IProgramElement.Kind.IMPORT_REFERENCE) return 1;
+ if (sv1.getKind() == IProgramElement.Kind.IMPORT_REFERENCE) return -1;
+ if (sv1.getSourceLocation() == null || sv2.getSourceLocation() == null) {
return 0;
- } else if (p1.getSourceLocation().getLine() < p2.getSourceLocation().getLine()) {
+ } else if (sv1.getSourceLocation().getLine() < sv2.getSourceLocation().getLine()) {
return -1;
} else {
return 1;
public class UserPreferencesStore implements UserPreferencesAdapter {
public static final String FILE_NAME = "/.ajbrowser";
- private final String VALUE_SEP = ";";
+ private static final String VALUE_SEP = ";";
private Properties properties = new Properties();
private boolean persist = true;
public void updateView(StructureView structureView) {
if (structureView instanceof GlobalStructureView) {
- treeManager.updateTree((GlobalStructureView)structureView);
+ treeManager.updateTree(structureView);
}
}
SwingTreeViewNode treeNode = (SwingTreeViewNode)tree.getLastSelectedPathComponent();
if (treeNode != null && !e.isControlDown() && !e.isShiftDown() && e.getModifiers() != 4) {
IProgramElement currNode = (IProgramElement)treeNode.getUserObject();
- if (currNode instanceof IProgramElement && !e.isControlDown()
+ if (currNode!=null && !e.isControlDown()
&& !e.isShiftDown() && e.getModifiers() != 4) {
//AjdeUIManager.getDefault().getViewManager().showNodeInMasterView((ProgramElementNode)currNode);
//if (AjdeUIManager.getDefault().getViewManager().isSplitViewMode()) {
SwingTreeViewNode treeNode = (SwingTreeViewNode)tree.getLastSelectedPathComponent();
if (treeNode != null) {
IProgramElement currNode = (IProgramElement)treeNode.getUserObject();
- if (currNode instanceof IProgramElement && !e.isControlDown() && !e.isShiftDown()
+ if (currNode!=null && !e.isControlDown() && !e.isShiftDown()
&& e.getModifiers() != 4) {
//AjdeUIManager.getDefault().getViewManager().showNodeInMasterView(((LinkNode)currNode).getProgramElementNode());
//AjdeUIManager.getDefault().getViewManager().showNodeInSlaveView(((LinkNode)currNode).getProgramElementNode());
IMessage cm = (IMessage) value;
label = cm.getMessage();
if (LangUtil.isEmpty(label)) {
- label = cm.getMessage().toString();
+ label = cm.getMessage();
}
kind = cm.getKind();
Throwable thrown = cm.getThrown();
setVisible(true);
main_tabbedPane.setSelectedComponent(panel);
}
-
- private void loadOptions() {
- try {
- Component[] components = main_tabbedPane.getComponents();
- for (int i = 0; i < components.length; i++) {
- if (components[i] instanceof OptionsPanel) {
- ((OptionsPanel)components[i]).loadOptions();
- }
- }
- } catch (IOException ioe) {
- Message msg = new Message("Could not load options.",IMessage.ERROR,ioe,null);
- Ajde.getDefault().getMessageHandler().handleMessage(msg);
- }
- }
+//
+// private void loadOptions() {
+// try {
+// Component[] components = main_tabbedPane.getComponents();
+// for (int i = 0; i < components.length; i++) {
+// if (components[i] instanceof OptionsPanel) {
+// ((OptionsPanel)components[i]).loadOptions();
+// }
+// }
+// } catch (IOException ioe) {
+// Message msg = new Message("Could not load options.",IMessage.ERROR,ioe,null);
+// Ajde.getDefault().getMessageHandler().handleMessage(msg);
+// }
+// }
private void saveOptions() {
try {
private void highlightNode(SwingTreeViewNode parent, IProgramElement node) {
for (int i = 0; i < parent.getChildCount(); i++) {
SwingTreeViewNode currNode = (SwingTreeViewNode)parent.getChildAt(i);
- IProgramElement sNode = (IProgramElement)currNode.getStructureNode();
+ IProgramElement sNode = currNode.getStructureNode();
if (sNode != null && sNode.equals(node) && currNode.getKind() != IStructureViewNode.Kind.LINK) {
TreePath path = new TreePath(currNode.getPath());
structureTree.setSelectionPath(path);
structureTree.expandPath(structureTree.getPathForRow(0));
}
- private class StructureTreeModel extends DefaultTreeModel implements TreeModel {
+ private static class StructureTreeModel extends DefaultTreeModel {
private static final long serialVersionUID = 1L;
public void setActiveNode(IStructureViewNode node, int lineOffset) {
if (node == null) return;
// if (!(node.getStructureNode() instanceof IProgramElement)) return;
- IProgramElement pNode = (IProgramElement)node.getStructureNode();
+ IProgramElement pNode = node.getStructureNode();
treeManager.highlightNode(pNode);
if (pNode.getSourceLocation() != null) {
Ajde.getDefault().getEditorAdapter().showSourceLine(
public void highlightActiveNode() {
if (currentView.getActiveNode() == null) return;
IProgramElement node = currentView.getActiveNode().getStructureNode();
- if (node instanceof IProgramElement) {
- treeManager.highlightNode((IProgramElement)node);
+ if (node!=null) {
+ treeManager.highlightNode(node);
}
}
jLabel1.setText(" Build configuration: " + configFile);
model = Ajde.getDefault().getBuildConfigManager().buildModel(configFile);
- root = buildTree((BuildConfigNode)model.getRoot());
+ root = buildTree(model.getRoot());
buildConfig_tree.setModel(new DefaultTreeModel(root));
buildConfig_tree.addMouseListener(new ConfigFileMouseAdapter(buildConfig_tree));
jScrollPane.getViewport().add(buildConfig_tree, null);
}
- private class ConfigTreeNode extends DefaultMutableTreeNode {
+ private static class ConfigTreeNode extends DefaultMutableTreeNode {
private static final long serialVersionUID = 1L;
public JCheckBox checkBox = null;
}
- private class ConfigFileMouseAdapter extends MouseAdapter {
+ private static class ConfigFileMouseAdapter extends MouseAdapter {
private JTree tree = null;
final JCheckBox checkBoxProto = new JCheckBox();
final int width = checkBoxProto.getPreferredSize().width;