From cd1ad650b8397ac72ed3e712bf2314fca8e0c17c Mon Sep 17 00:00:00 2001 From: mkersten Date: Fri, 25 Jul 2003 16:05:33 +0000 Subject: [PATCH] De-coupled AJDE APIs from javax.swing, and moved browser-specific funtionality into the the ajbrowser module.) --- .../tools/ajbrowser/BrowserManager.java | 13 ++------- .../aspectj/ajde/ui/swing/AjdeUIManager.java | 29 +++++++++++++++++-- .../ajde/ui/swing}/BuildConfigPopupMenu.java | 12 ++++---- .../org/aspectj/ajde/NullIdeManager.java | 3 +- 4 files changed, 37 insertions(+), 20 deletions(-) rename {ajbrowser/src/org/aspectj/tools/ajbrowser => ajde/src/org/aspectj/ajde/ui/swing}/BuildConfigPopupMenu.java (84%) diff --git a/ajbrowser/src/org/aspectj/tools/ajbrowser/BrowserManager.java b/ajbrowser/src/org/aspectj/tools/ajbrowser/BrowserManager.java index 5f6f9e6e8..7af4f2199 100644 --- a/ajbrowser/src/org/aspectj/tools/ajbrowser/BrowserManager.java +++ b/ajbrowser/src/org/aspectj/tools/ajbrowser/BrowserManager.java @@ -35,7 +35,6 @@ public class BrowserManager { private static final BrowserManager INSTANCE = new BrowserManager(); private BrowserProperties browserProjectProperties; private EditorManager editorManager; - private StructureViewPanel fileStructurePanel = null; public static BrowserManager getDefault() { return INSTANCE; @@ -73,22 +72,16 @@ public class BrowserManager { preferencesAdapter, browserUIAdapter, new IconRegistry(), - topFrame); + topFrame, + true); editorManager = new EditorManager(ajdeEditor); - FileStructureView structureView = Ajde.getDefault().getStructureViewManager().createViewForSourceFile( - editorManager.getCurrFile(), - Ajde.getDefault().getStructureViewManager().getDefaultViewProperties() - ); - Ajde.getDefault().getStructureViewManager().setDefaultFileView(structureView); - fileStructurePanel = new StructureViewPanel(structureView); - Ajde.getDefault().getBuildManager().addListener(BUILD_MESSAGES_LISTENER); MultiStructureViewPanel multiViewPanel = new MultiStructureViewPanel( AjdeUIManager.getDefault().getViewManager().getBrowserPanel(), - fileStructurePanel + AjdeUIManager.getDefault().getFileStructurePanel() ); topFrame.init( diff --git a/ajde/src/org/aspectj/ajde/ui/swing/AjdeUIManager.java b/ajde/src/org/aspectj/ajde/ui/swing/AjdeUIManager.java index f7228aea2..c2dbd074c 100644 --- a/ajde/src/org/aspectj/ajde/ui/swing/AjdeUIManager.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/AjdeUIManager.java @@ -16,8 +16,16 @@ package org.aspectj.ajde.ui.swing; import java.awt.Frame; -import org.aspectj.ajde.*; -import org.aspectj.ajde.ui.*; +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; /** @@ -37,6 +45,7 @@ public class AjdeUIManager { private OptionsFrame optionsFrame = null; private Frame rootFrame = null; + private StructureViewPanel fileStructurePanel = null; /** * Order of initialization is critical here. @@ -48,7 +57,8 @@ public class AjdeUIManager { UserPreferencesAdapter userPreferencesAdapter, IdeUIAdapter ideUIAdapter, IconRegistry iconRegistry, - Frame rootFrame) { + Frame rootFrame, + boolean useFileView) { try { BuildProgressMonitor compileProgress = new DefaultBuildProgressMonitor(rootFrame); ErrorHandler errorHandler = new AjdeErrorHandler(); @@ -72,6 +82,15 @@ public class AjdeUIManager { 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); @@ -142,6 +161,10 @@ public class AjdeUIManager { return buildConfigEditor; } + public StructureViewPanel getFileStructurePanel() { + return fileStructurePanel; + } + public IconRegistry getIconRegistry() { return iconRegistry; } diff --git a/ajbrowser/src/org/aspectj/tools/ajbrowser/BuildConfigPopupMenu.java b/ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java similarity index 84% rename from ajbrowser/src/org/aspectj/tools/ajbrowser/BuildConfigPopupMenu.java rename to ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java index 8ca49e727..6ad79052a 100644 --- a/ajbrowser/src/org/aspectj/tools/ajbrowser/BuildConfigPopupMenu.java +++ b/ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java @@ -12,7 +12,7 @@ * ******************************************************************/ -package org.aspectj.tools.ajbrowser; +package org.aspectj.ajde.ui.swing; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -24,7 +24,6 @@ import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.ui.swing.*; import org.aspectj.asm.ProgramElementNode; public class BuildConfigPopupMenu extends JPopupMenu { @@ -39,11 +38,12 @@ public class BuildConfigPopupMenu extends JPopupMenu { new ActionListener() { public void actionPerformed(ActionEvent e) { Ajde.getDefault().getConfigurationManager().setActiveConfigFile(buildConfig); - if (EditorManager.isShiftDown(e.getModifiers())) { - Ajde.getDefault().getBuildManager().buildFresh(); - } else { + // ??? 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(); - } +// } action.actionPerformed(e); } }); diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeManager.java b/ajde/testsrc/org/aspectj/ajde/NullIdeManager.java index c659dd2c8..4a73e6ee6 100644 --- a/ajde/testsrc/org/aspectj/ajde/NullIdeManager.java +++ b/ajde/testsrc/org/aspectj/ajde/NullIdeManager.java @@ -57,7 +57,8 @@ public class NullIdeManager { preferencesAdapter, uiAdapter, new IconRegistry(), - nullFrame); + nullFrame, + true); //Ajde.getDefault().enableLogging( System.out ); } catch (Throwable t) { -- 2.39.5