summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2008-10-20 04:38:32 +0000
committeraclement <aclement>2008-10-20 04:38:32 +0000
commit7a625d01b8e28fe62c0a5ad826abef2b1891d373 (patch)
treef66273815d0804af65ceb8682032b1d7c3586a33
parent0b8250b807fe55b63d2a18f6cf4cd695e00681ea (diff)
downloadaspectj-7a625d01b8e28fe62c0a5ad826abef2b1891d373.tar.gz
aspectj-7a625d01b8e28fe62c0a5ad826abef2b1891d373.zip
251277: making asmmanager non-singleton
-rw-r--r--ajde/src/org/aspectj/ajde/Ajde.java36
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java48
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureViewManager.java17
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java62
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java324
5 files changed, 241 insertions, 246 deletions
diff --git a/ajde/src/org/aspectj/ajde/Ajde.java b/ajde/src/org/aspectj/ajde/Ajde.java
index b8db214f9..c1a5946da 100644
--- a/ajde/src/org/aspectj/ajde/Ajde.java
+++ b/ajde/src/org/aspectj/ajde/Ajde.java
@@ -62,7 +62,7 @@ public class Ajde {
private IconRegistry iconRegistry;
private IRuntimeProperties runtimeProperties;
private boolean initialized = false;
-
+ private AsmManager asm;
private OptionsFrame optionsFrame = null;
private Frame rootFrame = null;
private StructureViewPanel fileStructurePanel = null;
@@ -70,7 +70,7 @@ public class Ajde {
private EditorAdapter editorAdapter;
private StructureViewManager structureViewManager;
private StructureSearchManager structureSearchManager;
- private BuildConfigManager configurationManager;
+ private final BuildConfigManager configurationManager;
// all to do with building....
private ICompilerConfiguration compilerConfig;
@@ -78,6 +78,10 @@ public class Ajde {
private IBuildProgressMonitor buildProgressMonitor;
private AjCompiler compiler;
+ public AsmManager getModel() {
+ return asm;
+ }
+
/**
* This class can only be constructured by itself (as a singleton) or by sub-classes.
*/
@@ -96,6 +100,7 @@ public class Ajde {
INSTANCE.compilerConfig = compilerConfig;
INSTANCE.uiBuildMsgHandler = uiBuildMessageHandler;
INSTANCE.buildProgressMonitor = monitor;
+ INSTANCE.asm = AsmManager.createNewStructureModel();
INSTANCE.iconRegistry = iconRegistry;
INSTANCE.ideUIAdapter = ideUIAdapter;
@@ -142,8 +147,9 @@ public class Ajde {
private final BuildConfigListener STRUCTURE_UPDATE_CONFIG_LISTENER = new BuildConfigListener() {
public void currConfigChanged(String configFilePath) {
- if (configFilePath != null)
- AsmManager.getDefault().readStructureModel(configFilePath);
+ if (configFilePath != null) {
+ Ajde.getDefault().asm.readStructureModel(configFilePath);
+ }
}
public void configsListUpdated(List configsList) {
@@ -234,7 +240,7 @@ public class Ajde {
final String classpath;
final String[] args;
final boolean valid;
- private Frame rootFrame;
+ private final Frame rootFrame;
RunProperties(ICompilerConfiguration compilerConfig, IRuntimeProperties runtimeProperties, IUIBuildMessageHandler handler,
Frame rootFrame) {
@@ -313,8 +319,8 @@ public class Ajde {
static class CompilerThread extends Thread {
- private AjCompiler compiler;
- private boolean buildFresh;
+ private final AjCompiler compiler;
+ private final boolean buildFresh;
public CompilerThread(AjCompiler compiler, boolean buildFresh) {
this.compiler = compiler;
@@ -463,4 +469,20 @@ public class Ajde {
}
return compiler;
}
+
+ public AsmManager getModelForConfigFile(String configFile) {
+ return compiler.getModel();
+ // 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
+ // // IncrementalStateManager's
+ // // list
+ // compiler.clearLastState();
+ // }
+ // getMessageHandler().reset();
+ // compiler = new AjCompiler(configFile, getCompilerConfig(), getBuildProgressMonitor(), getMessageHandler());
+ // }
+
+ }
}
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java b/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java
index 143c7ae52..a8fa324bf 100644
--- a/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java
+++ b/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java
@@ -12,7 +12,6 @@
* Helen Hawkins Converted to new interface (bug 148190)
* ******************************************************************/
-
package org.aspectj.ajde.ui;
import java.util.ArrayList;
@@ -24,53 +23,42 @@ import org.aspectj.asm.IHierarchy;
import org.aspectj.asm.IProgramElement;
/**
- * @author Mik Kersten
+ * @author Mik Kersten
*/
public class StructureSearchManager {
/**
- * @param pattern case-sensitive substring of node name
+ * @param pattern case-sensitive substring of node name
*
- * @return null if a corresponding node was not found
+ * @return null if a corresponding node was not found
*/
- public List findMatches(
- String pattern,
- IProgramElement.Kind kind) {
-
+ public List findMatches(String pattern, IProgramElement.Kind kind) {
+
List matches = new ArrayList();
- IHierarchy model = AsmManager.getDefault().getHierarchy();
+ IHierarchy model = AsmManager.lastActiveStructureModel.getHierarchy();
if (model.getRoot().equals(IHierarchy.NO_STRUCTURE)) {
return null;
} else {
return findMatchesHelper(model.getRoot(), pattern, kind, matches);
}
- }
-
-
- private List findMatchesHelper(
- IProgramElement node,
- String pattern,
- IProgramElement.Kind kind,
- List matches) {
-
+ }
+
+ private List findMatchesHelper(IProgramElement node, String pattern, IProgramElement.Kind kind, List matches) {
+
if (node != null && node.getName().indexOf(pattern) != -1) {
if (kind == null || node.getKind().equals(kind)) {
- matches.add(node);
- }
+ matches.add(node);
+ }
}
if (node != null && node.getChildren() != null) {
- for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
- IProgramElement nextNode = (IProgramElement)it.next();
- if (nextNode!=null) {
- findMatchesHelper(
- nextNode,
- pattern,
- kind,
- matches);
+ for (Iterator it = node.getChildren().iterator(); it.hasNext();) {
+ IProgramElement nextNode = (IProgramElement) it.next();
+ if (nextNode != null) {
+ findMatchesHelper(nextNode, pattern, kind, matches);
}
}
}
-
- return matches;
+
+ return matches;
}
}
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java b/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java
index fc38c0486..eb8fdc033 100644
--- a/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java
+++ b/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java
@@ -21,7 +21,6 @@ import java.util.List;
import org.aspectj.ajde.Ajde;
import org.aspectj.ajde.ui.internal.NavigationHistoryModel;
import org.aspectj.ajde.ui.internal.TreeStructureViewBuilder;
-import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IHierarchy;
import org.aspectj.asm.IHierarchyListener;
import org.aspectj.asm.IProgramElement;
@@ -33,11 +32,11 @@ import org.aspectj.asm.internal.AspectJElementHierarchy;
*/
public class StructureViewManager {
- private TreeStructureViewBuilder treeViewBuilder;
+ private final TreeStructureViewBuilder treeViewBuilder;
// private String buildConfigFilePath = null;
- private NavigationHistoryModel historyModel = new NavigationHistoryModel();
- private ArrayList structureViews = new ArrayList();
+ private final NavigationHistoryModel historyModel = new NavigationHistoryModel();
+ private final ArrayList structureViews = new ArrayList();
private FileStructureView defaultFileView = null;
private static final StructureViewProperties DEFAULT_VIEW_PROPERTIES;
@@ -59,7 +58,7 @@ public class StructureViewManager {
public StructureViewManager(StructureViewNodeFactory nodeFactory) {
treeViewBuilder = new TreeStructureViewBuilder(nodeFactory);
- AsmManager.getDefault().addListener(VIEW_LISTENER);
+ Ajde.getDefault().getModel().addListener(VIEW_LISTENER);
}
public void fireNavigateBackAction(StructureView view) {
@@ -88,7 +87,7 @@ public class StructureViewManager {
* @param newFilePath the canonicalized path to the new file
*/
public void fireNavigationAction(String newFilePath, int lineNumber) {
- IProgramElement currNode = AsmManager.getDefault().getHierarchy().findElementForSourceLine(newFilePath, lineNumber);
+ IProgramElement currNode = Ajde.getDefault().getModel().getHierarchy().findElementForSourceLine(newFilePath, lineNumber);
if (currNode != null) {
navigationAction(currNode, true);
@@ -116,7 +115,7 @@ public class StructureViewManager {
String newFilePath = node.getSourceLocation().getSourceFile().getAbsolutePath();
if (defaultFileView.getSourceFile() != null && !defaultFileView.getSourceFile().equals(newFilePath)) {
defaultFileView.setSourceFile(newFilePath);
- treeViewBuilder.buildView(defaultFileView, AsmManager.getDefault().getHierarchy());
+ treeViewBuilder.buildView(defaultFileView, Ajde.getDefault().getModel().getHierarchy());
}
}
@@ -142,7 +141,7 @@ public class StructureViewManager {
public void refreshView(StructureView view) {
IStructureViewNode activeNode = view.getActiveNode();
- treeViewBuilder.buildView(view, AsmManager.getDefault().getHierarchy());
+ treeViewBuilder.buildView(view, Ajde.getDefault().getModel().getHierarchy());
view.setActiveNode(activeNode);
}
@@ -177,7 +176,7 @@ public class StructureViewManager {
properties = DEFAULT_VIEW_PROPERTIES;
FileStructureView view = new FileStructureView(properties);
view.setSourceFile(sourceFilePath);
- treeViewBuilder.buildView(view, AsmManager.getDefault().getHierarchy());
+ treeViewBuilder.buildView(view, Ajde.getDefault().getModel().getHierarchy());
structureViews.add(view);
return view;
}
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java b/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java
index 03d84c3fd..cb82a65db 100644
--- a/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java
+++ b/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java
@@ -11,26 +11,30 @@
* Xerox/PARC initial implementation
* ******************************************************************/
-
package org.aspectj.ajde.ui;
-import java.util.*;
+import java.util.Iterator;
+import java.util.List;
-import org.aspectj.asm.*;
+import org.aspectj.ajde.Ajde;
+import org.aspectj.asm.AsmManager;
+import org.aspectj.asm.IProgramElement;
+import org.aspectj.asm.IRelationship;
+import org.aspectj.asm.IRelationshipMap;
/**
* @author Mik Kersten
- */
+ */
public abstract class StructureViewNodeFactory {
- private AbstractIconRegistry iconRegistry;
+ private final AbstractIconRegistry iconRegistry;
public StructureViewNodeFactory(AbstractIconRegistry iconRegistry) {
- this.iconRegistry = iconRegistry;
+ this.iconRegistry = iconRegistry;
}
public IStructureViewNode createNode(IProgramElement node) {
- return createNode(node, null);
+ return createNode(node, null);
}
public IStructureViewNode createNode(IProgramElement node, List children) {
@@ -38,30 +42,25 @@ public abstract class StructureViewNodeFactory {
IStructureViewNode svNode = createDeclaration(node, icon, children);
String nodeHandle = node.getHandleIdentifier();
- // Don't put relationships on fields as they can then appear twice when building the outline -
+ // Don't put relationships on fields as they can then appear twice when building the outline -
// once under clinit field-set nodes and once under the field declaration.
- if (nodeHandle != null && !node.getKind().equals(IProgramElement.Kind.FIELD)) {
- AsmManager manager = AsmManager.getDefault();
- IRelationshipMap relMap = (manager==null?null:manager.getRelationshipMap());
- List relationships = (relMap==null?null:relMap.get(nodeHandle));
+ if (nodeHandle != null && !node.getKind().equals(IProgramElement.Kind.FIELD)) {
+ AsmManager manager = Ajde.getDefault().getModel();
+ IRelationshipMap relMap = (manager == null ? null : manager.getRelationshipMap());
+ List relationships = (relMap == null ? null : relMap.get(nodeHandle));
if (relationships != null) {
- for (Iterator it = relationships.iterator(); it.hasNext(); ) {
- IRelationship rel = (IRelationship)it.next();
+ for (Iterator it = relationships.iterator(); it.hasNext();) {
+ IRelationship rel = (IRelationship) it.next();
if (rel != null && rel.getTargets().size() > 0) {
- IStructureViewNode relNode = createRelationship(
- rel,
- iconRegistry.getIcon(rel.getKind())
- );
+ IStructureViewNode relNode = createRelationship(rel, iconRegistry.getIcon(rel.getKind()));
if (relNode != null) {
- svNode.add(relNode, 0);
- for (Iterator it2 = rel.getTargets().iterator(); it2.hasNext(); ) {
- String handle = (String)it2.next();
- IProgramElement link = AsmManager.getDefault().getHierarchy().findElementForHandle(handle);
+ svNode.add(relNode, 0);
+ for (Iterator it2 = rel.getTargets().iterator(); it2.hasNext();) {
+ String handle = (String) it2.next();
+ IProgramElement link = Ajde.getDefault().getModel().getHierarchy().findElementForHandle(handle);
if (link != null) {
- IStructureViewNode linkNode = createLink(
- link,
- iconRegistry.getStructureIcon(link.getKind(), link.getAccessibility())
- );
+ IStructureViewNode linkNode = createLink(link, iconRegistry.getStructureIcon(link.getKind(),
+ link.getAccessibility()));
relNode.add(linkNode);
}
}
@@ -75,27 +74,26 @@ public abstract class StructureViewNodeFactory {
/**
* Implementors must override this method in order to create link new nodes.
- */
+ */
protected abstract IStructureViewNode createLink(IProgramElement node, AbstractIcon icon);
-
+
/**
* Implementors must override this method in order to create new relationship nodes.
*
* If returned node is null it will not be added to the tree.
- */
+ */
protected abstract IStructureViewNode createRelationship(IRelationship relationship, AbstractIcon icon);
/**
* Implementors must override this method in order to create new nodes.
- */
+ */
protected abstract IStructureViewNode createDeclaration(IProgramElement node, AbstractIcon icon, List children);
/**
* Don't show code elements under types since they show under the corresponding initializers.
*/
public static boolean acceptNode(IProgramElement parent, IProgramElement child) {
- if (parent.getKind() == IProgramElement.Kind.CLASS
- && child.getKind() == IProgramElement.Kind.CODE) {
+ if (parent.getKind() == IProgramElement.Kind.CLASS && child.getKind() == IProgramElement.Kind.CODE) {
return false;
} else {
return true;
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java
index b2d36b433..b12698d5e 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java
@@ -12,7 +12,6 @@
* Helen Hawkins Converted to new interface (bug 148190)
* ******************************************************************/
-
package org.aspectj.ajde.ui.swing;
import java.awt.BorderLayout;
@@ -33,7 +32,6 @@ import javax.swing.border.Border;
import org.aspectj.ajde.Ajde;
import org.aspectj.ajde.ui.StructureView;
import org.aspectj.ajde.ui.StructureViewProperties;
-import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IHierarchy;
import org.aspectj.asm.IHierarchyListener;
import org.aspectj.asm.IProgramElement;
@@ -43,179 +41,177 @@ import org.aspectj.bridge.Message;
public class SimpleStructureViewToolPanel extends JPanel {
private static final long serialVersionUID = -7573973278642540506L;
- private StructureView currentView;
- private JButton separator_button = new JButton();
+ private final StructureView currentView;
+ private final JButton separator_button = new JButton();
private boolean hideNonAJEnabled = false;
private boolean hideAssociationsEnabled = false;
private boolean sortEnabled = false;
- Border border1;
- Border border2;
- JButton structureView_button = new JButton();
- JPanel label_panel = new JPanel();
- JLabel currConfig_field = new JLabel();
- JPanel spacer_panel = new JPanel();
- JPanel jPanel2 = new JPanel();
- JButton forward_button = new JButton();
- JPanel navigation_panel = new JPanel();
- JButton back_button = new JButton();
- BorderLayout borderLayout1 = new BorderLayout();
- JPanel buttons_panel = new JPanel();
- BorderLayout borderLayout2 = new BorderLayout();
- BorderLayout borderLayout3 = new BorderLayout();
- BorderLayout borderLayout4 = new BorderLayout();
-
- public final IHierarchyListener MODEL_LISTENER = new IHierarchyListener() {
- public void elementsUpdated(IHierarchy model) {
+ Border border1;
+ Border border2;
+ JButton structureView_button = new JButton();
+ JPanel label_panel = new JPanel();
+ JLabel currConfig_field = new JLabel();
+ JPanel spacer_panel = new JPanel();
+ JPanel jPanel2 = new JPanel();
+ JButton forward_button = new JButton();
+ JPanel navigation_panel = new JPanel();
+ JButton back_button = new JButton();
+ BorderLayout borderLayout1 = new BorderLayout();
+ JPanel buttons_panel = new JPanel();
+ BorderLayout borderLayout2 = new BorderLayout();
+ BorderLayout borderLayout3 = new BorderLayout();
+ BorderLayout borderLayout4 = new BorderLayout();
+
+ public final IHierarchyListener MODEL_LISTENER = new IHierarchyListener() {
+ public void elementsUpdated(IHierarchy model) {
String path = Ajde.getDefault().getBuildConfigManager().getActiveConfigFile();
- String fileName = "<no active config>";
- if (path != null) fileName = new File(path).getName();
+ String fileName = "<no active config>";
+ if (path != null)
+ fileName = new File(path).getName();
updateCurrConfigLabel(fileName);
- }
- };
-
- JButton hideNonAJ_button = new JButton();
- JPanel navigation_panel1 = new JPanel();
- JButton hideAssociations_button = new JButton();
- BorderLayout borderLayout5 = new BorderLayout();
- JButton sort_button = new JButton();
+ }
+ };
+
+ JButton hideNonAJ_button = new JButton();
+ JPanel navigation_panel1 = new JPanel();
+ JButton hideAssociations_button = new JButton();
+ BorderLayout borderLayout5 = new BorderLayout();
+ JButton sort_button = new JButton();
public SimpleStructureViewToolPanel(StructureView currentView) {
this.currentView = currentView;
- AsmManager.getDefault().addListener(MODEL_LISTENER);
+ Ajde.getDefault().getModel().addListener(MODEL_LISTENER);
try {
jbInit();
} catch (Exception e) {
- Message msg = new Message("Could not initialize GUI.",IMessage.ERROR,e,null);
- Ajde.getDefault().getMessageHandler().handleMessage(msg);
+ Message msg = new Message("Could not initialize GUI.", IMessage.ERROR, e, null);
+ Ajde.getDefault().getMessageHandler().handleMessage(msg);
}
updateCurrConfigLabel("<no active config>");
}
-
- private void updateCurrConfigLabel(String text) {
- currConfig_field.setText(" File View (" + text + ")");
- }
-
- private void jbInit() throws Exception {
- border1 = BorderFactory.createBevelBorder(BevelBorder.LOWERED,Color.white,Color.white,new Color(156, 156, 158),new Color(109, 109, 110));
- border2 = BorderFactory.createEmptyBorder(0,1,0,0);
-
-
-
- separator_button.setPreferredSize(new Dimension(2, 16));
- separator_button.setMinimumSize(new Dimension(2, 16));
- separator_button.setEnabled(false);
- separator_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
- separator_button.setMaximumSize(new Dimension(2, 16));
-
- structureView_button.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- structureView_button_actionPerformed(e);
- }
- });
- structureView_button.setIcon(Ajde.getDefault().getIconRegistry().getStructureViewIcon());
- structureView_button.setBorder(border2);
- structureView_button.setToolTipText("Navigate back");
- structureView_button.setPreferredSize(new Dimension(20, 20));
- structureView_button.setMinimumSize(new Dimension(20, 20));
- structureView_button.setMaximumSize(new Dimension(24, 20));
- currConfig_field.setBackground(SystemColor.control);
- currConfig_field.setFont(new java.awt.Font("SansSerif", 0, 11));
- currConfig_field.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
- //currConfig_field.setEditable(false);
- currConfig_field.setText(" ");
-
- forward_button.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- forward_button_actionPerformed(e);
- }
- });
- forward_button.setIcon(Ajde.getDefault().getIconRegistry().getForwardIcon());
- forward_button.setToolTipText("Navigate forward");
- forward_button.setPreferredSize(new Dimension(20, 20));
- forward_button.setMinimumSize(new Dimension(20, 20));
- forward_button.setMaximumSize(new Dimension(24, 20));
- forward_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
- navigation_panel.setLayout(borderLayout1);
- back_button.setMaximumSize(new Dimension(24, 20));
- back_button.setMinimumSize(new Dimension(20, 20));
- back_button.setPreferredSize(new Dimension(20, 20));
- back_button.setToolTipText("Navigate back");
- back_button.setIcon(Ajde.getDefault().getIconRegistry().getBackIcon());
- back_button.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- back_button_actionPerformed(e);
- }
- });
- back_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
- this.setLayout(borderLayout2);
- buttons_panel.setLayout(borderLayout3);
- label_panel.setLayout(borderLayout4);
- hideNonAJ_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
- hideNonAJ_button.setMaximumSize(new Dimension(24, 20));
- hideNonAJ_button.setMinimumSize(new Dimension(20, 20));
- hideNonAJ_button.setPreferredSize(new Dimension(20, 20));
- hideNonAJ_button.setToolTipText("Hide non-AspectJ members");
- hideNonAJ_button.setIcon(Ajde.getDefault().getIconRegistry().getHideNonAJIcon());
- hideNonAJ_button.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- hideNonAJ_button_actionPerformed(e);
- }
- });
- navigation_panel1.setLayout(borderLayout5);
- hideAssociations_button.setMaximumSize(new Dimension(24, 20));
- hideAssociations_button.setMinimumSize(new Dimension(20, 20));
- hideAssociations_button.setPreferredSize(new Dimension(20, 20));
- hideAssociations_button.setToolTipText("Hide associations");
- hideAssociations_button.setIcon(Ajde.getDefault().getIconRegistry().getHideAssociationsIcon());
- hideAssociations_button.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- hideAssociations_button_actionPerformed(e);
- }
- });
- hideAssociations_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
- sort_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
- sort_button.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- sort_button_actionPerformed(e);
- }
- });
- sort_button.setIcon(Ajde.getDefault().getIconRegistry().getOrderIcon());
- sort_button.setToolTipText("Sort member");
- sort_button.setPreferredSize(new Dimension(20, 20));
- sort_button.setMinimumSize(new Dimension(20, 20));
- sort_button.setMaximumSize(new Dimension(24, 20));
- label_panel.add(currConfig_field, BorderLayout.CENTER);
- //label_panel.add(structureView_button, BorderLayout.WEST);
- this.add(spacer_panel, BorderLayout.CENTER);
- this.add(buttons_panel, BorderLayout.EAST);
- buttons_panel.add(navigation_panel, BorderLayout.CENTER);
- navigation_panel.add(back_button, BorderLayout.CENTER);
- navigation_panel.add(forward_button, BorderLayout.EAST);
- navigation_panel.add(jPanel2, BorderLayout.WEST);
- buttons_panel.add(navigation_panel1, BorderLayout.WEST);
- navigation_panel1.add(hideAssociations_button, BorderLayout.EAST);
- navigation_panel1.add(hideNonAJ_button, BorderLayout.CENTER);
- navigation_panel1.add(sort_button, BorderLayout.WEST);
- this.add(label_panel, BorderLayout.WEST);
+ private void updateCurrConfigLabel(String text) {
+ currConfig_field.setText(" File View (" + text + ")");
+ }
+ private void jbInit() throws Exception {
+ border1 = BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.white, Color.white, new Color(156, 156, 158),
+ new Color(109, 109, 110));
+ border2 = BorderFactory.createEmptyBorder(0, 1, 0, 0);
+
+ separator_button.setPreferredSize(new Dimension(2, 16));
+ separator_button.setMinimumSize(new Dimension(2, 16));
+ separator_button.setEnabled(false);
+ separator_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
+ separator_button.setMaximumSize(new Dimension(2, 16));
+
+ structureView_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ structureView_button_actionPerformed(e);
+ }
+ });
+ structureView_button.setIcon(Ajde.getDefault().getIconRegistry().getStructureViewIcon());
+ structureView_button.setBorder(border2);
+ structureView_button.setToolTipText("Navigate back");
+ structureView_button.setPreferredSize(new Dimension(20, 20));
+ structureView_button.setMinimumSize(new Dimension(20, 20));
+ structureView_button.setMaximumSize(new Dimension(24, 20));
+ currConfig_field.setBackground(SystemColor.control);
+ currConfig_field.setFont(new java.awt.Font("SansSerif", 0, 11));
+ currConfig_field.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
+ // currConfig_field.setEditable(false);
+ currConfig_field.setText(" ");
+
+ forward_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ forward_button_actionPerformed(e);
+ }
+ });
+ forward_button.setIcon(Ajde.getDefault().getIconRegistry().getForwardIcon());
+ forward_button.setToolTipText("Navigate forward");
+ forward_button.setPreferredSize(new Dimension(20, 20));
+ forward_button.setMinimumSize(new Dimension(20, 20));
+ forward_button.setMaximumSize(new Dimension(24, 20));
+ forward_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
+ navigation_panel.setLayout(borderLayout1);
+ back_button.setMaximumSize(new Dimension(24, 20));
+ back_button.setMinimumSize(new Dimension(20, 20));
+ back_button.setPreferredSize(new Dimension(20, 20));
+ back_button.setToolTipText("Navigate back");
+ back_button.setIcon(Ajde.getDefault().getIconRegistry().getBackIcon());
+ back_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ back_button_actionPerformed(e);
+ }
+ });
+ back_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
+ this.setLayout(borderLayout2);
+ buttons_panel.setLayout(borderLayout3);
+ label_panel.setLayout(borderLayout4);
+ hideNonAJ_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
+ hideNonAJ_button.setMaximumSize(new Dimension(24, 20));
+ hideNonAJ_button.setMinimumSize(new Dimension(20, 20));
+ hideNonAJ_button.setPreferredSize(new Dimension(20, 20));
+ hideNonAJ_button.setToolTipText("Hide non-AspectJ members");
+ hideNonAJ_button.setIcon(Ajde.getDefault().getIconRegistry().getHideNonAJIcon());
+ hideNonAJ_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ hideNonAJ_button_actionPerformed(e);
+ }
+ });
+ navigation_panel1.setLayout(borderLayout5);
+ hideAssociations_button.setMaximumSize(new Dimension(24, 20));
+ hideAssociations_button.setMinimumSize(new Dimension(20, 20));
+ hideAssociations_button.setPreferredSize(new Dimension(20, 20));
+ hideAssociations_button.setToolTipText("Hide associations");
+ hideAssociations_button.setIcon(Ajde.getDefault().getIconRegistry().getHideAssociationsIcon());
+ hideAssociations_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ hideAssociations_button_actionPerformed(e);
+ }
+ });
+ hideAssociations_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
+ sort_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
+ sort_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ sort_button_actionPerformed(e);
+ }
+ });
+ sort_button.setIcon(Ajde.getDefault().getIconRegistry().getOrderIcon());
+ sort_button.setToolTipText("Sort member");
+ sort_button.setPreferredSize(new Dimension(20, 20));
+ sort_button.setMinimumSize(new Dimension(20, 20));
+ sort_button.setMaximumSize(new Dimension(24, 20));
+ label_panel.add(currConfig_field, BorderLayout.CENTER);
+ // label_panel.add(structureView_button, BorderLayout.WEST);
+ this.add(spacer_panel, BorderLayout.CENTER);
+ this.add(buttons_panel, BorderLayout.EAST);
+ buttons_panel.add(navigation_panel, BorderLayout.CENTER);
+ navigation_panel.add(back_button, BorderLayout.CENTER);
+ navigation_panel.add(forward_button, BorderLayout.EAST);
+ navigation_panel.add(jPanel2, BorderLayout.WEST);
+ buttons_panel.add(navigation_panel1, BorderLayout.WEST);
+ navigation_panel1.add(hideAssociations_button, BorderLayout.EAST);
+ navigation_panel1.add(hideNonAJ_button, BorderLayout.CENTER);
+ navigation_panel1.add(sort_button, BorderLayout.WEST);
+ this.add(label_panel, BorderLayout.WEST);
}
- private void forward_button_actionPerformed(ActionEvent e) {
- Ajde.getDefault().getStructureViewManager().fireNavigateForwardAction(currentView);
- }
+ private void forward_button_actionPerformed(ActionEvent e) {
+ Ajde.getDefault().getStructureViewManager().fireNavigateForwardAction(currentView);
+ }
- private void back_button_actionPerformed(ActionEvent e) {
- Ajde.getDefault().getStructureViewManager().fireNavigateBackAction(currentView);
- }
+ private void back_button_actionPerformed(ActionEvent e) {
+ Ajde.getDefault().getStructureViewManager().fireNavigateBackAction(currentView);
+ }
- void structureView_button_actionPerformed(ActionEvent e) {
+ void structureView_button_actionPerformed(ActionEvent e) {
- }
+ }
- private void hideNonAJ_button_actionPerformed(ActionEvent e) {
+ private void hideNonAJ_button_actionPerformed(ActionEvent e) {
if (hideNonAJEnabled) {
hideNonAJ_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
hideNonAJEnabled = false;
@@ -223,42 +219,34 @@ public class SimpleStructureViewToolPanel extends JPanel {
} else {
hideNonAJ_button.setBorder(AjdeWidgetStyles.LOWERED_BEVEL_BORDER);
hideNonAJEnabled = true;
- currentView.getViewProperties().setFilteredMemberKinds(
- IProgramElement.Kind.getNonAJMemberKinds()
- );
+ currentView.getViewProperties().setFilteredMemberKinds(IProgramElement.Kind.getNonAJMemberKinds());
}
Ajde.getDefault().getStructureViewManager().refreshView(currentView);
- }
+ }
- private void hideAssociations_button_actionPerformed(ActionEvent e) {
+ private void hideAssociations_button_actionPerformed(ActionEvent e) {
if (hideAssociationsEnabled) {
hideAssociations_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
hideAssociationsEnabled = false;
- currentView.getViewProperties().setRelations(
- Ajde.getDefault().getStructureViewManager().getAvailableRelations()
- );
+ currentView.getViewProperties().setRelations(Ajde.getDefault().getStructureViewManager().getAvailableRelations());
} else {
hideAssociations_button.setBorder(AjdeWidgetStyles.LOWERED_BEVEL_BORDER);
hideAssociationsEnabled = true;
currentView.getViewProperties().setRelations(new ArrayList());
}
Ajde.getDefault().getStructureViewManager().refreshView(currentView);
- }
+ }
- private void sort_button_actionPerformed(ActionEvent e) {
+ private void sort_button_actionPerformed(ActionEvent e) {
if (sortEnabled) {
sort_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
sortEnabled = false;
- currentView.getViewProperties().setSorting(
- StructureViewProperties.Sorting.DECLARATIONAL
- );
+ currentView.getViewProperties().setSorting(StructureViewProperties.Sorting.DECLARATIONAL);
} else {
sort_button.setBorder(AjdeWidgetStyles.LOWERED_BEVEL_BORDER);
sortEnabled = true;
- currentView.getViewProperties().setSorting(
- StructureViewProperties.Sorting.ALPHABETICAL
- );
+ currentView.getViewProperties().setSorting(StructureViewProperties.Sorting.ALPHABETICAL);
}
Ajde.getDefault().getStructureViewManager().refreshView(currentView);
- }
+ }
}