diff options
author | aclement <aclement> | 2007-01-15 08:44:35 +0000 |
---|---|---|
committer | aclement <aclement> | 2007-01-15 08:44:35 +0000 |
commit | a010542247f01c64386cef5a0ad3f8e502f0f306 (patch) | |
tree | 6b138f83c23c51f1a5a6bff698a5c2c47524e058 /ajde/src | |
parent | e375a91c1d5727c0551dcc7b5193149823779d74 (diff) | |
download | aspectj-a010542247f01c64386cef5a0ad3f8e502f0f306.tar.gz aspectj-a010542247f01c64386cef5a0ad3f8e502f0f306.zip |
148190#32
Diffstat (limited to 'ajde/src')
25 files changed, 272 insertions, 871 deletions
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/AJButtonMenuCombo.java b/ajde/src/org/aspectj/ajde/ui/swing/AJButtonMenuCombo.java index 82ff318d1..72b7abeba 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/AJButtonMenuCombo.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/AJButtonMenuCombo.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -27,6 +28,8 @@ import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JPopupMenu; +import org.aspectj.ajde.Ajde; + public class AJButtonMenuCombo extends JPanel { private static final long serialVersionUID = -4866207530403336160L; @@ -54,7 +57,7 @@ public class AJButtonMenuCombo extends JPanel { mainButton.setMaximumSize(new Dimension(22, 20)); popupButton = new JButton(); - popupButton.setIcon(AjdeUIManager.getDefault().getIconRegistry().getPopupIcon()); + popupButton.setIcon(Ajde.getDefault().getIconRegistry().getPopupIcon()); popupButton.setBorder(BorderFactory.createEmptyBorder()); popupButton.setToolTipText(toolTipText); popupButton.setPreferredSize(new Dimension(13, 20)); diff --git a/ajde/src/org/aspectj/ajde/ui/swing/AjdeErrorHandler.java b/ajde/src/org/aspectj/ajde/ui/swing/AjdeErrorHandler.java deleted file mode 100644 index a15670324..000000000 --- a/ajde/src/org/aspectj/ajde/ui/swing/AjdeErrorHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation - * ******************************************************************/ - - - -package org.aspectj.ajde.ui.swing; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import javax.swing.JOptionPane; - -import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.ErrorHandler; - -public class AjdeErrorHandler implements ErrorHandler { - - public void handleWarning(String message) { - JOptionPane.showMessageDialog(AjdeUIManager.getDefault().getRootFrame(), - message, - "AJDE Warning", - JOptionPane.WARNING_MESSAGE); - } - - public void handleError(String errorMessage) { - handleError(errorMessage, null); - } - - public void handleError(String message, Throwable t) { - String stack = getStackTraceAsString(t); - Ajde.getDefault().logEvent("Error: " + stack); - ErrorDialog errorDialog = new ErrorDialog(AjdeUIManager.getDefault().getRootFrame(), "AJDE Error", t, message, stack); - errorDialog.setVisible(true); - } - - private String getStackTraceAsString(Throwable t) { - StringWriter stringWriter = new StringWriter(); - if (t != null) { - t.printStackTrace(new PrintWriter(stringWriter)); - return stringWriter.getBuffer().toString(); - } else { - return "<no stack trace available>"; - } - } -} - diff --git a/ajde/src/org/aspectj/ajde/ui/swing/AjdeUIManager.java b/ajde/src/org/aspectj/ajde/ui/swing/AjdeUIManager.java deleted file mode 100644 index c502e29c4..000000000 --- a/ajde/src/org/aspectj/ajde/ui/swing/AjdeUIManager.java +++ /dev/null @@ -1,209 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation - * ******************************************************************/ - - -package org.aspectj.ajde.ui.swing; - -import java.awt.Frame; - -import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.BuildListener; -import org.aspectj.ajde.BuildProgressMonitor; -import org.aspectj.ajde.EditorAdapter; -import org.aspectj.ajde.ErrorHandler; -import org.aspectj.ajde.ProjectPropertiesAdapter; -import org.aspectj.ajde.TaskListManager; -import org.aspectj.ajde.ui.FileStructureView; -import org.aspectj.ajde.ui.IdeUIAdapter; -import org.aspectj.ajde.ui.UserPreferencesAdapter; -import org.aspectj.ajde.ui.internal.AjcBuildOptions; - -/** - * @author Mik Kersten - */ -public class AjdeUIManager { - - protected static final AjdeUIManager INSTANCE = new AjdeUIManager(); - private BrowserViewManager viewManager = null; -// private BuildProgressMonitor buildProgressMonitor = null; -// private ErrorHandler errorHandler = null; -// private UserPreferencesAdapter userPreferencesAdapter = null; - private AjcBuildOptions buildOptionsAdapter = null; - private IdeUIAdapter ideUIAdapter = null; - private TreeViewBuildConfigEditor buildConfigEditor = null; - private IconRegistry iconRegistry; - private boolean initialized = false; - - private OptionsFrame optionsFrame = null; - private Frame rootFrame = null; - private StructureViewPanel fileStructurePanel = null; - - public void init( - EditorAdapter editorAdapter, - TaskListManager taskListManager, - ProjectPropertiesAdapter projectProperties, - UserPreferencesAdapter userPreferencesAdapter, - IdeUIAdapter ideUIAdapter, - IconRegistry iconRegistry, - Frame rootFrame, - boolean useFileView) { - - init(editorAdapter, - taskListManager, - projectProperties, - userPreferencesAdapter, - ideUIAdapter, - iconRegistry, - rootFrame, - new DefaultBuildProgressMonitor(rootFrame), - new AjdeErrorHandler(), - useFileView); - } - - /** - * Order of initialization is critical here. - */ - public void init( - EditorAdapter editorAdapter, - TaskListManager taskListManager, - ProjectPropertiesAdapter projectProperties, - UserPreferencesAdapter userPreferencesAdapter, - IdeUIAdapter ideUIAdapter, - IconRegistry iconRegistry, - Frame rootFrame, - BuildProgressMonitor progressMonitor, - ErrorHandler errorHandler, - boolean useFileView) { - try { - this.iconRegistry = iconRegistry; - //ConfigurationManager configManager = new LstConfigurationManager(); - this.ideUIAdapter = ideUIAdapter; -// this.userPreferencesAdapter = userPreferencesAdapter; - this.buildOptionsAdapter = new AjcBuildOptions(userPreferencesAdapter); - this.buildConfigEditor = new TreeViewBuildConfigEditor(); - this.rootFrame = rootFrame; - Ajde.init( - editorAdapter, - taskListManager, - progressMonitor, - projectProperties, - buildOptionsAdapter, - new SwingTreeViewNodeFactory(iconRegistry), - ideUIAdapter, - errorHandler); - - Ajde.getDefault().getBuildManager().addListener(STATUS_TEXT_UPDATER); - //Ajde.getDefault().setConfigurationManager(configManager); - - if (useFileView) { - FileStructureView structureView = Ajde.getDefault().getStructureViewManager().createViewForSourceFile( - Ajde.getDefault().getEditorAdapter().getCurrFile(), - Ajde.getDefault().getStructureViewManager().getDefaultViewProperties() - ); - Ajde.getDefault().getStructureViewManager().setDefaultFileView(structureView); - fileStructurePanel = new StructureViewPanel(structureView); - } - - viewManager = new BrowserViewManager(); - optionsFrame = new OptionsFrame(iconRegistry); - - - //Ajde.getDefault().getStructureViewManager().refreshView( - // Ajde.getDefault().getStructureViewManager().getDefaultFileStructureView() - //); - - //viewManager.updateView(); - initialized = true; - } catch (Throwable t) { - Ajde.getDefault().getErrorHandler().handleError("AJDE failed to initialize.", t); - } - } - - public static AjdeUIManager getDefault() { - return INSTANCE; - } - - public BrowserViewManager getViewManager() { - return viewManager; - } - - public Frame getRootFrame() { - return rootFrame; - } - - public OptionsFrame getOptionsFrame() { - return optionsFrame; - } - - public void showOptionsFrame() { - int x = (rootFrame.getWidth()/2) + rootFrame.getX() - optionsFrame.getWidth()/2; - int y = (rootFrame.getHeight()/2) + rootFrame.getY() - optionsFrame.getHeight()/2; - optionsFrame.setLocation(x, y); - optionsFrame.setVisible(true); - } - - public AjcBuildOptions getBuildOptions() { - return buildOptionsAdapter; - } - - private final BuildListener STATUS_TEXT_UPDATER = new BuildListener() { - - public void compileStarted(String buildConfigFile) { - ideUIAdapter.displayStatusInformation(" Building: " + buildConfigFile + "..."); - } - - public void compileFinished(String buildConfigFile, int buildTime, boolean succeeded, boolean warnings) { - int timeInSeconds = buildTime/1000; - if (succeeded) { - ideUIAdapter.displayStatusInformation(" Build succeeded in " + timeInSeconds + " second(s)."); - //hideMessages(); - } else { - ideUIAdapter.displayStatusInformation(" Build failed in " + timeInSeconds + " second(s)"); - //showMessages(); - } - } - - public void compileAborted(String buildConfigFile, String message) { - ideUIAdapter.displayStatusInformation("Compile aborted: " + message); - } - }; - - public IdeUIAdapter getIdeUIAdapter() { - return ideUIAdapter; - } - - public TreeViewBuildConfigEditor getBuildConfigEditor() { - return buildConfigEditor; - } - - public StructureViewPanel getFileStructurePanel() { - return fileStructurePanel; - } - - public IconRegistry getIconRegistry() { - return iconRegistry; - } - public boolean isInitialized() { - return initialized; - } - -} - -//public abstract class AjdeAction { -// public abstract void actionPerformed(ActionEvent e); -// -// public abstract String getName(); -// -// public abstract ImageIcon getIcon(); -//} - diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserStructureViewToolPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserStructureViewToolPanel.java index b39d95f72..6988536da 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/BrowserStructureViewToolPanel.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserStructureViewToolPanel.java @@ -9,21 +9,37 @@ * * Contributors: * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ package org.aspectj.ajde.ui.swing; -import java.awt.*; -import java.awt.event.*; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.util.Iterator; -import javax.swing.*; +import javax.swing.ButtonGroup; +import javax.swing.Icon; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JRadioButtonMenuItem; +import javax.swing.JSeparator; import javax.swing.border.Border; import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.ui.*; -import org.aspectj.asm.*; +import org.aspectj.ajde.ui.GlobalStructureView; +import org.aspectj.ajde.ui.StructureView; +import org.aspectj.ajde.ui.StructureViewProperties; +import org.aspectj.asm.IProgramElement; +import org.aspectj.asm.IRelationship; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.Message; public class BrowserStructureViewToolPanel extends JPanel { @@ -63,7 +79,8 @@ public class BrowserStructureViewToolPanel extends JPanel { try { jbInit(); } catch (Exception e) { - Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e); + Message msg = new Message("Could not initialize GUI.",IMessage.ERROR,e,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); } initToolBar(); } @@ -73,21 +90,21 @@ public class BrowserStructureViewToolPanel extends JPanel { granularityCombo = new AJButtonMenuCombo( "Visible granularity", "Visible granularity", - AjdeUIManager.getDefault().getIconRegistry().getGranularityIcon(), + Ajde.getDefault().getIconRegistry().getGranularityIcon(), createGranularityMenu(), false); filterCombo = new AJButtonMenuCombo( "Filter members", "Filter members", - AjdeUIManager.getDefault().getIconRegistry().getFilterIcon(), + Ajde.getDefault().getIconRegistry().getFilterIcon(), createFilterMenu(), false); relationsCombo = new AJButtonMenuCombo( "Filter associations", "Filter associations", - AjdeUIManager.getDefault().getIconRegistry().getRelationsIcon(), + Ajde.getDefault().getIconRegistry().getRelationsIcon(), createRelationsMenu(), false); @@ -95,7 +112,8 @@ public class BrowserStructureViewToolPanel extends JPanel { buttons_panel.add(filterCombo, BorderLayout.CENTER); buttons_panel.add(relationsCombo, BorderLayout.EAST); } catch(Exception e) { - Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e); + Message msg = new Message("Could not initialize GUI.",IMessage.ERROR,e,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); } } @@ -104,7 +122,7 @@ public class BrowserStructureViewToolPanel extends JPanel { IProgramElement.Accessibility[] accessibility = IProgramElement.Accessibility.ALL; for (int i = 0; i < accessibility.length; i++) { CheckBoxSelectionMenuButton menuItem = new CheckBoxSelectionMenuButton(accessibility[i]); - menuItem.setIcon(AjdeUIManager.getDefault().getIconRegistry().getAccessibilitySwingIcon(accessibility[i])); + menuItem.setIcon(Ajde.getDefault().getIconRegistry().getAccessibilitySwingIcon(accessibility[i])); filterMenu.add(menuItem); } filterMenu.add(new JSeparator()); @@ -113,7 +131,7 @@ public class BrowserStructureViewToolPanel extends JPanel { for (int i = 0; i < kinds.length; i++) { if (kinds[i].isMember()) { CheckBoxSelectionMenuButton menuItem = new CheckBoxSelectionMenuButton(kinds[i]); - menuItem.setIcon((Icon)AjdeUIManager.getDefault().getIconRegistry().getIcon(kinds[i]).getIconResource()); + menuItem.setIcon((Icon)Ajde.getDefault().getIconRegistry().getIcon(kinds[i]).getIconResource()); filterMenu.add(menuItem); } } @@ -134,7 +152,7 @@ public class BrowserStructureViewToolPanel extends JPanel { for (Iterator it = relations.iterator(); it.hasNext(); ) { IRelationship.Kind relation = (IRelationship.Kind)it.next(); CheckBoxSelectionMenuButton menuItem = new CheckBoxSelectionMenuButton(relation); - menuItem.setIcon((Icon)AjdeUIManager.getDefault().getIconRegistry().getIcon(relation).getIconResource()); + menuItem.setIcon((Icon)Ajde.getDefault().getIconRegistry().getIcon(relation).getIconResource()); relationsMenu.add(menuItem); } @@ -282,9 +300,7 @@ public class BrowserStructureViewToolPanel extends JPanel { currentView.getViewProperties().addRelation(relation); } } - Ajde.getDefault().getStructureViewManager().refreshView( - currentView - ); + Ajde.getDefault().getStructureViewManager().refreshView(currentView); } } diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserView.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserView.java index c7973028a..9b1838577 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/BrowserView.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserView.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -37,7 +38,10 @@ import javax.swing.ListCellRenderer; import javax.swing.border.Border; import org.aspectj.ajde.Ajde; +import org.aspectj.ajde.IconRegistry; import org.aspectj.asm.IProgramElement; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.Message; /** * @author Mik Kersten @@ -73,7 +77,7 @@ class BrowserView extends JPanel { // this.masterView = masterView; this.slaveView = slaveView; this.icons = icons; - configs_comboBox = new JComboBox(Ajde.getDefault().getProjectProperties().getBuildConfigFiles().toArray()); + configs_comboBox = new JComboBox(Ajde.getDefault().getBuildConfigManager().getAllBuildConfigFiles().toArray()); configs_comboBox.setRenderer(new ConfigsCellRenderer()); // configs_comboBox.addItemListener(new ItemListener() { // public void itemStateChanged(ItemEvent e) { @@ -81,8 +85,8 @@ class BrowserView extends JPanel { // } // }); - if (Ajde.getDefault().getProjectProperties().getBuildConfigFiles().size() > 0) { - Ajde.getDefault().getConfigurationManager().setActiveConfigFile((String)Ajde.getDefault().getProjectProperties().getBuildConfigFiles().get(0)); + if (Ajde.getDefault().getBuildConfigManager().getAllBuildConfigFiles().size() > 0) { + Ajde.getDefault().getBuildConfigManager().setActiveConfigFile((String)Ajde.getDefault().getBuildConfigManager().getAllBuildConfigFiles().get(0)); } jbInit(); @@ -93,7 +97,9 @@ class BrowserView extends JPanel { nav_toolBar.remove(joinpointProbe_button); } catch(Exception e) { - Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e); + Message msg = new Message("Could not initialize GUI.",IMessage.ERROR,e,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); + } } @@ -318,7 +324,7 @@ class BrowserView extends JPanel { if (!configs_comboBox.getSelectedItem().toString().equals(lastSelectedConfig)) { //TopManager.INSTANCE.VIEW_MANAGER.readStructureView(); lastSelectedConfig = configs_comboBox.getSelectedItem().toString(); - Ajde.getDefault().getConfigurationManager().setActiveConfigFile(lastSelectedConfig); + Ajde.getDefault().getBuildConfigManager().setActiveConfigFile(lastSelectedConfig); } } } diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java index 27e794b6b..cd01dec70 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java @@ -8,17 +8,19 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ package org.aspectj.ajde.ui.swing; -import java.util.*; +import java.util.ArrayList; import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.ui.*; -//import org.aspectj.asm.*; +import org.aspectj.ajde.ui.GlobalStructureView; +import org.aspectj.ajde.ui.GlobalViewProperties; +import org.aspectj.ajde.ui.StructureViewProperties; /** * Responsible for displaying and controlling the configuration and output of a @@ -60,7 +62,7 @@ public class BrowserViewManager { public void extractAndInsertSignatures(java.util.List signatures, boolean calls) { PointcutWizard pointcutWizard = new PointcutWizard(signatures); pointcutWizard.setVisible(true); - pointcutWizard.setLocation(AjdeUIManager.getDefault().getRootFrame().getX()+100, AjdeUIManager.getDefault().getRootFrame().getY()+100); + pointcutWizard.setLocation(Ajde.getDefault().getRootFrame().getX()+100, Ajde.getDefault().getRootFrame().getY()+100); } { diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewPanel.java index aacf49032..c237cbca1 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewPanel.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewPanel.java @@ -9,6 +9,7 @@ * * Contributors: * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -26,11 +27,14 @@ import javax.swing.JSlider; import javax.swing.JToolBar; import org.aspectj.ajde.Ajde; +import org.aspectj.ajde.IconRegistry; import org.aspectj.ajde.ui.GlobalStructureView; -import org.aspectj.ajde.ui.StructureView; import org.aspectj.ajde.ui.IStructureViewNode; +import org.aspectj.ajde.ui.StructureView; import org.aspectj.ajde.ui.StructureViewProperties; import org.aspectj.ajde.ui.StructureViewRenderer; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.Message; /** * Represents the configuration of a structure view of the system, rendered @@ -78,7 +82,8 @@ public class BrowserViewPanel extends JPanel implements StructureViewRenderer { //Ajde.getDefault().getViewManager().getFileStructureView().addListener(VIEW_LISTENER); } catch(Exception e) { - Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e); + Message msg = new Message("Could not initialize GUI.",IMessage.ERROR,e,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); } } diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewTreeListener.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewTreeListener.java index ad43dc566..d7ea37076 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewTreeListener.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewTreeListener.java @@ -8,19 +8,27 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ package org.aspectj.ajde.ui.swing; -import java.awt.event.*; -import java.util.*; +import java.awt.event.ActionEvent; +import java.awt.event.InputEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.ArrayList; +import java.util.List; -import javax.swing.*; -import javax.swing.event.*; -//import javax.swing.tree.TreePath; +import javax.swing.AbstractAction; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import org.aspectj.ajde.Ajde; import org.aspectj.asm.IProgramElement; /** @@ -107,7 +115,7 @@ class BrowserViewTreeListener implements TreeSelectionListener, MouseListener { // } JPopupMenu popup = new JPopupMenu(); - JMenuItem showSourcesItem = new JMenuItem("Display sources", AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.CODE)); + JMenuItem showSourcesItem = new JMenuItem("Display sources", Ajde.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.CODE)); showSourcesItem.setFont(new java.awt.Font("Dialog", 0, 11)); showSourcesItem.addActionListener(new AbstractAction() { @@ -139,14 +147,14 @@ class BrowserViewTreeListener implements TreeSelectionListener, MouseListener { popup.add(showSourcesItem); popup.addSeparator(); - JMenuItem generatePCD = new JMenuItem("Pointcut Wizard (alpha)...", AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.POINTCUT)); + JMenuItem generatePCD = new JMenuItem("Pointcut Wizard (alpha)...", Ajde.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.POINTCUT)); generatePCD.setFont(new java.awt.Font("Dialog", 0, 11)); generatePCD.addActionListener(new AbstractAction() { private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent e) { - AjdeUIManager.getDefault().getViewManager().extractAndInsertSignatures(signatures, true); + Ajde.getDefault().getViewManager().extractAndInsertSignatures(signatures, true); } }); popup.add(generatePCD); diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java b/ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java index 7a4c063a4..7ca7a35fd 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -17,6 +18,7 @@ package org.aspectj.ajde.ui.swing; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Iterator; +import java.util.List; import javax.swing.AbstractAction; import javax.swing.Icon; @@ -26,12 +28,17 @@ import javax.swing.JPopupMenu; import org.aspectj.ajde.Ajde; import org.aspectj.asm.IProgramElement; +/** + * Creates a popup menu that displays all the available .lst files. When one + * is selected it runs a full build of files within the selected .lst file + * in a separate thread. + */ public class BuildConfigPopupMenu extends JPopupMenu { private static final long serialVersionUID = -6730132748667530482L; public BuildConfigPopupMenu(final AbstractAction action) { - java.util.List configFiles = Ajde.getDefault().getProjectProperties().getBuildConfigFiles(); + List configFiles = Ajde.getDefault().getBuildConfigManager().getAllBuildConfigFiles(); for (Iterator it = configFiles.iterator(); it.hasNext(); ) { final String buildConfig = (String)it.next(); JMenuItem buildItem = new JMenuItem(buildConfig); @@ -39,17 +46,15 @@ public class BuildConfigPopupMenu extends JPopupMenu { buildItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { - Ajde.getDefault().getConfigurationManager().setActiveConfigFile(buildConfig); - // ??? should we be able to do a build refresh if shift is down? -// if (EditorManager.isShiftDown(e.getModifiers())) { -// Ajde.getDefault().getBuildManager().buildFresh(); -// } else { - Ajde.getDefault().getBuildManager().build(); -// } + Ajde.getDefault().getBuildConfigManager().setActiveConfigFile(buildConfig); + // A separate thread is required here because the buildProgresssMonitor + // that monitors the build needs to be in a different thread + // to that which is doing the build (swing threading issues) + Ajde.getDefault().runBuildInDifferentThread(buildConfig, true); action.actionPerformed(e); } }); - buildItem.setIcon((Icon)AjdeUIManager.getDefault().getIconRegistry().getIcon(IProgramElement.Kind.FILE_LST).getIconResource()); + buildItem.setIcon((Icon)Ajde.getDefault().getIconRegistry().getIcon(IProgramElement.Kind.FILE_LST).getIconResource()); this.add(buildItem); } } diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BuildOptionsPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/BuildOptionsPanel.java deleted file mode 100644 index cabdb5f85..000000000 --- a/ajde/src/org/aspectj/ajde/ui/swing/BuildOptionsPanel.java +++ /dev/null @@ -1,284 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation - * ******************************************************************/ - - -package org.aspectj.ajde.ui.swing; - -import java.io.IOException; - -import javax.swing.border.Border; -import javax.swing.border.TitledBorder; - -import org.aspectj.ajde.Ajde; -import org.aspectj.org.eclipse.jdt.internal.compiler.impl.CompilerOptions; - -import javax.swing.*; -import java.awt.*; - -/** - * @author Mik Kersten - */ -public class BuildOptionsPanel extends OptionsPanel { - -// private static String INCREMENTAL_NOTE = "Please note that this release offers an early access integration of the incremental\n" -// + "AspectJ compiler. The Document Outline View will fail to refresh correctly when\n" -// + "incremental mode is enabled. Submit any other bugs at http://eclipse.org/aspectj"; - - private static final long serialVersionUID = 5891996016897166802L; - - protected static final BuildOptionsPanel INSTANCE = new BuildOptionsPanel(); - -// private ButtonGroup compilerMode_buttonGroup = new ButtonGroup(); - private TitledBorder titledBorder1; -// private Border border3; -// private Border border4; -// private TitledBorder titledBorder2; -// private Border border5; - private Border border1; - private Border border2; - private JPanel jPanel3 = new JPanel(); - private BorderLayout borderLayout6 = new BorderLayout(); - private JPanel jPanel4 = new JPanel(); - private JPanel compileOptions_panel1 = new JPanel(); - private JPanel build_panel1 = new JPanel(); -// private JRadioButton normal_radioButton = new JRadioButton(); -// private JRadioButton strict_radioButton = new JRadioButton(); -// private JRadioButton lenient_radioButton = new JRadioButton(); - private BorderLayout borderLayout8 = new BorderLayout(); - private Box options_box1 = Box.createVerticalBox(); - private BorderLayout borderLayout5 = new BorderLayout(); -// private JTextField workingDir_field = new JTextField(); - private JPanel jPanel2 = new JPanel(); - private JPanel jPanel1 = new JPanel(); - private JPanel build_panel = new JPanel(); - private JTextField nonStandard_field = new JTextField(); - private JPanel compileOptions_panel = new JPanel(); - private JLabel workingDir_label = new JLabel(); - private JLabel nonStandard_label = new JLabel(); - private BorderLayout borderLayout4 = new BorderLayout(); - private BorderLayout borderLayout3 = new BorderLayout(); - private BorderLayout borderLayout2 = new BorderLayout(); - private Box fields_box = Box.createVerticalBox(); - private BorderLayout borderLayout1 = new BorderLayout(); - private BorderLayout borderLayout7 = new BorderLayout(); - Box options_box2 = Box.createVerticalBox(); - //JTextArea incrementalNote = new JTextArea(); - JLabel spacer_label = new JLabel(); - JCheckBox assertions_checkBox = new JCheckBox(); - JCheckBox oneFive_checkBox = new JCheckBox(); - Box options_box = Box.createVerticalBox(); - //JCheckBox incremental_checkBox = new JCheckBox(); -// JCheckBox useJavac_checkBox = new JCheckBox(); -// JCheckBox preprocess_checkBox = new JCheckBox(); - JLabel spacer_label1 = new JLabel(); - - public BuildOptionsPanel() { - try { - jbInit(); - this.setName("AspectJ Build Options"); - -// compilerMode_buttonGroup.add(normal_radioButton); -// compilerMode_buttonGroup.add(strict_radioButton); -// compilerMode_buttonGroup.add(lenient_radioButton); - -// preprocess_checkBox.setEnabled(false); -// useJavac_checkBox.setEnabled(false); -// workingDir_field.setEnabled(false); -// workingDir_label.setEnabled(false); - } catch (Exception e) { - Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e); - } - } - - public void loadOptions() throws IOException { - if (Ajde.getDefault().getBuildManager().getBuildOptions().getSourceCompatibilityLevel() != null) { - oneFive_checkBox.setSelected( - Ajde.getDefault().getBuildManager().getBuildOptions().getSourceCompatibilityLevel().equals(CompilerOptions.VERSION_1_5) - ); - } - if (Ajde.getDefault().getBuildManager().getBuildOptions().getSourceCompatibilityLevel() != null) { - assertions_checkBox.setSelected( - Ajde.getDefault().getBuildManager().getBuildOptions().getSourceCompatibilityLevel().equals(CompilerOptions.VERSION_1_4) - ); - } -// preprocess_checkBox.setSelected( -// Ajde.getDefault().getBuildManager().getBuildOptions().getPreprocessMode() -// ); -// useJavac_checkBox.setSelected( -// Ajde.getDefault().getBuildManager().getBuildOptions().getUseJavacMode() -// ); -// incremental_checkBox.setSelected( -// Ajde.getDefault().getBuildManager().getBuildOptions().getIncrementalMode() -// ); - - nonStandard_field.setText( - Ajde.getDefault().getBuildManager().getBuildOptions().getNonStandardOptions() - ); -// workingDir_field.setText( -// Ajde.getDefault().getBuildManager().getBuildOptions().getWorkingOutputPath() -// ); - -// if (Ajde.getDefault().getBuildManager().getBuildOptions().getStrictSpecMode()) { -// strict_radioButton.setSelected(true); -// } else if (Ajde.getDefault().getBuildManager().getBuildOptions().getLenientSpecMode()) { -// lenient_radioButton.setSelected(true); -// } else { -// normal_radioButton.setSelected(true); -// } - } - - public void saveOptions() throws IOException { - if (oneFive_checkBox.isSelected()) { - AjdeUIManager.getDefault().getBuildOptions().setSourceCompatibilityLevel(CompilerOptions.VERSION_1_5); - } else if (assertions_checkBox.isSelected()) { -// AjdeUIManager.getDefault().getBuildOptions().setSourceOnePointFourMode(true); - AjdeUIManager.getDefault().getBuildOptions().setSourceCompatibilityLevel(CompilerOptions.VERSION_1_4); - } else { - AjdeUIManager.getDefault().getBuildOptions().setSourceCompatibilityLevel(CompilerOptions.VERSION_1_3); - } -// AjdeUIManager.getDefault().getBuildOptions().setPreprocessMode( -// preprocess_checkBox.isSelected() -// ); -// AjdeUIManager.getDefault().getBuildOptions().setUseJavacMode( -// useJavac_checkBox.isSelected() -// ); -// AjdeUIManager.getDefault().getBuildOptions().setIncrementalMode( -// incremental_checkBox.isSelected() -// ); - - AjdeUIManager.getDefault().getBuildOptions().setNonStandardOptions( - nonStandard_field.getText() - ); -// AjdeUIManager.getDefault().getBuildOptions().setWorkingDir( -// workingDir_field.getText() -// ); - -// AjdeUIManager.getDefault().getBuildOptions().setStrictSpecMode(strict_radioButton.isSelected()); -// AjdeUIManager.getDefault().getBuildOptions().setLenientSpecMode(lenient_radioButton.isSelected()); - } - - public static BuildOptionsPanel getDefault() { - return INSTANCE; - } - - private void jbInit() throws Exception { - titledBorder1 = - new TitledBorder( - BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158)), - "ajc Options"); - BorderFactory.createCompoundBorder( - new TitledBorder( - BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158)), - "ajc Options"), - BorderFactory.createEmptyBorder(5, 5, 5, 5)); - BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158)); -// titledBorder2 = -// new TitledBorder( -// BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158)), -// "ajc Strictness Mode"); -// border5 = -// BorderFactory.createCompoundBorder( -// titledBorder2, -// BorderFactory.createEmptyBorder(5, 5, 5, 5)); -// border1 = -// BorderFactory.createCompoundBorder( -// titledBorder2, -// BorderFactory.createEmptyBorder(5, 5, 5, 5)); - border2 = - BorderFactory.createCompoundBorder( - titledBorder1, - BorderFactory.createEmptyBorder(5, 5, 5, 5)); - titledBorder1.setTitle("ajc Options"); - titledBorder1.setTitleFont(new java.awt.Font("Dialog", 0, 11)); -// titledBorder2.setTitleFont(new java.awt.Font("Dialog", 0, 11)); - this.setLayout(borderLayout6); - compileOptions_panel1.setLayout(borderLayout8); - build_panel1.setLayout(borderLayout5); - build_panel1.setFont(new java.awt.Font("Dialog", 0, 11)); - build_panel1.setBorder(border1); - build_panel1.setMaximumSize(new Dimension(2147483647, 109)); -// normal_radioButton.setFont(new java.awt.Font("Dialog", 0, 11)); -// normal_radioButton.setText("Normal"); -// strict_radioButton.setText( -// "Be extra strict in interpreting the Java specification"); -// strict_radioButton.setFont(new java.awt.Font("Dialog", 0, 11)); -// lenient_radioButton.setText( -// "Be lenient in interpreting the Java specification"); -// lenient_radioButton.setFont(new java.awt.Font("Dialog", 0, 11)); -// workingDir_field.setFont(new java.awt.Font("SansSerif", 0, 11)); -// workingDir_field.setMinimumSize(new Dimension(200, 21)); -// workingDir_field.setPreferredSize(new Dimension(350, 21)); - jPanel2.setLayout(borderLayout3); - jPanel1.setLayout(borderLayout2); - build_panel.setLayout(borderLayout4); - build_panel.setBorder(border2); - nonStandard_field.setFont(new java.awt.Font("SansSerif", 0, 11)); - nonStandard_field.setMinimumSize(new Dimension(200, 21)); - nonStandard_field.setPreferredSize(new Dimension(350, 21)); - compileOptions_panel.setLayout(borderLayout1); - nonStandard_label.setText("Other compiler options:"); - nonStandard_label.setFont(new java.awt.Font("Dialog", 0, 11)); - nonStandard_label.setPreferredSize(new Dimension(80, 16)); - nonStandard_label.setToolTipText(""); - jPanel3.setLayout(borderLayout7); - workingDir_label.setFont(new java.awt.Font("Dialog", 0, 11)); - workingDir_label.setPreferredSize(new Dimension(80, 16)); - workingDir_label.setText("Working directory: "); -// incrementalNote.setBackground(AjdeWidgetStyles.DEFAULT_BACKGROUND_COLOR); -// incrementalNote.setFont(new java.awt.Font("Dialog", 0, 11)); -// incrementalNote.setEditable(false); -// incrementalNote.setText(INCREMENTAL_NOTE); - spacer_label.setText(" "); - assertions_checkBox.setFont(new java.awt.Font("Dialog", 0, 11)); - assertions_checkBox.setText("Java 1.4 source compatibility mode"); - oneFive_checkBox.setFont(new java.awt.Font("Dialog", 0, 11)); - oneFive_checkBox.setText("Java 1.5 source compatibility mode"); -// incremental_checkBox.setText("Incremental compile"); -// incremental_checkBox.setToolTipText("Only recompile necessary sources."); -// incremental_checkBox.setFont(new java.awt.Font("Dialog", 0, 11)); -// useJavac_checkBox.setText("Use javac to generate .class files"); -// useJavac_checkBox.setFont(new java.awt.Font("Dialog", 0, 11)); -// preprocess_checkBox.setFont(new java.awt.Font("Dialog", 0, 11)); -// preprocess_checkBox.setToolTipText(""); -// preprocess_checkBox.setText("Only preprocess and generate .java source files"); - spacer_label1.setText(" "); -// this.add(jPanel3, BorderLayout.NORTH); -// jPanel2.add(workingDir_label, BorderLayout.CENTER); -// jPanel2.add(workingDir_field, BorderLayout.EAST); - compileOptions_panel.add(options_box2, BorderLayout.CENTER); - //options_box2.add(incrementalNote, null); - options_box2.add(spacer_label1, null); - compileOptions_panel.add(options_box, BorderLayout.NORTH); - options_box.add(assertions_checkBox, null); - options_box.add(oneFive_checkBox, null); -// options_box.add(preprocess_checkBox, null); -// options_box.add(useJavac_checkBox, null); - //options_box.add(incremental_checkBox, null); - options_box.add(spacer_label, null); - fields_box.add(jPanel1, null); - fields_box.add(jPanel2, null); - jPanel1.add(nonStandard_label, BorderLayout.CENTER); - jPanel1.add(nonStandard_field, BorderLayout.EAST); - compileOptions_panel.add(fields_box, BorderLayout.SOUTH); - - jPanel3.add(build_panel, BorderLayout.CENTER); - build_panel.add(compileOptions_panel, BorderLayout.NORTH); - jPanel3.add(build_panel1, BorderLayout.SOUTH); - build_panel1.add(compileOptions_panel1, BorderLayout.NORTH); - compileOptions_panel1.add(options_box1, BorderLayout.NORTH); -// options_box1.add(normal_radioButton, null); -// options_box1.add(lenient_radioButton, null); -// options_box1.add(strict_radioButton, null); - this.add(jPanel4, BorderLayout.CENTER); - } -} diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BuildProgressPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/BuildProgressPanel.java index 346d6928e..8b778cd8a 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/BuildProgressPanel.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/BuildProgressPanel.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -23,14 +24,12 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; -import org.aspectj.ajde.Ajde; - /** * @author Mik Kersten */ -class BuildProgressPanel extends JPanel { +public class BuildProgressPanel extends JPanel { - private static final long serialVersionUID = -8045879840621749183L; + //private static final long serialVersionUID = -8045879840621749183L; private static final int MAX_VAL = 100; //private JDialog dialog = null; @@ -44,6 +43,8 @@ class BuildProgressPanel extends JPanel { JPanel jPanel1 = new JPanel(); JProgressBar compile_progressBar = new JProgressBar(); + private boolean buildIsCancelled = false; + /** * @param maxVal the value to which value to which the progress bar will * count up to (in seconds) @@ -131,6 +132,10 @@ class BuildProgressPanel extends JPanel { } void cancel_button_actionPerformed(ActionEvent e) { - Ajde.getDefault().getBuildManager().abortBuild(); + buildIsCancelled = true; + } + + public boolean isCancelRequested() { + return buildIsCancelled; } } diff --git a/ajde/src/org/aspectj/ajde/ui/swing/CompilerMessagesCellRenderer.java b/ajde/src/org/aspectj/ajde/ui/swing/CompilerMessagesCellRenderer.java index 7f30df474..77de70d53 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/CompilerMessagesCellRenderer.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/CompilerMessagesCellRenderer.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -20,6 +21,7 @@ import javax.swing.JLabel; import javax.swing.JList; import javax.swing.ListCellRenderer; +import org.aspectj.ajde.Ajde; import org.aspectj.bridge.IMessage; import org.aspectj.util.LangUtil; @@ -55,11 +57,11 @@ public class CompilerMessagesCellRenderer extends JLabel implements ListCellRend } setText(label); if (kind.equals(IMessage.WARNING)) { - setIcon(AjdeUIManager.getDefault().getIconRegistry().getWarningIcon()); + setIcon(Ajde.getDefault().getIconRegistry().getWarningIcon()); } else if (IMessage.ERROR.isSameOrLessThan(kind)) { - setIcon(AjdeUIManager.getDefault().getIconRegistry().getErrorIcon()); + setIcon(Ajde.getDefault().getIconRegistry().getErrorIcon()); } else { - setIcon(AjdeUIManager.getDefault().getIconRegistry().getInfoIcon()); + setIcon(Ajde.getDefault().getIconRegistry().getInfoIcon()); } if (isSelected) { setBackground(list.getSelectionBackground()); diff --git a/ajde/src/org/aspectj/ajde/ui/swing/DefaultBuildProgressMonitor.java b/ajde/src/org/aspectj/ajde/ui/swing/DefaultBuildProgressMonitor.java index 5328c9616..7fab45d91 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/DefaultBuildProgressMonitor.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/DefaultBuildProgressMonitor.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -18,7 +19,8 @@ import java.awt.Frame; import javax.swing.JDialog; -import org.aspectj.ajde.BuildProgressMonitor; +import org.aspectj.ajde.Ajde; +import org.aspectj.ajde.core.IBuildProgressMonitor; /** * This dialog box is open while ajc is compiling the system and displays @@ -26,8 +28,10 @@ import org.aspectj.ajde.BuildProgressMonitor; * * @author Mik Kersten */ -public class DefaultBuildProgressMonitor extends Thread implements BuildProgressMonitor { +public class DefaultBuildProgressMonitor extends Thread implements IBuildProgressMonitor { + public static final String PROGRESS_HEADING = "AspectJ Build"; + private BuildProgressPanel progressDialog = null; private JDialog dialog = null; @@ -46,11 +50,10 @@ public class DefaultBuildProgressMonitor extends Thread implements BuildProgress /** * Start the progress monitor. */ - public void start(String configFilePath) { - progressDialog.setConfigFile(configFilePath); + public void begin() { progressDialog.setProgressBarVal(0); progressDialog.setProgressText("starting build..."); - dialog.setLocationRelativeTo(AjdeUIManager.getDefault().getRootFrame()); + dialog.setLocationRelativeTo(Ajde.getDefault().getRootFrame()); dialog.setVisible(true); } @@ -62,38 +65,18 @@ public class DefaultBuildProgressMonitor extends Thread implements BuildProgress } /** - * Jumps the progress bar to <CODE>newVal</CODE>. - */ - public void setProgressBarVal(int newVal) { - progressDialog.setProgressBarVal(newVal); - } - - /** - * Makes the progress bar by one. - */ - public void incrementProgressBarVal() { - progressDialog.incrementProgressBarVal(); - } - - /** - * @param maxVal sets the value at which the progress will finish. - */ - public void setProgressBarMax(int maxVal) { - progressDialog.setProgressBarMax(maxVal); - } - - /** - * @return the value at which the progress monitoring will finish. - */ - public int getProgressBarMax() { - return progressDialog.getProgressBarMax(); - } - - /** * Jump the progress bar to the end and finish progress monitoring. */ public void finish(boolean wasFullBuild) { progressDialog.finish(); dialog.dispose(); } + + public boolean isCancelRequested() { + return progressDialog.isCancelRequested(); + } + + public void setProgress(double percentDone) { + progressDialog.setProgressBarVal((int) (percentDone*progressDialog.getProgressBarMax())); + } } diff --git a/ajde/src/org/aspectj/ajde/ui/swing/GoToLineThread.java b/ajde/src/org/aspectj/ajde/ui/swing/GoToLineThread.java index 66cd1af15..7b7ae7b68 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/GoToLineThread.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/GoToLineThread.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -19,6 +20,8 @@ import javax.swing.SwingUtilities; import org.aspectj.ajde.Ajde; import org.aspectj.ajde.EditorAdapter; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.Message; /** * Used to ensure that a source line has been seeked to. Will repeatedly attempt @@ -60,7 +63,8 @@ public class GoToLineThread extends Thread { } }); } catch (Exception e) { - Ajde.getDefault().getErrorHandler().handleError("Could not seek to line.", e); + Message msg = new Message("Could not seek to line.",IMessage.ERROR,e,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); } finished = true; break; diff --git a/ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java b/ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java deleted file mode 100644 index 3972edfd8..000000000 --- a/ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java +++ /dev/null @@ -1,158 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation - * ******************************************************************/ - - -package org.aspectj.ajde.ui.swing; - -import javax.swing.*; - -import org.aspectj.ajde.ui.*; -import org.aspectj.asm.*; -import org.aspectj.asm.IProgramElement; - -/** - * Default icons. Override behavior for custom icons. - * - * @author Mik Kersten - */ -public class IconRegistry extends AbstractIconRegistry { - - //public static IconRegistry INSTANCE = null; - protected String RESOURCE_PATH = "org/aspectj/ajde/resources/"; - - private final Icon START_AJDE = makeIcon("actions/startAjde.gif"); - private final Icon STOP_AJDE = makeIcon("actions/stopAjde.gif"); - private final Icon BUILD = makeIcon("actions/build.gif"); - private final Icon DEBUG = makeIcon("actions/debug.gif"); - private final Icon EXECUTE = makeIcon("actions/execute.gif"); - private final Icon AJBROWSER = makeIcon("structure/advice.gif"); - private final Icon AJBROWSER_ENABLED = makeIcon("actions/browserEnabled.gif"); - private final Icon AJBROWSER_DISABLED = makeIcon("actions/browserDisabled.gif"); - private final Icon STRUCTURE_VIEW = makeIcon("actions/structureView.gif"); - - private final Icon HIDE_ASSOCIATIONS = makeIcon("actions/hideAssociations.gif"); - private final Icon HIDE_NON_AJ = makeIcon("actions/hideNonAJ.gif"); - private final Icon GRANULARITY = makeIcon("actions/granularity.gif"); - private final Icon AJDE_SMALL = makeIcon("actions/ajdeSmall.gif"); - - private final Icon ERROR = makeIcon("structure/error.gif"); - private final Icon WARNING = makeIcon("structure/warning.gif"); - private final Icon INFO = makeIcon("structure/info.gif"); - - private final Icon POPUP = makeIcon("actions/popup.gif"); - private final Icon FILTER = makeIcon("actions/filter.gif"); - private final Icon RELATIONS = makeIcon("actions/relations.gif"); - private final Icon ORDER = makeIcon("actions/order.gif"); - - private final Icon ZOOM_STRUCTURE_TO_FILE_MODE = makeIcon("actions/zoomStructureToFileMode.gif"); - private final Icon ZOOM_STRUCTURE_TO_GLOBAL_MODE = makeIcon("actions/zoomStructureToGlobalMode.gif"); - private final Icon SPLIT_STRUCTURE_VIEW = makeIcon("actions/splitStructureView.gif"); - private final Icon MERGE_STRUCTURE_VIEW = makeIcon("actions/mergeStructureView.gif"); - - private final Icon BACK = makeIcon("actions/back.gif"); - private final Icon FORWARD = makeIcon("actions/forward.gif"); - private final Icon SEARCH = makeIcon("actions/search.gif"); - private final Icon OPEN_CONFIG = makeIcon("actions/openConfig.gif"); - private final Icon CLOSE_CONFIG = makeIcon("actions/closeConfig.gif"); - private final Icon SAVE = makeIcon("actions/save.gif"); - private final Icon SAVE_ALL = makeIcon("actions/saveAll.gif"); - private final Icon BROWSER_OPTIONS = makeIcon("actions/browseroptions.gif"); - - private final Icon ACCESSIBILITY_PUBLIC = makeIcon("structure/accessibility-public.gif"); - private final Icon ACCESSIBILITY_PACKAGE = makeIcon("structure/accessibility-package.gif"); - private final Icon ACCESSIBILITY_PROTECTED = makeIcon("structure/accessibility-protected.gif"); - private final Icon ACCESSIBILITY_PRIVATE = makeIcon("structure/accessibility-private.gif"); - private final Icon ACCESSIBILITY_PRIVILEGED = makeIcon("structure/accessibility-privileged.gif"); - - public Icon getAjdeSmallIcon() { return AJDE_SMALL; } - public Icon getHideAssociationsIcon() { return HIDE_ASSOCIATIONS; } - public Icon getHideNonAJIcon() { return HIDE_NON_AJ; } - public Icon getGranularityIcon() { return GRANULARITY; } - public Icon getErrorIcon() { return ERROR; } - public Icon getWarningIcon() { return WARNING; } - public Icon getInfoIcon() { return INFO; } - public Icon getAJBrowserIcon() { return AJBROWSER; } - public Icon getAJBrowserEnabledIcon() { return AJBROWSER_ENABLED; } - public Icon getAJBrowserDisabledIcon() { return AJBROWSER_DISABLED; } - public Icon getPopupIcon() { return POPUP; } - public Icon getFilterIcon() { return FILTER; } - public Icon getOrderIcon() { return ORDER; } - public Icon getRelationsIcon() { return RELATIONS; } - public Icon getStartAjdeIcon() { return START_AJDE; } - public Icon getStopAjdeIcon() { return STOP_AJDE; } - public Icon getBackIcon() { return BACK; } - public Icon getForwardIcon() { return FORWARD; } - public Icon getSearchIcon() { return SEARCH; } - public Icon getBuildIcon() { return BUILD; } - public Icon getDebugIcon() { return DEBUG; } - public Icon getExecuteIcon() { return EXECUTE; } - public Icon getOpenConfigIcon() { return OPEN_CONFIG; } - public Icon getCloseConfigIcon() { return CLOSE_CONFIG; } - public Icon getOpenIcon() { return OPEN_CONFIG; } - public Icon getSaveIcon() { return SAVE; } - public Icon getSaveAllIcon() { return SAVE_ALL; } - public Icon getBrowserOptionsIcon() { return BROWSER_OPTIONS; } - public Icon getZoomStructureToFileModeIcon() { return ZOOM_STRUCTURE_TO_FILE_MODE; } - public Icon getZoomStructureToGlobalModeIcon() { return ZOOM_STRUCTURE_TO_GLOBAL_MODE; } - public Icon getSplitStructureViewIcon() { return SPLIT_STRUCTURE_VIEW; } - public Icon getMergeStructureViewIcon() { return MERGE_STRUCTURE_VIEW; } - public Icon getStructureViewIcon() { return STRUCTURE_VIEW; } - - public Icon getAssociationSwingIcon(IRelationship.Kind relation) { - return convertToSwingIcon(getIcon(relation)); - } - - public AbstractIcon getStructureIcon(IProgramElement.Kind kind, IProgramElement.Accessibility accessibility) { - return getIcon(kind); - } - - public Icon getStructureSwingIcon(IProgramElement.Kind kind, IProgramElement.Accessibility accessibility) { - return convertToSwingIcon(getStructureIcon(kind, accessibility)); - } - - public Icon getStructureSwingIcon(IProgramElement.Kind kind) { - return convertToSwingIcon(getIcon(kind)); - } - - public Icon getAccessibilitySwingIcon(IProgramElement.Accessibility accessibility) { - if (accessibility == IProgramElement.Accessibility.PUBLIC) { - return ACCESSIBILITY_PUBLIC; - } else if (accessibility == IProgramElement.Accessibility.PACKAGE) { - return ACCESSIBILITY_PACKAGE; - } else if (accessibility == IProgramElement.Accessibility.PROTECTED) { - return ACCESSIBILITY_PROTECTED; - } else if (accessibility == IProgramElement.Accessibility.PRIVATE) { - return ACCESSIBILITY_PRIVATE; - } else if (accessibility == IProgramElement.Accessibility.PRIVILEGED) { - return ACCESSIBILITY_PRIVILEGED; - } else { - return null; - } - } - - public Icon convertToSwingIcon(AbstractIcon iconAdapter) { - if (iconAdapter != null) { - return (Icon)iconAdapter.getIconResource(); - } else { - return null; - } - } - - protected AbstractIcon createIcon(String path) { - return new AbstractIcon(new ImageIcon(ClassLoader.getSystemResource(path))); - } - - protected Icon makeIcon(String iconPath) { - return new ImageIcon(ClassLoader.getSystemResource(RESOURCE_PATH + iconPath)); - } -} diff --git a/ajde/src/org/aspectj/ajde/ui/swing/MultiStructureViewPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/MultiStructureViewPanel.java index cf945f5fa..5c44d09ba 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/MultiStructureViewPanel.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/MultiStructureViewPanel.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -20,6 +21,8 @@ import javax.swing.JPanel; import javax.swing.JSplitPane; import org.aspectj.ajde.Ajde; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.Message; /** * @author Mik Kersten @@ -36,7 +39,8 @@ public class MultiStructureViewPanel extends JPanel { views_splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, bottomPanel); jbInit(); } catch(Exception e) { - Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e); + Message msg = new Message("Could not initialize GUI.",IMessage.ERROR,e,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); } } diff --git a/ajde/src/org/aspectj/ajde/ui/swing/OptionsFrame.java b/ajde/src/org/aspectj/ajde/ui/swing/OptionsFrame.java index b1c210f7d..f92b19d7f 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/OptionsFrame.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/OptionsFrame.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -23,8 +24,6 @@ import java.io.IOException; import java.util.Date; import javax.swing.BorderFactory; -//import javax.swing.Box; -//import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; @@ -37,6 +36,9 @@ import javax.swing.border.Border; import javax.swing.border.TitledBorder; import org.aspectj.ajde.Ajde; +import org.aspectj.ajde.IconRegistry; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.Message; import org.aspectj.bridge.Version; /** @@ -112,12 +114,10 @@ public class OptionsFrame extends JFrame { version_label.setText("Version: " + Version.text); built_label.setText("Built: " + new Date(Version.getTime()).toString()); - - addOptionsPanel(new BuildOptionsPanel()); - loadOptions(); } catch(Exception e) { - Ajde.getDefault().getErrorHandler().handleError("Could not open OptionsFrame", e); + Message msg = new Message("Could not open OptionsFrame.",IMessage.ERROR,e,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); } } @@ -126,7 +126,12 @@ public class OptionsFrame extends JFrame { */ public void addOptionsPanel(OptionsPanel panel) { main_tabbedPane.add(panel, main_tabbedPane.getComponentCount()-1); - loadOptions(); + try { + panel.loadOptions(); + } catch (IOException e) { + Message msg = new Message("Could not load options.",IMessage.ERROR,e,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); + } } public void removeOptionsPanel(OptionsPanel panel) { @@ -141,14 +146,14 @@ public class OptionsFrame extends JFrame { private void loadOptions() { try { Component[] components = main_tabbedPane.getComponents(); - for -(int i = 0; i < components.length; i++) { + for (int i = 0; i < components.length; i++) { if (components[i] instanceof OptionsPanel) { ((OptionsPanel)components[i]).loadOptions(); } } } catch (IOException ioe) { - Ajde.getDefault().getErrorHandler().handleError("Could not load options.", ioe); + Message msg = new Message("Could not load options.",IMessage.ERROR,ioe,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); } } @@ -161,7 +166,8 @@ public class OptionsFrame extends JFrame { } } } catch (IOException ioe) { - Ajde.getDefault().getErrorHandler().handleError("Could not load options.", ioe); + Message msg = new Message("Could not load options.",IMessage.ERROR,ioe,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); } } @@ -247,7 +253,7 @@ public class OptionsFrame extends JFrame { titledBorder3.setTitleFont(new java.awt.Font("Dialog", 0, 11)); titledBorder6.setTitleFont(new java.awt.Font("Dialog", 0, 11)); titledBorder5.setTitleFont(new java.awt.Font("Dialog", 0, 11)); - titledBorder4.setTitle("Compiler Flags"); + titledBorder4.setTitle("AjCompiler Flags"); titledBorder4.setTitleFont(new java.awt.Font("Dialog", 0, 11)); titledBorder7.setTitleFont(new java.awt.Font("Dialog", 0, 11)); titledBorder8.setTitle("Access Modifiers"); diff --git a/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java index c354b5145..b2d36b433 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java @@ -8,23 +8,37 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ package org.aspectj.ajde.ui.swing; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.SystemColor; import java.awt.event.ActionEvent; import java.io.File; import java.util.ArrayList; -import javax.swing.*; -import javax.swing.border.*; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.border.BevelBorder; +import javax.swing.border.Border; import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.ui.*; -import org.aspectj.asm.*; +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; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.Message; public class SimpleStructureViewToolPanel extends JPanel { @@ -53,7 +67,7 @@ public class SimpleStructureViewToolPanel extends JPanel { public final IHierarchyListener MODEL_LISTENER = new IHierarchyListener() { public void elementsUpdated(IHierarchy model) { - String path = Ajde.getDefault().getConfigurationManager().getActiveConfigFile(); + String path = Ajde.getDefault().getBuildConfigManager().getActiveConfigFile(); String fileName = "<no active config>"; if (path != null) fileName = new File(path).getName(); updateCurrConfigLabel(fileName); @@ -68,11 +82,12 @@ public class SimpleStructureViewToolPanel extends JPanel { public SimpleStructureViewToolPanel(StructureView currentView) { this.currentView = currentView; - Ajde.getDefault().getStructureModelManager().addListener(MODEL_LISTENER); + AsmManager.getDefault().addListener(MODEL_LISTENER); try { jbInit(); } catch (Exception e) { - Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e); + Message msg = new Message("Could not initialize GUI.",IMessage.ERROR,e,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); } updateCurrConfigLabel("<no active config>"); } @@ -99,7 +114,7 @@ public class SimpleStructureViewToolPanel extends JPanel { structureView_button_actionPerformed(e); } }); - structureView_button.setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureViewIcon()); + structureView_button.setIcon(Ajde.getDefault().getIconRegistry().getStructureViewIcon()); structureView_button.setBorder(border2); structureView_button.setToolTipText("Navigate back"); structureView_button.setPreferredSize(new Dimension(20, 20)); @@ -116,7 +131,7 @@ public class SimpleStructureViewToolPanel extends JPanel { forward_button_actionPerformed(e); } }); - forward_button.setIcon(AjdeUIManager.getDefault().getIconRegistry().getForwardIcon()); + 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)); @@ -127,7 +142,7 @@ public class SimpleStructureViewToolPanel extends JPanel { back_button.setMinimumSize(new Dimension(20, 20)); back_button.setPreferredSize(new Dimension(20, 20)); back_button.setToolTipText("Navigate back"); - back_button.setIcon(AjdeUIManager.getDefault().getIconRegistry().getBackIcon()); + back_button.setIcon(Ajde.getDefault().getIconRegistry().getBackIcon()); back_button.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { back_button_actionPerformed(e); @@ -142,7 +157,7 @@ public class SimpleStructureViewToolPanel extends JPanel { hideNonAJ_button.setMinimumSize(new Dimension(20, 20)); hideNonAJ_button.setPreferredSize(new Dimension(20, 20)); hideNonAJ_button.setToolTipText("Hide non-AspectJ members"); - hideNonAJ_button.setIcon(AjdeUIManager.getDefault().getIconRegistry().getHideNonAJIcon()); + hideNonAJ_button.setIcon(Ajde.getDefault().getIconRegistry().getHideNonAJIcon()); hideNonAJ_button.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { hideNonAJ_button_actionPerformed(e); @@ -153,7 +168,7 @@ public class SimpleStructureViewToolPanel extends JPanel { hideAssociations_button.setMinimumSize(new Dimension(20, 20)); hideAssociations_button.setPreferredSize(new Dimension(20, 20)); hideAssociations_button.setToolTipText("Hide associations"); - hideAssociations_button.setIcon(AjdeUIManager.getDefault().getIconRegistry().getHideAssociationsIcon()); + hideAssociations_button.setIcon(Ajde.getDefault().getIconRegistry().getHideAssociationsIcon()); hideAssociations_button.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { hideAssociations_button_actionPerformed(e); @@ -166,7 +181,7 @@ public class SimpleStructureViewToolPanel extends JPanel { sort_button_actionPerformed(e); } }); - sort_button.setIcon(AjdeUIManager.getDefault().getIconRegistry().getOrderIcon()); + 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)); @@ -189,11 +204,11 @@ public class SimpleStructureViewToolPanel extends JPanel { } private void forward_button_actionPerformed(ActionEvent e) { - Ajde.getDefault().getStructureViewManager().fireNavigateForwardAction(currentView); + Ajde.getDefault().getStructureViewManager().fireNavigateForwardAction(currentView); } private void back_button_actionPerformed(ActionEvent e) { - Ajde.getDefault().getStructureViewManager().fireNavigateBackAction(currentView); + Ajde.getDefault().getStructureViewManager().fireNavigateBackAction(currentView); } void structureView_button_actionPerformed(ActionEvent e) { diff --git a/ajde/src/org/aspectj/ajde/ui/swing/StructureTree.java b/ajde/src/org/aspectj/ajde/ui/swing/StructureTree.java index d39134609..af4cd16e2 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/StructureTree.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/StructureTree.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -19,6 +20,8 @@ import java.awt.Font; import javax.swing.JTree; import org.aspectj.ajde.Ajde; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.Message; /** * @author Mik Kersten @@ -36,7 +39,8 @@ class StructureTree extends JTree { jbInit(); } catch(Exception e) { - Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e); + Message msg = new Message("Could not initialize GUI.",IMessage.ERROR,e,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); } } diff --git a/ajde/src/org/aspectj/ajde/ui/swing/StructureTreeManager.java b/ajde/src/org/aspectj/ajde/ui/swing/StructureTreeManager.java index eef8529a2..7e1f8123b 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/StructureTreeManager.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/StructureTreeManager.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -19,11 +20,22 @@ import java.util.ArrayList; import javax.swing.SwingUtilities; import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.*; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.ui.*; -import org.aspectj.asm.*; +import org.aspectj.ajde.ui.AbstractIcon; +import org.aspectj.ajde.ui.GlobalStructureView; +import org.aspectj.ajde.ui.IStructureViewNode; +import org.aspectj.ajde.ui.StructureView; +import org.aspectj.ajde.ui.StructureViewProperties; +import org.aspectj.asm.IHierarchy; +import org.aspectj.asm.IProgramElement; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.Message; /** * @author Mik Kersten @@ -122,7 +134,8 @@ class StructureTreeManager { try { SwingUtilities.invokeAndWait(update); } catch (Exception e) { - Ajde.getDefault().getErrorHandler().handleError("Could not update tree.", e); + Message msg = new Message("Could not update tree.",IMessage.ERROR,e,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); } } } diff --git a/ajde/src/org/aspectj/ajde/ui/swing/StructureViewPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/StructureViewPanel.java index d1f37ed1e..69eb0fd51 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/StructureViewPanel.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/StructureViewPanel.java @@ -8,21 +8,31 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ package org.aspectj.ajde.ui.swing; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; import java.util.Iterator; -import javax.swing.*; -import javax.swing.border.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.border.BevelBorder; +import javax.swing.border.Border; import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.ui.*; +import org.aspectj.ajde.ui.FileStructureView; +import org.aspectj.ajde.ui.IStructureViewNode; +import org.aspectj.ajde.ui.StructureView; +import org.aspectj.ajde.ui.StructureViewRenderer; import org.aspectj.asm.IProgramElement; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.Message; /** * Represents the configuration of a structure view of the system, rendered @@ -65,7 +75,8 @@ public class StructureViewPanel extends JPanel implements StructureViewRenderer try { jbInit(); } catch (Exception e) { - Ajde.getDefault().getErrorHandler().handleError("Could not initialize view panel.", e); + Message msg = new Message("Could not initialize view panel.",IMessage.ERROR,e,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); } updateView(currentView); } @@ -95,7 +106,7 @@ public class StructureViewPanel extends JPanel implements StructureViewRenderer IProgramElement pNode = (IProgramElement)node.getStructureNode(); treeManager.highlightNode(pNode); if (pNode.getSourceLocation() != null) { - Ajde.getDefault().getEditorAdapter().showSourceLine( + Ajde.getDefault().getEditorAdapter().showSourceLine( pNode.getSourceLocation().getSourceFile().getAbsolutePath(), pNode.getSourceLocation().getLine() + lineOffset, true diff --git a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeFactory.java b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeFactory.java index cbf10a4b4..02b8ba52c 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeFactory.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeFactory.java @@ -9,6 +9,7 @@ * * Contributors: * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -16,9 +17,9 @@ package org.aspectj.ajde.ui.swing; import java.util.List; +import org.aspectj.ajde.IconRegistry; import org.aspectj.ajde.ui.*; import org.aspectj.asm.*; -import org.aspectj.asm.IProgramElement; /** * @author Mik Kersten diff --git a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java index 6e99cc4bb..80396be73 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java @@ -8,20 +8,26 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ package org.aspectj.ajde.ui.swing; -import java.awt.*; +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; -import javax.swing.*; +import javax.swing.Icon; +import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; +import org.aspectj.ajde.Ajde; import org.aspectj.ajde.ui.IStructureViewNode; -import org.aspectj.asm.*; -import org.aspectj.bridge.*; +import org.aspectj.asm.IProgramElement; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.ISourceLocation; /** * @author Mik Kersten @@ -68,15 +74,15 @@ class SwingTreeViewNodeRenderer extends DefaultTreeCellRenderer { if (node != null) { if (node.isRunnable()) { - setIcon(AjdeUIManager.getDefault().getIconRegistry().getExecuteIcon()); + setIcon(Ajde.getDefault().getIconRegistry().getExecuteIcon()); } if (node.getMessage() != null) { if (node.getMessage().getKind().equals(IMessage.WARNING)) { - setIcon(AjdeUIManager.getDefault().getIconRegistry().getWarningIcon()); + setIcon(Ajde.getDefault().getIconRegistry().getWarningIcon()); } else if (node.getMessage().getKind().equals(IMessage.ERROR)) { - setIcon(AjdeUIManager.getDefault().getIconRegistry().getErrorIcon()); + setIcon(Ajde.getDefault().getIconRegistry().getErrorIcon()); } else { - setIcon(AjdeUIManager.getDefault().getIconRegistry().getInfoIcon()); + setIcon(Ajde.getDefault().getIconRegistry().getInfoIcon()); } } diff --git a/ajde/src/org/aspectj/ajde/ui/swing/TreeViewBuildConfigEditor.java b/ajde/src/org/aspectj/ajde/ui/swing/TreeViewBuildConfigEditor.java index 6be37e312..64a69998c 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/TreeViewBuildConfigEditor.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/TreeViewBuildConfigEditor.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -46,6 +47,8 @@ import org.aspectj.ajde.ui.BuildConfigModel; import org.aspectj.ajde.ui.BuildConfigNode; import org.aspectj.ajde.ui.InvalidResourceException; import org.aspectj.asm.IProgramElement; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.Message; /** * UI for editing build configuration (".lst") files via a graphical tree-based * representation. @@ -77,7 +80,8 @@ public class TreeViewBuildConfigEditor extends JPanel implements BuildConfigEdit public void openFile(String configFile) throws IOException, InvalidResourceException { try { if (configFile == null) { - Ajde.getDefault().getErrorHandler().handleError("No structure is selected for editing."); + Message msg = new Message("No structure is selected for editing.",IMessage.ERROR,null,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); return; } // this.configFile = configFile; @@ -85,7 +89,7 @@ public class TreeViewBuildConfigEditor extends JPanel implements BuildConfigEdit jbInit(); jLabel1.setText(" Build configuration: " + configFile); - model = Ajde.getDefault().getConfigurationManager().buildModel(configFile); + model = Ajde.getDefault().getBuildConfigManager().buildModel(configFile); root = buildTree((BuildConfigNode)model.getRoot()); buildConfig_tree.setModel(new DefaultTreeModel(root)); @@ -96,7 +100,8 @@ public class TreeViewBuildConfigEditor extends JPanel implements BuildConfigEdit buildConfig_tree.expandPath(buildConfig_tree.getPathForRow(j)); } } catch(Exception e) { - Ajde.getDefault().getErrorHandler().handleError("Could not open file.", e); + Message msg = new Message("Could not open file.",IMessage.ERROR,e,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); } } @@ -110,7 +115,7 @@ public class TreeViewBuildConfigEditor extends JPanel implements BuildConfigEdit } private void saveModel() { - Ajde.getDefault().getConfigurationManager().writeModel(model); + Ajde.getDefault().getBuildConfigManager().writeModel(model); } private void jbInit() throws Exception { @@ -250,15 +255,15 @@ public class TreeViewBuildConfigEditor extends JPanel implements BuildConfigEdit //} BuildConfigNode.Kind kind = ctn.getModelNode().getBuildConfigNodeKind(); if (kind.equals(BuildConfigNode.Kind.FILE_ASPECTJ)) { - setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.FILE_ASPECTJ)); + setIcon(Ajde.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.FILE_ASPECTJ)); } else if (kind.equals(BuildConfigNode.Kind.FILE_JAVA)) { - setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.FILE_JAVA)); + setIcon(Ajde.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.FILE_JAVA)); } else if (kind.equals(BuildConfigNode.Kind.FILE_LST)) { - setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.FILE_LST)); + setIcon(Ajde.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.FILE_LST)); } else if (kind.equals(BuildConfigNode.Kind.DIRECTORY)) { - setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.PACKAGE)); + setIcon(Ajde.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.PACKAGE)); } else { - setIcon((Icon)AjdeUIManager.getDefault().getIconRegistry().getIcon(IProgramElement.Kind.ERROR).getIconResource()); + setIcon((Icon)Ajde.getDefault().getIconRegistry().getIcon(IProgramElement.Kind.ERROR).getIconResource()); p.remove(cbox); } diff --git a/ajde/src/org/aspectj/ajde/ui/swing/UpdateConfigurationDialog.java b/ajde/src/org/aspectj/ajde/ui/swing/UpdateConfigurationDialog.java index 3f2a70640..2fc7bf201 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/UpdateConfigurationDialog.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/UpdateConfigurationDialog.java @@ -8,7 +8,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * Xerox/PARC initial implementation + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -41,6 +42,8 @@ import javax.swing.ListCellRenderer; import javax.swing.border.TitledBorder; import org.aspectj.ajde.Ajde; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.Message; /** * Used for automatically updating build configuration files (".lst") when a @@ -106,7 +109,8 @@ public class UpdateConfigurationDialog extends JFrame { this.setLocation(posX, posY); } catch(Exception e) { - Ajde.getDefault().getErrorHandler().handleError("Could not open configuration dialog", e); + Message msg = new Message("Could not open configuration dialog",IMessage.ERROR,e,null); + Ajde.getDefault().getMessageHandler().handleMessage(msg); } } |