aboutsummaryrefslogtreecommitdiffstats
path: root/ajde
diff options
context:
space:
mode:
authorwisberg <wisberg>2002-12-16 17:58:19 +0000
committerwisberg <wisberg>2002-12-16 17:58:19 +0000
commitd842c4f1139629c1f062b74ba818d233b2c31043 (patch)
tree842d3871620bc0eb60edcd95e55804d67e0f61fa /ajde
parent3ce247199704eae6b2c92c6e38c69584e3250c52 (diff)
downloadaspectj-d842c4f1139629c1f062b74ba818d233b2c31043.tar.gz
aspectj-d842c4f1139629c1f062b74ba818d233b2c31043.zip
initial version
Diffstat (limited to 'ajde')
-rw-r--r--ajde/.classpath14
-rw-r--r--ajde/.project22
-rw-r--r--ajde/AJDE.jpx47
-rw-r--r--ajde/ajdeIssues.txt3
-rw-r--r--ajde/aspectj-ajdt.jardesc30
-rw-r--r--ajde/aspectj-ajdt.mf2
-rw-r--r--ajde/aspectjtools.jardesc65
-rw-r--r--ajde/aspectjtools.mf2
-rw-r--r--ajde/src/.cvsignore2
-rw-r--r--ajde/src/org/aspectj/ajde/Ajde.java218
-rw-r--r--ajde/src/org/aspectj/ajde/BuildConfigListener.java36
-rw-r--r--ajde/src/org/aspectj/ajde/BuildConfigManager.java91
-rw-r--r--ajde/src/org/aspectj/ajde/BuildListener.java51
-rw-r--r--ajde/src/org/aspectj/ajde/BuildManager.java59
-rw-r--r--ajde/src/org/aspectj/ajde/BuildOptionsAdapter.java74
-rw-r--r--ajde/src/org/aspectj/ajde/BuildProgressMonitor.java65
-rw-r--r--ajde/src/org/aspectj/ajde/ConfigurationListener.java36
-rw-r--r--ajde/src/org/aspectj/ajde/EditorAdapter.java75
-rw-r--r--ajde/src/org/aspectj/ajde/EditorListener.java32
-rw-r--r--ajde/src/org/aspectj/ajde/ErrorHandler.java28
-rw-r--r--ajde/src/org/aspectj/ajde/ProjectPropertiesAdapter.java58
-rw-r--r--ajde/src/org/aspectj/ajde/TaskListManager.java48
-rw-r--r--ajde/src/org/aspectj/ajde/internal/AspectJBuildManager.java417
-rw-r--r--ajde/src/org/aspectj/ajde/internal/BuildNotifierAdapter.java67
-rw-r--r--ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java178
-rw-r--r--ajde/src/org/aspectj/ajde/internal/DebugErrorHandler.java32
-rw-r--r--ajde/src/org/aspectj/ajde/internal/LstBuildConfigFileParser.java61
-rw-r--r--ajde/src/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java196
-rw-r--r--ajde/src/org/aspectj/ajde/internal/LstBuildConfigManager.java303
-rw-r--r--ajde/src/org/aspectj/ajde/internal/StructureUtilities.java89
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/ajdeSmall.gifbin0 -> 553 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/back.gifbin0 -> 209 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/browserDisabled.gifbin0 -> 565 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/browserEnabled.gifbin0 -> 596 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/browseroptions.gifbin0 -> 129 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/build.gifbin0 -> 125 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/clean.gifbin0 -> 231 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/closeConfig.gifbin0 -> 127 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/debug.gifbin0 -> 118 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/default.gifbin0 -> 858 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/execute.gifbin0 -> 104 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/filter.gifbin0 -> 113 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/find.gifbin0 -> 326 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/forward.gifbin0 -> 211 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/granularity.gifbin0 -> 104 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/hideAssociations.gifbin0 -> 109 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/hideNonAJ.gifbin0 -> 109 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/mergeStructureView.gifbin0 -> 159 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/new.gifbin0 -> 349 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/open.gifbin0 -> 147 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/openConfig.gifbin0 -> 132 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/options.gifbin0 -> 125 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/order.gifbin0 -> 84 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/outputWindow.gifbin0 -> 173 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/popup.gifbin0 -> 51 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/refresh.gifbin0 -> 375 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/relations.gifbin0 -> 84 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/save.gifbin0 -> 123 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/saveAll.gifbin0 -> 126 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/search.gifbin0 -> 223 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/splitStructureView.gifbin0 -> 161 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/startAjde.gifbin0 -> 120 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/stopAjde.gifbin0 -> 582 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/structureView.gifbin0 -> 124 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/zoomStructureToFileMode.gifbin0 -> 363 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/actions/zoomStructureToGlobalMode.gifbin0 -> 359 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/accessibility-package.gifbin0 -> 141 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/accessibility-private.gifbin0 -> 98 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/accessibility-privileged.gifbin0 -> 82 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/accessibility-protected.gifbin0 -> 135 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/accessibility-public.gifbin0 -> 55 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/advice.gifbin0 -> 150 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/adviceBack.gifbin0 -> 82 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/adviceForward.gifbin0 -> 82 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/aspect.gifbin0 -> 124 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/class.gifbin0 -> 97 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/code.gifbin0 -> 103 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/declareError.gifbin0 -> 126 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/declareParents.gifbin0 -> 125 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/declareSoft.gifbin0 -> 114 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/declareWarning.gifbin0 -> 123 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/error.gifbin0 -> 93 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/field.gifbin0 -> 88 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/file-aspectj.gifbin0 -> 130 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/file-java.gifbin0 -> 125 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/file-lst.gifbin0 -> 124 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/file.gifbin0 -> 104 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/info.gifbin0 -> 78 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/inheritanceBack.gifbin0 -> 83 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/inheritanceForward.gifbin0 -> 83 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/interface.gifbin0 -> 112 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/introduction.gifbin0 -> 115 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/method.gifbin0 -> 150 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/package.gifbin0 -> 124 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/pointcut.gifbin0 -> 90 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/project.gifbin0 -> 124 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/referenceBack.gifbin0 -> 78 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/referenceForward.gifbin0 -> 79 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/search.gifbin0 -> 223 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/resources/structure/warning.gifbin0 -> 82 bytes
-rw-r--r--ajde/src/org/aspectj/ajde/ui/AbstractIcon.java31
-rw-r--r--ajde/src/org/aspectj/ajde/ui/AbstractIconRegistry.java143
-rw-r--r--ajde/src/org/aspectj/ajde/ui/BuildConfigEditor.java28
-rw-r--r--ajde/src/org/aspectj/ajde/ui/BuildConfigModel.java96
-rw-r--r--ajde/src/org/aspectj/ajde/ui/BuildConfigNode.java110
-rw-r--r--ajde/src/org/aspectj/ajde/ui/EditorManager.java162
-rw-r--r--ajde/src/org/aspectj/ajde/ui/FileStructureView.java48
-rw-r--r--ajde/src/org/aspectj/ajde/ui/GlobalStructureView.java52
-rw-r--r--ajde/src/org/aspectj/ajde/ui/GlobalViewProperties.java49
-rw-r--r--ajde/src/org/aspectj/ajde/ui/IdeUIAdapter.java23
-rw-r--r--ajde/src/org/aspectj/ajde/ui/InvalidResourceException.java40
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java236
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java71
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureView.java104
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureViewManager.java255
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureViewNode.java43
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java58
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureViewProperties.java255
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureViewRenderer.java49
-rw-r--r--ajde/src/org/aspectj/ajde/ui/UserPreferencesAdapter.java67
-rw-r--r--ajde/src/org/aspectj/ajde/ui/internal/AjcBuildOptions.java136
-rw-r--r--ajde/src/org/aspectj/ajde/ui/internal/BrowserViewProperties.java162
-rw-r--r--ajde/src/org/aspectj/ajde/ui/internal/NavigationHistoryModel.java56
-rw-r--r--ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java454
-rw-r--r--ajde/src/org/aspectj/ajde/ui/internal/UserPreferencesStore.java99
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/AJButtonMenuCombo.java142
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/AjdeErrorHandler.java56
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/AjdeUIManager.java172
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/AjdeWidgetStyles.java32
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BasicEditor.java175
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BrowserStructureViewToolPanel.java342
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BrowserView.java312
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java105
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BrowserViewPanel.java152
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BrowserViewTreeListener.java129
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java46
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BuildOptionsPanel.java248
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BuildProgressPanel.java132
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/CompilerMessage.java50
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/CompilerMessagesCellRenderer.java59
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/DefaultBuildProgressMonitor.java95
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/ErrorDialog.java94
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/GoToLineThread.java78
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java160
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/MultiStructureViewPanel.java48
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/OptionsFrame.java257
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/OptionsPanel.java28
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/PointcutWizard.java157
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java247
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/StructureTree.java56
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/StructureTreeManager.java429
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/StructureViewPanel.java126
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/StructureViewTreeListener.java63
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNode.java69
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeFactory.java33
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java89
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/TreeViewBuildConfigEditor.java270
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/UpdateConfigurationDialog.java212
-rw-r--r--ajde/testdata/AspectJBuildManagerTest/.cvsignore2
-rw-r--r--ajde/testdata/LstBuildConfigManagerTest/.cvsignore1
-rw-r--r--ajde/testdata/LstBuildConfigManagerTest/A.java5
-rw-r--r--ajde/testdata/LstBuildConfigManagerTest/B.aj5
-rw-r--r--ajde/testdata/LstBuildConfigManagerTest/moduleB/B1.java4
-rw-r--r--ajde/testdata/LstBuildConfigManagerTest/moduleB/B2.java3
-rw-r--r--ajde/testdata/LstBuildConfigManagerTest/moduleB/B3.java3
-rw-r--r--ajde/testdata/LstBuildConfigManagerTest/moduleB/moduleC/C1.java3
-rw-r--r--ajde/testdata/LstBuildConfigManagerTest/moduleB/moduleC/C2.java3
-rw-r--r--ajde/testdata/LstBuildConfigManagerTest/moduleB/moduleC/moduleD/D.java3
-rw-r--r--ajde/testdata/SimpleStructureModelTest/Foo.java3
-rw-r--r--ajde/testdata/SimpleStructureModelTest/Good.java18
-rw-r--r--ajde/testdata/StructureModelRegressionTest/.cvsignore1
-rw-r--r--ajde/testdata/StructureModelRegressionTest/pkg/.cvsignore1
-rw-r--r--ajde/testdata/StructureModelRegressionTest/pkg/Example.java16
-rw-r--r--ajde/testdata/StructureModelTest/.cvsignore1
-rw-r--r--ajde/testdata/StructureSearchManagerTest/.cvsignore1
-rw-r--r--ajde/testdata/StructureViewManagerTest/.cvsignore1
-rw-r--r--ajde/testdata/StructureViewManagerTest/pkg/Example.java16
-rw-r--r--ajde/testdata/examples/configs/.cvsignore1
-rw-r--r--ajde/testdata/examples/figures-coverage/.cvsignore1
-rw-r--r--ajde/testdata/examples/figures-coverage/editor/Editor.java4
-rw-r--r--ajde/testdata/examples/figures-coverage/figures/.cvsignore8
-rw-r--r--ajde/testdata/examples/figures-coverage/figures/Debug.java7
-rw-r--r--ajde/testdata/examples/figures-coverage/figures/Figure.java88
-rw-r--r--ajde/testdata/examples/figures-coverage/figures/FigureElement.java9
-rw-r--r--ajde/testdata/examples/figures-coverage/figures/Main.java54
-rw-r--r--ajde/testdata/examples/figures-coverage/figures/composites/.cvsignore3
-rw-r--r--ajde/testdata/examples/figures-coverage/figures/composites/Line.java6
-rw-r--r--ajde/testdata/examples/figures-coverage/figures/composites/Square.java6
-rw-r--r--ajde/testdata/examples/figures-coverage/figures/primitives/planar/.cvsignore4
-rw-r--r--ajde/testdata/examples/figures-coverage/figures/primitives/planar/Point.java73
-rw-r--r--ajde/testdata/examples/figures-coverage/figures/primitives/solid/.cvsignore1
-rw-r--r--ajde/testdata/examples/figures-coverage/figures/primitives/solid/SolidPoint.java24
-rw-r--r--ajde/testdata/examples/figures-demo/.cvsignore1
-rw-r--r--ajde/testdata/examples/figures-demo/figures/Box.java55
-rw-r--r--ajde/testdata/examples/figures-demo/figures/Canvas.java11
-rw-r--r--ajde/testdata/examples/figures-demo/figures/ColorControl.java20
-rw-r--r--ajde/testdata/examples/figures-demo/figures/FigureElement.java21
-rw-r--r--ajde/testdata/examples/figures-demo/figures/Group.java88
-rw-r--r--ajde/testdata/examples/figures-demo/figures/Line.java73
-rw-r--r--ajde/testdata/examples/figures-demo/figures/Point.java59
-rw-r--r--ajde/testdata/examples/figures-demo/figures/ShapeFigureElement.java38
-rw-r--r--ajde/testdata/examples/figures-demo/figures/SlothfulPoint.java42
-rw-r--r--ajde/testdata/examples/figures-demo/figures/gui/FigurePanel.java172
-rw-r--r--ajde/testdata/examples/figures-demo/figures/gui/LogAdapter.java16
-rw-r--r--ajde/testdata/examples/figures-demo/figures/gui/Main.java26
-rw-r--r--ajde/testdata/examples/figures-demo/figures/support/Enforcement.java67
-rw-r--r--ajde/testdata/examples/figures-demo/figures/support/Log.java36
-rw-r--r--ajde/testdata/examples/inheritance/.cvsignore1
-rw-r--r--ajde/testdata/examples/inheritance/A.java22
-rw-r--r--ajde/testdata/examples/plainJava/apples/Apple.java115
-rw-r--r--ajde/testdata/examples/plainJava/apples/AppleCrate.java54
-rw-r--r--ajde/testdata/examples/plainJava/apples/BigRigAspect.java17
-rw-r--r--ajde/testdata/examples/plainJava/apples/TransportAspect.java26
-rw-r--r--ajde/testdata/test-script.html304
-rw-r--r--ajde/testsrc/AjdeModuleTests.java31
-rw-r--r--ajde/testsrc/org/aspectj/ajde/AjdeTestCase.java65
-rw-r--r--ajde/testsrc/org/aspectj/ajde/AjdeTests.java34
-rw-r--r--ajde/testsrc/org/aspectj/ajde/BuildOptionsTest.java63
-rw-r--r--ajde/testsrc/org/aspectj/ajde/NullIdeManager.java54
-rw-r--r--ajde/testsrc/org/aspectj/ajde/NullIdeProperties.java87
-rw-r--r--ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java38
-rw-r--r--ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java27
-rw-r--r--ajde/testsrc/org/aspectj/ajde/SimpleStructureModelTest.java32
-rw-r--r--ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java87
-rw-r--r--ajde/testsrc/org/aspectj/ajde/StructureModelTest.java145
-rw-r--r--ajde/testsrc/org/aspectj/ajde/TestBuildListener.java45
-rw-r--r--ajde/testsrc/org/aspectj/ajde/VersionTest.java49
-rw-r--r--ajde/testsrc/org/aspectj/ajde/internal/AjdeInternalTests.java32
-rw-r--r--ajde/testsrc/org/aspectj/ajde/internal/AspectJBuildManagerTest.java80
-rw-r--r--ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java157
-rw-r--r--ajde/testsrc/org/aspectj/ajde/ui/AjdeUiTests.java33
-rw-r--r--ajde/testsrc/org/aspectj/ajde/ui/NullIdeFileStructureView.java39
-rw-r--r--ajde/testsrc/org/aspectj/ajde/ui/NullIdeStructureViewRenderer.java44
-rw-r--r--ajde/testsrc/org/aspectj/ajde/ui/StructureModelUtilTest.java78
-rw-r--r--ajde/testsrc/org/aspectj/ajde/ui/StructureSearchManagerTest.java80
-rw-r--r--ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java167
236 files changed, 13001 insertions, 0 deletions
diff --git a/ajde/.classpath b/ajde/.classpath
new file mode 100644
index 000000000..0a864e2b8
--- /dev/null
+++ b/ajde/.classpath
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="testsrc"/>
+ <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
+ <classpathentry kind="src" path="/util"/>
+ <classpathentry kind="lib" path="/lib/junit/junit.jar" sourcepath="/lib/junit/junit-src.jar"/>
+ <classpathentry kind="src" path="/bridge"/>
+ <classpathentry kind="src" path="/asm"/>
+ <classpathentry kind="src" path="/org.aspectj.ajdt.core"/>
+ <classpathentry kind="src" path="/org.eclipse.jdt.core"/>
+ <classpathentry kind="lib" path="/lib/eclipse2.0/jdtDepends.jar" sourcepath="/lib/eclipse2.0/jdtDependsSrc.zip"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/ajde/.project b/ajde/.project
new file mode 100644
index 000000000..6a9272f79
--- /dev/null
+++ b/ajde/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>ajde</name>
+ <comment></comment>
+ <projects>
+ <project>asm</project>
+ <project>bridge</project>
+ <project>org.aspectj.ajdt.core</project>
+ <project>org.eclipse.jdt.core</project>
+ <project>util</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/ajde/AJDE.jpx b/ajde/AJDE.jpx
new file mode 100644
index 000000000..146b28eec
--- /dev/null
+++ b/ajde/AJDE.jpx
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--JBuilder XML Project-->
+<project>
+ <property category="ajde" name="build.configs.active" value="&lt;all project files&gt;"/>
+ <property category="idl" name="ProcessIDL" value="false"/>
+ <property category="runtime.0" name="RunnableType" value="com.borland.jbuilder.runtime.ApplicationRunner"/>
+ <property category="runtime.0" name="appserver.ejbJarsSaved" value="1"/>
+ <property category="runtime.0" name="appserver.parameters" value="-jts -jns -jss -jdb"/>
+ <property category="runtime.0" name="appserver.servername" value="standard"/>
+ <property category="runtime.0" name="appserver.vmparameters" value="-Dvbroker.agent.port=14000 -Djava.library.path=/BorlandEnterpriseServer/lib;/BorlandEnterpriseServer/bin -Dborland.enterprise.licenseDir=/BorlandEnterpriseServer/var/servers/ADVICE/adm -Dejb.module_preload=true"/>
+ <property category="runtime.0" name="jsprunner.launchuri" value="/"/>
+ <property category="runtime.0" name="test.harness" value="junit.textui.TestRunner"/>
+ <property category="sys" name="AuthorLabel" value="@author"/>
+ <property category="sys" name="BackupPath" value="bak"/>
+ <property category="sys" name="CheckStable" value="1"/>
+ <property category="sys" name="Company" value=""/>
+ <property category="sys" name="CompanyLabel" value="Company:"/>
+ <property category="sys" name="CompileOnDebug" value="0"/>
+ <property category="sys" name="CompileOnRun" value="0"/>
+ <property category="sys" name="Copyright" value="Copyright (c) 2002"/>
+ <property category="sys" name="CopyrightLabel" value="Copyright:"/>
+ <property category="sys" name="DefaultPath" value="../src"/>
+ <property category="sys" name="Description" value=""/>
+ <property category="sys" name="DescriptionLabel" value="Description:"/>
+ <property category="sys" name="DocPath" value="doc"/>
+ <property category="sys" name="ExcludeClassEnabled" value="0"/>
+ <property category="sys" name="IncludeTestPath" value="1"/>
+ <property category="sys" name="JDK" value="java 1.3.1-b24"/>
+ <property category="sys" name="LastTag" value="0"/>
+ <property category="sys" name="Libraries" value="AspectJ Tools;Open Tools SDK"/>
+ <property category="sys" name="MakeStable" value="0"/>
+ <property category="sys" name="OutPath" value="../bin"/>
+ <property category="sys" name="SourcePath" value="../src;test"/>
+ <property category="sys" name="TestPath" value="test"/>
+ <property category="sys" name="Title" value=""/>
+ <property category="sys" name="TitleLabel" value="Title:"/>
+ <property category="sys" name="Version" value="1.0"/>
+ <property category="sys" name="VersionLabel" value="@version"/>
+ <property category="sys" name="WorkingDirectory" value="."/>
+ <property category="sys" name="max.package.levels" value="5"/>
+ <property category="sys"
+ name="uidesign.size.org.aspectj.ajde.ui.swing.BrowserStructureViewToolPanel" value="518,92"/>
+ <property category="sys"
+ name="uidesign.size.org.aspectj.ajde.ui.swing.BuildConfigManagementPanel" value="299,86"/>
+ <property category="sys"
+ name="uidesign.size.org.aspectj.ajde.ui.swing.ErrorDialog" value="465,361"/>
+</project>
diff --git a/ajde/ajdeIssues.txt b/ajde/ajdeIssues.txt
new file mode 100644
index 000000000..47b5836b3
--- /dev/null
+++ b/ajde/ajdeIssues.txt
@@ -0,0 +1,3 @@
+
+* Source path needs to be same directory as ".lst" file, multiple sourcepaths not supported.
+
diff --git a/ajde/aspectj-ajdt.jardesc b/ajde/aspectj-ajdt.jardesc
new file mode 100644
index 000000000..6bdf54e08
--- /dev/null
+++ b/ajde/aspectj-ajdt.jardesc
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jardesc>
+ <jar path="C:/Dev/eclipse/org.aspectj.ajde/ajde.jar"/>
+ <options overwrite="true" compress="true" exportErrors="false"
+ exportWarnings="true" saveDescription="true"
+ descriptionLocation="/ajde/aspectj-ajdt.jardesc"
+ useSourceFolders="false" buildIfNeeded="true"/>
+ <manifest manifestVersion="1.0" usesManifest="true"
+ reuseManifest="true" saveManifest="true"
+ generateManifest="false" manifestLocation="/ajde/aspectj-ajdt.mf">
+ <sealing sealJar="false">
+ <packagesToSeal/>
+ <packagesToUnSeal/>
+ </sealing>
+ </manifest>
+ <selectedElements exportClassFiles="true" exportJavaFiles="true">
+ <javaElement handleIdentifier="=ajde/src&lt;org.aspectj.ajde.resources.actions"/>
+ <javaElement handleIdentifier="=asm/src&lt;org.aspectj.asm.associations"/>
+ <javaElement handleIdentifier="=ajde/src&lt;org.aspectj.ajde.ui"/>
+ <javaElement handleIdentifier="=ajde/src&lt;org.aspectj.ajde.ui.swing"/>
+ <javaElement handleIdentifier="=ajde/src&lt;org.aspectj.ajde"/>
+ <javaElement handleIdentifier="=asm/src&lt;org.aspectj.asm.internal"/>
+ <javaElement handleIdentifier="=asm/src&lt;org.aspectj.asm.views"/>
+ <javaElement handleIdentifier="=asm/src&lt;org.aspectj.asm"/>
+ <javaElement handleIdentifier="=ajde/src&lt;org.aspectj.ajde.resources.structure"/>
+ <javaElement handleIdentifier="=ajde/src&lt;org.aspectj.ajde.internal"/>
+ <javaElement handleIdentifier="=ajde/src&lt;org.aspectj.ajde.ui.internal"/>
+ <javaElement handleIdentifier="=bridge/src&lt;org.aspectj.bridge"/>
+ </selectedElements>
+</jardesc>
diff --git a/ajde/aspectj-ajdt.mf b/ajde/aspectj-ajdt.mf
new file mode 100644
index 000000000..58630c02e
--- /dev/null
+++ b/ajde/aspectj-ajdt.mf
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+
diff --git a/ajde/aspectjtools.jardesc b/ajde/aspectjtools.jardesc
new file mode 100644
index 000000000..6d6c8bb4e
--- /dev/null
+++ b/ajde/aspectjtools.jardesc
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jardesc>
+ <jar path="C:/Dev/eclipse/org.aspectj.ajde/aspectjtools.jar"/>
+ <options overwrite="true" compress="true" exportErrors="false"
+ exportWarnings="true" saveDescription="true"
+ descriptionLocation="/ajde/aspectjtools.jardesc"
+ useSourceFolders="false" buildIfNeeded="true"/>
+ <manifest manifestVersion="1.0" usesManifest="true"
+ reuseManifest="true" saveManifest="true"
+ generateManifest="false" manifestLocation="/ajde/aspectjtools.mf">
+ <sealing sealJar="false">
+ <packagesToSeal/>
+ <packagesToUnSeal/>
+ </sealing>
+ </manifest>
+ <selectedElements exportClassFiles="true" exportJavaFiles="true">
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util.gui"/>
+ <javaElement handleIdentifier="=runtime/src&lt;org.aspectj.lang"/>
+ <javaElement handleIdentifier="=bcweaver/src&lt;org.aspectj.weaver.patterns"/>
+ <javaElement handleIdentifier="=runtime/src&lt;org.aspectj.lang.reflect"/>
+ <javaElement handleIdentifier="=runtime/src&lt;org.aspectj.runtime"/>
+ <javaElement handleIdentifier="=runtime/src&lt;org.aspectj.runtime.reflect"/>
+ <javaElement handleIdentifier="=org.eclipse.jdt.core/dom"/>
+ <javaElement handleIdentifier="=org.eclipse.jdt.core/formatter"/>
+ <javaElement handleIdentifier="=org.eclipse.jdt.core/batch"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{NonLocalExit.java"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{IntList.java"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{FuzzyBoolean.java"/>
+ <javaElement handleIdentifier="=runtime/src&lt;org.aspectj.runtime.internal"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{StreamPrintWriter.java"/>
+ <javaElement handleIdentifier="=org.eclipse.jdt.core/model"/>
+ <javaElement handleIdentifier="=org.aspectj.ajdt.core/src&lt;org.aspectj.ajdt.internal.compiler.lookup"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{LineReader.java"/>
+ <javaElement handleIdentifier="=org.aspectj.ajdt.core/src&lt;org.aspectj.workbench.resources"/>
+ <javaElement handleIdentifier="=org.eclipse.jdt.core/search"/>
+ <javaElement handleIdentifier="=org.aspectj.ajdt.core/src&lt;org.aspectj.ajdt.internal.compiler.parser"/>
+ <javaElement handleIdentifier="=org.eclipse.jdt.core/compiler"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{ConfigParser.java"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{ArgumentScanner.java"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{LineNumberTableMapper.java"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{InvertableSet.java"/>
+ <javaElement handleIdentifier="=org.aspectj.ajdt.core/src&lt;org.aspectj.ajdt.internal.compiler.ast"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{StackMap.java"/>
+ <javaElement handleIdentifier="=bcweaver/src&lt;org.aspectj.weaver.ast"/>
+ <javaElement handleIdentifier="=org.eclipse.jdt.core/codeassist"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{Reflection.java"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{PartialOrder.java"/>
+ <javaElement handleIdentifier="=org.aspectj.ajdt.core/src&lt;org.aspectj.ajdt.ajc"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{FileUtil.java"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{ConfigFileUtil.java"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{JavaStrings.java"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{CollectionUtil.java"/>
+ <javaElement handleIdentifier="=bcweaver/src&lt;org.aspectj.weaver.bcel"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{UnicodeEscapeWriter.java"/>
+ <javaElement handleIdentifier="=org.aspectj.ajdt.core/src&lt;org.aspectj.ajdt.internal.compiler.problem"/>
+ <javaElement handleIdentifier="=org.aspectj.ajdt.core/src&lt;org.aspectj.tools.ajc"/>
+ <javaElement handleIdentifier="=org.aspectj.ajdt.core/src&lt;org.aspectj.ajdt.internal.compiler"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{TypeSafeEnum.java"/>
+ <javaElement handleIdentifier="=org.eclipse.jdt.core/eval"/>
+ <javaElement handleIdentifier="=bcweaver/src&lt;org.aspectj.weaver"/>
+ <javaElement handleIdentifier="=org.aspectj.ajdt.core/src&lt;org.aspectj.ajdt.compiler"/>
+ <javaElement handleIdentifier="=org.aspectj.ajdt.core/src&lt;org.aspectj.ajdt.internal.core.builder"/>
+ <javaElement handleIdentifier="=util/src&lt;org.aspectj.util{LangUtil.java"/>
+ </selectedElements>
+</jardesc>
diff --git a/ajde/aspectjtools.mf b/ajde/aspectjtools.mf
new file mode 100644
index 000000000..58630c02e
--- /dev/null
+++ b/ajde/aspectjtools.mf
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+
diff --git a/ajde/src/.cvsignore b/ajde/src/.cvsignore
new file mode 100644
index 000000000..ff5587df8
--- /dev/null
+++ b/ajde/src/.cvsignore
@@ -0,0 +1,2 @@
+ajde.lst
+ajdeSrc.lst
diff --git a/ajde/src/org/aspectj/ajde/Ajde.java b/ajde/src/org/aspectj/ajde/Ajde.java
new file mode 100644
index 000000000..7edd825a5
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/Ajde.java
@@ -0,0 +1,218 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import java.io.PrintStream;
+import java.util.List;
+
+import org.aspectj.ajde.internal.AspectJBuildManager;
+import org.aspectj.ajde.internal.LstBuildConfigManager;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.StructureModelManager;
+import org.aspectj.bridge.Version;
+
+/**
+ * Singleton class responsible for AJDE initialization, and the main point of access to
+ * Ajde functionality.
+ *
+ * @author Mik Kersten
+ */
+public class Ajde {
+
+ private static final Ajde INSTANCE = new Ajde();
+ private static final String NOT_INITIALIZED_MESSAGE = "Ajde is not initialized.";
+ private static boolean isInitialized = false;
+ private BuildManager buildManager;
+ private EditorManager editorManager;
+ private StructureViewManager structureViewManager;
+ private StructureSearchManager structureSearchManager;
+ private BuildConfigManager configurationManager ;
+ private ProjectPropertiesAdapter projectProperties;
+ private TaskListManager taskListManager;
+ private IdeUIAdapter ideUIAdapter;
+ private ErrorHandler errorHandler;
+ private PrintStream logPrintStream = null;
+
+ /**
+ * This class can only be constructured by itself (as a singleton) or by sub-classes.
+ */
+ protected Ajde() {
+ configurationManager = new LstBuildConfigManager();
+ }
+
+ /**
+ * This method must be called before using Ajde. A <CODE>RuntimeException</CODE> will
+ * be thrown if use is attempted before initialization.
+ */
+ public static void init(
+ EditorAdapter editorAdapter,
+ TaskListManager taskListManager,
+ BuildProgressMonitor compileProgressMonitor,
+ ProjectPropertiesAdapter projectProperties,
+ BuildOptionsAdapter buildOptionsAdapter,
+ StructureViewNodeFactory structureViewNodeFactory,
+ IdeUIAdapter ideUIAdapter,
+ ErrorHandler errorHandler) {
+ try {
+ INSTANCE.projectProperties = projectProperties;
+ INSTANCE.errorHandler = errorHandler;
+ INSTANCE.taskListManager = taskListManager;
+ INSTANCE.editorManager = new EditorManager(editorAdapter);
+ INSTANCE.buildManager = new AspectJBuildManager(
+ taskListManager,
+ compileProgressMonitor,
+ buildOptionsAdapter);
+
+ INSTANCE.buildManager.addListener(INSTANCE.BUILD_STATUS_LISTENER);
+ INSTANCE.configurationManager.addListener(INSTANCE.STRUCTURE_UPDATE_CONFIG_LISTENER);
+ INSTANCE.ideUIAdapter = ideUIAdapter;
+
+ INSTANCE.structureSearchManager = new StructureSearchManager();
+ INSTANCE.structureViewManager = new StructureViewManager(structureViewNodeFactory);
+
+ isInitialized = true;
+// INSTANCE.enableLogging(System.out);
+ } catch (Throwable t) {
+ System.err.println("AJDE ERROR: could not initialize Ajde.");
+ t.printStackTrace();
+ }
+ }
+
+ /**
+ * @return the default singleton instance of <CODE>Ajde</CODE>
+ */
+ public static Ajde getDefault() {
+ if (!isInitialized) throw new RuntimeException(NOT_INITIALIZED_MESSAGE);
+ return INSTANCE;
+ }
+
+ /**
+ * Set a <CODE>ConfigurationManager</CODE> to use instead of the default one.
+ */
+ public void setConfigurationManager(BuildConfigManager configurationManager) {
+ this.configurationManager = configurationManager;
+ }
+
+ public BuildManager getBuildManager() {
+ return buildManager;
+ }
+
+ public EditorManager getEditorManager() {
+ return editorManager;
+ }
+
+ public StructureViewManager getStructureViewManager() {
+ return structureViewManager;
+ }
+
+ public StructureSearchManager getStructureSearchManager() {
+ return structureSearchManager;
+ }
+
+ public BuildConfigManager getConfigurationManager() {
+ return configurationManager;
+ }
+
+ public ProjectPropertiesAdapter getProjectProperties() {
+ return projectProperties;
+ }
+
+ public TaskListManager getTaskListManager() {
+ return taskListManager;
+ }
+
+ public IdeUIAdapter getIdeUIAdapter() {
+ return ideUIAdapter;
+ }
+
+ public void setIdeUIAdapter(IdeUIAdapter ideUIAdapter) {
+ this.ideUIAdapter = ideUIAdapter;
+ }
+
+ public ErrorHandler getErrorHandler() {
+ return errorHandler;
+ }
+
+ public String getVersion() {
+ return Version.text;
+ }
+
+ public void enableLogging(PrintStream logPrintStream) {
+ this.logPrintStream = logPrintStream;
+ }
+
+ public void disableLogging() {
+ this.logPrintStream = null;
+ }
+
+ /**
+ * The structure manager is not a part of the public API and its
+ * use should be avoided. Used <CODE>getStructureViewManager()</CODE>
+ * instead.
+ */
+ public StructureModelManager getStructureModelManager() {
+ return StructureModelManager.INSTANCE;
+ }
+
+ public void logEvent(String message) {
+ if (logPrintStream != null) {
+ logPrintStream.println("<AJDE> " + message);
+ }
+ }
+
+ private final BuildConfigListener STRUCTURE_UPDATE_CONFIG_LISTENER = new BuildConfigListener() {
+ public void currConfigChanged(String configFilePath) {
+ if (configFilePath != null) Ajde.getDefault().getStructureModelManager().readStructureModel(configFilePath);
+ }
+
+ public void configsListUpdated(List configsList) { }
+ };
+
+ private final BuildListener BUILD_STATUS_LISTENER = new BuildListener() {
+
+ /**
+ * Writes the default configuration file if it has been selected for compilation
+ */
+ public void compileStarted(String buildConfig) {
+ String configFilePath = projectProperties.getDefaultBuildConfigFile();
+ if (buildConfig.equals(configFilePath)) {
+ configurationManager.writePaths(configFilePath, projectProperties.getProjectSourceFiles());
+ logEvent("wrote default build config: " + configFilePath);
+ }
+ }
+
+ /**
+ * The strucutre model is annotated with error messages after an unsuccessful compile.
+ */
+ public void compileFinished(String buildConfig, int buildTime, boolean succeeded, boolean warnings) {
+ String configFilePath = projectProperties.getDefaultBuildConfigFile();
+ if (!succeeded) {
+ StructureModelManager.INSTANCE.fireModelUpdated();
+ }
+ }
+
+ /**
+ * Ignored.
+ */
+ public void compileAborted(String buildConfigFile, String message) { }
+ };
+
+ public void setErrorHandler(ErrorHandler errorHandler) {
+ this.errorHandler = errorHandler;
+ }
+
+}
+
+
diff --git a/ajde/src/org/aspectj/ajde/BuildConfigListener.java b/ajde/src/org/aspectj/ajde/BuildConfigListener.java
new file mode 100644
index 000000000..8bdf3823c
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/BuildConfigListener.java
@@ -0,0 +1,36 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde;
+
+import java.util.*;
+
+/**
+ * @author Mik Kersten
+ */
+public interface BuildConfigListener extends EventListener {
+
+ /**
+ * Called when the current configuration has changed.
+ *
+ * @param configFilePath the path to the new current configuration file
+ */
+ public void currConfigChanged(String configFilePath);
+
+ /**
+ * Called when items are added to or deleted from the configurations list.
+ */
+ public void configsListUpdated(List configsList);
+}
diff --git a/ajde/src/org/aspectj/ajde/BuildConfigManager.java b/ajde/src/org/aspectj/ajde/BuildConfigManager.java
new file mode 100644
index 000000000..aaf013997
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/BuildConfigManager.java
@@ -0,0 +1,91 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import java.util.List;
+
+import org.aspectj.ajde.ui.BuildConfigModel;
+
+/**
+ * @author Mik Kersten
+ */
+public interface BuildConfigManager {
+
+ public static final String CONFIG_FILE_SUFFIX = ".lst";
+
+ public static final String DEFAULT_CONFIG_LABEL = "<all project files>";
+
+ /**
+ * Returns the currently active build configuration file. The current active
+ * build configuration file that is set in this class is used for building and
+ * for updating the structure model.
+ *
+ * @return full path to the file
+ */
+ public String getActiveConfigFile();
+
+ /**
+ * Sets the currently active build configuration file.
+ *
+ * @param full path to the file
+ */
+ public void setActiveConfigFile(String currConfigFilePath);
+
+ /**
+ * Add a listner that will be notified of build configuration change events
+ */
+ public void addListener(BuildConfigListener configurationListener);
+
+ /**
+ * Remove a configuration listener.
+ */
+ public void removeListener(BuildConfigListener configurationListener);
+
+ /**
+ * Build a model for the corresponding configuration file.
+ *
+ * @param full path to the file
+ */
+ public BuildConfigModel buildModel(String configFilePath);
+
+ /**
+ * Save the given configuration model to the file that it was generated from.
+ */
+ public void writeModel(BuildConfigModel model);
+
+ /**
+ * Write a list of source files into a configuration file. File paths will be
+ * written relative to the path of the configuration file.
+ */
+ public void writePaths(String configFilePath, List paths);
+
+ /**
+ * Add files to a configuration.
+ *
+ * @param configFilePath full path to the configuration file
+ * @param files list of full paths to the files to be added
+ */
+ public void addFilesToConfig(String configFilePath, List files);
+
+ /**
+ * Remove files from a configuration.
+ *
+ * @param configFilePath full path to the configuration file
+ * @param files list of full paths to the files to be removed
+ */
+ public void removeFilesFromConfig(String configFilePath, List files);
+}
+
+
diff --git a/ajde/src/org/aspectj/ajde/BuildListener.java b/ajde/src/org/aspectj/ajde/BuildListener.java
new file mode 100644
index 000000000..016026583
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/BuildListener.java
@@ -0,0 +1,51 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde;
+
+import java.util.EventListener;
+
+/**
+ * Compiler listeners get notified of compilation events.
+ *
+ * @author Mik Kersten
+ */
+public interface BuildListener extends EventListener {
+
+ /**
+ * Called when a new build is started.
+ *
+ * @param buildConfigFile configuration file used for the last compile
+ */
+ public void compileStarted(String buildConfigFile);
+
+ /**
+ * Called when a build completes.
+ *
+ * @param buildConfigFile configuration file used for the last compile
+ * @param buildTime compilation time in miliseconds
+ * @param succeeded true if build succeeded without errors
+ */
+ public void compileFinished(String buildConfigFile, int buildTime, boolean succeeded, boolean warnings);
+
+ /**
+ * Called when a build is aborted before completion.
+ *
+ * @param buildConfigFile configuration used for the last compile
+ * @param message message explaining reason for abort
+ */
+ public void compileAborted(String buildConfigFile, String message);
+}
+
diff --git a/ajde/src/org/aspectj/ajde/BuildManager.java b/ajde/src/org/aspectj/ajde/BuildManager.java
new file mode 100644
index 000000000..8bb823f0e
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/BuildManager.java
@@ -0,0 +1,59 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+
+/**
+ * Responsible for the build process, including compiler invocation, threading, and error
+ * reporting.
+ *
+ * @author Mik Kersten
+ */
+public interface BuildManager {
+
+ /**
+ * Build the structure model for the default build configuration. No ".class" files
+ * are generated.
+ */
+ public void buildStructure();
+
+ /**
+ * Build the default build configuration.
+ */
+ public void build();
+
+ /**
+ * Build the specified build configuration.
+ */
+ public void build(String configFile);
+
+ /**
+ * Exit the build immediately, before completion.
+ */
+ public void abortBuild();
+
+ public BuildOptionsAdapter getBuildOptions();
+
+// public CompilerAdapter getCurrCompiler();
+
+ public boolean isStructureDirty();
+
+ public void setStructureDirty(boolean structureDirty);
+
+ public void addListener(BuildListener compilerListener);
+
+ public void removeListener(BuildListener compilerListener);
+}
+
diff --git a/ajde/src/org/aspectj/ajde/BuildOptionsAdapter.java b/ajde/src/org/aspectj/ajde/BuildOptionsAdapter.java
new file mode 100644
index 000000000..edf4c0972
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/BuildOptionsAdapter.java
@@ -0,0 +1,74 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde;
+
+/**
+ * When a particular option is not set its documented default is used.
+ */
+public interface BuildOptionsAdapter {
+
+ /**
+ * Use javac to generate .class files. The default is "false".
+ */
+ public boolean getUseJavacMode();
+
+ /**
+ * Only relevant with Use Javac or Preprocess modes. Specify where to place
+ * intermediate .java files. The default is "workingdir".
+ */
+ public String getWorkingOutputPath();
+
+ /**
+ * Generate regular Java code into the Working OutputPath. Don't try to generate
+ * any .class files. The default is "false".
+ */
+ public boolean getPreprocessMode();
+
+ /**
+ * Specify character encoding used by source files. The default is the current
+ * JVM's default.
+ */
+ public String getCharacterEncoding();
+
+ /**
+ * Support assertions as defined in JLS-1.4. The default is "false".
+ */
+ public boolean getSourceOnePointFourMode();
+
+ /**
+ * Be extra-lenient in interpreting the Java specification. The default is "false",
+ * i.e. "regular" mode.
+ */
+ public boolean getLenientSpecMode();
+
+ /**
+ * Be extra-strict in interpreting the Java specification. The default is "false",
+ * i.e. "regular" mode.
+ */
+ public boolean getStrictSpecMode();
+
+ /**
+ * Make the use of some features from pre-1.0 versions of AspectJ be warnings to ease
+ * porting of old code. The default is "false".
+ */
+ public boolean getPortingMode();
+
+ /**
+ * The non-standard, typically prefaced with -X when used with a command line compiler.
+ * The default is no non-standard options.
+ */
+ public String getNonStandardOptions();
+}
diff --git a/ajde/src/org/aspectj/ajde/BuildProgressMonitor.java b/ajde/src/org/aspectj/ajde/BuildProgressMonitor.java
new file mode 100644
index 000000000..785376ead
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/BuildProgressMonitor.java
@@ -0,0 +1,65 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde;
+
+/**
+ * This interface should be implemented by a progress monitor that that presents
+ * the user with the current state of the compile and estimated finish.
+ *
+ * @author Mik Kersten
+ */
+public interface BuildProgressMonitor {
+
+ /**
+ * The heading that should be used in the title of the progress monitor.
+ */
+ public static final String PROGRESS_HEADING = "AspectJ Build";
+
+ /**
+ * Start the progress monitor.
+ */
+ public void start(String configFile);
+
+ /**
+ * Sets the label describing the current progress phase.
+ */
+ public void setProgressText(String text);
+
+ /**
+ * Jumps the progress bar to <CODE>newVal</CODE>.
+ */
+ public void setProgressBarVal(int newVal);
+
+ /**
+ * Makes the progress bar by one.
+ */
+ public void incrementProgressBarVal();
+
+ /**
+ * @param maxVal sets the value at which the progress will finish.
+ */
+ public void setProgressBarMax(int maxVal);
+
+ /**
+ * @return the value at which the progress monitoring will finish.
+ */
+ public int getProgressBarMax();
+
+ /**
+ * Jump the progress bar to the end and finish progress monitoring.
+ */
+ public void finish();
+}
diff --git a/ajde/src/org/aspectj/ajde/ConfigurationListener.java b/ajde/src/org/aspectj/ajde/ConfigurationListener.java
new file mode 100644
index 000000000..21e3e1e44
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ConfigurationListener.java
@@ -0,0 +1,36 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde;
+
+import java.util.*;
+
+/**
+ * @author Mik Kersten
+ */
+public interface ConfigurationListener extends EventListener {
+
+ /**
+ * Called when the current configuration has changed.
+ *
+ * @param configFilePath the path to the new current configuration file
+ */
+ public void currConfigChanged(String configFilePath);
+
+ /**
+ * Called when items are added to or deleted from the configurations list.
+ */
+ public void configsListUpdated(List configsList);
+}
diff --git a/ajde/src/org/aspectj/ajde/EditorAdapter.java b/ajde/src/org/aspectj/ajde/EditorAdapter.java
new file mode 100644
index 000000000..dab7febc6
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/EditorAdapter.java
@@ -0,0 +1,75 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.aspectj.bridge.ISourceLocation;
+
+/**
+ * @author Mik Kersten
+ */
+public interface EditorAdapter {
+
+ /**
+ * Seek the editor to a source line in the file specified.
+ */
+ public void showSourceLine(String filePath, int lineNumber, boolean highlight);
+
+ /**
+ * Seek the editor to a {@link SourceLocation} and highlight if specified.
+ */
+ public void showSourceLine(ISourceLocation sourceLocation, boolean highlight);
+
+ /**
+ * Seek the editor to a source line in the current file.
+ */
+ public void showSourceLine(int lineNumber, boolean highlight);
+
+ /**
+ * @return full path to the file currently being edited.
+ */
+ public String getCurrFile();
+
+ /**
+ * Save the contents of the current file being edited.
+ */
+ public void saveContents() throws IOException;
+
+ /**
+ * Paste text into the current caret position of the editor.
+ */
+ public void pasteToCaretPos(String text);
+
+ /**
+ * Implement if inline annotations are supported by the editor. Make null
+ * implementation if inline annotations are not supported.
+ *
+ * @param filePath path to the file that should get the annotation
+ * @param lineNumber line number for the annotation
+ * @param items list of relations to be rendered as the annotation
+ */
+ public void showSourcelineAnnotation(String filePath, int lineNumber, List items);
+
+ /**
+ * Implement if multipe editor views are supported by the editor. Make null
+ * implementation if multiple editor views are not supported.
+ *
+ * @param filePath path to the source file
+ * @param lineNumber line number of the sourceline
+ */
+ //public void addEditorViewForSourceLine(String filePath, int lineNumber);
+}
diff --git a/ajde/src/org/aspectj/ajde/EditorListener.java b/ajde/src/org/aspectj/ajde/EditorListener.java
new file mode 100644
index 000000000..12da1c875
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/EditorListener.java
@@ -0,0 +1,32 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import java.util.EventListener;
+
+/**
+ * Compiler listeners get notified of structure model update events.
+ *
+ * XXX remove, not used
+ *
+ * @author Mik Kersten
+ */
+public interface EditorListener extends EventListener {
+
+ /**
+ * @param filePath full path to the current file being edited
+ */
+ public void currentFileChanged(String filePath);
+}
diff --git a/ajde/src/org/aspectj/ajde/ErrorHandler.java b/ajde/src/org/aspectj/ajde/ErrorHandler.java
new file mode 100644
index 000000000..3f07f897b
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ErrorHandler.java
@@ -0,0 +1,28 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde;
+
+/**
+ * @author Mik Kersten
+ */
+public interface ErrorHandler {
+
+ public void handleWarning(String message);
+
+ public void handleError(String message);
+
+ public void handleError(String message, Throwable t);
+}
diff --git a/ajde/src/org/aspectj/ajde/ProjectPropertiesAdapter.java b/ajde/src/org/aspectj/ajde/ProjectPropertiesAdapter.java
new file mode 100644
index 000000000..e24307320
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ProjectPropertiesAdapter.java
@@ -0,0 +1,58 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde;
+
+import java.util.List;
+
+/**
+ * @author Mik Kersten
+ */
+public interface ProjectPropertiesAdapter {
+
+ public String getProjectName();
+
+ public String getRootProjectDir();
+
+ public List getBuildConfigFiles();
+
+ public String getDefaultBuildConfigFile();
+
+ /**
+ * @return The last selected build configuration for this project. If no selection
+ * is present the default build config file for this project is returned.
+ */
+ public String getLastActiveBuildConfigFile();
+
+ public List getProjectSourceFiles();
+
+ public String getProjectSourcePath();
+
+ public String getClasspath();
+
+ public String getOutputPath();
+
+ public String getAjcWorkingDir();
+
+ // @todo: move to build options
+ public String getBootClasspath();
+
+ // @todo: move all below to execution options
+ public String getClassToExecute();
+
+ public String getExecutionArgs();
+
+ public String getVmArgs();
+}
diff --git a/ajde/src/org/aspectj/ajde/TaskListManager.java b/ajde/src/org/aspectj/ajde/TaskListManager.java
new file mode 100644
index 000000000..59cde6c51
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/TaskListManager.java
@@ -0,0 +1,48 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import org.aspectj.bridge.*;
+
+/**
+ * Used for displaying tasks, such as compiler messages, to the user.
+ *
+ * @author Mik Kersten
+ */
+public interface TaskListManager {
+
+ /**
+ * Add a task associated with a particular line in a source file.
+ *
+ * @param message description of compiler message
+ * @param sourceLocation can be null
+ * @param kind one of <code>ERROR_MESSAGE, WARNING_MESSAGE, INFO_MESSAGE</code>
+ */
+ public void addSourcelineTask(String message, ISourceLocation sourceLocation, IMessage.Kind kind);
+
+ /**
+ * Add a task associated with the current project.
+ *
+ * @param message description of compiler message
+ * @param kind one of <code>ERROR_MESSAGE, WARNING_MESSAGE, INFO_MESSAGE</code>
+ */
+ public void addProjectTask(String message, IMessage.Kind kind);
+
+ /**
+ * Delete all of the currently active tasks.
+ */
+ public void clearTasks();
+}
+
diff --git a/ajde/src/org/aspectj/ajde/internal/AspectJBuildManager.java b/ajde/src/org/aspectj/ajde/internal/AspectJBuildManager.java
new file mode 100644
index 000000000..a52117e38
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/internal/AspectJBuildManager.java
@@ -0,0 +1,417 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.internal;
+
+import java.io.*;
+import java.util.*;
+
+import org.aspectj.ajde.*;
+import org.aspectj.asm.StructureNode;
+import org.aspectj.bridge.*;
+import org.aspectj.util.ConfigParser;
+
+/**
+ * Responsible for the build process, including compiler invocation, threading, and error
+ * reporting.
+ *
+ * @author Mik Kersten
+ */
+public class AspectJBuildManager implements BuildManager {
+
+ private CompilerAdapter compiler = null;
+ private TaskListManager compilerMessages = null;
+ private BuildProgressMonitor progressMonitor = null;
+ private BuildOptionsAdapter buildOptions = null;
+ private ArrayList compilerListeners = new ArrayList();
+ private String configFile = "";
+ private int lastCompileTime = 50;
+ private boolean buildStrucutreOnly = false;
+
+ public AspectJBuildManager(
+ TaskListManager compilerMessages,
+ BuildProgressMonitor progressMonitor,
+ BuildOptionsAdapter buildOptions) {
+ this.compilerMessages = compilerMessages;
+ this.progressMonitor = progressMonitor;
+ this.buildOptions = buildOptions;
+ this.compiler = new CompilerAdapter();
+ }
+
+ public void build() {
+ if (Ajde.getDefault().getConfigurationManager().getActiveConfigFile() == null) {
+ Ajde.getDefault().getErrorHandler().handleWarning("Nothing to compile, please add a \".lst\" file.");
+ return;
+ } else {
+ build(Ajde.getDefault().getConfigurationManager().getActiveConfigFile());
+ }
+ }
+
+ public void buildStructure() {
+ buildStrucutreOnly = true;
+ build();
+ }
+
+ public void build(String configFile) {
+ buildStrucutreOnly = false;
+ if (configFile == null) {
+ Ajde.getDefault().getErrorHandler().handleWarning("Please add a configuration file to compile.");
+ } else {
+ this.configFile = configFile;
+ CompilerThread compilerThread = new CompilerThread();
+ compilerThread.start();
+ }
+ }
+
+ public void abortBuild() {
+ if (compiler != null) {
+ compiler.requestCompileExit();
+ }
+ }
+
+// public CompilerAdapter getCurrCompiler() {
+// return currCompiler;
+// }
+
+ public boolean isStructureDirty() {
+ if (compiler != null) {
+ return compiler.isStructureDirty();
+ } else {
+ return false;
+ }
+ }
+
+ public void setStructureDirty(boolean structureDirty) {
+ if (compiler != null) {
+ compiler.setStructureDirty(structureDirty);
+ }
+ }
+
+ public void addListener(BuildListener compilerListener) {
+ compilerListeners.add(compilerListener);
+ }
+
+ public void removeListener(BuildListener compilerListener) {
+ compilerListeners.remove(compilerListener);
+ }
+
+ private void notifyCompileFinished(String configFile, int buildTime, boolean succeeded, boolean warnings) {
+ Ajde.getDefault().logEvent("build finished, succeeded: " + succeeded);
+ for (Iterator it = compilerListeners.iterator(); it.hasNext(); ) {
+ ((BuildListener)it.next()).compileFinished(configFile, buildTime, succeeded, warnings);
+ }
+ }
+
+ private void notifyCompileStarted(String configFile) {
+ Ajde.getDefault().logEvent("build started: " + configFile);
+ for (Iterator it = compilerListeners.iterator(); it.hasNext(); ) {
+ ((BuildListener)it.next()).compileStarted(configFile);
+ }
+ }
+
+ private void notifyCompileAborted(String configFile, String message) {
+ for (Iterator it = compilerListeners.iterator(); it.hasNext(); ) {
+ ((BuildListener)it.next()).compileAborted(configFile, message);
+ }
+ }
+
+ /**
+ * @todo use structured error messages instead
+ */
+ private void displayMessages(CompileResult compileResult) {
+ String[] descriptions = compileResult.getDescriptions();
+ String[] files = compileResult.getfiles();
+ Integer[] lineNumbers = compileResult.getLineNumbers();
+ if (descriptions.length == 0 && compileResult.getResult().trim() != "") {
+ //compilerMessages.addSourcelineTask(compileResult.getResult(), "", 0, 0, TaskListManager.ERROR_MESSAGE);
+ compilerMessages.addSourcelineTask(
+ compileResult.getResult(),
+ new SourceLocation(null, 0, 0),
+ IMessage.ERROR);
+ return;
+ }
+
+ for ( int i = 0; i < descriptions.length &&
+ i < files.length &&
+ i < lineNumbers.length; i++ ) {
+ String message = "";
+ if (files[i] != "") {
+ message += "\"" + files[i] + "\": ";
+ }
+ if (lineNumbers[i].intValue() != -1 && lineNumbers[i].intValue() != 0) {
+ message += descriptions[i] + ", at line: " + lineNumbers[i];
+ } else {
+ message += descriptions[i];
+ }
+
+ if (message.startsWith("Nothing to compile.")) {
+ message = "Nothing to compile, please select the project, package(s), or class(es) to compile.";
+ }
+
+
+ IMessage.Kind kind = IMessage.ERROR;
+ if (descriptions[i].endsWith("(warning)")) kind = IMessage.WARNING;
+
+ compilerMessages.addSourcelineTask(
+ message,
+ new SourceLocation(new File(files[i]), lineNumbers[i].intValue(), 0),
+ kind);
+
+ StructureNode node = Ajde.getDefault().getStructureModelManager().getStructureModel().findNodeForSourceLine(
+ files[i],
+ lineNumbers[i].intValue()
+ );
+
+ if (node != null) {
+ node.setMessage(new Message(message, kind, null, null));
+ }
+ }
+ }
+
+ /**
+ * @todo clean up this mess.
+ */
+ public class CompilerThread extends Thread {
+
+ public void run() {
+ boolean succeeded = true;
+ boolean warnings = false;
+ try {
+ long timeStart = System.currentTimeMillis();
+ notifyCompileStarted(configFile);
+ progressMonitor.start(configFile);
+ compilerMessages.clearTasks();
+
+ Ajde.getDefault().logEvent("building with options: "
+ + getFormattedOptionsString(buildOptions, Ajde.getDefault().getProjectProperties()));
+
+ succeeded = compiler.compile(configFile, progressMonitor);
+
+ long timeEnd = System.currentTimeMillis();
+ lastCompileTime = (int)(timeEnd - timeStart);
+ } catch (ConfigParser.ParseException pe) {
+ Ajde.getDefault().getErrorHandler().handleWarning(
+ "Config file entry invalid, file: "
+ + pe.getFile().getPath()
+ + ", line number: "
+ + pe.getLine());
+// }
+// catch (ExitRequestException ere) {
+// if (ere.getValue() == 0) {
+// notifyCompileAborted(configFile, "Build cancelled by user.");
+// } else {
+// Ajde.getDefault().getErrorHandler().handleWarning("Compile could not complete. See the console for more details. "
+// + "If no console is available re-launch the application from the command line.");
+// }
+// } catch (InternalCompilerError compilerError) {
+// if (compilerError.uncaughtThrowable instanceof OutOfMemoryError) {
+// Ajde.getDefault().getErrorHandler().handleError("Out of memory. "
+// + "Increase memory by setting the -Xmx parameter that this VM was launched with.\n"
+// + "Note that some AJDE structure persists across compiles." ,
+// compilerError.uncaughtThrowable);
+// } else if (compilerError.uncaughtThrowable instanceof MissingRuntimeError) {
+// Ajde.getDefault().getErrorHandler().handleWarning("Compilation aborted because the AspectJ runtime was not found. "
+// + "Please place aspectjrt.jar in the lib/ext directory.");
+// } else if (compilerError.uncaughtThrowable instanceof BadRuntimeError) {
+// Ajde.getDefault().getErrorHandler().handleWarning("Compilation aborted because an out-of-date version of " +
+// "the AspectJ runtime was found. "
+// + "Please place a current version of aspectjrt.jar in the lib/ext directory.");
+// } else {
+// Ajde.getDefault().getErrorHandler().handleError("Compile error.", compilerError.uncaughtThrowable);
+// }
+ } catch (Throwable e) {
+ Ajde.getDefault().getErrorHandler().handleError("Compile error, caught Throwable: " + e.toString(), e);
+ } finally {
+ progressMonitor.finish();
+ }
+ notifyCompileFinished(configFile, lastCompileTime, succeeded, warnings);
+ }
+
+ private String getFormattedOptionsString(BuildOptionsAdapter buildOptions, ProjectPropertiesAdapter properties) {
+ return "Building with settings: "
+ + "\n-> output path: " + properties.getOutputPath()
+ + "\n-> classpath: " + properties.getClasspath()
+ + "\n-> bootclasspath: " + properties.getBootClasspath()
+ + "\n-> non-standard options: " + buildOptions.getNonStandardOptions()
+ + "\n-> porting mode: " + buildOptions.getPortingMode()
+ + "\n-> source 1.4 mode: " + buildOptions.getSourceOnePointFourMode()
+ + "\n-> strict spec mode: " + buildOptions.getStrictSpecMode()
+ + "\n-> lenient spec mode: " + buildOptions.getLenientSpecMode()
+ + "\n-> use javac mode: " + buildOptions.getUseJavacMode()
+ + "\n-> preprocess mode: " + buildOptions.getPreprocessMode()
+ + "\n-> working dir: " + buildOptions.getWorkingOutputPath();
+ }
+ }
+
+ public BuildOptionsAdapter getBuildOptions() {
+ return buildOptions;
+ }
+
+// private void setCompilerOptions(AjdeCompiler compiler) {
+// String nonstandardOptions = buildOptions.getNonStandardOptions();
+// if (nonstandardOptions != null && !nonstandardOptions.trim().equals("")) {
+// StringTokenizer st = new StringTokenizer(nonstandardOptions, " ");
+// while (st.hasMoreTokens()) {
+// String flag = (String)st.nextToken();
+// compiler.getOptions().set(flag.substring(1, flag.length()), Boolean.TRUE);
+// }
+// }
+//
+// if (Ajde.getDefault().getProjectProperties().getOutputPath() != null
+// && !compiler.getOptions().XtargetNearSource) {
+// compiler.getOptions().outputDir = new File(Ajde.getDefault().getProjectProperties().getOutputPath());
+// }
+// if (Ajde.getDefault().getProjectProperties().getBootClasspath() != null) {
+// compiler.getOptions().bootclasspath = Ajde.getDefault().getProjectProperties().getBootClasspath();
+// }
+// if (Ajde.getDefault().getProjectProperties().getClasspath() != null) {
+// compiler.getOptions().classpath = Ajde.getDefault().getProjectProperties().getClasspath();
+// }
+// if (buildOptions.getWorkingOutputPath() != null) {
+// compiler.getOptions().workingDir = new File(buildOptions.getWorkingOutputPath());
+// }
+//// if (buildOptions.getCharacterEncoding() != null) {
+//// compiler.getOptions().encoding = buildOptions.getCharacterEncoding();
+//// }
+//
+// compiler.getOptions().lenient = buildOptions.getLenientSpecMode();
+// compiler.getOptions().strict = buildOptions.getStrictSpecMode();
+// compiler.getOptions().usejavac = buildOptions.getUseJavacMode();
+// compiler.getOptions().porting = buildOptions.getPortingMode();
+// compiler.getOptions().preprocess = buildOptions.getPreprocessMode();
+//
+// if (buildOptions.getSourceOnePointFourMode()) {
+// compiler.getOptions().source = "1.4";
+// }
+// }
+
+ static class CompileResult {
+ private String[] files = null;
+ private Integer[] lineNumbers = null;
+ private String[] descriptions = null;
+ private String resultString = "";
+ private boolean resultContainsErrors = false;
+
+ /**
+ * Parses out warning messages, error messages, "file not found" messages, javac "Note:" messages.
+ *
+ * @todo get error message structure directly from compiler
+ */
+ public CompileResult( String result )
+ {
+ resultString = result;
+
+ BufferedReader reader = new BufferedReader( new StringReader( result ) );
+ Vector fileV = new Vector();
+ Vector lineV = new Vector();
+ Vector descV = new Vector();
+ try {
+ for (String line = reader.readLine(); line != null; line = reader.readLine()) {
+ String originalLine = line;
+ String description = "";
+ String file = "";
+ Integer lineNo = new Integer(0);
+ int index = line.indexOf( ":", 2 ); // @todo skip the initial drive ":" (fix, Windows only)
+ try {
+ if (line.indexOf("Note: ") != -1) {
+ int index1 = line.indexOf(".java");
+ if (index1 != -1) {
+ description = line.substring(index1+5) + " (warning)";
+ file = line.substring("Note: ".length(), index1+5);
+ lineNo = new Integer(0);
+ } else {
+ description = line + " (warning)";
+ file = "";
+ lineNo = new Integer(-1);
+ }
+ }
+ else if (line.indexOf("file not found: ") != -1) {
+ description = "file not found: ";
+ file = line.substring("file not found: ".length());
+ lineNo = new Integer(0);
+ }
+ else if (index != -1 && line.indexOf( "java" ) != -1) {
+ file = line.substring( 0, index );
+ line = line.substring( index+1 );
+
+ index = line.indexOf( ":" );
+ lineNo = new Integer( Integer.parseInt( line.substring( 0, index ) ) ) ;
+ line = line.substring( index+1 );
+
+ if (!resultContainsErrors) {
+ if (!line.endsWith("(warning)")) {
+ resultContainsErrors = true;
+ }
+ }
+ description = line.substring( line.indexOf( ":" ) + 2 );
+ }
+ } catch (Exception e) {
+ description = "Internal ajc message: " + originalLine;
+ file = "";
+ lineNo = new Integer(-1);
+ }
+ if (description.trim() != "") {
+ descV.addElement(description);
+ fileV.addElement(file);
+ lineV.addElement(lineNo);
+ }
+ }
+ }
+ catch ( IOException ioe ) {
+ resultString = "ERROR: could not parse result at line for string: " + result;
+ }
+ files = new String[fileV.size()];
+ lineNumbers = new Integer[lineV.size()];
+ descriptions = new String[descV.size()];
+ fileV.copyInto(files);
+ lineV.copyInto(lineNumbers);
+ descV.copyInto(descriptions);
+ }
+
+ public String toString()
+ {
+ return resultString;
+ }
+
+ public String[] getfiles()
+ {
+ return files;
+ }
+
+ public Integer[] getLineNumbers()
+ {
+ return lineNumbers;
+ }
+
+ public String[] getDescriptions()
+ {
+ return descriptions;
+ }
+
+ public String getResult()
+ {
+ return resultString;
+ }
+
+ public boolean containsErrors() {
+ return resultContainsErrors;
+ }
+ }
+}
+
+class ConfigFileDoesNotExistException extends Exception {
+ public ConfigFileDoesNotExistException(String filePath) {
+ super(filePath);
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/internal/BuildNotifierAdapter.java b/ajde/src/org/aspectj/ajde/internal/BuildNotifierAdapter.java
new file mode 100644
index 000000000..18d51c6eb
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/internal/BuildNotifierAdapter.java
@@ -0,0 +1,67 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.internal;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.BuildProgressMonitor;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
+import org.eclipse.jdt.internal.core.builder.BuildNotifier;
+
+public class BuildNotifierAdapter extends BuildNotifier {
+
+ private BuildProgressMonitor progressMonitor;
+ private int numCompilationUnitPasses = 1;
+ private int completedPasses = 0;
+ private boolean cancelled = false;
+
+ // ??? get rid of project coupling
+ public BuildNotifierAdapter(IProject project, BuildProgressMonitor progressMonitor, int numFiles) {
+ super(null, project);
+ this.progressMonitor = progressMonitor;
+ this.numCompilationUnitPasses = numFiles*2;
+ }
+
+ public void begin() {
+ progressMonitor.start(Ajde.getDefault().getConfigurationManager().getActiveConfigFile());
+ progressMonitor.setProgressText("starting build...");
+ }
+
+ public void cancelBuild() {
+ progressMonitor.setProgressText("cancelling build...");
+ cancelled = true;
+ }
+
+ public void compiled(ICompilationUnit unit) {
+ completedPasses++;
+ float val = (float)completedPasses/numCompilationUnitPasses;
+ int intVal = (int)((float)val*100);
+ progressMonitor.setProgressBarVal(intVal);
+ progressMonitor.setProgressText("compiled: " + new String(unit.getFileName()));
+ }
+
+ public void generatedBytecode(String message) {
+ completedPasses++;
+ float val = (float)completedPasses/numCompilationUnitPasses;
+ int intVal = (int)((float)val*100);
+ progressMonitor.setProgressBarVal(intVal);
+ progressMonitor.setProgressText(message);
+ }
+
+ public void checkCancel() {
+ if (cancelled) throw new OperationCanceledException();
+ }
+
+}
diff --git a/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java b/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
new file mode 100644
index 000000000..3132288fb
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
@@ -0,0 +1,178 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.internal;
+
+import java.io.File;
+import java.util.*;
+
+import org.aspectj.ajde.*;
+import org.aspectj.ajdt.internal.core.builder.AjBuildConfig;
+import org.aspectj.ajdt.internal.core.builder.AjBuildManager;
+import org.aspectj.bridge.*;
+import org.aspectj.util.ConfigParser;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
+public class CompilerAdapter {
+
+ private AjBuildManager buildManager = null;
+ private MessageHandlerAdapter messageHandler = null;
+ private BuildNotifierAdapter currNotifier = null;
+ private boolean initialized = false;
+ private boolean structureDirty = true;
+ private boolean firstBuild = true;
+
+ public CompilerAdapter() {
+ super();
+ }
+
+ public void requestCompileExit() {
+ if (currNotifier != null) currNotifier.cancelBuild();
+// buildManager.getJavaBuilder().notifier.setCancelling(true);
+ }
+
+ public boolean isStructureDirty() {
+ return structureDirty;
+ }
+
+ public void setStructureDirty(boolean structureDirty) {
+ this.structureDirty = structureDirty;
+ }
+
+ public boolean compile(String configFile, BuildProgressMonitor progressMonitor) {
+ init();
+ try {
+ AjBuildConfig buildConfig = genBuildConfig(configFile);
+ currNotifier = new BuildNotifierAdapter(
+ AjBuildManager.DEFAULT_PROJECT,
+ progressMonitor,
+ buildConfig.getFiles().size());
+ buildManager.setBuildNotifier(currNotifier);
+ messageHandler.setBuildNotifierAdapter(currNotifier);
+
+ String rtInfo = buildManager.checkRtJar(buildConfig); // !!! will get called twice
+ if (rtInfo != null) {
+ Ajde.getDefault().getErrorHandler().handleWarning(
+ "AspectJ Runtime error: " + rtInfo
+ + " Please place a valid aspectjrt.jar in the lib/ext directory.");
+ return false;
+ }
+
+ if (firstBuild) {
+ firstBuild = false;
+ return buildManager.batchBuild(buildConfig, messageHandler);
+ } else {
+ return buildManager.batchBuild(buildConfig, messageHandler); // XXX incremental not implemented
+// return buildManager.incrementalBuild(buildConfig);
+ }
+ } catch (OperationCanceledException ce) {
+ Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("build cancelled by user");
+ return false;
+ } catch (Throwable t) {
+ t.printStackTrace();
+ return false;
+// messageHandler.handleMessage(new Message(t.toString(), Message.ERROR, t, null));
+ }
+ }
+
+ public AjBuildConfig genBuildConfig(String configFile) {
+ AjBuildConfig buildConfig = new AjBuildConfig();
+ File config = new File(configFile);
+ if (!config.exists()) {
+ Ajde.getDefault().getErrorHandler().handleWarning("Config file \"" + configFile + "\" does not exist.");
+ } else {
+ ConfigParser configParser = new ConfigParser();
+ configParser.parseConfigFile(config);
+ buildConfig.setFiles(configParser.getFiles());
+ buildConfig.setConfigFile(config);
+ }
+
+ String classpathString =
+ Ajde.getDefault().getProjectProperties().getBootClasspath()
+ + File.pathSeparator
+ + Ajde.getDefault().getProjectProperties().getClasspath();
+
+ StringTokenizer st = new StringTokenizer(
+ classpathString,
+ File.pathSeparator
+ );
+ List classpath = new ArrayList();
+ while (st.hasMoreTokens()) classpath.add(st.nextToken());
+ buildConfig.setClasspath(classpath);
+ Ajde.getDefault().logEvent("building with classpath: " + classpath);
+
+ if (Ajde.getDefault().getBuildManager().getBuildOptions().getSourceOnePointFourMode()) {
+ buildConfig.getJavaOptions().put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
+ }
+
+ // XXX problematic restriction, support multiple source roots
+ List sourceRoots = new ArrayList();
+ sourceRoots.add(new File(configFile).getParentFile());
+ buildConfig.setSourceRoots(sourceRoots);
+
+ buildConfig.setOutputDir(
+ new File(Ajde.getDefault().getProjectProperties().getOutputPath())
+ );
+
+ buildConfig.setGenerateModelMode(true);
+
+ return buildConfig;
+ }
+
+ private void init() {
+ if (!initialized) { // XXX plug into AJDE initialization
+// Ajde.getDefault().setErrorHandler(new DebugErrorHandler());
+ this.messageHandler = new MessageHandlerAdapter();
+ buildManager = new AjBuildManager(messageHandler);
+ initialized = true;
+ }
+ }
+
+ class MessageHandlerAdapter implements IMessageHandler {
+ private TaskListManager taskListManager;
+ private BuildNotifierAdapter buildNotifierAdapter;
+
+ public MessageHandlerAdapter() {
+ this.taskListManager = Ajde.getDefault().getTaskListManager();
+ }
+
+ public boolean handleMessage(IMessage message) throws AbortException {
+ if (isIgnoring(message.getKind())) return true;
+
+ // ??? relies on only info messages being class-file written messages
+ if (message.getKind().equals(IMessage.INFO)) {
+ if (buildNotifierAdapter != null) {
+ buildNotifierAdapter.generatedBytecode(message.getMessage());
+ }
+ } else {
+ taskListManager.addSourcelineTask(
+ message.getMessage(),
+ message.getISourceLocation(),
+ message.getKind()
+ );
+ }
+ return true;
+ }
+
+ public boolean isIgnoring(IMessage.Kind kind) {
+ // XXX implement for INFO, DEBUG?
+ return false;
+ }
+
+ public void setBuildNotifierAdapter(BuildNotifierAdapter buildNotifierAdapter) {
+ this.buildNotifierAdapter = buildNotifierAdapter;
+ }
+
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/internal/DebugErrorHandler.java b/ajde/src/org/aspectj/ajde/internal/DebugErrorHandler.java
new file mode 100644
index 000000000..9285e2b59
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/internal/DebugErrorHandler.java
@@ -0,0 +1,32 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.internal;
+
+import org.aspectj.ajde.ErrorHandler;
+
+public class DebugErrorHandler implements ErrorHandler {
+
+ public void handleWarning(String message) {
+ System.err.println("> WARNING: " + message);
+ }
+
+ public void handleError(String errorMessage) {
+ handleError(errorMessage, null);
+ }
+
+ public void handleError(String message, Throwable t) {
+ System.err.println("> ERROR: " + message);
+ throw (RuntimeException)t;
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/internal/LstBuildConfigFileParser.java b/ajde/src/org/aspectj/ajde/internal/LstBuildConfigFileParser.java
new file mode 100644
index 000000000..187dda1c0
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/internal/LstBuildConfigFileParser.java
@@ -0,0 +1,61 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.internal;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.aspectj.util.ConfigParser;
+
+/**
+ * @author Mik Kersten
+ */
+public class LstBuildConfigFileParser extends ConfigParser {
+
+ private List importedFiles = new ArrayList();
+ private List problemEntries = new ArrayList();
+
+ private String currFilePath;
+
+ public LstBuildConfigFileParser(String currFilePath) {
+ this.currFilePath = currFilePath;
+ }
+
+ protected void showWarning(String message) {
+ problemEntries.add(message);
+ }
+
+ protected void parseImportedConfigFile(String relativeFilePath) {
+ importedFiles.add(makeFile(relativeFilePath));
+ super.files.add(new File(relativeFilePath));
+ super.parseImportedConfigFile(relativeFilePath);
+ }
+
+ protected void showError(String message) {
+ problemEntries.add(message);
+ }
+
+ public List getImportedFiles() {
+ return importedFiles;
+ }
+
+ public List getProblemEntries() {
+ return problemEntries;
+ }
+}
+
+
+
diff --git a/ajde/src/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java b/ajde/src/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java
new file mode 100644
index 000000000..c3f14057c
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java
@@ -0,0 +1,196 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.internal;
+
+import java.util.*;
+import java.io.*;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.util.ConfigParser;
+
+/**
+ * Used for reading and writing build configuration (".lst") files.
+ *
+ * @author Mik Kersten
+ */
+class LstBuildConfigFileUpdater {
+
+ /**
+ * Adds an entry to a build configuration file.
+ */
+ public void updateBuildConfigFile(String buildConfigFile, String update, boolean addToConfiguration) {
+ List fileContents = readConfigFile(buildConfigFile);
+ if (addToConfiguration) {
+ fileContents.add(update);
+ } else {
+ fileContents.remove(update);
+ }
+ writeConfigFile(buildConfigFile, fileContents);
+ }
+
+ /**
+ * Adds an entry to multiple build configuration files.
+ */
+ public void updateBuildConfigFiles(List buildConfigFiles, List filesToUpdate, boolean addToConfiguration) {
+ for (int i = 0; i < buildConfigFiles.size(); i++) {
+ List fileContents = readConfigFile((String)buildConfigFiles.get(i));
+ if (addToConfiguration) {
+ for (int j = 0; j < filesToUpdate.size(); j++) {
+ fileContents.add(filesToUpdate.get(j));
+ }
+ } else {
+ for (int k =0; k < filesToUpdate.size(); k++) {
+ if (fileContents.contains(filesToUpdate.get(k))) {
+ fileContents.remove(filesToUpdate.get(k));
+ }
+ }
+ }
+ writeConfigFile((String)buildConfigFiles.get(i), fileContents);
+ }
+ }
+
+ /**
+ * Checks if an entry exists within a build configuration file.
+ */
+ public boolean exists(String entry, String configFile) {
+ return exists(entry, configFile, "");
+ }
+
+ public boolean exists(String entry, String configFile, String rootPath) {
+ Iterator it = readConfigFile(configFile).iterator();
+ while (it.hasNext()) {
+ if ((entry).equals(rootPath + "/" + (String)it.next())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Reads the entries of a configuration file.
+ */
+ public List readConfigFile(String filePath) {
+ try {
+ File configFile = new File(filePath);
+ if (!configFile.exists()) {
+ Ajde.getDefault().getErrorHandler().handleWarning("Config file: " + filePath +
+ " does not exist. Update failed.");
+ }
+ List fileContents = new ArrayList();
+ BufferedReader reader = new BufferedReader(new FileReader(configFile));
+ String line = reader.readLine();
+ while (line != null) {
+ fileContents.add(line.replace('\\', '/'));
+ line = reader.readLine();
+ }
+ return fileContents;
+ } catch (IOException ioe) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not update build config file.", ioe);
+ }
+ return null;
+ }
+
+ public void writeConfigFile(String filePath, List files, List importedNodes) {
+ //Set contentsSet = new TreeSet(fileContents);
+ String fileContentsString = "";
+ //List filesToWrite = null;
+ Set includedFiles = new HashSet();
+ for (Iterator it = importedNodes.iterator(); it.hasNext(); ) {
+ BuildConfigNode node = (BuildConfigNode)it.next();
+ fileContentsString += '@' + node.getResourcePath() + "\n";
+ String parentPath = new File(filePath).getParent();
+ String importedFilePath = parentPath + File.separator + node.getResourcePath();
+ includedFiles.addAll(getIncludedFiles(importedFilePath, parentPath));
+ }
+
+ for (Iterator it = files.iterator(); it.hasNext(); ) {
+ BuildConfigNode node = (BuildConfigNode)it.next();
+ if (node.getName().endsWith(".lst") && !node.getResourcePath().startsWith("..")) {
+ fileContentsString += '@';
+ fileContentsString += node.getResourcePath() + "\n";
+ } else {
+ if (!includedFiles.contains(node.getResourcePath())) {
+ fileContentsString += node.getResourcePath() + "\n";
+ }
+ }
+ }
+ writeFile(fileContentsString, filePath);
+ }
+
+ private List getIncludedFiles(String path, String rootPath) {
+ try {
+ ConfigParser configParser = new ConfigParser();
+ configParser.parseConfigFile(new File(path));
+ List files = configParser.getFiles();
+ List relativeFiles = new ArrayList();
+ for (Iterator it = files.iterator(); it.hasNext(); ) {
+ relativeFiles.add(relativizePath(((File)it.next()).getPath(), rootPath));
+ }
+ return relativeFiles;
+ } catch (ConfigParser.ParseException pe) {
+ return new ArrayList();
+ }
+ }
+
+ private synchronized List getUniqueFileList(List list, Set set) {
+ List uniqueList = new ArrayList();
+ for (Iterator it = list.iterator(); it.hasNext(); ) {
+ BuildConfigNode node = (BuildConfigNode)it.next();
+ String file1 = node.getResourcePath();
+ if (set.contains(file1) && !uniqueList.contains(file1)) {
+ uniqueList.add(file1);
+ }
+ }
+ return uniqueList;
+ }
+
+ public String relativizePath(String path, String rootPath) {
+ path = path.replace('\\', '/');
+ rootPath = rootPath.replace('\\', '/');
+ int pathIndex = path.indexOf(rootPath);
+ if (pathIndex > -1) {
+ return path.substring(pathIndex + rootPath.length() + 1);
+ } else {
+ return path;
+ }
+ }
+
+ /**
+ * Sorts and does not write duplicates.
+ *
+ * @param fileContents full paths representing file entries
+ */
+ public void writeConfigFile(String filePath, List fileContents) {
+ Set contentsSet = new TreeSet(fileContents);
+ String fileContentsString = "";
+ Iterator it = contentsSet.iterator();
+ while (it.hasNext()) {
+ fileContentsString += it.next().toString() + "\n";
+ }
+ writeFile(fileContentsString, filePath);
+ }
+
+ private void writeFile(String contents, String filePath) {
+ try {
+ FileOutputStream fos = new FileOutputStream(filePath, false);
+ fos.write(contents.getBytes());
+ fos.close();
+ } catch (IOException ioe) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not update build config file: " + filePath, ioe);
+ }
+ }
+}
+
diff --git a/ajde/src/org/aspectj/ajde/internal/LstBuildConfigManager.java b/ajde/src/org/aspectj/ajde/internal/LstBuildConfigManager.java
new file mode 100644
index 000000000..26eafbdb8
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/internal/LstBuildConfigManager.java
@@ -0,0 +1,303 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.internal;
+
+import java.util.*;
+import java.io.*;
+
+import org.aspectj.ajde.*;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.*;
+import org.aspectj.bridge.*;
+import org.aspectj.util.ConfigParser;
+
+/**
+ * @author Mik Kersten
+ */
+public class LstBuildConfigManager implements BuildConfigManager {
+
+ private List configFiles = new ArrayList();
+ private List listeners = new ArrayList();
+ private LstBuildConfigFileUpdater fileUpdater = new LstBuildConfigFileUpdater();
+ protected String currConfigFilePath = null;
+
+ private static final FilenameFilter SOURCE_FILE_FILTER = new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".java")
+ || name.endsWith(".aj")
+ || name.endsWith(".lst");
+ }
+ };
+
+ private static final FileFilter DIR_FILTER = new FileFilter() {
+ public boolean accept(File file) {
+ return file.isDirectory();
+ }
+ };
+
+ public BuildConfigModel buildModel(String configFilePath) {
+ File configFile = new File(configFilePath);
+ String rootPath = configFile.getParent();
+ String configFileName = configFile.getName();
+ BuildConfigModel model = new BuildConfigModel(configFilePath);
+ List configFiles = new ArrayList();
+ List importedFiles = new ArrayList();
+ List badEntries = null;
+ try {
+ LstBuildConfigFileParser configParser = new LstBuildConfigFileParser(configFilePath);
+ configParser.parseConfigFile(new File(configFilePath));
+ configFiles = configParser.getFiles();
+ importedFiles = configParser.getImportedFiles();
+ badEntries = configParser.getProblemEntries();
+ } catch (ConfigParser.ParseException pe) {
+// String filePath = "<unknown>";
+// if (pe.getFile() != null) filePath = pe.getFile().getAbsolutePath();
+ Ajde.getDefault().getTaskListManager().addSourcelineTask(
+ pe.getMessage(),
+ new SourceLocation(pe.getFile(), pe.getLine(), 1),
+ IMessage.ERROR);
+ }
+
+ List relativePaths = relativizeFilePaths(configFiles, rootPath);
+ BuildConfigNode root = new BuildConfigNode(configFileName, BuildConfigNode.Kind.FILE_LST, rootPath);
+ buildDirTree(root, rootPath, importedFiles, configFileName);
+ model.setRoot(root);
+ addFilesToDirTree(model, relativePaths, badEntries);
+
+ pruneEmptyDirs(root);
+ sortModel((BuildConfigNode)model.getRoot(), ALPHABETICAL_COMPARATOR);
+ //addImportedFilesToDirTree(model, importedFiles);
+
+ addProblemEntries(root, badEntries);
+ return model;
+ }
+
+ private void addProblemEntries(BuildConfigNode root, List badEntries) {
+ for (Iterator it = badEntries.iterator(); it.hasNext(); ) {
+ root.addChild(new BuildConfigNode(
+ it.next().toString(),
+ BuildConfigNode.Kind.ERROR, null)
+ );
+ }
+ }
+
+ public void writeModel(BuildConfigModel model) {
+// final List paths = new ArrayList();
+// StructureWalker walker = new StructureWalker() {
+// protected void postProcess(StructureNode node) {
+// BuildConfigNode configNode = (BuildConfigNode)node;
+// if (configNode.isActive() && configNode.isValidResource()) {
+// paths.add(configNode.getResourcePath());
+// }
+// }
+// };
+// model.getRoot().walk(walker);
+
+ List activeSourceFiles = model.getActiveNodes(BuildConfigNode.Kind.FILE_ASPECTJ);
+ activeSourceFiles.addAll(model.getActiveNodes(BuildConfigNode.Kind.FILE_JAVA));
+ List activeImportedFiles = model.getActiveNodes(BuildConfigNode.Kind.FILE_LST);
+ fileUpdater.writeConfigFile(model.getSourceFile(), activeSourceFiles, activeImportedFiles);
+ }
+
+ public void writePaths(String configFilePath, List files) {
+ fileUpdater.writeConfigFile(configFilePath, files);
+ }
+
+ public void addFilesToConfig(String configFilePath, List paths) {
+
+ }
+
+ public void removeFilesFromConfig(String configFilePath, List files) {
+
+ }
+
+ private List relativizeFilePaths(List configFiles, String rootPath) {
+ List relativePathsList = new ArrayList();
+ for (Iterator it = configFiles.iterator(); it.hasNext(); ) {
+ File file = (File)it.next();
+ relativePathsList.add(fileUpdater.relativizePath(file.getPath(), rootPath));
+ }
+ return relativePathsList;
+ }
+
+// private String relativizePath(String path, String rootPath) {
+// path = path.replace('\\', '/');
+// rootPath = rootPath.replace('\\', '/');
+// int pathIndex = path.indexOf(rootPath);
+// if (pathIndex > -1) {
+// return path.substring(pathIndex + rootPath.length() + 1);
+// } else {
+// return path;
+// }
+// }
+
+ private void buildDirTree(BuildConfigNode node, String rootPath, List importedFiles, String configFileName) {
+ File[] dirs = new File(node.getResourcePath()).listFiles(DIR_FILTER);
+ if (dirs == null) return;
+ for (int i = 0; i < dirs.length; i++) {
+ BuildConfigNode dir = new BuildConfigNode(dirs[i].getName(), BuildConfigNode.Kind.DIRECTORY, dirs[i].getPath());
+ File[] files = dirs[i].listFiles(SOURCE_FILE_FILTER);
+ for (int j = 0; j < files.length; j++) {
+ if (files[j] != null) {// && !files[j].getName().endsWith(".lst")) {
+ String filePath = fileUpdater.relativizePath(files[j].getPath(), rootPath);
+ BuildConfigNode.Kind kind = BuildConfigNode.Kind.FILE_JAVA;
+ if (!files[j].getName().endsWith(".lst")) {
+ //kind = BuildConfigNode.Kind.FILE_LST;
+ BuildConfigNode file = new BuildConfigNode(files[j].getName(), kind, filePath);
+ file.setActive(false);
+ dir.addChild(file);
+ }
+ }
+ }
+ node.addChild(dir);
+ boolean foundMatch = false;
+ for (Iterator it = importedFiles.iterator(); it.hasNext(); ) {
+ File importedFile = (File)it.next();
+ if (importedFile.getParentFile().getAbsolutePath().equals(dirs[i].getAbsolutePath())) {
+ foundMatch = true;
+ BuildConfigNode importedFileNode = new BuildConfigNode(
+ importedFile.getName(),
+ BuildConfigNode.Kind.FILE_LST,
+ fileUpdater.relativizePath(importedFile.getPath(), rootPath));
+ importedFileNode.setActive(true);
+ //dir.getChildren().clear();
+ boolean found = false;
+ for (Iterator it2 = dir.getChildren().iterator(); it2.hasNext(); ) {
+ if (((BuildConfigNode)it2.next()).getName().equals(importedFile.getName())) {
+ found = true;
+ }
+ }
+ if (!found) dir.addChild(importedFileNode);
+ }
+
+ }
+ //if (!foundMatch)
+ buildDirTree(dir, rootPath, importedFiles, configFileName);
+ }
+
+ if (node.getName().endsWith(".lst")) {
+ File[] files = new File(rootPath).listFiles(SOURCE_FILE_FILTER);
+ if (files == null) return;
+ for (int i = 0; i < files.length; i++) {
+ if (files[i] != null && !files[i].getName().equals(configFileName)) {// && !files[i].getName().endsWith(".lst")) {
+ BuildConfigNode.Kind kind = BuildConfigNode.Kind.FILE_JAVA;
+ if (files[i].getName().endsWith(".lst")) {
+ kind = BuildConfigNode.Kind.FILE_LST;
+ }
+ BuildConfigNode file = new BuildConfigNode(files[i].getName(), kind, files[i].getName());
+ file.setActive(false);
+ node.addChild(file);
+ }
+ }
+ }
+ }
+
+ private void addFilesToDirTree(BuildConfigModel model, List configFiles, List badEntries) {
+ for (Iterator it = configFiles.iterator(); it.hasNext(); ) {
+ String path = (String)it.next();
+ if (path.startsWith("..")) {
+ File file = new File(path);
+ BuildConfigNode node = new BuildConfigNode(file.getName(), BuildConfigNode.Kind.FILE_JAVA, path);
+ BuildConfigNode upPath = model.getNodeForPath(file.getParentFile().getPath());
+ if (upPath == model.getRoot()) {
+ upPath = new BuildConfigNode(file.getParentFile().getPath(), BuildConfigNode.Kind.DIRECTORY, file.getParentFile().getAbsolutePath());
+ model.getRoot().addChild(upPath);
+ }
+ node.setActive(true);
+ upPath.addChild(node);
+ } else if (!(new File(path).isAbsolute())) {
+ String name = new File(path).getName();
+ BuildConfigNode existingNode = model.getNodeForPath(path);
+ existingNode.setActive(true);
+ } else {
+ badEntries.add("Use relative paths only, omitting: " + path);
+ }
+ }
+ }
+
+ private boolean pruneEmptyDirs(BuildConfigNode node) {
+ List nodesToRemove = new ArrayList();
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ BuildConfigNode currNode = (BuildConfigNode)it.next();
+ boolean hasValidChildren = pruneEmptyDirs(currNode);
+ if (!currNode.isValidResource() && !hasValidChildren) {
+ nodesToRemove.add(currNode);
+ }
+ }
+
+ for (Iterator it = nodesToRemove.iterator(); it.hasNext(); ) {
+ StructureNode currNode = (StructureNode)it.next();
+ node.removeChild(currNode);
+ }
+ return node.getChildren().size() > 0;
+ }
+
+ public String getActiveConfigFile() {
+ if (currConfigFilePath == null) return null;
+ if (currConfigFilePath.equals(DEFAULT_CONFIG_LABEL)) {
+ return Ajde.getDefault().getProjectProperties().getDefaultBuildConfigFile();// getDefaultConfigFile();
+ } else {
+ return currConfigFilePath;
+ }
+ }
+
+ public void setActiveConfigFile(String currConfigFilePath) {
+ if (currConfigFilePath.equals(DEFAULT_CONFIG_LABEL)) {
+ this.currConfigFilePath = Ajde.getDefault().getProjectProperties().getDefaultBuildConfigFile();//getDefaultConfigFile();
+ } else {
+ this.currConfigFilePath = currConfigFilePath;
+ }
+ notifyConfigChanged();
+ }
+
+ public void addListener(BuildConfigListener configurationListener) {
+ listeners.add(configurationListener);
+ }
+
+ public void removeListener(BuildConfigListener configurationListener) {
+ listeners.remove(configurationListener);
+ }
+
+ private void notifyConfigChanged() {
+ for (Iterator it = listeners.iterator(); it.hasNext(); ) {
+ ((BuildConfigListener)it.next()).currConfigChanged(currConfigFilePath);
+ }
+ }
+
+ private void notifyConfigsListUpdated() {
+ for (Iterator it = listeners.iterator(); it.hasNext(); ) {
+ ((BuildConfigListener)it.next()).configsListUpdated(configFiles);
+ }
+ }
+
+ private void sortModel(BuildConfigNode node, Comparator comparator) {
+ if (node == null || node.getChildren() == null) return;
+ Collections.sort(node.getChildren(), comparator);
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ BuildConfigNode nextNode = (BuildConfigNode)it.next();
+ if (nextNode != null) sortModel(nextNode, comparator);
+ }
+ }
+
+ private static final Comparator ALPHABETICAL_COMPARATOR = new Comparator() {
+ public int compare(Object o1, Object o2) {
+ BuildConfigNode n1 = (BuildConfigNode)o1;
+ BuildConfigNode n2 = (BuildConfigNode)o2;
+ return n1.getName().compareTo(n2.getName());
+ }
+ };
+}
+
+
diff --git a/ajde/src/org/aspectj/ajde/internal/StructureUtilities.java b/ajde/src/org/aspectj/ajde/internal/StructureUtilities.java
new file mode 100644
index 000000000..adef640ca
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/internal/StructureUtilities.java
@@ -0,0 +1,89 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.internal;
+
+//import org.aspectj.ajde.compiler.AjdeCompiler;
+//import org.aspectj.compiler.structure.*;
+//import org.aspectj.compiler.structure.associations.*;
+
+/**
+ * Utility class for building a structure model for a given compile. Typical command-line usage: <BR>
+ * &nbsp;&nbsp;&gt; <TT>java org.aspectj.tools.ajde.StructureManager @&lt;config-file&gt;.lst</TT>
+ */
+public class StructureUtilities {
+
+// private static StructureManager structureManager = new StructureManager();
+
+ /**
+ * Usage is the same as <CODE>org.aspectj.tools.ajc.Main</CODE>.
+ */
+// public static void main(String[] args) throws IOException {
+// StructureNode model = buildStructureModel(args);
+// if (model == null) {
+
+// } else {
+// dumpStructure(model, "");
+// }
+// }
+
+ /**
+ * Compiles and builds a structure model.
+ *
+ * @return the node representing the root for the structure model
+ */
+// public static StructureNode buildStructureModel(String[] args) {
+// new StructureBuilder().buildStructure(args);
+// return structureManager.getStructureModel();
+// }
+
+ /**
+ * Dumps the structure model by walking the
+ * corresponding tree.
+ * * @param node node to start traversal at, typically the root
+ * @param indent whitespace accumulator for pretty-printing
+ */
+// public static void dumpStructure(StructureNode node, String indent) {
+// if (node == null) return;
+// Syste.println(indent + node);
+// if (node.getChildren() != null) {
+// for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+// dumpStructure((StructureNode)it.next(), indent + " ");
+// }
+// }
+// if (node instanceof ProgramElementNode) {
+// if (((ProgramElementNode)node).getRelations() != null) {
+// for (Iterator it = ((ProgramElementNode)node).getRelations().iterator(); it.hasNext(); ) {
+// dumpStructure((StructureNode)it.next(), indent + " ");
+// }
+// }
+// }
+// }
+//
+// private static class StructureBuilder extends org.aspectj.tools.ajc.Main {
+// public void buildStructure(String[] args) {
+// compile(args);
+// }
+//
+// public JavaCompiler getCompiler() {
+// if (compiler != null) return compiler;
+// if (compiler == null) {
+// if (errorHandler == null) {
+// compiler = new AjdeCompiler(structureManager);
+// }
+// }
+// return compiler;
+// }
+// }
+}
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/ajdeSmall.gif b/ajde/src/org/aspectj/ajde/resources/actions/ajdeSmall.gif
new file mode 100644
index 000000000..2b08761cb
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/ajdeSmall.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/back.gif b/ajde/src/org/aspectj/ajde/resources/actions/back.gif
new file mode 100644
index 000000000..06960ea56
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/back.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/browserDisabled.gif b/ajde/src/org/aspectj/ajde/resources/actions/browserDisabled.gif
new file mode 100644
index 000000000..0ed9ecac9
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/browserDisabled.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/browserEnabled.gif b/ajde/src/org/aspectj/ajde/resources/actions/browserEnabled.gif
new file mode 100644
index 000000000..876dd51f2
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/browserEnabled.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/browseroptions.gif b/ajde/src/org/aspectj/ajde/resources/actions/browseroptions.gif
new file mode 100644
index 000000000..4c8aa8d01
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/browseroptions.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/build.gif b/ajde/src/org/aspectj/ajde/resources/actions/build.gif
new file mode 100644
index 000000000..2673baa2d
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/build.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/clean.gif b/ajde/src/org/aspectj/ajde/resources/actions/clean.gif
new file mode 100644
index 000000000..9dc08247b
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/clean.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/closeConfig.gif b/ajde/src/org/aspectj/ajde/resources/actions/closeConfig.gif
new file mode 100644
index 000000000..e11d635a9
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/closeConfig.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/debug.gif b/ajde/src/org/aspectj/ajde/resources/actions/debug.gif
new file mode 100644
index 000000000..9c38140c0
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/debug.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/default.gif b/ajde/src/org/aspectj/ajde/resources/actions/default.gif
new file mode 100644
index 000000000..b1341dff4
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/default.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/execute.gif b/ajde/src/org/aspectj/ajde/resources/actions/execute.gif
new file mode 100644
index 000000000..5d7bfcc96
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/execute.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/filter.gif b/ajde/src/org/aspectj/ajde/resources/actions/filter.gif
new file mode 100644
index 000000000..b73b8fff5
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/filter.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/find.gif b/ajde/src/org/aspectj/ajde/resources/actions/find.gif
new file mode 100644
index 000000000..bca27b12a
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/find.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/forward.gif b/ajde/src/org/aspectj/ajde/resources/actions/forward.gif
new file mode 100644
index 000000000..cc7f973d2
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/forward.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/granularity.gif b/ajde/src/org/aspectj/ajde/resources/actions/granularity.gif
new file mode 100644
index 000000000..286ee1945
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/granularity.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/hideAssociations.gif b/ajde/src/org/aspectj/ajde/resources/actions/hideAssociations.gif
new file mode 100644
index 000000000..492e148e8
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/hideAssociations.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/hideNonAJ.gif b/ajde/src/org/aspectj/ajde/resources/actions/hideNonAJ.gif
new file mode 100644
index 000000000..3e1ce96ef
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/hideNonAJ.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/mergeStructureView.gif b/ajde/src/org/aspectj/ajde/resources/actions/mergeStructureView.gif
new file mode 100644
index 000000000..359d2888d
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/mergeStructureView.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/new.gif b/ajde/src/org/aspectj/ajde/resources/actions/new.gif
new file mode 100644
index 000000000..1d02decea
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/new.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/open.gif b/ajde/src/org/aspectj/ajde/resources/actions/open.gif
new file mode 100644
index 000000000..1549ecd7b
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/open.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/openConfig.gif b/ajde/src/org/aspectj/ajde/resources/actions/openConfig.gif
new file mode 100644
index 000000000..64d7028e5
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/openConfig.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/options.gif b/ajde/src/org/aspectj/ajde/resources/actions/options.gif
new file mode 100644
index 000000000..02538e940
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/options.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/order.gif b/ajde/src/org/aspectj/ajde/resources/actions/order.gif
new file mode 100644
index 000000000..67586ef30
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/order.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/outputWindow.gif b/ajde/src/org/aspectj/ajde/resources/actions/outputWindow.gif
new file mode 100644
index 000000000..9b65c6b6e
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/outputWindow.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/popup.gif b/ajde/src/org/aspectj/ajde/resources/actions/popup.gif
new file mode 100644
index 000000000..3030e1954
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/popup.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/refresh.gif b/ajde/src/org/aspectj/ajde/resources/actions/refresh.gif
new file mode 100644
index 000000000..7e6bd1747
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/refresh.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/relations.gif b/ajde/src/org/aspectj/ajde/resources/actions/relations.gif
new file mode 100644
index 000000000..e091ac2b5
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/relations.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/save.gif b/ajde/src/org/aspectj/ajde/resources/actions/save.gif
new file mode 100644
index 000000000..ed704396c
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/save.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/saveAll.gif b/ajde/src/org/aspectj/ajde/resources/actions/saveAll.gif
new file mode 100644
index 000000000..18d0c9ff5
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/saveAll.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/search.gif b/ajde/src/org/aspectj/ajde/resources/actions/search.gif
new file mode 100644
index 000000000..164b9123e
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/search.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/splitStructureView.gif b/ajde/src/org/aspectj/ajde/resources/actions/splitStructureView.gif
new file mode 100644
index 000000000..825dcfea7
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/splitStructureView.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/startAjde.gif b/ajde/src/org/aspectj/ajde/resources/actions/startAjde.gif
new file mode 100644
index 000000000..5c49b6a32
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/startAjde.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/stopAjde.gif b/ajde/src/org/aspectj/ajde/resources/actions/stopAjde.gif
new file mode 100644
index 000000000..97cfa4c71
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/stopAjde.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/structureView.gif b/ajde/src/org/aspectj/ajde/resources/actions/structureView.gif
new file mode 100644
index 000000000..8e2d2e7d0
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/structureView.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/zoomStructureToFileMode.gif b/ajde/src/org/aspectj/ajde/resources/actions/zoomStructureToFileMode.gif
new file mode 100644
index 000000000..0c1d83eec
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/zoomStructureToFileMode.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/actions/zoomStructureToGlobalMode.gif b/ajde/src/org/aspectj/ajde/resources/actions/zoomStructureToGlobalMode.gif
new file mode 100644
index 000000000..98a93e096
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/actions/zoomStructureToGlobalMode.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/accessibility-package.gif b/ajde/src/org/aspectj/ajde/resources/structure/accessibility-package.gif
new file mode 100644
index 000000000..0c7bfc426
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/accessibility-package.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/accessibility-private.gif b/ajde/src/org/aspectj/ajde/resources/structure/accessibility-private.gif
new file mode 100644
index 000000000..d543c82f5
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/accessibility-private.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/accessibility-privileged.gif b/ajde/src/org/aspectj/ajde/resources/structure/accessibility-privileged.gif
new file mode 100644
index 000000000..3b65259bd
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/accessibility-privileged.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/accessibility-protected.gif b/ajde/src/org/aspectj/ajde/resources/structure/accessibility-protected.gif
new file mode 100644
index 000000000..dd2a5f0c6
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/accessibility-protected.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/accessibility-public.gif b/ajde/src/org/aspectj/ajde/resources/structure/accessibility-public.gif
new file mode 100644
index 000000000..45b759436
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/accessibility-public.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/advice.gif b/ajde/src/org/aspectj/ajde/resources/structure/advice.gif
new file mode 100644
index 000000000..48317f8b9
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/advice.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/adviceBack.gif b/ajde/src/org/aspectj/ajde/resources/structure/adviceBack.gif
new file mode 100644
index 000000000..81a3bb684
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/adviceBack.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/adviceForward.gif b/ajde/src/org/aspectj/ajde/resources/structure/adviceForward.gif
new file mode 100644
index 000000000..06ed1932c
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/adviceForward.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/aspect.gif b/ajde/src/org/aspectj/ajde/resources/structure/aspect.gif
new file mode 100644
index 000000000..3c4bcbe43
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/aspect.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/class.gif b/ajde/src/org/aspectj/ajde/resources/structure/class.gif
new file mode 100644
index 000000000..3c5670560
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/class.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/code.gif b/ajde/src/org/aspectj/ajde/resources/structure/code.gif
new file mode 100644
index 000000000..177155246
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/code.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/declareError.gif b/ajde/src/org/aspectj/ajde/resources/structure/declareError.gif
new file mode 100644
index 000000000..1db5788e2
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/declareError.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/declareParents.gif b/ajde/src/org/aspectj/ajde/resources/structure/declareParents.gif
new file mode 100644
index 000000000..c768f43c8
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/declareParents.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/declareSoft.gif b/ajde/src/org/aspectj/ajde/resources/structure/declareSoft.gif
new file mode 100644
index 000000000..a78b43e4c
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/declareSoft.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/declareWarning.gif b/ajde/src/org/aspectj/ajde/resources/structure/declareWarning.gif
new file mode 100644
index 000000000..6f80eec9d
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/declareWarning.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/error.gif b/ajde/src/org/aspectj/ajde/resources/structure/error.gif
new file mode 100644
index 000000000..964229dcc
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/error.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/field.gif b/ajde/src/org/aspectj/ajde/resources/structure/field.gif
new file mode 100644
index 000000000..2df264501
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/field.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/file-aspectj.gif b/ajde/src/org/aspectj/ajde/resources/structure/file-aspectj.gif
new file mode 100644
index 000000000..c6b3df108
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/file-aspectj.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/file-java.gif b/ajde/src/org/aspectj/ajde/resources/structure/file-java.gif
new file mode 100644
index 000000000..3cab52eb2
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/file-java.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/file-lst.gif b/ajde/src/org/aspectj/ajde/resources/structure/file-lst.gif
new file mode 100644
index 000000000..d67e52bb8
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/file-lst.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/file.gif b/ajde/src/org/aspectj/ajde/resources/structure/file.gif
new file mode 100644
index 000000000..53eafb09c
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/file.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/info.gif b/ajde/src/org/aspectj/ajde/resources/structure/info.gif
new file mode 100644
index 000000000..6a6d53745
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/info.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/inheritanceBack.gif b/ajde/src/org/aspectj/ajde/resources/structure/inheritanceBack.gif
new file mode 100644
index 000000000..42db4fe5e
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/inheritanceBack.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/inheritanceForward.gif b/ajde/src/org/aspectj/ajde/resources/structure/inheritanceForward.gif
new file mode 100644
index 000000000..cc55b3c86
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/inheritanceForward.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/interface.gif b/ajde/src/org/aspectj/ajde/resources/structure/interface.gif
new file mode 100644
index 000000000..1b3eaec83
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/interface.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/introduction.gif b/ajde/src/org/aspectj/ajde/resources/structure/introduction.gif
new file mode 100644
index 000000000..389d1429e
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/introduction.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/method.gif b/ajde/src/org/aspectj/ajde/resources/structure/method.gif
new file mode 100644
index 000000000..14308e89a
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/method.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/package.gif b/ajde/src/org/aspectj/ajde/resources/structure/package.gif
new file mode 100644
index 000000000..f9be40a97
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/package.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/pointcut.gif b/ajde/src/org/aspectj/ajde/resources/structure/pointcut.gif
new file mode 100644
index 000000000..d6e9454ac
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/pointcut.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/project.gif b/ajde/src/org/aspectj/ajde/resources/structure/project.gif
new file mode 100644
index 000000000..8e2d2e7d0
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/project.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/referenceBack.gif b/ajde/src/org/aspectj/ajde/resources/structure/referenceBack.gif
new file mode 100644
index 000000000..0a8207c0e
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/referenceBack.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/referenceForward.gif b/ajde/src/org/aspectj/ajde/resources/structure/referenceForward.gif
new file mode 100644
index 000000000..f5ecde63f
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/referenceForward.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/search.gif b/ajde/src/org/aspectj/ajde/resources/structure/search.gif
new file mode 100644
index 000000000..164b9123e
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/search.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/resources/structure/warning.gif b/ajde/src/org/aspectj/ajde/resources/structure/warning.gif
new file mode 100644
index 000000000..4430459ce
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/resources/structure/warning.gif
Binary files differ
diff --git a/ajde/src/org/aspectj/ajde/ui/AbstractIcon.java b/ajde/src/org/aspectj/ajde/ui/AbstractIcon.java
new file mode 100644
index 000000000..dfe779db1
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/AbstractIcon.java
@@ -0,0 +1,31 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+/**
+ * @author Mik Kersten
+ */
+public class AbstractIcon {
+
+ private Object iconResource;
+
+ public AbstractIcon(Object iconResource) {
+ this.iconResource = iconResource;
+ }
+
+ public Object getIconResource() {
+ return iconResource;
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/AbstractIconRegistry.java b/ajde/src/org/aspectj/ajde/ui/AbstractIconRegistry.java
new file mode 100644
index 000000000..96ef60f4c
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/AbstractIconRegistry.java
@@ -0,0 +1,143 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import org.aspectj.asm.*;
+
+/**
+ * Uses the factory pattern.
+ *
+ * @author Mik Kersten
+ */
+public abstract class AbstractIconRegistry {
+
+ protected final String RESOURCE_PATH = "org/aspectj/ajde/resources/";
+ protected final String STRUCTURE_PATH = RESOURCE_PATH + "structure/";
+
+ protected final AbstractIcon PROJECT = createIcon(STRUCTURE_PATH + "project.gif");
+ protected final AbstractIcon PACKAGE = createIcon(STRUCTURE_PATH + "package.gif");
+ protected final AbstractIcon ASPECT = createIcon(STRUCTURE_PATH + "aspect.gif");
+ protected final AbstractIcon INITIALIZER = createIcon(STRUCTURE_PATH + "code.gif");
+ protected final AbstractIcon INTRODUCTION = createIcon(STRUCTURE_PATH + "introduction.gif");
+ protected final AbstractIcon CONSTRUCTOR = createIcon(STRUCTURE_PATH + "method.gif");
+ protected final AbstractIcon POINTCUT = createIcon(STRUCTURE_PATH + "pointcut.gif");
+ protected final AbstractIcon ADVICE = createIcon(STRUCTURE_PATH + "advice.gif");
+ protected final AbstractIcon DECLARE_PARENTS = createIcon(STRUCTURE_PATH + "declareParents.gif");
+ protected final AbstractIcon DECLARE_WARNING = createIcon(STRUCTURE_PATH + "declareWarning.gif");
+ protected final AbstractIcon DECLARE_ERROR = createIcon(STRUCTURE_PATH + "declareError.gif");
+ protected final AbstractIcon DECLARE_SOFT = createIcon(STRUCTURE_PATH + "declareSoft.gif");
+ protected final AbstractIcon CODE = createIcon(STRUCTURE_PATH + "code.gif");
+ protected final AbstractIcon ERROR = createIcon(STRUCTURE_PATH + "error.gif");
+
+ protected final AbstractIcon FILE = createIcon(STRUCTURE_PATH + "file.gif");
+ protected final AbstractIcon FILE_JAVA = createIcon(STRUCTURE_PATH + "file-java.gif");
+ protected final AbstractIcon FILE_ASPECTJ = createIcon(STRUCTURE_PATH + "file-aspectj.gif");
+ protected final AbstractIcon FILE_LST = createIcon(STRUCTURE_PATH + "file-lst.gif");
+
+ protected final AbstractIcon METHOD = createIcon(STRUCTURE_PATH + "method.gif");
+ protected final AbstractIcon FIELD = createIcon(STRUCTURE_PATH + "field.gif");
+ protected final AbstractIcon CLASS = createIcon(STRUCTURE_PATH + "class.gif");
+ protected final AbstractIcon INTERFACE = createIcon(STRUCTURE_PATH + "interface.gif");
+
+ protected final AbstractIcon RELATION_ADVICE_FORWARD = createIcon(STRUCTURE_PATH + "adviceForward.gif");
+ protected final AbstractIcon RELATION_ADVICE_BACK = createIcon(STRUCTURE_PATH + "adviceBack.gif");
+ protected final AbstractIcon RELATION_INHERITANCE_FORWARD = createIcon(STRUCTURE_PATH + "inheritanceForward.gif");
+ protected final AbstractIcon RELATION_INHERITANCE_BACK = createIcon(STRUCTURE_PATH + "inheritanceBack.gif");
+ protected final AbstractIcon RELATION_REFERENCE_FORWARD = createIcon(STRUCTURE_PATH + "referenceForward.gif");
+ protected final AbstractIcon RELATION_REFERENCE_BACK = createIcon(STRUCTURE_PATH + "referenceBack.gif");
+
+ public AbstractIcon getRelationIcon(Relation relation) {
+ if (relation.getAssociationName().equals(AdviceAssociation.NAME)) {
+ return RELATION_ADVICE_FORWARD;
+ } else if (relation.getAssociationName().equals(IntroductionAssociation.NAME)) {
+ return RELATION_ADVICE_FORWARD;
+ } else if (relation.getAssociationName().equals(InheritanceAssociation.NAME)) {
+ return RELATION_INHERITANCE_FORWARD;
+ } else {
+ return RELATION_REFERENCE_FORWARD;
+ }
+ }
+
+ /**
+ * @return null if the kind could not be resolved
+ */
+ protected AbstractIcon getStructureIcon(ProgramElementNode.Kind kind, ProgramElementNode.Accessibility accessibility) {
+ return getStructureIcon(kind, ProgramElementNode.Accessibility.PUBLIC);
+ }
+
+ /**
+ * Assumes "public" visibility for the icon.
+ *
+ * @return null if the kind could not be resolved
+ */
+ public AbstractIcon getStructureIcon(ProgramElementNode.Kind kind) {
+ if (kind == ProgramElementNode.Kind.PROJECT) {
+ return PROJECT;
+ } else if (kind == ProgramElementNode.Kind.PACKAGE) {
+ return PACKAGE;
+ } else if (kind == ProgramElementNode.Kind.FILE) {
+ return FILE;
+ } else if (kind == ProgramElementNode.Kind.FILE_JAVA) {
+ return FILE_JAVA;
+ } else if (kind == ProgramElementNode.Kind.FILE_ASPECTJ) {
+ return FILE_ASPECTJ;
+ } else if (kind == ProgramElementNode.Kind.FILE_LST) {
+ return FILE_LST;
+ } else if (kind == ProgramElementNode.Kind.CLASS) {
+ return CLASS;
+ } else if (kind == ProgramElementNode.Kind.INTERFACE) {
+ return INTERFACE;
+ } else if (kind == ProgramElementNode.Kind.ASPECT) {
+ return ASPECT;
+ } else if (kind == ProgramElementNode.Kind.INITIALIZER) {
+ return INITIALIZER;
+ } else if (kind == ProgramElementNode.Kind.INTRODUCTION) {
+ return INTRODUCTION;
+ } else if (kind == ProgramElementNode.Kind.CONSTRUCTOR) {
+ return CONSTRUCTOR;
+ } else if (kind == ProgramElementNode.Kind.METHOD) {
+ return METHOD;
+ } else if (kind == ProgramElementNode.Kind.FIELD) {
+ return FIELD;
+ } else if (kind == ProgramElementNode.Kind.POINTCUT) {
+ return POINTCUT;
+ } else if (kind == ProgramElementNode.Kind.ADVICE) {
+ return ADVICE;
+ } else if (kind == ProgramElementNode.Kind.DECLARE_PARENTS) {
+ return DECLARE_PARENTS;
+ } else if (kind == ProgramElementNode.Kind.DECLARE_WARNING) {
+ return DECLARE_WARNING;
+ } else if (kind == ProgramElementNode.Kind.DECLARE_ERROR) {
+ return DECLARE_ERROR;
+ } else if (kind == ProgramElementNode.Kind.DECLARE_SOFT) {
+ return DECLARE_SOFT;
+ } else if (kind == ProgramElementNode.Kind.CODE) {
+ return CODE;
+ } else if (kind == ProgramElementNode.Kind.ERROR) {
+ return ERROR;
+ } else {
+ System.err.println("AJDE Message: unresolved icon kind " + kind);
+ return null;
+ }
+ }
+
+ /**
+ * Implement to create platform-specific icons.
+ */
+ protected abstract AbstractIcon createIcon(String path);
+}
+
+
+
diff --git a/ajde/src/org/aspectj/ajde/ui/BuildConfigEditor.java b/ajde/src/org/aspectj/ajde/ui/BuildConfigEditor.java
new file mode 100644
index 000000000..7f146505f
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/BuildConfigEditor.java
@@ -0,0 +1,28 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import java.io.*;
+
+/**
+ * @author Mik Kersten
+ */
+public interface BuildConfigEditor {
+
+ /**
+ * @param the full path to the file resource to be opened
+ */
+ public void openFile(String filePath) throws IOException, InvalidResourceException;
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/BuildConfigModel.java b/ajde/src/org/aspectj/ajde/ui/BuildConfigModel.java
new file mode 100644
index 000000000..cbffa6a25
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/BuildConfigModel.java
@@ -0,0 +1,96 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import java.util.*;
+
+import org.aspectj.asm.StructureModel;
+
+/**
+ * @author Mik Kersten
+ */
+public class BuildConfigModel extends StructureModel {
+
+ private String sourceFile;
+
+ public BuildConfigModel(String sourceFile) {
+ this.sourceFile = sourceFile;
+ }
+
+ /**
+ * @param path java.io.File.separator delimited path
+ * @return corresponding node if the path is found, the root otherwise
+ */
+ public BuildConfigNode getNodeForPath(String path) {
+ BuildConfigNode upPathMatch = searchUpPaths(path);
+ if (upPathMatch != null && upPathMatch != root) {
+ return upPathMatch;
+ } else {
+ StringTokenizer st = new StringTokenizer(path, "/");
+ BuildConfigNode node = (BuildConfigNode)root;
+ return getNodeForPathHelper(st, node);
+ }
+ }
+
+ private BuildConfigNode searchUpPaths(String path) {
+ for (Iterator it = root.getChildren().iterator(); it.hasNext(); ) {
+ BuildConfigNode node = (BuildConfigNode)it.next();
+ if (node.getName().equals(path)) return node;
+ }
+ return null;
+ }
+
+ private BuildConfigNode getNodeForPathHelper(StringTokenizer st, BuildConfigNode node) {
+ BuildConfigNode parent = node;
+ while (st.hasMoreElements()) {
+ String pathItem = (String)st.nextElement();
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ node = (BuildConfigNode)it.next();
+ String childName = node.getName();
+ if (childName.equals(pathItem)) {
+ return getNodeForPathHelper(st, node);
+ }
+ }
+ }
+ return parent;
+ }
+
+ public List getActiveNodes(BuildConfigNode.Kind kind) {
+ List nodes = new ArrayList();
+ getActiveNodesHelper((BuildConfigNode)getRoot(), kind, nodes);
+ return nodes;
+ }
+
+ private void getActiveNodesHelper(BuildConfigNode node, BuildConfigNode.Kind kind, List nodes) {
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ BuildConfigNode currNode = (BuildConfigNode)it.next();
+ if (currNode.getBuildConfigNodeKind().equals(kind)
+ && currNode.isActive()) {
+ nodes.add(currNode);
+ }
+ getActiveNodesHelper(currNode, kind, nodes);
+ }
+ }
+
+ public String getSourceFile() {
+ return sourceFile;
+ }
+
+ public void setSourceFile(String sourceFile) {
+ this.sourceFile = sourceFile;
+ }
+}
+
+
diff --git a/ajde/src/org/aspectj/ajde/ui/BuildConfigNode.java b/ajde/src/org/aspectj/ajde/ui/BuildConfigNode.java
new file mode 100644
index 000000000..6e22b8aa8
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/BuildConfigNode.java
@@ -0,0 +1,110 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import java.util.List;
+import java.io.*;
+
+import org.aspectj.asm.StructureNode;
+
+/**
+ * @author Mik Kersten
+ */
+public class BuildConfigNode extends StructureNode {
+
+ private String resourcePath;
+ private Kind kind;
+ private boolean isActive = true;
+
+ public BuildConfigNode(String name, Kind kind, String resourcePath) {
+ super(name, kind.toString());
+ this.kind = kind;
+ this.resourcePath = resourcePath;
+ }
+
+ public BuildConfigNode(String name, String kind, String resourcePath, List children) {
+ super(name, kind, children);
+ this.resourcePath = resourcePath;
+ }
+
+ public String getResourcePath() {
+ return resourcePath;
+ }
+
+ public void setResourcePath(String resourcePath) {
+ this.resourcePath = resourcePath;
+ }
+
+ public boolean isValidResource() {
+ return name.endsWith(".java")
+ || name.endsWith(".aj")
+ || name.endsWith(".lst");
+ }
+
+ public boolean isActive() {
+ return isActive;
+ }
+
+ public void setActive(boolean isActive) {
+ this.isActive = isActive;
+ }
+
+ /**
+ * Uses "typesafe enum" pattern.
+ */
+ public static class Kind implements Serializable {
+
+ public static final Kind FILE_JAVA = new Kind("Java source file");
+ public static final Kind FILE_ASPECTJ = new Kind("AspectJ source file");
+ public static final Kind FILE_LST = new Kind("build configuration file");
+ public static final Kind ERROR = new Kind("error");
+ public static final Kind DIRECTORY = new Kind("directory");
+
+
+ public static final Kind[] ALL = { FILE_JAVA, FILE_ASPECTJ, FILE_LST, DIRECTORY };
+
+ private final String name;
+
+ private Kind(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ public boolean equals(Object o) {
+ return o.equals(name);
+ }
+
+ public boolean isDeclareKind() {
+ return name.startsWith("declare");
+ }
+
+ // The 4 declarations below are necessary for serialization
+ private static int nextOrdinal = 0;
+ private final int ordinal = nextOrdinal++;
+ private Object readResolve() throws ObjectStreamException {
+ return ALL[ordinal];
+ }
+ }
+
+ public Kind getBuildConfigNodeKind() {
+ return kind;
+ }
+}
+
+
+
diff --git a/ajde/src/org/aspectj/ajde/ui/EditorManager.java b/ajde/src/org/aspectj/ajde/ui/EditorManager.java
new file mode 100644
index 000000000..f6159ea6f
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/EditorManager.java
@@ -0,0 +1,162 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import java.awt.BorderLayout;
+import java.io.IOException;
+import java.util.*;
+
+import javax.swing.*;
+
+import org.aspectj.ajde.*;
+import org.aspectj.ajde.ui.swing.BasicEditor;
+import org.aspectj.bridge.ISourceLocation;
+
+/**
+ * Responsible for controlling the editor.
+ *
+ * @todo remove coupling to <CODE>BasicEditor</CODE>
+ * @author Mik Kersten
+ */
+public class EditorManager {
+
+ private EditorAdapter editor = null;
+ private BasicEditor basicEditor = null;
+ private ArrayList editorListeners = new ArrayList();
+ private Vector editors = new Vector();
+ private JPanel editor_panel = null;
+ private Box editors_box = Box.createVerticalBox();
+
+ public EditorManager(EditorAdapter ajdeEditor) {
+ if (ajdeEditor instanceof BasicEditor) {
+ this.basicEditor = (BasicEditor)ajdeEditor;
+ editors.add(basicEditor);
+ editors_box.add(basicEditor.getPanel());
+ editor_panel = new JPanel(new BorderLayout());
+ editor_panel.add(editors_box, BorderLayout.CENTER);
+ } else {
+ editors.add(ajdeEditor);
+ this.editor = ajdeEditor;
+ }
+ }
+
+ public void addListener(EditorListener editorListener) {
+ editorListeners.add(editorListener);
+ }
+
+ public void removeListener(EditorListener editorListener) {
+ editorListeners.remove(editorListener);
+ }
+
+ public void notifyCurrentFileChanged(String filePath) {
+ for (Iterator it = editorListeners.iterator(); it.hasNext(); ) {
+ ((EditorListener)it.next()).currentFileChanged(filePath);
+ }
+ }
+
+ public void addViewForSourceLine(final String filePath, final int lineNumber) {
+ if (basicEditor == null) return;
+ editors_box.remove(basicEditor.getPanel());
+ final BasicEditor newEditor = new BasicEditor();
+ editors.add(newEditor);
+
+ Runnable update = new Runnable() {
+ public void run() {
+ editors_box.add(newEditor.getPanel());
+ newEditor.showSourceLine(filePath, lineNumber, true);
+ //AjdeUIManager.getDefault().getIdeUIAdapter().resetGUI();
+ }
+ };
+
+ if (SwingUtilities.isEventDispatchThread()) {
+ update.run();
+ } else {
+ try {
+ SwingUtilities.invokeAndWait(update);
+ } catch (Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not add view for source line.", e);
+ }
+ }
+ }
+
+ public String getCurrFile() {
+ if (basicEditor != null) {
+ return basicEditor.getCurrFile();
+ } else {
+ return editor.getCurrFile();
+ }
+ }
+
+
+ public void showSourceLine(ISourceLocation sourceLocation, boolean highlight) {
+ if (sourceLocation != null) {
+ showSourceLine(
+ sourceLocation.getSourceFile().getAbsolutePath(),
+ sourceLocation.getLine(),
+ highlight);
+ }
+ }
+
+ /**
+ * @todo remove "instanceof AjdeManager" hack
+ */
+ public void showSourceLine(String filePath, int lineNumber, boolean highlight) {
+ if (editors.size() > 1) {
+ editors_box.removeAll();
+ editors_box.add(basicEditor.getPanel());
+ //AjdeUIManager.getDefault().getIdeUIAdapter().resetGUI();
+ editors.removeAllElements();
+ editors.add(basicEditor);
+ }
+
+ if (basicEditor != null) {
+ basicEditor.showSourceLine(filePath, lineNumber, highlight);
+ } else {
+ editor.showSourceLine(filePath, lineNumber, highlight);
+ }
+ }
+
+ public void pasteToCaretPos(String text) {
+ if (basicEditor != null) {
+ basicEditor.pasteToCaretPos(text);
+ } else {
+ editor.pasteToCaretPos(text);
+ }
+ }
+
+ public void showSourcelineAnnotation(String filePath, int lineNumber, java.util.List items) {
+ editor.showSourcelineAnnotation(filePath, lineNumber, items);
+ }
+
+ public void saveContents() {
+ try {
+ for (Iterator it = editors.iterator(); it.hasNext(); ) {
+ ((EditorAdapter)it.next()).saveContents();
+ }
+ } catch (IOException ioe) {
+ Ajde.getDefault().getErrorHandler().handleError("Editor could not save the current file.", ioe);
+ }
+ }
+
+ public JPanel getEditorPanel() {
+ if (editor_panel != null) {
+ return editor_panel;
+ } else {
+ return basicEditor.getPanel();
+ }
+ }
+}
+
+
diff --git a/ajde/src/org/aspectj/ajde/ui/FileStructureView.java b/ajde/src/org/aspectj/ajde/ui/FileStructureView.java
new file mode 100644
index 000000000..f3451c3cf
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/FileStructureView.java
@@ -0,0 +1,48 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+
+/**
+ * Should only be created by the {@link StructureViewManager} or an
+ * equivalent factory.
+ *
+ * @author Mik Kersten
+ */
+public class FileStructureView extends StructureView {
+
+ private String sourceFilePath = null;
+
+ public FileStructureView(StructureViewProperties viewProperties) {
+ super.viewProperties = viewProperties;
+ }
+ public String getSourceFile() {
+ return sourceFilePath;
+ }
+
+ public void setSourceFile(String sourceFile) {
+ this.sourceFilePath = sourceFile;
+ }
+
+ public void setRootNode(StructureViewNode rootNode) {
+ super.setRootNode(rootNode);
+ notifyViewUpdated();
+ }
+
+ public String getName() {
+ return "File view for: " + sourceFilePath;
+ }
+}
+
diff --git a/ajde/src/org/aspectj/ajde/ui/GlobalStructureView.java b/ajde/src/org/aspectj/ajde/ui/GlobalStructureView.java
new file mode 100644
index 000000000..4c9a6ba94
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/GlobalStructureView.java
@@ -0,0 +1,52 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+
+/**
+ * Should only be created by the {@link StructureViewManager} or an
+ * equivalent factory.
+ *
+ * @author Mik Kersten
+ */
+public class GlobalStructureView extends FileStructureView {
+
+ private GlobalViewProperties viewProperties;
+
+ public GlobalStructureView(GlobalViewProperties viewProperties) {
+ super(viewProperties);
+ this.viewProperties = viewProperties;
+ }
+
+ public GlobalViewProperties getGlobalViewProperties() {
+ return viewProperties;
+ }
+
+// public void setActiveNode(StructureViewNode activeNode) {
+// StructureNode node = activeNode.getStructureNode();
+//
+// activeNode = activeNode;
+// if (renderer != null) renderer.setActiveNode(activeNode);
+// }
+//
+// public void setActiveNode(StructureViewNode activeNode, int sourceLine) {
+// activeNode = activeNode;
+// if (renderer != null) renderer.setActiveNode(activeNode, sourceLine);
+// }
+
+ public String toString() {
+ return viewProperties.getHierarchy().toString();
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/GlobalViewProperties.java b/ajde/src/org/aspectj/ajde/ui/GlobalViewProperties.java
new file mode 100644
index 000000000..a6b8ee3e5
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/GlobalViewProperties.java
@@ -0,0 +1,49 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+/**
+ * @author Mik Kersten
+ */
+public class GlobalViewProperties extends StructureViewProperties {
+
+ private StructureViewProperties.Granularity granularity = StructureViewProperties.Granularity.MEMBER;
+ private StructureViewProperties.Hierarchy hierarchy = StructureViewProperties.Hierarchy.DECLARATION;
+
+ public GlobalViewProperties(StructureViewProperties.Hierarchy hierarchy) {
+ this.hierarchy = hierarchy;
+ }
+
+ public void setGranularity(StructureViewProperties.Granularity granularity) {
+ this.granularity = granularity;
+ }
+
+ public StructureViewProperties.Granularity getGranularity() {
+ return granularity;
+ }
+
+ public void setHierarchy(StructureViewProperties.Hierarchy hierarchy) {
+ this.hierarchy = hierarchy;
+ }
+
+ public StructureViewProperties.Hierarchy getHierarchy() {
+ return hierarchy;
+ }
+
+ public String getName() {
+ return hierarchy.toString();
+ }
+}
+
diff --git a/ajde/src/org/aspectj/ajde/ui/IdeUIAdapter.java b/ajde/src/org/aspectj/ajde/ui/IdeUIAdapter.java
new file mode 100644
index 000000000..423cd3720
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/IdeUIAdapter.java
@@ -0,0 +1,23 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+/**
+ * @author Mik Kersten
+ */
+public interface IdeUIAdapter {
+
+ public void displayStatusInformation(String message);
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/InvalidResourceException.java b/ajde/src/org/aspectj/ajde/ui/InvalidResourceException.java
new file mode 100644
index 000000000..e7807bec2
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/InvalidResourceException.java
@@ -0,0 +1,40 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+/**
+ * @author Mik Kersten
+ *
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates.
+ */
+public class InvalidResourceException extends Exception {
+
+ /**
+ * Constructor for InvalidResourceException.
+ */
+ public InvalidResourceException() {
+ super();
+ }
+
+ /**
+ * Constructor for InvalidResourceException.
+ * @param s
+ */
+ public InvalidResourceException(String s) {
+ super(s);
+ }
+
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java b/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java
new file mode 100644
index 000000000..cb1a3ba82
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java
@@ -0,0 +1,236 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import java.util.*;
+import org.aspectj.asm.*;
+import org.aspectj.ajde.*;
+
+/**
+ * Prototype functionality for package view clients.
+ */
+public class StructureModelUtil {
+
+ /**
+ * This method returns a map from affected source lines in a class to
+ * a List of aspects affecting that line.
+ * Based on method of same name by mik kirsten. To be replaced when StructureModelUtil
+ * corrects its implementation
+ *
+ * @param the full path of the source file to get a map for
+ *
+ * @return a Map from line numbers to a List of ProgramElementNodes.
+ */
+ public static Map getLinesToAspectMap(String sourceFilePath) {
+
+ Map annotationsMap =
+ StructureModelManager.INSTANCE.getInlineAnnotations(
+ sourceFilePath,
+ true,
+ true);
+
+ Map aspectMap = new HashMap();
+ Set keys = annotationsMap.keySet();
+ for (Iterator it = keys.iterator(); it.hasNext();) {
+ Object key = it.next();
+ List annotations = (List) annotationsMap.get(key);
+ for (Iterator it2 = annotations.iterator(); it2.hasNext();) {
+ ProgramElementNode node = (ProgramElementNode) it2.next();
+
+ List relations = node.getRelations();
+
+ for (Iterator it3 = relations.iterator(); it3.hasNext();) {
+ RelationNode relationNode = (RelationNode) it3.next();
+
+ if (relationNode.getKind().equals("Advice")) {
+ List children = relationNode.getChildren();
+
+ List aspects = new Vector();
+
+ for (Iterator it4 = children.iterator();
+ it4.hasNext();
+ ) {
+ Object object = it4.next();
+
+ if (object instanceof LinkNode) {
+ ProgramElementNode pNode =
+ ((LinkNode) object).getProgramElementNode();
+
+ if (pNode.getProgramElementKind()
+ == ProgramElementNode.Kind.ADVICE) {
+
+ StructureNode theAspect = pNode.getParent();
+
+ aspects.add(theAspect);
+
+ }
+ }
+ }
+ if (!aspects.isEmpty()) {
+ aspectMap.put(key, aspects);
+ }
+ }
+
+ }
+ }
+ }
+ return aspectMap;
+ }
+
+ /**
+ * This method is copied from StructureModelUtil inoder for it to use the working
+ * version of getLineToAspectMap()
+ *
+ * @return the set of aspects with advice that affects the specified package
+ */
+ public static Set getAspectsAffectingPackage(ProgramElementNode packageNode) {
+ List files = StructureModelUtil.getFilesInPackage(packageNode);
+ Set aspects = new HashSet();
+ for (Iterator it = files.iterator(); it.hasNext();) {
+ ProgramElementNode fileNode = (ProgramElementNode) it.next();
+ Map adviceMap =
+ getLinesToAspectMap(
+ fileNode.getSourceLocation().getSourceFile().getAbsolutePath());
+ Collection values = adviceMap.values();
+ for (Iterator it2 = values.iterator(); it2.hasNext();) {
+ aspects.add(it2.next());
+ }
+ }
+ return aspects;
+ }
+
+ public static List getPackagesInModel() {
+ List packages = new ArrayList();
+ StructureModel model =
+ Ajde.getDefault().getStructureModelManager().getStructureModel();
+ if (model.equals(StructureModel.NO_STRUCTURE)) {
+ return null;
+ } else {
+ return getPackagesHelper(
+ (ProgramElementNode) model.getRoot(),
+ ProgramElementNode.Kind.PACKAGE,
+ null,
+ packages);
+ }
+ }
+
+ private static List getPackagesHelper(
+ ProgramElementNode node,
+ ProgramElementNode.Kind kind,
+ String prename,
+ List matches) {
+
+ if (kind == null || node.getProgramElementKind().equals(kind)) {
+ if (prename == null) {
+ prename = new String(node.toString());
+ } else {
+ prename = new String(prename + "." + node);
+ }
+ Object[] o = new Object[2];
+ o[0] = node;
+ o[1] = prename;
+
+ matches.add(o);
+ }
+
+ for (Iterator it = node.getChildren().iterator(); it.hasNext();) {
+ StructureNode nextNode = (StructureNode) it.next();
+ if (nextNode instanceof ProgramElementNode) {
+ getPackagesHelper(
+ (ProgramElementNode) nextNode,
+ kind,
+ prename,
+ matches);
+ }
+ }
+
+ return matches;
+ }
+
+ /**
+ * Helper function sorts a list of resources into alphabetical order
+ */
+ private List sortElements(List oldElements) {
+ Object[] temp = oldElements.toArray();
+ SortingComparator comparator = new SortingComparator();
+
+ Arrays.sort(temp, comparator);
+
+ List newResources = Arrays.asList(temp);
+
+ return newResources;
+ }
+
+ private static List sortArray(List oldElements) {
+ Object[] temp = oldElements.toArray();
+ SortArrayComparator comparator = new SortArrayComparator();
+
+ Arrays.sort(temp, comparator);
+
+ List newElements = Arrays.asList(temp);
+
+ return newElements;
+ }
+
+ private class SortingComparator implements Comparator {
+ public int compare(Object o1, Object o2) {
+ ProgramElementNode p1 = (ProgramElementNode) o1;
+ ProgramElementNode p2 = (ProgramElementNode) o2;
+
+ String name1 = p1.getName();
+ String name2 = p2.getName();
+
+ return name1.compareTo(name2);
+ }
+ }
+
+ private static class SortArrayComparator implements Comparator {
+ public int compare(Object o1, Object o2) {
+ Object[] array1 = (Object[]) o1;
+ Object[] array2 = (Object[]) o2;
+
+ ProgramElementNode p1 = (ProgramElementNode) array1[1];
+ ProgramElementNode p2 = (ProgramElementNode) array2[1];
+
+ String name1 = p1.getName();
+ String name2 = p2.getName();
+
+ return name1.compareTo(name2);
+ }
+ }
+
+ /**
+ * @return all of the AspectJ and Java source files in a package
+ */
+ public static List getFilesInPackage(ProgramElementNode packageNode) {
+ List packageContents;
+ if (packageNode == null) {
+ return null;
+ } else {
+ packageContents = packageNode.getChildren();
+ }
+ List files = new ArrayList();
+ for (Iterator it = packageContents.iterator(); it.hasNext(); ) {
+ ProgramElementNode packageItem = (ProgramElementNode)it.next();
+ if (packageItem.getProgramElementKind() == ProgramElementNode.Kind.FILE_JAVA
+ || packageItem.getProgramElementKind() == ProgramElementNode.Kind.FILE_ASPECTJ) {
+ files.add(packageItem);
+ }
+ }
+ return files;
+ }
+}
+
+
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java b/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java
new file mode 100644
index 000000000..776dd4a18
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java
@@ -0,0 +1,71 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import java.util.*;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.asm.*;
+
+/**
+ * @author Mik Kersten
+ */
+public class StructureSearchManager {
+
+ /**
+ * @param pattern case-sensitive substring of node name
+ *
+ * @return null if a corresponding node was not found
+ */
+ public List findMatches(
+ String pattern,
+ ProgramElementNode.Kind kind) {
+
+ List matches = new ArrayList();
+ StructureModel model = Ajde.getDefault().getStructureModelManager().getStructureModel();
+ if (model.equals(StructureModel.NO_STRUCTURE)) {
+ return null;
+ } else {
+ return findMatchesHelper((ProgramElementNode)model.getRoot(), pattern, kind, matches);
+ }
+ }
+
+
+ private List findMatchesHelper(
+ ProgramElementNode node,
+ String pattern,
+ ProgramElementNode.Kind kind,
+ List matches) {
+
+ if (node != null && node.getName().indexOf(pattern) != -1) {
+ if (kind == null || node.getProgramElementKind().equals(kind)) {
+ matches.add(node);
+ }
+ }
+
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ StructureNode nextNode = (StructureNode)it.next();
+ if (nextNode instanceof ProgramElementNode) {
+ findMatchesHelper(
+ (ProgramElementNode)nextNode,
+ pattern,
+ kind,
+ matches);
+ }
+ }
+
+ return matches;
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureView.java b/ajde/src/org/aspectj/ajde/ui/StructureView.java
new file mode 100644
index 000000000..52d592479
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/StructureView.java
@@ -0,0 +1,104 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import java.util.Iterator;
+
+import org.aspectj.asm.ProgramElementNode;
+
+/**
+ * @author Mik Kersten
+ */
+public abstract class StructureView {
+
+ private StructureViewNode rootNode = null;
+ private StructureViewNode activeNode = null;
+ protected StructureViewProperties viewProperties = null;
+ protected StructureViewRenderer renderer = null;
+
+ public StructureViewProperties getViewProperties() {
+ return viewProperties;
+ }
+
+ public StructureViewNode getRootNode() {
+ return rootNode;
+ }
+
+ public void setRootNode(StructureViewNode rootNode) {
+ this.rootNode = rootNode;
+ }
+
+ public void setViewProperties(StructureViewProperties viewProperties) {
+ this.viewProperties = viewProperties;
+ }
+
+ public void setRenderer(StructureViewRenderer renderer) {
+ this.renderer = renderer;
+ }
+
+ protected void notifyViewUpdated() {
+ if (renderer != null) renderer.updateView(this);
+ }
+
+ /**
+ * @return the view node corresponding to the active ProgramElementNode or null
+ */
+ public StructureViewNode getActiveNode() {
+ if (activeNode != null
+ && activeNode.getStructureNode() instanceof ProgramElementNode) {
+ return activeNode;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Searches from the root node of the view down in order to find matches.
+ *
+ * @return the first match
+ */
+ public StructureViewNode findCorrespondingViewNode(ProgramElementNode node) {
+ return findCorrespondingViewNodeHelper(rootNode, node);
+ }
+
+ private StructureViewNode findCorrespondingViewNodeHelper(StructureViewNode node, ProgramElementNode pNode) {
+
+ if (node != null
+ && node.getStructureNode() != null
+ && node.getStructureNode().equals(pNode)) {
+ return node;
+ }
+
+ if (node != null && node.getChildren() != null) {
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ StructureViewNode foundNode = findCorrespondingViewNodeHelper((StructureViewNode)it.next(), pNode);
+ if (foundNode != null) return foundNode;
+ }
+ }
+
+ return null;
+ }
+
+ public void setActiveNode(StructureViewNode activeNode) {
+ this.activeNode = activeNode;
+ if (renderer != null) renderer.setActiveNode(activeNode);
+ }
+
+ public void setActiveNode(StructureViewNode activeNode, int sourceLine) {
+ this.activeNode = activeNode;
+ if (renderer != null) renderer.setActiveNode(activeNode, sourceLine);
+ }
+}
+
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java b/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java
new file mode 100644
index 000000000..947d522ae
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/StructureViewManager.java
@@ -0,0 +1,255 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import java.util.*;
+import org.aspectj.ajde.*;
+import org.aspectj.ajde.ui.internal.*;
+import org.aspectj.asm.*;
+
+/**
+ * @author Mik Kersten
+ */
+public class StructureViewManager {
+
+ private TreeStructureViewBuilder treeViewBuilder;
+ private String buildConfigFilePath = null;
+
+ private NavigationHistoryModel historyModel = new NavigationHistoryModel();
+ private ArrayList structureViews = new ArrayList();
+ private FileStructureView defaultFileView = null;
+
+ private static final StructureViewProperties DEFAULT_VIEW_PROPERTIES;
+ private static final List AVAILABLE_RELATIONS;
+
+ public final StructureModelListener VIEW_LISTENER = new StructureModelListener() {
+ public void modelUpdated(StructureModel model) {
+ Ajde.getDefault().logEvent("updating structure views: " + structureViews);
+
+ if (defaultFileView != null) {
+ defaultFileView.setSourceFile(Ajde.getDefault().getEditorManager().getCurrFile());
+ }
+
+ for (Iterator it = structureViews.iterator(); it.hasNext(); ) {
+ treeViewBuilder.buildView((StructureView)it.next(), (StructureModel)model);
+ }
+ }
+ };
+
+ /**
+ * @param nodeFactory concrete factory for creating view nodes
+ */
+ public StructureViewManager(StructureViewNodeFactory nodeFactory) {
+ treeViewBuilder = new TreeStructureViewBuilder(nodeFactory);
+
+ StructureModelManager.INSTANCE.addListener(VIEW_LISTENER);
+ }
+
+ public void fireNavigateBackAction(StructureView view) {
+ ProgramElementNode backNode = historyModel.navigateBack();
+
+ if (backNode == null) {
+ Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("No node to navigate back to in history");
+ } else {
+ navigationAction(backNode, false);
+ }
+ }
+
+ public void fireNavigateForwardAction(StructureView view) {
+ ProgramElementNode forwardNode = historyModel.navigateForward();
+
+ if (forwardNode == null) {
+ Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("No node to navigate forward to in history");
+ } else {
+ navigationAction(forwardNode, false);
+ }
+ }
+
+ /**
+ * Only navigations of the default view are registered with
+ * the history.
+ */
+ public void fireNavigationAction(String newFilePath, int lineNumber) {
+ StructureNode currNode = Ajde.getDefault().getStructureModelManager().getStructureModel().findNodeForSourceLine(
+ newFilePath,
+ lineNumber);
+
+ if (currNode instanceof ProgramElementNode) {
+ navigationAction((ProgramElementNode)currNode, true);
+ }
+ }
+
+ /**
+ * History is recorded for {@link LinkNode} navigations.
+ */
+ public void fireNavigationAction(StructureNode structureNode) {
+ ProgramElementNode node = null;
+ boolean recordHistory = false;
+ if (structureNode instanceof LinkNode) {
+ node = ((LinkNode)structureNode).getProgramElementNode();
+ recordHistory = true;
+ } else if (structureNode instanceof ProgramElementNode) {
+ node = (ProgramElementNode)structureNode;
+ }
+ if (node != null) navigationAction(node, recordHistory);
+ }
+
+ /**
+ * Highlights the given node in all structure views. If the node represents code
+ * and as such is below the granularity visible in the view the parent is highlighted,
+ * along with the corresponding sourceline.
+ */
+ private void navigationAction(ProgramElementNode node, boolean recordHistory) {
+ if (node == null
+ || node == StructureModel.NO_STRUCTURE) {
+ Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("Source not available for node: " + node.getName());
+ return;
+ }
+ Ajde.getDefault().logEvent("navigating to node: " + node + ", recordHistory: " + recordHistory);
+ if (recordHistory) historyModel.navigateToNode(node);
+ if (defaultFileView != null && node.getSourceLocation() != null) {
+ String newFilePath = node.getSourceLocation().getSourceFile().getAbsolutePath();
+ if (defaultFileView.getSourceFile() != null
+ && !defaultFileView.getSourceFile().equals(newFilePath)) {
+ defaultFileView.setSourceFile(newFilePath);
+ treeViewBuilder.buildView(defaultFileView, StructureModelManager.INSTANCE.getStructureModel());
+ }
+ }
+
+ for (Iterator it = structureViews.iterator(); it.hasNext(); ) {
+ StructureView view = (StructureView)it.next();
+ if (!(view instanceof GlobalStructureView) || !recordHistory || defaultFileView == null) {
+ if (node.getProgramElementKind().equals(ProgramElementNode.Kind.CODE)) {
+ ProgramElementNode parentNode = (ProgramElementNode)node.getParent();
+ if (parentNode != null) {
+ StructureViewNode currNode = view.findCorrespondingViewNode(parentNode);
+ int lineOffset = node.getSourceLocation().getLine() - parentNode.getSourceLocation().getLine();
+ if (currNode != null) view.setActiveNode(currNode, lineOffset);
+ }
+ } else {
+ StructureViewNode currNode = view.findCorrespondingViewNode(node);
+ if (currNode != null) view.setActiveNode(currNode);
+ }
+ }
+ }
+ }
+
+ private ProgramElementNode getProgramElementNode(StructureViewNode node) {
+ if (node.getStructureNode() instanceof ProgramElementNode) {
+ return (ProgramElementNode)node.getStructureNode();
+ } else if (node.getStructureNode() instanceof LinkNode) {
+ return ((LinkNode)node.getStructureNode()).getProgramElementNode();
+ } else {
+ return null;
+ }
+ }
+
+ public void refreshView(StructureView view) {
+ StructureViewNode activeNode = view.getActiveNode();
+ treeViewBuilder.buildView(view, Ajde.getDefault().getStructureModelManager().getStructureModel());
+ view.setActiveNode(activeNode);
+ }
+
+ public StructureViewProperties getDefaultViewProperties() {
+ return DEFAULT_VIEW_PROPERTIES;
+ }
+
+ /**
+ * Returns the list of all available relations.
+ */
+ public List getAvailableRelations() {
+ return AVAILABLE_RELATIONS;
+ }
+
+ /**
+ * @param properties can not be null
+ */
+ public GlobalStructureView createGlobalView(GlobalViewProperties properties) {
+ GlobalStructureView view = new GlobalStructureView(properties);
+ structureViews.add(view);
+ return view;
+ }
+
+ /**
+ * @param sourceFilePath full path to corresponding source file
+ * @param properties if null default properties will be used
+ * @return always returns a view intance
+ */
+ public FileStructureView createViewForSourceFile(String sourceFilePath, StructureViewProperties properties) {
+ Ajde.getDefault().logEvent("creating view for file: " + sourceFilePath);
+ if (properties == null) properties = DEFAULT_VIEW_PROPERTIES;
+ FileStructureView view = new FileStructureView(properties);
+ view.setSourceFile(sourceFilePath);
+ treeViewBuilder.buildView(view, StructureModelManager.INSTANCE.getStructureModel());
+ structureViews.add(view);
+ return view;
+ }
+
+ /**
+ * @return true if the view was found and removed, false otherwise
+ */
+ public boolean deleteView(StructureView view) {
+ return structureViews.remove(view);
+ }
+
+ public void setDefaultFileView(FileStructureView defaultFileView) {
+ this.defaultFileView = defaultFileView;
+ }
+
+ static {
+ AVAILABLE_RELATIONS = new ArrayList();
+ AVAILABLE_RELATIONS.add(AdviceAssociation.METHOD_CALL_SITE_RELATION);
+ AVAILABLE_RELATIONS.add(AdviceAssociation.METHOD_RELATION);
+ AVAILABLE_RELATIONS.add(AdviceAssociation.CONSTRUCTOR_CALL_SITE_RELATION);
+ AVAILABLE_RELATIONS.add(AdviceAssociation.CONSTRUCTOR_RELATION);
+ AVAILABLE_RELATIONS.add(AdviceAssociation.FIELD_ACCESS_RELATION);
+ AVAILABLE_RELATIONS.add(AdviceAssociation.INITIALIZER_RELATION);
+ AVAILABLE_RELATIONS.add(AdviceAssociation.HANDLER_RELATION);
+ AVAILABLE_RELATIONS.add(AdviceAssociation.INTRODUCTION_RELATION);
+ AVAILABLE_RELATIONS.add(IntroductionAssociation.INTRODUCES_RELATION);
+ AVAILABLE_RELATIONS.add(InheritanceAssociation.IMPLEMENTS_RELATION);
+ AVAILABLE_RELATIONS.add(InheritanceAssociation.INHERITS_RELATION);
+ AVAILABLE_RELATIONS.add(InheritanceAssociation.INHERITS_MEMBERS_RELATION);
+ AVAILABLE_RELATIONS.add(ReferenceAssociation.USES_POINTCUT_RELATION);
+ AVAILABLE_RELATIONS.add(ReferenceAssociation.IMPORTS_RELATION);
+
+ DEFAULT_VIEW_PROPERTIES = new StructureViewProperties();
+ DEFAULT_VIEW_PROPERTIES.setRelations(AVAILABLE_RELATIONS);
+ }
+}
+
+// this.multiFileViewMode = multiFileViewMode;
+// if (!multiFileViewMode) {
+// structureViews.add(DEFAULT_FILE_VIEW);
+// structureViews.add(DECLARATION_VIEW);
+// structureViews.add(CROSSCUTTING_VIEW);
+// structureViews.add(INHERITANCE_VIEW);
+// }
+
+// public GlobalStructureView getGlobalStructureView(StructureViewProperties.Hierarchy hierarchy) {
+// if (hierarchy == StructureViewProperties.Hierarchy.CROSSCUTTING) {
+// return CROSSCUTTING_VIEW;
+// } else if (hierarchy == StructureViewProperties.Hierarchy.INHERITANCE) {
+// return INHERITANCE_VIEW;
+// } else {
+// return DECLARATION_VIEW;
+// }
+// }
+
+// public FileStructureView getDefaultFileStructureView() {
+// return DEFAULT_FILE_VIEW;
+// }
+
+
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureViewNode.java b/ajde/src/org/aspectj/ajde/ui/StructureViewNode.java
new file mode 100644
index 000000000..5676078bc
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/StructureViewNode.java
@@ -0,0 +1,43 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import org.aspectj.asm.*;
+import java.util.List;
+
+/**
+ * @author Mik Kersten
+ */
+public interface StructureViewNode {
+
+ public StructureNode getStructureNode();
+
+ public AbstractIcon getIcon();
+
+ /**
+ * Add a child node.
+ */
+ public void add(StructureViewNode child);
+
+ /**
+ * Remove a child node.
+ */
+ public void remove(StructureViewNode child);
+
+ /**
+ * @return an empty list if there are no children
+ */
+ public List getChildren();
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java b/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java
new file mode 100644
index 000000000..f2fa818c9
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/StructureViewNodeFactory.java
@@ -0,0 +1,58 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import org.aspectj.asm.*;
+import java.util.List;
+
+/**
+ * @author Mik Kersten
+ */
+public abstract class StructureViewNodeFactory {
+
+ private AbstractIconRegistry iconRegistry;
+
+ public StructureViewNodeFactory(AbstractIconRegistry iconRegistry) {
+ this.iconRegistry = iconRegistry;
+ }
+
+ public StructureViewNode createNode(StructureNode node) {
+ return createNode(node, null);
+ }
+
+ public StructureViewNode createNode(StructureNode node, List children) {
+ AbstractIcon icon;
+ if (node instanceof ProgramElementNode) {
+ ProgramElementNode pNode = (ProgramElementNode)node;
+ icon = iconRegistry.getStructureIcon(pNode.getProgramElementKind(), pNode.getAccessibility());
+ } else if (node instanceof RelationNode) {
+ RelationNode relationNode = (RelationNode)node;
+ icon = iconRegistry.getRelationIcon(relationNode.getRelation());
+ } else if (node instanceof LinkNode) {
+ LinkNode linkNode = (LinkNode)node;
+ icon = iconRegistry.getStructureIcon(
+ linkNode.getProgramElementNode().getProgramElementKind(),
+ linkNode.getProgramElementNode().getAccessibility());
+ } else {
+ icon = new AbstractIcon(null);
+ }
+ return createConcreteNode(node, icon, children);
+ }
+
+ /**
+ * Implementors must override this method in order to create new nodes.
+ */
+ protected abstract StructureViewNode createConcreteNode(StructureNode node, AbstractIcon icon, List children);
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureViewProperties.java b/ajde/src/org/aspectj/ajde/ui/StructureViewProperties.java
new file mode 100644
index 000000000..e41faa159
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/StructureViewProperties.java
@@ -0,0 +1,255 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import java.util.*;
+import java.io.*;
+import org.aspectj.asm.*;
+
+/**
+ * Nested properties use the typesafe enum pattern.
+ *
+ * @author Mik Kersten
+ */
+public class StructureViewProperties {
+
+ /**
+ * @deprecated
+ */
+ public static final String SORT_DECLARATIONAL = StructureViewProperties.Sorting.DECLARATIONAL.toString();
+
+ /**
+ * @deprecated
+ */
+ public void setSorting(String sorting) { }
+
+ private List relations = new ArrayList();
+ private List filteredMemberAccessibility = new ArrayList();
+ private List filteredMemberModifiers = new ArrayList();
+ private List filteredMemberKinds = new ArrayList();
+ private List grouping = new ArrayList();
+ private Sorting sorting = Sorting.DECLARATIONAL;
+ private Granularity granularity = Granularity.MEMBER;
+
+ public List getRelations() {
+ return relations;
+ }
+
+ public void setRelations(List relations) {
+ this.relations = relations;
+ }
+
+ public void addRelation(Relation relation) {
+ relations.add(relation);
+ }
+
+ public void removeRelation(Relation relation) {
+ relations.remove(relation);
+ }
+
+ public void setFilteredMemberAccessibility(List memberVisibility) {
+ this.filteredMemberAccessibility = memberVisibility;
+ }
+
+ public List getFilteredMemberAccessibility() {
+ return filteredMemberAccessibility;
+ }
+
+ public void addFilteredMemberAccessibility(ProgramElementNode.Accessibility accessibility) {
+ this.filteredMemberAccessibility.add(accessibility);
+ }
+
+ public void removeFilteredMemberAccessibility(ProgramElementNode.Accessibility accessibility) {
+ this.filteredMemberAccessibility.remove(accessibility);
+ }
+
+ public List getFilteredMemberModifiers() {
+ return filteredMemberModifiers;
+ }
+
+ public void setFilteredMemberModifiers(List memberModifiers) {
+ this.filteredMemberModifiers = memberModifiers;
+ }
+
+ public void addFilteredMemberModifiers(ProgramElementNode.Modifiers modifiers) {
+ this.filteredMemberModifiers.add(modifiers);
+ }
+
+ public void removeFilteredMemberModifiers(ProgramElementNode.Modifiers modifiers) {
+ this.filteredMemberModifiers.remove(modifiers);
+ }
+
+ public StructureViewProperties.Sorting getSorting() {
+ return sorting;
+ }
+
+ public void setSorting(StructureViewProperties.Sorting sorting) {
+ this.sorting = sorting;
+ }
+
+ public List getFilteredMemberKinds() {
+ return filteredMemberKinds;
+ }
+
+ public void setFilteredMemberKinds(List memberKinds) {
+ this.filteredMemberKinds = memberKinds;
+ }
+
+ public void addFilteredMemberKind(ProgramElementNode.Kind kind) {
+ this.filteredMemberKinds.add(kind);
+ }
+
+ public void removeFilteredMemberKind(ProgramElementNode.Kind kind) {
+ this.filteredMemberKinds.remove(kind);
+ }
+
+ public List getGrouping() {
+ return grouping;
+ }
+
+ public void setGrouping(List grouping) {
+ this.grouping = grouping;
+ }
+
+
+ public void addGrouping(Grouping grouping) {
+ this.grouping.add(grouping);
+ }
+
+ public void removeGrouping(Grouping grouping) {
+ this.grouping.remove(grouping);
+ }
+
+ public Granularity getGranularity() {
+ return granularity;
+ }
+
+ public void setGranularity(Granularity granularity) {
+ this.granularity = granularity;
+ }
+
+ public String getName() {
+ return "<unnamed view>";
+ }
+
+ public String toString() {
+ return "\nView Properties:"
+ + "\n-> sorting: " + sorting
+ + "\n-> grouping: " + grouping
+ + "\n-> filtered member kinds: " + filteredMemberKinds
+ + "\n-> filtered member accessibility: " + filteredMemberAccessibility
+ + "\n-> filtered member modifiers: " + filteredMemberModifiers
+ + "\n-> relations: " + relations;
+ }
+
+ public static class Hierarchy {
+
+ public static final Hierarchy DECLARATION = new Hierarchy("package hierarchy");
+ public static final Hierarchy CROSSCUTTING = new Hierarchy("crosscutting structure");
+ public static final Hierarchy INHERITANCE = new Hierarchy("type hierarchy");
+ public static final Hierarchy[] ALL = { DECLARATION, CROSSCUTTING, INHERITANCE };
+
+ private final String name;
+
+ private Hierarchy(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ // The 4 declarations below are necessary for serialization
+ private static int nextOrdinal = 0;
+ private final int ordinal = nextOrdinal++;
+ private Object readResolve() throws ObjectStreamException {
+ return ALL[ordinal];
+ }
+ }
+
+ public static class Grouping {
+
+ public static final Grouping KIND = new Grouping("group by kind");
+ public static final Grouping VISIBILITY = new Grouping("group by visibility");
+ public static final Grouping[] ALL = { KIND, VISIBILITY };
+
+ private final String name;
+
+ private Grouping(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ // The 4 declarations below are necessary for serialization
+ private static int nextOrdinal = 0;
+ private final int ordinal = nextOrdinal++;
+ private Object readResolve() throws ObjectStreamException {
+ return ALL[ordinal];
+ }
+ }
+
+ public static class Sorting {
+
+ public static final Sorting ALPHABETICAL = new Sorting("sort alphabetically");
+ public static final Sorting DECLARATIONAL = new Sorting("sort declarationally");
+ public static final Sorting[] ALL = { ALPHABETICAL, DECLARATIONAL };
+
+ private final String name;
+
+ private Sorting(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ // The 4 declarations below are necessary for serialization
+ private static int nextOrdinal = 0;
+ private final int ordinal = nextOrdinal++;
+ private Object readResolve() throws ObjectStreamException {
+ return ALL[ordinal];
+ }
+ }
+
+ public static class Granularity {
+
+ public static final Granularity PACKAGE = new Granularity("package");
+ public static final Granularity FILE = new Granularity("file");
+ public static final Granularity TYPE = new Granularity("type");
+ public static final Granularity MEMBER = new Granularity("member");
+ public static final Granularity[] ALL = { PACKAGE, FILE, TYPE, MEMBER };
+
+ private final String name;
+
+ private Granularity(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ // The 4 declarations below are necessary for serialization
+ private static int nextOrdinal = 0;
+ private final int ordinal = nextOrdinal++;
+ private Object readResolve() throws ObjectStreamException {
+ return ALL[ordinal];
+ }
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureViewRenderer.java b/ajde/src/org/aspectj/ajde/ui/StructureViewRenderer.java
new file mode 100644
index 000000000..eb0b2f819
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/StructureViewRenderer.java
@@ -0,0 +1,49 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import java.util.EventListener;
+
+/**
+ * View renderers get notified of structure view update events and should
+ * update the display of the structure view accordingly.
+ *
+ * @author Mik Kersten
+ */
+public interface StructureViewRenderer extends EventListener {
+
+ /**
+ * Implementors should updated the display of the corresponding
+ * file structure view.
+ */
+ public void updateView(StructureView structureView);
+
+ /**
+ * Highlights and selects the given node as active. What "active"
+ * means depends on the renderer: a typical activation should cause
+ * the corresponding node's sourceline to be highlighted in the
+ * active editor.
+ */
+ public void setActiveNode(StructureViewNode node);
+
+ /**
+ * Same behavior as <CODE>setActiveNode(StructureViewNode)</CODE> but
+ * highlights a particular line within the span of the node.
+ *
+ * @param lineOffset number of lines after the begin and before the
+ * end line of the corresponding <CODE>StructureNode</CODE>.
+ */
+ public void setActiveNode(StructureViewNode activeNode, int lineOffset);
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/UserPreferencesAdapter.java b/ajde/src/org/aspectj/ajde/ui/UserPreferencesAdapter.java
new file mode 100644
index 000000000..ba02e55b3
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/UserPreferencesAdapter.java
@@ -0,0 +1,67 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde.ui;
+
+import java.util.List;
+
+/**
+ * This interface needs to be implemented by an IDE extension in order for AJDE
+ * to store properties in a way that matches the IDE's property storing facilities.
+ *
+ * @author Mik Kersten
+ */
+public interface UserPreferencesAdapter {
+
+ /**
+ * Retrieves a global IDE option.
+ */
+ public String getGlobalPreference(String name);
+
+ /**
+ * Retrieves a global IDE option.
+ */
+ public List getGlobalMultivalPreference(String name);
+
+ /**
+ * Sets a global IDE option with a single value.
+ */
+ public void setGlobalPreference(String name, String value);
+
+ /**
+ * Sets a global IDE option with multiple values.
+ */
+ public void setGlobalMultivalPreference(String name, List values);
+
+ /**
+ * Retrieves an option for the currently active project.
+ */
+ public String getProjectPreference(String name);
+
+ /**
+ * Retrieves an option for the currently active project.
+ */
+ public List getProjectMultivalPreference(String name);
+
+ /**
+ * Sets an option for the currently active project.
+ */
+ public void setProjectPreference(String name, String value);
+
+ /**
+ * Sets an option for the currently active project.
+ */
+ public void setProjectMultivalPreference(String name, List values);
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/internal/AjcBuildOptions.java b/ajde/src/org/aspectj/ajde/ui/internal/AjcBuildOptions.java
new file mode 100644
index 000000000..3093d09a0
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/internal/AjcBuildOptions.java
@@ -0,0 +1,136 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde.ui.internal;
+
+import org.aspectj.ajde.*;
+import org.aspectj.ajde.ui.*;
+
+public class AjcBuildOptions implements BuildOptionsAdapter {
+
+ private UserPreferencesAdapter preferencesAdapter = null;
+
+ private static final String AJC = "ajc";
+ private static final String USE_JAVAC_MODE = AJC + ".useJavacMode";
+ private static final String WORKING_DIR = AJC + ".workingDir";
+ private static final String PREPROCESS_MODE = AJC + ".preprocessMode";
+ private static final String CHARACTER_ENCODING = AJC + ".characterEncoding";
+ private static final String SOURCE_ONE_POINT_FOUR_MODE = AJC + ".sourceOnePointFourMode";
+ private static final String LENIENT_MODE = AJC + ".lenientSpecMode";
+ private static final String STRICT_MODE = AJC + ".strictSpecMode";
+ private static final String PORTING_MODE = AJC + ".portingMode";
+ private static final String VERBOSE_MODE = AJC + ".verboseMode";
+ private static final String NONSTANDARD_OPTIONS = AJC + ".nonStandardOptions";
+
+ public AjcBuildOptions(UserPreferencesAdapter userPreferencesAdapter) {
+ this.preferencesAdapter = userPreferencesAdapter;
+ }
+
+ public boolean getUseJavacMode() {
+ return getBooleanOptionVal(USE_JAVAC_MODE);
+ }
+
+ public void setUseJavacMode(boolean value) {
+ setBooleanOptionVal(USE_JAVAC_MODE, value);
+ }
+
+ public String getWorkingOutputPath() {
+ return preferencesAdapter.getProjectPreference(WORKING_DIR);
+ }
+
+ public void setWorkingDir(String path) {
+ preferencesAdapter.setProjectPreference(WORKING_DIR, path);
+ }
+
+ public boolean getPreprocessMode() {
+ return getBooleanOptionVal(PREPROCESS_MODE);
+ }
+
+ public void setPreprocessMode(boolean value) {
+ setBooleanOptionVal(PREPROCESS_MODE, value);
+ }
+
+ public String getCharacterEncoding() {
+ return preferencesAdapter.getProjectPreference(CHARACTER_ENCODING);
+ }
+
+ public void setCharacterEncoding(String value) {
+ preferencesAdapter.setProjectPreference(CHARACTER_ENCODING, value);
+ }
+
+ public boolean getSourceOnePointFourMode() {
+ return getBooleanOptionVal(SOURCE_ONE_POINT_FOUR_MODE);
+ }
+
+ public void setSourceOnePointFourMode(boolean value) {
+ setBooleanOptionVal(SOURCE_ONE_POINT_FOUR_MODE, value);
+ }
+
+ public boolean getLenientSpecMode() {
+ return getBooleanOptionVal(LENIENT_MODE);
+ }
+
+ public void setLenientSpecMode(boolean value) {
+ setBooleanOptionVal(LENIENT_MODE, value);
+ }
+
+ public boolean getStrictSpecMode() {
+ return getBooleanOptionVal(STRICT_MODE);
+ }
+
+ public void setStrictSpecMode(boolean value) {
+ setBooleanOptionVal(STRICT_MODE, value);
+ }
+
+ public boolean getPortingMode() {
+ return getBooleanOptionVal(PORTING_MODE);
+ }
+
+ public void setPortingMode(boolean value) {
+ setBooleanOptionVal(PORTING_MODE, value);
+ }
+
+ public boolean getVerboseMode() {
+ return getBooleanOptionVal(VERBOSE_MODE);
+ }
+
+ public void setVerboseMode(boolean value) {
+ setBooleanOptionVal(VERBOSE_MODE, value);
+ }
+
+ public String getNonStandardOptions() {
+ return preferencesAdapter.getProjectPreference(NONSTANDARD_OPTIONS);
+ }
+
+ public void setNonStandardOptions(String value) {
+ preferencesAdapter.setProjectPreference(NONSTANDARD_OPTIONS, value);
+ }
+
+ private boolean getBooleanOptionVal(String name) {
+ if (preferencesAdapter.getProjectPreference(name) != null) {
+ return preferencesAdapter.getProjectPreference(name).equals("true");
+ } else {
+ return false;
+ }
+ }
+
+ private void setBooleanOptionVal(String name, boolean value) {
+ if (value) {
+ preferencesAdapter.setProjectPreference(name, "true");
+ } else {
+ preferencesAdapter.setProjectPreference(name, "false");
+ }
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/internal/BrowserViewProperties.java b/ajde/src/org/aspectj/ajde/ui/internal/BrowserViewProperties.java
new file mode 100644
index 000000000..794afb5d5
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/internal/BrowserViewProperties.java
@@ -0,0 +1,162 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde.ui.internal;
+
+import java.io.*;
+import java.util.*;
+
+import org.aspectj.ajde.Ajde;
+
+/**
+ * @deprecated this class should be removed from the source tree
+ */
+public class BrowserViewProperties {
+ public static final String FILE_NAME = "/.ajbrowser";
+ private final String VALUE_SEP = ";";
+ private Properties properties = new Properties();
+
+ public BrowserViewProperties() {
+ try {
+ if (new File(getPropertiesFilePath()).exists()) {
+ properties.load(new FileInputStream(getPropertiesFilePath()));
+ }
+ } catch (IOException ioe) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not read properties", ioe);
+ }
+ }
+
+ public List getStructureViewOrdering() {
+ return getPropertyValues("structureView.ordering");
+ }
+
+ public void setStructureViewOrdering(List ordering) {
+ storeProperty("structureView.ordering", ordering);
+ }
+
+// /**
+// * Returns default values if no associations are saved.
+// */
+// public List getActiveAssociations() {
+// List associations = getPropertyValues("structureView.associations");
+// if (associations.size() == 0) {
+// associations.add(Advice.METHOD_CALL_SITE_RELATION.toString());
+// associations.add(Advice.METHOD_RELATION.toString());
+// associations.add(Advice.CONSTRUCTOR_CALL_SITE_RELATION.toString());
+// associations.add(Advice.CONSTRUCTOR_RELATION.toString());
+// associations.add(Advice.FIELD_ACCESS_RELATION.toString());
+// associations.add(Advice.INITIALIZER_RELATION.toString());
+// associations.add(Advice.HANDLER_RELATION.toString());
+// associations.add(Advice.INTRODUCTION_RELATION.toString());
+// associations.add(Introduction.INTRODUCES_RELATION.toString());
+// associations.add(Inheritance.IMPLEMENTS_RELATION.toString());
+// associations.add(Inheritance.INHERITS_RELATION.toString());
+// associations.add(Inheritance.INHERITS_MEMBERS_RELATION.toString());
+// associations.add(Reference.USES_POINTCUT_RELATION.toString());
+// associations.add(Reference.IMPORTS_RELATION.toString());
+// }
+// return associations;
+// }
+
+ public void setActiveAssociations(List associations) {
+ storeProperty("structureView.associations", associations);
+ }
+
+ public void setActiveFilteredMemberKinds(List associations) {
+ storeProperty("structureView.filtering.memberKinds", associations);
+ }
+
+ public String getActiveHierarchy() {
+ return getProperty("structureView.hierarchy");
+ }
+
+ public void setActiveHierarchy(String hierarchy) {
+ storeProperty("structureView.hierarchy", hierarchy);
+ }
+
+ public List getActiveVisibility() {
+ return getPropertyValues("structureView.filtering.accessibility");
+ }
+
+ public void setActiveVisiblity(List visibility) {
+ storeProperty("structureView.filtering.accessibility", visibility);
+ }
+
+ public List getActiveModifiers() {
+ return getPropertyValues("structureView.filtering.modifiers");
+ }
+
+ public List getActiveFilteredMemberKinds() {
+ return getPropertyValues("structureView.filtering.memberKinds");
+ }
+
+ public String getActiveGranularity() {
+ return getProperty("structureView.granularity");
+ }
+
+ public void setActiveGranularity(String granularity) {
+ storeProperty("structureView.granularity", granularity);
+ }
+
+ public void setActiveModifiers(List modifiers) {
+ storeProperty("structureView.filtering.modifiers", modifiers);
+ }
+
+ protected String getProperty(String name) {
+ return properties.getProperty(name);
+ }
+
+ protected List getPropertyValues(String name) {
+ List values = new ArrayList();
+ String valuesString = properties.getProperty(name);
+ if (valuesString != null && !valuesString.trim().equals("")) {
+ StringTokenizer st = new StringTokenizer(valuesString, VALUE_SEP);
+ while (st.hasMoreTokens()) {
+ values.add(st.nextToken());
+ }
+ }
+ return values;
+ }
+
+ private void storeProperty(String name, String value) {
+ properties.setProperty(name, value);
+ saveProperties();
+ }
+
+ private void storeProperty(String name, List values) {
+ String valuesString = "";
+ for (Iterator it = values.iterator(); it.hasNext(); ) {
+ valuesString += (String)it.next() + ';';
+ }
+ properties.setProperty(name, valuesString);
+ saveProperties();
+ }
+
+ private void saveProperties() {
+ try {
+ properties.store(new FileOutputStream(getPropertiesFilePath()), "AJDE Settings");
+ } catch (IOException ioe) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not write properties", ioe);
+ }
+ }
+
+ protected String getPropertiesFilePath() {
+ String path = System.getProperty("user.home");
+ if (path == null) {
+ path = ".";
+ }
+ return path + FILE_NAME;
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/internal/NavigationHistoryModel.java b/ajde/src/org/aspectj/ajde/ui/internal/NavigationHistoryModel.java
new file mode 100644
index 000000000..653f21fd8
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/internal/NavigationHistoryModel.java
@@ -0,0 +1,56 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.internal;
+
+import java.util.*;
+import org.aspectj.asm.*;
+
+/**
+ * @author Mik Kersten
+ */
+public class NavigationHistoryModel {
+
+ private ProgramElementNode currNode = null;
+ private Stack backHistory = new Stack();
+ private Stack forwardHistory = new Stack();
+
+ /**
+ * @return null if the history is empty
+ */
+ public ProgramElementNode navigateBack() {
+ if (backHistory.isEmpty() || currNode == null) return null;
+
+ forwardHistory.push(currNode);
+ currNode = (ProgramElementNode)backHistory.pop();
+ return currNode;
+ }
+
+ /**
+ * @return null if the history is empty
+ */
+ public ProgramElementNode navigateForward() {
+ if (forwardHistory.isEmpty() || currNode == null) return null;
+
+ backHistory.push(currNode);
+ currNode = (ProgramElementNode)forwardHistory.pop();
+ return currNode;
+ }
+
+
+ public void navigateToNode(ProgramElementNode toNode) {
+ if (currNode != null) backHistory.push(currNode);
+ currNode = toNode;
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java b/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java
new file mode 100644
index 000000000..c2f9bcca6
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/internal/TreeStructureViewBuilder.java
@@ -0,0 +1,454 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.internal;
+
+import java.util.*;
+
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.*;
+
+/**
+ * @author Mik Kersten
+ */
+public class TreeStructureViewBuilder {
+
+ private StructureViewNodeFactory nodeFactory;
+
+ public TreeStructureViewBuilder(StructureViewNodeFactory nodeFactory) {
+ this.nodeFactory = nodeFactory;
+ }
+
+ /**
+ * @todo get rid of instanceof tests
+ */
+ public void buildView(StructureView view, StructureModel model) {
+ StructureViewProperties properties = view.getViewProperties();
+ StructureNode modelRoot = null;
+ boolean noStructure = false;
+ if (isFileView(view)) {
+ FileStructureView fileView = (FileStructureView)view;
+ if (fileView.getSourceFile() == null) {
+ modelRoot = StructureModel.NO_STRUCTURE;
+ noStructure = true;
+ } else {
+ modelRoot = model.findRootNodeForSourceFile(fileView.getSourceFile());
+ }
+ } else {
+ modelRoot = model.getRoot();
+ }
+
+ StructureViewNode viewRoot = null;
+ if (!isFileView(view)) {
+ StructureViewProperties.Hierarchy hierarchy
+ = ((GlobalStructureView)view).getGlobalViewProperties().getHierarchy();
+ if (hierarchy.equals(StructureViewProperties.Hierarchy.CROSSCUTTING)
+ || hierarchy.equals(StructureViewProperties.Hierarchy.INHERITANCE)) {
+ viewRoot = buildCustomTree((GlobalStructureView)view, model);
+ }
+ }
+ if (viewRoot == null) {
+ viewRoot = createViewNode(modelRoot, view.getViewProperties());//modelRoot;
+ }
+
+ if (view.getViewProperties().getSorting() == StructureViewProperties.Sorting.ALPHABETICAL
+ || (!isFileView(view) &&
+ ((GlobalStructureView)view).getGlobalViewProperties().getHierarchy().equals(StructureViewProperties.Hierarchy.DECLARATION))) {
+ sortView(viewRoot, ALPHABETICAL_COMPARATOR);
+ } else {
+ sortView(viewRoot, DECLARATIONAL_COMPARATOR);
+ }
+
+ addPackageNode(view, viewRoot);
+ view.setRootNode(viewRoot);
+ }
+
+ private void addPackageNode(StructureView view, StructureViewNode viewRoot) {
+ if (isFileView(view)) {
+ ProgramElementNode fileNode = (ProgramElementNode)viewRoot.getStructureNode();
+
+ StructureNode parentNode = fileNode.getParent();
+ if (parentNode instanceof ProgramElementNode
+ && ((ProgramElementNode)parentNode).getProgramElementKind().equals(ProgramElementNode.Kind.PACKAGE)) {
+ String name = ((ProgramElementNode)parentNode).getName();
+ ProgramElementNode packageNode = new ProgramElementNode(name, ProgramElementNode.Kind.PACKAGE, null);
+ packageNode.setSourceLocation(fileNode.getSourceLocation());
+ StructureViewNode packageViewNode = createViewNode(
+ packageNode,
+ view.getViewProperties()
+ );
+ viewRoot.getChildren().add(0, packageViewNode);
+ };
+ }
+ }
+
+ private StructureViewNode createViewNode(StructureNode node, StructureViewProperties properties) {
+ if (node == null) return null;
+ List children = new ArrayList();
+ if (node instanceof ProgramElementNode) {
+ ProgramElementNode pNode = (ProgramElementNode)node;
+ if (pNode.getRelations() != null) {
+ for (Iterator it = pNode.getRelations().iterator(); it.hasNext(); ) {
+ StructureNode structureNode = (StructureNode)it.next();
+ if (acceptNode(structureNode, properties)) {
+ children.add(createViewNode(structureNode, properties));
+ }
+ }
+ }
+ if (pNode.isRunnable() && pNode.getParent() != null) {
+ ProgramElementNode parent = (ProgramElementNode)pNode.getParent();
+ if (parent.getProgramElementKind().equals(ProgramElementNode.Kind.CLASS)
+ || parent.getProgramElementKind().equals(ProgramElementNode.Kind.ASPECT)) {
+ parent.setRunnable(true);
+ pNode.setRunnable(false);
+ }
+ }
+ }
+ if (node.getChildren() != null) {
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ StructureNode structureNode = (StructureNode)it.next();
+ if (acceptNode(structureNode, properties)) {
+ children.add(createViewNode(structureNode, properties));
+ }
+ }
+ }
+ StructureViewNode viewNode = nodeFactory.createNode(node, children);//new TreeViewNode(root, null, children);
+ return viewNode;
+ }
+
+ /**
+ * @todo get rid of this test, fix polymorphism
+ */
+ private boolean isFileView(StructureView view) {
+ return view instanceof FileStructureView
+ && !(view instanceof GlobalStructureView);
+ }
+
+ private boolean acceptGranularity(ProgramElementNode.Kind kind, StructureViewProperties.Granularity granularity) {
+ if (kind == ProgramElementNode.Kind.CODE) return false;
+
+ if (granularity == StructureViewProperties.Granularity.MEMBER) {
+ return true;
+ } else if (granularity == StructureViewProperties.Granularity.TYPE
+ && (kind == ProgramElementNode.Kind.PROJECT
+ || kind == ProgramElementNode.Kind.PACKAGE
+ || kind.isSourceFileKind()
+ || kind.isTypeKind())) {
+ return true;
+ } else if (granularity == StructureViewProperties.Granularity.FILE
+ && (kind == ProgramElementNode.Kind.PROJECT
+ || kind == ProgramElementNode.Kind.PACKAGE
+ || kind.isSourceFileKind())) {
+ return true;
+ } else if (granularity == StructureViewProperties.Granularity.PACKAGE
+ && (kind == ProgramElementNode.Kind.PROJECT
+ || kind == ProgramElementNode.Kind.PACKAGE)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private boolean acceptNode(StructureNode node, StructureViewProperties properties) {
+ if (node instanceof ProgramElementNode) {
+ ProgramElementNode pNode = (ProgramElementNode)node;
+ if (!acceptGranularity(pNode.getProgramElementKind(), properties.getGranularity())) {
+ return false;
+ } else if (pNode.isMemberKind()) {
+ if (properties.getFilteredMemberAccessibility().contains(pNode.getAccessibility())) {
+ return false;
+ }
+ if (properties.getFilteredMemberKinds().contains(pNode.getProgramElementKind())) {
+ return false;
+ }
+ for (Iterator it = pNode.getModifiers().iterator(); it.hasNext(); ) {
+ if (properties.getFilteredMemberModifiers().contains(it.next())) {
+ return false;
+ }
+ }
+ }
+ } else if (node instanceof RelationNode) {
+ Relation relation = ((RelationNode)node).getRelation();
+ return properties.getRelations().contains(relation);
+ } else {
+ return true;
+ }
+ return true;
+ }
+
+ private void sortView(StructureViewNode node, Comparator comparator) {
+ if (node == null || node.getChildren() == null) return;
+ Collections.sort(node.getChildren(), comparator);
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ StructureViewNode nextNode = (StructureViewNode)it.next();
+ if (nextNode != null) sortView(nextNode, comparator);
+ }
+ }
+
+ private StructureViewNode buildCustomTree(GlobalStructureView view, StructureModel model) {
+ StructureNode rootNode = model.getRoot();
+ StructureViewNode treeNode = nodeFactory.createNode(rootNode);
+
+ List rootNodes = new ArrayList();
+ getRoots(rootNode, rootNodes, view.getGlobalViewProperties().getHierarchy());
+
+ for (Iterator it = rootNodes.iterator(); it.hasNext(); ) {
+ if (view.getGlobalViewProperties().getHierarchy().equals(StructureViewProperties.Hierarchy.CROSSCUTTING)) {
+ treeNode.add(getCrosscuttingChildren((StructureNode)it.next()));
+ } else if (view.getGlobalViewProperties().getHierarchy().equals(StructureViewProperties.Hierarchy.INHERITANCE)) {
+ treeNode.add(getInheritanceChildren(
+ (StructureNode)it.next(),
+ view.getViewProperties().getRelations())
+ );
+ }
+ }
+ return treeNode;
+ }
+
+ private void getRoots(StructureNode rootNode, List roots, StructureViewProperties.Hierarchy hierarchy) {
+ if (rootNode != null && rootNode.getChildren() != null) {
+ for (Iterator it = rootNode.getChildren().iterator(); it.hasNext(); ) {
+ StructureNode node = (StructureNode)it.next();
+ if (node instanceof ProgramElementNode) {
+ if (acceptNodeAsRoot((ProgramElementNode)node, hierarchy)) {
+ ProgramElementNode pNode = (ProgramElementNode)node;
+ List relations = pNode.getRelations();
+ String delimiter = "";
+ if (hierarchy.equals(StructureViewProperties.Hierarchy.CROSSCUTTING)) {
+ delimiter = "uses pointcut";
+ } else if (hierarchy.equals(StructureViewProperties.Hierarchy.INHERITANCE)) {
+ delimiter = "inherits";
+ }
+ if (relations != null && relations.toString().indexOf(delimiter) == -1) {
+ boolean found = false;
+ for (Iterator it2 = roots.iterator(); it2.hasNext(); ) {
+ if (((ProgramElementNode)it2.next()).equals(pNode)) found = true;
+ }
+ if (!found) roots.add(pNode);
+ }
+ }
+ }
+ getRoots(node, roots, hierarchy);
+ }
+ }
+ }
+
+ public boolean acceptNodeAsRoot(ProgramElementNode node, StructureViewProperties.Hierarchy hierarchy) {
+ if (hierarchy.equals(StructureViewProperties.Hierarchy.CROSSCUTTING)) {
+ return node.getProgramElementKind().equals(ProgramElementNode.Kind.ADVICE)
+ || node.getProgramElementKind().equals(ProgramElementNode.Kind.POINTCUT);
+ } else if (hierarchy.equals(StructureViewProperties.Hierarchy.INHERITANCE)) {
+ return node.getProgramElementKind().equals(ProgramElementNode.Kind.CLASS);
+ } else {
+ return false;
+ }
+ }
+
+ private StructureViewNode getInheritanceChildren(StructureNode node, List associations) {
+ StructureViewNode treeNode = nodeFactory.createNode(node);
+ //StructureViewNode treeNode = new StructureViewNodeAdapter(node);
+ List relations = ((ProgramElementNode)node).getRelations();
+ if (relations != null) {
+ for (Iterator it = relations.iterator(); it.hasNext(); ) {
+ RelationNode relation = (RelationNode)it.next();
+ if (relation.getName().equals("is inherited by")) {
+ for (Iterator it2 = relation.getChildren().iterator(); it2.hasNext(); ) {
+ ProgramElementNode pNode = ((LinkNode)it2.next()).getProgramElementNode();
+ StructureViewNode newNode = getInheritanceChildren(pNode, associations);
+ StructureViewNode typeChildren = buildTree(newNode.getStructureNode(), associations);
+ for (int i = 0; i < typeChildren.getChildren().size(); i++) {
+ newNode.add((StructureViewNode)typeChildren.getChildren().get(i));
+ }
+ treeNode.add(newNode);
+ }
+ }
+ }
+ }
+ return treeNode;
+ }
+
+ private StructureViewNode getCrosscuttingChildren(StructureNode node) {
+ //StructureViewNodeAdapter treeNode = new StructureViewNodeAdapter(node);
+ StructureViewNode treeNode = nodeFactory.createNode(node);
+ List relations = ((ProgramElementNode)node).getRelations();
+ if (relations != null) {
+ for (Iterator it = relations.iterator(); it.hasNext(); ) {
+ RelationNode relation = (RelationNode)it.next();
+ if (relation.getName().equals("pointcut used by")) {
+ for (Iterator it2 = relation.getChildren().iterator(); it2.hasNext(); ) {
+ ProgramElementNode pNode = ((LinkNode)it2.next()).getProgramElementNode();
+ StructureViewNode newNode = getCrosscuttingChildren(pNode);
+ for (Iterator it3 = pNode.getRelations().iterator(); it3.hasNext(); ) {
+ RelationNode relationNode = (RelationNode)it3.next();
+ if (relationNode.getName().indexOf("pointcut") == -1) {
+ newNode.add(getRelations(relationNode));
+ }
+ }
+ treeNode.add(newNode);
+ }
+ } else if (relations.toString().indexOf("uses pointcut") == -1) {
+ for (Iterator it4 = relations.iterator(); it4.hasNext(); ) {
+ RelationNode relationNode = (RelationNode)it4.next();
+ if (relationNode.getName().indexOf("pointcut") == -1) {
+ treeNode.add(getRelations(relationNode));
+ }
+ }
+ }
+ }
+ }
+ return treeNode;
+ }
+
+ private StructureViewNode buildTree(StructureNode node, List associations) {
+ //StructureViewNode treeNode = new StructureViewNodeAdapter(node);
+ StructureViewNode treeNode = nodeFactory.createNode(node);
+ if (node instanceof ProgramElementNode) {
+ List relations = ((ProgramElementNode)node).getRelations();
+ if (relations != null) {
+ for (Iterator it = relations.iterator(); it.hasNext(); ) {
+ RelationNode relationNode = (RelationNode)it.next();
+ if (associations.contains(relationNode.getRelation().toString())) {
+ treeNode.add(buildTree(relationNode, associations));
+ }
+ }
+ }
+ }
+ if (node != null) {
+ List children = null;
+ children = node.getChildren();
+ if (children != null) {
+ List childList = new ArrayList();
+ for (Iterator itt = children.iterator(); itt.hasNext(); ) {
+ StructureNode child = (StructureNode)itt.next();
+ if (child instanceof ProgramElementNode) {
+ ProgramElementNode progNode = (ProgramElementNode)child;
+ if (!progNode.isCode()) {
+ childList.add(buildTree(child, associations));
+ }
+ } else {
+ childList.add(buildTree(child, associations));
+ }
+ }
+ //sortNodes(childList);
+ for (Iterator it = childList.iterator(); it.hasNext(); ) {
+ treeNode.add((StructureViewNode)it.next());
+ }
+ }
+
+ }
+ return treeNode;
+ }
+
+ private StructureViewNode getRelations(RelationNode node) {
+ //StructureViewNode treeNode = new StructureViewNode(node);
+ StructureViewNode treeNode = nodeFactory.createNode(node);
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ treeNode.add(
+ nodeFactory.createNode((StructureNode)it.next())
+ );
+ }
+ return treeNode;
+ }
+
+ /**
+ * For debugging only.
+ */
+ private void dumpView(StructureViewNode root, int level) {
+ System.out.println(root.getStructureNode());
+ for (Iterator it = root.getChildren().iterator(); it.hasNext(); ) {
+ dumpView((StructureViewNode)it.next(), level++);
+ }
+ for (int i = 0; i < level; i++) {
+ System.out.print(' ');
+ }
+ }
+
+ private static final Comparator ALPHABETICAL_COMPARATOR = new Comparator() {
+ public int compare(Object o1, Object o2) {
+ StructureNode sv1 = ((StructureViewNode)o1).getStructureNode();
+ StructureNode sv2 = ((StructureViewNode)o2).getStructureNode();
+ if (sv1 instanceof ProgramElementNode && sv2 instanceof ProgramElementNode) {
+ ProgramElementNode p1 = (ProgramElementNode)sv1;
+ ProgramElementNode p2 = (ProgramElementNode)sv2;
+ return p1.getName().compareTo(p2.getName());
+ } else {
+ return 0;
+ }
+ }
+ };
+
+ private static final Comparator DECLARATIONAL_COMPARATOR = new Comparator() {
+ public int compare(Object o1, Object o2) {
+ StructureNode sv1 = ((StructureViewNode)o1).getStructureNode();
+ StructureNode sv2 = ((StructureViewNode)o2).getStructureNode();
+ if (sv1 instanceof ProgramElementNode && sv2 instanceof ProgramElementNode) {
+ ProgramElementNode p1 = (ProgramElementNode)sv1;
+ ProgramElementNode p2 = (ProgramElementNode)sv2;
+ if (p1.getSourceLocation() == null) {
+ return 0;
+ } else if (p1.getSourceLocation().getLine() < p2.getSourceLocation().getLine()) {
+ return -1;
+ } else {
+ return 1;
+ }
+ } else {
+ return 0;
+ }
+ }
+ };
+}
+
+// private boolean acceptNode(ProgramElementNode node) {
+// return true;
+// if (node.getKind().equals("package")) return true;
+//
+// if (node.getKind().equals("file")) {
+// if (granularity == ViewProperties.Granularity.PACKAGE) {
+// return false;
+// } else {
+// return true;
+// }
+// }
+//
+// if (node.getKind().equals("class") || node.getKind().equals("aspect") || node.getKind().equals("interface")) {
+// if (granularity == ViewProperties.Granularity.FILE || granularity == ViewProperties.Granularity.PACKAGE) {
+// return false;
+// } else {
+// return true;
+// }
+// }
+//
+// if (node.isMemberKind()) {
+// if (granularity == ViewProperties.Granularity.MEMBER) {
+// for (Iterator it = modifiers.iterator(); it.hasNext(); ) {
+// if (node.getModifiers().contains((String)it.next())) return false;
+// }
+// for (Iterator it2 = visibility.iterator(); it2.hasNext(); ) {
+// if (node.getAccessibility().equals((String)it2.next())) return false;
+// }
+// if (filteredMemberKinds.contains(node.getKind())) {
+// return false;
+// } else {
+// return true;
+// }
+// } else {
+// return false;
+// }
+// }
+//
+// if (node.isCode()) return false;
+//
+// return false;
+// }
+
diff --git a/ajde/src/org/aspectj/ajde/ui/internal/UserPreferencesStore.java b/ajde/src/org/aspectj/ajde/ui/internal/UserPreferencesStore.java
new file mode 100644
index 000000000..617c516a9
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/internal/UserPreferencesStore.java
@@ -0,0 +1,99 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde.ui.internal;
+
+import java.util.*;
+import java.io.*;
+import org.aspectj.ajde.*;
+import org.aspectj.ajde.ui.UserPreferencesAdapter;
+
+public class UserPreferencesStore implements UserPreferencesAdapter {
+ public static final String FILE_NAME = "/.ajbrowser";
+ private final String VALUE_SEP = ";";
+ private Properties properties = new Properties();
+
+ public UserPreferencesStore() {
+ try {
+ if (new File(getPropertiesFilePath()).exists()) {
+ properties.load(new FileInputStream(getPropertiesFilePath()));
+ }
+ } catch (IOException ioe) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not read properties", ioe);
+ }
+ }
+
+ public String getProjectPreference(String name) {
+ return properties.getProperty(name);
+ }
+
+ public List getProjectMultivalPreference(String name) {
+ List values = new ArrayList();
+ String valuesString = properties.getProperty(name);
+ if (valuesString != null && !valuesString.trim().equals("")) {
+ StringTokenizer st = new StringTokenizer(valuesString, VALUE_SEP);
+ while (st.hasMoreTokens()) {
+ values.add(st.nextToken());
+ }
+ }
+ return values;
+ }
+
+ public void setProjectPreference(String name, String value) {
+ properties.setProperty(name, value);
+ saveProperties();
+ }
+
+ public void setProjectMultivalPreference(String name, List values) {
+ String valuesString = "";
+ for (Iterator it = values.iterator(); it.hasNext(); ) {
+ valuesString += (String)it.next() + ';';
+ }
+ properties.setProperty(name, valuesString);
+ saveProperties();
+ }
+
+ public String getPropertiesFilePath() {
+ String path = System.getProperty("user.home");
+ if (path == null) {
+ path = ".";
+ }
+ return path + FILE_NAME;
+ }
+
+ public String getGlobalPreference(String name) {
+ return getProjectPreference(name);
+ }
+
+ public List getGlobalMultivalPreference(String name) {
+ return getProjectMultivalPreference(name);
+ }
+
+ public void setGlobalPreference(String name, String value) {
+ setProjectPreference(name, value);
+ }
+
+ public void setGlobalMultivalPreference(String name, List values) {
+ setProjectMultivalPreference(name, values);
+ }
+
+ public void saveProperties() {
+ try {
+ properties.store(new FileOutputStream(getPropertiesFilePath()), "AJDE Settings");
+ } catch (IOException ioe) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not write properties", ioe);
+ }
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/AJButtonMenuCombo.java b/ajde/src/org/aspectj/ajde/ui/swing/AJButtonMenuCombo.java
new file mode 100644
index 000000000..c5e626e1d
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/AJButtonMenuCombo.java
@@ -0,0 +1,142 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.event.*;
+
+import javax.swing.*;
+
+public class AJButtonMenuCombo extends JPanel {
+
+ private JButton mainButton;
+ private JButton popupButton;
+ private JPopupMenu menu;
+ private boolean depressable = false;
+ private boolean isPressed = false;
+
+ public AJButtonMenuCombo(String name,
+ String toolTipText,
+ Icon icon,
+ JPopupMenu menu,
+ boolean depressable) {
+
+ this.menu = menu;
+ this.depressable = depressable;
+ mainButton = new JButton();
+ mainButton.setIcon(icon);
+ mainButton.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
+ mainButton.setToolTipText(toolTipText);
+ mainButton.setPreferredSize(new Dimension(22, 20));
+ mainButton.setMinimumSize(new Dimension(22, 20));
+ mainButton.setMaximumSize(new Dimension(22, 20));
+
+ popupButton = new JButton();
+ popupButton.setIcon(AjdeUIManager.getDefault().getIconRegistry().getPopupIcon());
+ popupButton.setBorder(BorderFactory.createEmptyBorder());
+ popupButton.setToolTipText(toolTipText);
+ popupButton.setPreferredSize(new Dimension(13, 20));
+ popupButton.setMinimumSize(new Dimension(13, 20));
+ popupButton.setMaximumSize(new Dimension(13, 20));
+
+ PopupListener popupListener = new PopupListener(mainButton);
+
+ if (depressable) {
+ mainButton.addActionListener(new ButtonActionListener());
+ } else {
+ mainButton.addMouseListener(popupListener);
+ }
+
+ popupButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ popupButton.setBorder(null);
+ }
+ });
+
+ BorderUpdateListener borderUpdateListner = new BorderUpdateListener();
+ mainButton.addMouseListener(borderUpdateListner);
+ popupButton.addMouseListener(borderUpdateListner);
+
+ popupButton.addMouseListener(popupListener);
+
+ this.setLayout(new BorderLayout());
+ this.add(mainButton, BorderLayout.CENTER);
+ this.add(popupButton, BorderLayout.EAST);
+
+ this.setMinimumSize(new Dimension(35, 20));
+ this.setMaximumSize(new Dimension(35, 20));
+ }
+
+ class ButtonActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ if (isPressed) {
+ mainButton.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
+ isPressed = false;
+ } else {
+ mainButton.setBorder(AjdeWidgetStyles.LOWERED_BEVEL_BORDER);
+ isPressed = true;
+ }
+ }
+ }
+
+
+ class BorderUpdateListener extends MouseAdapter {
+ public void mouseEntered(MouseEvent e) {
+ popupButton.setBorder(AjdeWidgetStyles.RAISED_BEVEL_BORDER);
+ mainButton.setBorder(AjdeWidgetStyles.RAISED_BEVEL_BORDER);
+ }
+
+ public void mouseExited(MouseEvent e) {
+ popupButton.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
+ if (isPressed) {
+ mainButton.setBorder(AjdeWidgetStyles.LOWERED_BEVEL_BORDER);
+ } else {
+ mainButton.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
+ }
+ }
+ }
+
+ class PopupListener extends MouseAdapter {
+ private JButton button;
+
+ public PopupListener(JButton button) {
+ this.button = button;
+ }
+
+ public void mousePressed(MouseEvent e) {
+ maybeShowPopup(e);
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ maybeShowPopup(e);
+ }
+
+ private void maybeShowPopup(MouseEvent e) {
+ menu.show(e.getComponent(), button.getX(), button.getY() + popupButton.getHeight());
+ }
+ }
+
+ public void setEnabled(boolean enabled) {
+ mainButton.setEnabled(enabled);
+ popupButton.setEnabled(enabled);
+ }
+
+ public void setMenu(JPopupMenu menu) {
+ this.menu = menu;
+ this.repaint();
+ }
+
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/AjdeErrorHandler.java b/ajde/src/org/aspectj/ajde/ui/swing/AjdeErrorHandler.java
new file mode 100644
index 000000000..a79b37167
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/AjdeErrorHandler.java
@@ -0,0 +1,56 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-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
new file mode 100644
index 000000000..37cfe6f34
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/AjdeUIManager.java
@@ -0,0 +1,172 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.Frame;
+
+import org.aspectj.ajde.*;
+import org.aspectj.ajde.ui.*;
+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 OptionsFrame optionsFrame = null;
+ private Frame rootFrame = null;
+ private StructureViewPanel fileStructurePanel = null;
+
+ /**
+ * Order of initialization is critical here.
+ */
+ public void init(
+ EditorAdapter editorAdapter,
+ TaskListManager taskListManager,
+ ProjectPropertiesAdapter projectProperties,
+ UserPreferencesAdapter userPreferencesAdapter,
+ IdeUIAdapter ideUIAdapter,
+ IconRegistry iconRegistry,
+ Frame rootFrame,
+ boolean useFileView) {
+ try {
+ BuildProgressMonitor compileProgress = new DefaultBuildProgressMonitor(rootFrame);
+ ErrorHandler errorHandler = new AjdeErrorHandler();
+ 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,
+ compileProgress,
+ 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().getEditorManager().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();
+ } 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.show();
+ }
+
+ 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 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/AjdeWidgetStyles.java b/ajde/src/org/aspectj/ajde/ui/swing/AjdeWidgetStyles.java
new file mode 100644
index 000000000..8da23390a
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/AjdeWidgetStyles.java
@@ -0,0 +1,32 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+
+public interface AjdeWidgetStyles {
+
+ public static final Font DEFAULT_LABEL_FONT = new java.awt.Font("SansSerif", 0, 11);
+ public static final Border DEFAULT_BORDER = BorderFactory.createEmptyBorder();
+ public static final Border LOWERED_BEVEL_BORDER = BorderFactory.createBevelBorder(BevelBorder.LOWERED);
+ public static final Border RAISED_BEVEL_BORDER = BorderFactory.createBevelBorder(BevelBorder.RAISED);
+ public static final Color DEFAULT_BACKGROUND_COLOR = Color.lightGray;
+
+ public static final Color LINK_NODE_COLOR = new Color(0, 0, 255);
+ public static final Color LINK_NODE_NO_SOURCE_COLOR = new Color(150, 150, 255);
+
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BasicEditor.java b/ajde/src/org/aspectj/ajde/ui/swing/BasicEditor.java
new file mode 100644
index 000000000..99d070591
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BasicEditor.java
@@ -0,0 +1,175 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Font;
+import java.io.*;
+import java.net.URL;
+
+import javax.swing.*;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultHighlighter;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.EditorAdapter;
+import org.aspectj.bridge.ISourceLocation;
+
+/**
+ * Bare-bones editor implementation used when the framework is being used
+ * standalone.
+ *
+ * @author Mik Kersten
+ */
+public class BasicEditor implements EditorAdapter {
+
+ private String NO_FILE = "<no file selected>";
+ private String filePath = NO_FILE;
+ private JPanel editor_panel = new JPanel();
+
+ // @todo get rid of these
+ private int currHighlightStart = 0;
+ private int currHighlightEnd = 0;
+
+ private BorderLayout borderLayout1 = new BorderLayout();
+ private JScrollPane jScrollPane1 = new JScrollPane();
+ private JEditorPane editorPane = new JEditorPane();
+
+ public BasicEditor() {
+ try {
+ editorPane.setEditable(true);
+ editorPane.setContentType("text/plain");
+ editorPane.setFont(new Font("Monospaced", 0, 11));
+ editor_panel.add(editorPane);
+ jbInit();
+ }
+ catch(Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e);
+ }
+ }
+
+ public String getCurrFile() {
+ return filePath;
+ }
+
+ public void showSourceLine(ISourceLocation sourceLocation, boolean highlight) {
+ showSourceLine(sourceLocation.getSourceFile().getAbsolutePath(), sourceLocation.getLine(), highlight);
+ }
+
+ public void showSourceLine(int lineNumber, boolean highlight) {
+ showSourceLine(filePath, lineNumber, highlight);
+ }
+
+ public void pasteToCaretPos(String text) {
+ if (currHighlightEnd < 1) return;
+ String contents = editorPane.getText();
+ String pasted = contents.substring(0, currHighlightEnd) +
+ text + contents.substring(currHighlightEnd, contents.length());
+ editorPane.setText(pasted);
+ }
+
+ public void showSourceLine(String filePath, int lineNumber, boolean highlight) {
+ //AjdeUIManager.getDefault().getIdeUIAdapter().resetEditor();
+
+ String oldPath = this.filePath;
+ this.filePath = filePath;
+// if (oldPath != filePath && !Ajde.INSTANCE.BROWSER_MANAGER.isGlobalMode()) {
+// Ajde.INSTANCE.BROWSER_MANAGER.updateView();
+// }
+
+// Ajde.IDE_MANAGER.setEditorStatusText(filePath);
+
+ currHighlightStart = 0;
+ currHighlightEnd = 0;
+ editorPane.setText(readFile(filePath, lineNumber));
+ try {
+ editorPane.getHighlighter().addHighlight(currHighlightStart, currHighlightEnd, DefaultHighlighter.DefaultPainter);
+ editorPane.setCaretPosition(currHighlightStart);
+ } catch (BadLocationException ble) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not highlight location.", ble);
+ }
+ Ajde.getDefault().getEditorManager().notifyCurrentFileChanged(filePath);
+ }
+
+ /**
+ * Not implemented.
+ */
+ public void showSourcelineAnnotation(String filePath, int lineNumber, java.util.List items) { }
+
+ public void addEditorViewForSourceLine(String filePath, int lineNumber) {
+
+ }
+
+ public void saveContents() throws IOException {
+ if (filePath != NO_FILE && filePath != "" && editorPane.getText() != "") {
+ BufferedWriter writer = new BufferedWriter(new FileWriter(filePath));
+ writer.write(editorPane.getText());
+ writer.flush();
+ }
+ }
+
+ public JPanel getPanel() {
+ return editor_panel;
+ }
+
+ public void showSourceForFile(String filePath) { }
+
+ public void showSourceForLine(int lineNumber, boolean highlight) { }
+
+ public void showSourceForSourceLine(String filePath, int lineNumber, boolean highlight) { }
+
+ public String getCurrSourceFilePath() { return null; }
+
+ public void setBreakpointRequest(String filePath, int lineNumber, boolean isDeferred) { }
+
+ public void clearBreakpointRequest(String filePath, int lineNumber) { }
+
+ private String readFile(String filePath, int lineNumber) {
+ try {
+ URL url = ClassLoader.getSystemResource(filePath);
+ File file = new File(filePath);
+ if (!file.exists()) {
+ return "ERROR: file \"" + filePath + "\" does not exist.";
+ }
+ BufferedReader reader = new BufferedReader(new FileReader(file));
+ StringBuffer contents = new StringBuffer();
+ String line = reader.readLine();
+ int numChars = 0;
+ int numLines = 0;
+ while (line != null) {
+ numLines++;
+ if (numLines < lineNumber) {
+ currHighlightStart += line.length()+1;
+ }
+ if (numLines == lineNumber) {
+ currHighlightEnd = currHighlightStart + line.length();
+ }
+ contents.append(line);
+ contents.append('\n');
+ line = reader.readLine();
+ }
+ return contents.toString();
+ } catch (IOException ioe) {
+ return "ERROR: could not read file \"" + filePath + "\", make sure that you have mounted /project/aop on X:\\";
+ }
+ }
+
+ private void jbInit() throws Exception {
+ editor_panel.setFont(new java.awt.Font("DialogInput", 1, 12));
+ editor_panel.setLayout(borderLayout1);
+ editor_panel.add(jScrollPane1, BorderLayout.CENTER);
+ jScrollPane1.getViewport().add(editorPane, null);
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserStructureViewToolPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserStructureViewToolPanel.java
new file mode 100644
index 000000000..963fb9ae0
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserStructureViewToolPanel.java
@@ -0,0 +1,342 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.Iterator;
+
+import javax.swing.*;
+import javax.swing.border.Border;
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.*;
+
+public class BrowserStructureViewToolPanel extends JPanel {
+
+ private StructureView currentView;
+ private StructureViewPanel viewPanel;
+ protected BorderLayout borderLayout1 = new BorderLayout();
+ protected Border border1;
+ protected Border border2;
+ AJButtonMenuCombo granularityCombo;
+ AJButtonMenuCombo filterCombo;
+ AJButtonMenuCombo relationsCombo;
+ JPanel buttons_panel = new JPanel();
+ JPanel spacer_panel = new JPanel();
+ BorderLayout borderLayout2 = new BorderLayout();
+ BorderLayout borderLayout3 = new BorderLayout();
+ JPanel view_panel = new JPanel();
+ JComboBox view_comboBox = null;
+ JLabel view_label = new JLabel();
+ BorderLayout borderLayout4 = new BorderLayout();
+
+ public BrowserStructureViewToolPanel(
+ java.util.List structureViews,
+ StructureView currentView,
+ StructureViewPanel viewPanel) {
+
+ this.currentView = currentView;
+ this.viewPanel = viewPanel;
+ view_comboBox = new JComboBox();
+ view_comboBox.setFont(AjdeWidgetStyles.DEFAULT_LABEL_FONT);
+
+ for (Iterator it = structureViews.iterator(); it.hasNext(); ) {
+ view_comboBox.addItem(it.next());
+ }
+
+ try {
+ jbInit();
+ } catch (Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e);
+ }
+ initToolBar();
+ }
+
+ private void initToolBar() {
+ try {
+ granularityCombo = new AJButtonMenuCombo(
+ "Visible granularity",
+ "Visible granularity",
+ AjdeUIManager.getDefault().getIconRegistry().getGranularityIcon(),
+ createGranularityMenu(),
+ false);
+
+ filterCombo = new AJButtonMenuCombo(
+ "Filter members",
+ "Filter members",
+ AjdeUIManager.getDefault().getIconRegistry().getFilterIcon(),
+ createFilterMenu(),
+ false);
+
+ relationsCombo = new AJButtonMenuCombo(
+ "Filter associations",
+ "Filter associations",
+ AjdeUIManager.getDefault().getIconRegistry().getRelationsIcon(),
+ createRelationsMenu(),
+ false);
+
+ buttons_panel.add(granularityCombo, BorderLayout.WEST);
+ buttons_panel.add(filterCombo, BorderLayout.CENTER);
+ buttons_panel.add(relationsCombo, BorderLayout.EAST);
+ } catch(Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e);
+ }
+ }
+
+ private JPopupMenu createFilterMenu() {
+ JPopupMenu filterMenu = new JPopupMenu();
+ ProgramElementNode.Accessibility[] accessibility = ProgramElementNode.Accessibility.ALL;
+ for (int i = 0; i < accessibility.length; i++) {
+ CheckBoxSelectionMenuButton menuItem = new CheckBoxSelectionMenuButton(accessibility[i]);
+ menuItem.setIcon(AjdeUIManager.getDefault().getIconRegistry().getAccessibilitySwingIcon(accessibility[i]));
+ filterMenu.add(menuItem);
+ }
+ filterMenu.add(new JSeparator());
+
+ ProgramElementNode.Kind[] kinds = ProgramElementNode.Kind.ALL;
+ for (int i = 0; i < kinds.length; i++) {
+ if (kinds[i].isMemberKind()) {
+ CheckBoxSelectionMenuButton menuItem = new CheckBoxSelectionMenuButton(kinds[i]);
+ menuItem.setIcon((Icon)AjdeUIManager.getDefault().getIconRegistry().getStructureIcon(kinds[i]).getIconResource());
+ filterMenu.add(menuItem);
+ }
+ }
+ filterMenu.add(new JSeparator());
+
+ ProgramElementNode.Modifiers[] modifiers = ProgramElementNode.Modifiers.ALL;
+ for (int i = 0; i < modifiers.length; i++) {
+ CheckBoxSelectionMenuButton menuItem = new CheckBoxSelectionMenuButton(modifiers[i]);
+ filterMenu.add(menuItem);
+ }
+ return filterMenu;
+ }
+
+ private JPopupMenu createRelationsMenu() {
+ JPopupMenu relationsMenu = new JPopupMenu();
+
+ java.util.List relations = Ajde.getDefault().getStructureViewManager().getAvailableRelations();
+ for (Iterator it = relations.iterator(); it.hasNext(); ) {
+ Relation relation = (Relation)it.next();
+ CheckBoxSelectionMenuButton menuItem = new CheckBoxSelectionMenuButton(relation);
+ menuItem.setIcon((Icon)AjdeUIManager.getDefault().getIconRegistry().getRelationIcon(relation).getIconResource());
+ relationsMenu.add(menuItem);
+ }
+
+ return relationsMenu;
+ }
+
+ private JPopupMenu createGranularityMenu() {
+ JPopupMenu orderMenu = new JPopupMenu();
+
+ StructureViewProperties.Granularity[] granularity = StructureViewProperties.Granularity.ALL;
+ ButtonGroup group = new ButtonGroup();
+ for (int i = 0; i < granularity.length; i++) {
+ RadioSelectionMenuButton menuItem = new RadioSelectionMenuButton(granularity[i], group);
+ orderMenu.add(menuItem);
+ if (granularity[i].equals(StructureViewProperties.Granularity.MEMBER)) {
+ menuItem.setSelected(true);
+ }
+ }
+ return orderMenu;
+ }
+
+ private class RadioSelectionMenuButton extends JRadioButtonMenuItem {
+ public RadioSelectionMenuButton(StructureViewProperties.Granularity granularity, ButtonGroup group) {
+ super(granularity.toString());
+ super.setFont(AjdeWidgetStyles.DEFAULT_LABEL_FONT);
+ group.add(this);
+ this.addActionListener(new RadioSelectionMenuActionListener(granularity));
+ }
+ }
+
+ private class RadioSelectionMenuActionListener implements ActionListener {
+ private StructureViewProperties.Granularity granularity;
+
+ public RadioSelectionMenuActionListener(StructureViewProperties.Granularity granularity) {
+ this.granularity = granularity;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ currentView.getViewProperties().setGranularity(granularity);
+ Ajde.getDefault().getStructureViewManager().refreshView(currentView);
+ }
+ }
+
+ private class CheckBoxSelectionMenuButton extends JCheckBoxMenuItem {
+
+ public CheckBoxSelectionMenuButton(String name) {
+ super(name);
+ this.setFont(AjdeWidgetStyles.DEFAULT_LABEL_FONT);
+ this.setBackground(AjdeWidgetStyles.DEFAULT_BACKGROUND_COLOR);
+ //super.setSelected(true);
+ }
+
+ public CheckBoxSelectionMenuButton(ProgramElementNode.Accessibility accessibility) {
+ this(accessibility.toString());
+ this.addActionListener(new CheckBoxSelectionMenuActionListener(accessibility));
+ }
+
+ public CheckBoxSelectionMenuButton(ProgramElementNode.Kind kind) {
+ this(kind.toString());
+ this.addActionListener(new CheckBoxSelectionMenuActionListener(kind));
+ }
+
+ public CheckBoxSelectionMenuButton(ProgramElementNode.Modifiers modifiers) {
+ this(modifiers.toString());
+ this.addActionListener(new CheckBoxSelectionMenuActionListener(modifiers));
+ }
+
+ public CheckBoxSelectionMenuButton(StructureViewProperties.Sorting sorting) {
+ this(sorting.toString());
+ this.addActionListener(new CheckBoxSelectionMenuActionListener(sorting));
+ }
+
+ public CheckBoxSelectionMenuButton(Relation relation) {
+ this(relation.toString());
+ this.addActionListener(new CheckBoxSelectionMenuActionListener(relation));
+ }
+ }
+
+ /**
+ * Ewwwwww!
+ */
+ private class CheckBoxSelectionMenuActionListener implements ActionListener {
+ private ProgramElementNode.Accessibility accessibility = null;
+ private ProgramElementNode.Kind kind = null;
+ private ProgramElementNode.Modifiers modifiers = null;
+ private StructureViewProperties.Sorting sorting = null;
+ private Relation relation = null;
+
+ public CheckBoxSelectionMenuActionListener(ProgramElementNode.Accessibility accessibility) {
+ this.accessibility = accessibility;
+ }
+
+ public CheckBoxSelectionMenuActionListener(ProgramElementNode.Kind kind) {
+ this.kind = kind;
+ }
+
+ public CheckBoxSelectionMenuActionListener(ProgramElementNode.Modifiers modifiers) {
+ this.modifiers = modifiers;
+ }
+
+ public CheckBoxSelectionMenuActionListener(StructureViewProperties.Sorting sorting) {
+ this.sorting = sorting;
+ }
+
+ public CheckBoxSelectionMenuActionListener(Relation relation) {
+ this.relation = relation;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (!(e.getSource() instanceof CheckBoxSelectionMenuButton)) return;
+ CheckBoxSelectionMenuButton checkMenu = (CheckBoxSelectionMenuButton)e.getSource();
+ if (accessibility != null) {
+ if (checkMenu.isSelected()) {
+ currentView.getViewProperties().addFilteredMemberAccessibility(accessibility);
+ } else {
+ currentView.getViewProperties().removeFilteredMemberAccessibility(accessibility);
+ }
+ } else if (kind != null) {
+ if (checkMenu.isSelected()) {
+ currentView.getViewProperties().addFilteredMemberKind(kind);
+ } else {
+ currentView.getViewProperties().removeFilteredMemberKind(kind);
+ }
+ } else if (modifiers != null) {
+ if (checkMenu.isSelected()) {
+ currentView.getViewProperties().addFilteredMemberModifiers(modifiers);
+ } else {
+ currentView.getViewProperties().removeFilteredMemberModifiers(modifiers);
+ }
+ } else if (sorting != null) {
+ if (checkMenu.isSelected()) {
+ currentView.getViewProperties().setSorting(sorting);
+ } else {
+ currentView.getViewProperties().setSorting(StructureViewProperties.Sorting.DECLARATIONAL);
+ }
+ } else if (relation != null) {
+ if (checkMenu.isSelected()) {
+ currentView.getViewProperties().removeRelation(relation);
+ } else {
+ currentView.getViewProperties().addRelation(relation);
+ }
+ }
+ Ajde.getDefault().getStructureViewManager().refreshView(
+ currentView
+ );
+ }
+ }
+
+// public void highlightNode(ProgramElementNode node) {
+// treeManager.navigationAction(node, true, true);
+// }
+
+ private void order_comboBox_actionPerformed(ActionEvent e) {
+ Ajde.getDefault().getStructureViewManager().refreshView(
+ currentView
+ );
+ }
+
+ private void jbInit() throws Exception {
+ this.setLayout(borderLayout2);
+ buttons_panel.setLayout(borderLayout3);
+ buttons_panel.setMinimumSize(new Dimension(105, 10));
+ buttons_panel.setPreferredSize(new Dimension(105, 10));
+ view_comboBox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ view_comboBox_actionPerformed(e);
+ }
+ });
+ view_label.setFont(new java.awt.Font("Dialog", 0, 11));
+ view_label.setText(" Global View ");
+ view_comboBox.setFont(new java.awt.Font("SansSerif", 0, 11));
+ view_comboBox.setPreferredSize(new Dimension(125, 22));
+ view_panel.setLayout(borderLayout4);
+ view_panel.add(view_label, BorderLayout.WEST);
+ this.add(buttons_panel, BorderLayout.EAST);
+ this.add(spacer_panel, BorderLayout.CENTER);
+ this.add(view_panel, BorderLayout.WEST);
+ view_panel.add(view_comboBox, BorderLayout.CENTER);
+
+ }
+
+ private void order_button_actionPerformed(ActionEvent e) {
+
+ }
+
+ private void orderPopup_button_actionPerformed(ActionEvent e) {
+
+ }
+
+ void separator_button_actionPerformed(ActionEvent e) {
+
+ }
+
+ void view_comboBox_actionPerformed(ActionEvent e) {
+ StructureView view = (StructureView)view_comboBox.getSelectedItem();
+ viewPanel.setCurrentView(view);
+ if (((GlobalStructureView)view).getGlobalViewProperties().getHierarchy()
+ == StructureViewProperties.Hierarchy.DECLARATION) {
+ granularityCombo.setEnabled(true);
+ relationsCombo.setEnabled(true);
+ filterCombo.setEnabled(true);
+ } else {
+ granularityCombo.setEnabled(false);
+ relationsCombo.setEnabled(false);
+ filterCombo.setEnabled(false);
+ }
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserView.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserView.java
new file mode 100644
index 000000000..cb36bb809
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserView.java
@@ -0,0 +1,312 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.util.Iterator;
+
+import javax.swing.*;
+import javax.swing.border.Border;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.asm.ProgramElementNode;
+
+/**
+ * @author Mik Kersten
+ */
+class BrowserView extends JPanel {
+ private BrowserViewPanel masterView;
+ private BrowserViewPanel slaveView;
+ private boolean slaveViewVisible = false;
+ private String lastSelectedConfig = "";
+
+ private IconRegistry icons = null;
+ private BorderLayout borderLayout1 = new BorderLayout();
+ private Border default_border;
+ private JPanel toolBar_panel = new JPanel();
+ private BorderLayout borderLayout2 = new BorderLayout();
+ JPanel mainToolBar_panel = new JPanel();
+ JToolBar config_toolBar = new JToolBar();
+ JComboBox configs_comboBox = null;
+ BorderLayout borderLayout3 = new BorderLayout();
+ JToolBar nav_toolBar = new JToolBar();
+ JButton forward_button = new JButton();
+ JButton back_button = new JButton();
+ GridLayout gridLayout1 = new GridLayout();
+ JSplitPane views_splitPane = new JSplitPane();
+ JToolBar command_toolBar = new JToolBar();
+ JToggleButton splitView_button = new JToggleButton();
+ JToggleButton zoomToFile_button = new JToggleButton();
+ JButton joinpointProbe_button = new JButton();
+
+ public BrowserView(BrowserViewPanel masterView, BrowserViewPanel slaveView, IconRegistry icons) {
+ try {
+ this.masterView = masterView;
+ this.slaveView = slaveView;
+ this.icons = icons;
+ configs_comboBox = new JComboBox(Ajde.getDefault().getProjectProperties().getBuildConfigFiles().toArray());
+ configs_comboBox.setRenderer(new ConfigsCellRenderer());
+// configs_comboBox.addItemListener(new ItemListener() {
+// public void itemStateChanged(ItemEvent e) {
+// Ajde.getDefault().getConfigurationManager().setCurrConfigFile(lastSelectedConfig);
+// }
+// });
+
+ if (Ajde.getDefault().getProjectProperties().getBuildConfigFiles().size() > 0) {
+ Ajde.getDefault().getConfigurationManager().setActiveConfigFile((String)Ajde.getDefault().getProjectProperties().getBuildConfigFiles().get(0));
+ }
+
+ jbInit();
+ fixButtonBorders();
+ views_splitPane.add(masterView, JSplitPane.TOP);
+ views_splitPane.add(slaveView, JSplitPane.BOTTOM);
+ setSlaveViewVisible(false);
+
+ nav_toolBar.remove(joinpointProbe_button);
+ } catch(Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e);
+ }
+ }
+
+ public void setSlaveViewVisible(boolean visible) {
+ slaveViewVisible = visible;
+ if (visible) {
+ views_splitPane.add(slaveView, JSplitPane.BOTTOM);
+ views_splitPane.setDividerLocation(this.getHeight()-250);
+ //masterView.scrollToHighlightedNode();
+ } else {
+ views_splitPane.remove(slaveView);
+ views_splitPane.setDividerLocation(this.getHeight());
+ }
+ }
+
+ public boolean isSlaveViewVisible() {
+ return slaveViewVisible;
+ }
+
+ public void updateConfigs(java.util.List configsList) {
+ configs_comboBox.removeAllItems();
+ for (Iterator it = configsList.iterator(); it.hasNext(); ) {
+ configs_comboBox.addItem((String)it.next());
+ }
+ }
+
+ public void setSelectedConfig(String config) {
+ for (int i = 0; i < configs_comboBox.getItemCount(); i++) {
+ if (configs_comboBox.getItemAt(i).equals(config)) {
+ configs_comboBox.setSelectedIndex(i);
+ }
+ }
+ }
+
+ public String getSelectedConfig() {
+ return (String)configs_comboBox.getSelectedItem();
+ }
+
+ /**
+ * @todo get rid of this method and make the GUI-designer generated code work properly
+ */
+ private void fixButtonBorders() {
+ back_button.setBorder(BorderFactory.createEmptyBorder());
+ forward_button.setBorder(BorderFactory.createEmptyBorder());
+ zoomToFile_button.setBorder(BorderFactory.createEmptyBorder());
+ splitView_button.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, Color.blue));
+ }
+
+ private void jbInit() throws Exception {
+ default_border = BorderFactory.createEmptyBorder();
+ this.setLayout(borderLayout1);
+ toolBar_panel.setLayout(borderLayout2);
+ toolBar_panel.setBorder(BorderFactory.createEtchedBorder());
+ config_toolBar.setBorder(default_border);
+ config_toolBar.setFloatable(false);
+ configs_comboBox.setPreferredSize(new Dimension(200, 20));
+ configs_comboBox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ configs_comboBox_actionPerformed(e);
+ }
+ });
+ configs_comboBox.setMinimumSize(new Dimension(40, 20));
+ configs_comboBox.setFont(new java.awt.Font("SansSerif", 0, 11));
+ mainToolBar_panel.setLayout(borderLayout3);
+ nav_toolBar.setFloatable(false);
+ nav_toolBar.setBorder(default_border);
+ forward_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ forward_button_actionPerformed(e);
+ }
+ });
+ forward_button.setIcon(icons.getForwardIcon());
+ forward_button.setToolTipText("Navigate forward");
+ forward_button.setPreferredSize(new Dimension(20, 20));
+ forward_button.setMinimumSize(new Dimension(20, 20));
+ forward_button.setBorder(default_border);
+ forward_button.setMaximumSize(new Dimension(24, 20));
+ back_button.setMaximumSize(new Dimension(24, 20));
+ back_button.setBorder(default_border);
+ back_button.setMinimumSize(new Dimension(20, 20));
+ back_button.setPreferredSize(new Dimension(20, 20));
+ back_button.setToolTipText("Navigate back");
+ back_button.setIcon(icons.getBackIcon());
+ back_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ back_button_actionPerformed(e);
+ }
+ });
+// structureViews_box.add(comment_editorPane, null);
+ views_splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
+ views_splitPane.setDividerSize(2);
+ command_toolBar.setBorder(default_border);
+ command_toolBar.setFloatable(false);
+ splitView_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ splitView_button.setBorder(default_border);
+ splitView_button.setMaximumSize(new Dimension(24, 24));
+ splitView_button.setPreferredSize(new Dimension(20, 20));
+ splitView_button.setToolTipText("Togge split-tree view mode");
+ splitView_button.setIcon(icons.getSplitStructureViewIcon());
+ splitView_button.setSelectedIcon(icons.getMergeStructureViewIcon());
+ splitView_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ //splitView_button_actionPerformed(e);
+ }
+ });
+ zoomToFile_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ //zoomToFile_button_actionPerformed(e);
+ }
+ });
+ zoomToFile_button.setIcon(icons.getZoomStructureToFileModeIcon());
+ zoomToFile_button.setSelectedIcon(icons.getZoomStructureToGlobalModeIcon());
+ zoomToFile_button.setBorder(BorderFactory.createRaisedBevelBorder());
+ zoomToFile_button.setMaximumSize(new Dimension(24, 24));
+ zoomToFile_button.setPreferredSize(new Dimension(20, 20));
+ zoomToFile_button.setToolTipText("Toggle file-view mode");
+ zoomToFile_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ joinpointProbe_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ joinpointProbe_button_actionPerformed(e);
+ }
+ });
+ joinpointProbe_button.setIcon(icons.getStructureSwingIcon(ProgramElementNode.Kind.POINTCUT));
+ joinpointProbe_button.setToolTipText("Create joinpoint probe");
+ joinpointProbe_button.setPreferredSize(new Dimension(20, 20));
+ joinpointProbe_button.setMinimumSize(new Dimension(20, 20));
+ joinpointProbe_button.setBorder(default_border);
+ joinpointProbe_button.setMaximumSize(new Dimension(24, 20));
+ this.add(toolBar_panel, BorderLayout.NORTH);
+ toolBar_panel.add(mainToolBar_panel, BorderLayout.NORTH);
+ mainToolBar_panel.add(config_toolBar, BorderLayout.CENTER);
+ config_toolBar.add(configs_comboBox, null);
+ mainToolBar_panel.add(nav_toolBar, BorderLayout.EAST);
+ nav_toolBar.add(splitView_button, null);
+ nav_toolBar.add(zoomToFile_button, null);
+ nav_toolBar.add(joinpointProbe_button, null);
+ nav_toolBar.add(back_button, null);
+ nav_toolBar.add(forward_button, null);
+ mainToolBar_panel.add(command_toolBar, BorderLayout.WEST);
+ this.add(views_splitPane, BorderLayout.CENTER);
+ views_splitPane.setDividerLocation(400);
+ }
+
+ void forward_button_actionPerformed(ActionEvent e) {
+ //AjdeUIManager.getDefault().getViewManager().navigateForwardAction();
+ }
+ void back_button_actionPerformed(ActionEvent e) {
+ //AjdeUIManager.getDefault().getViewManager().navigateBackAction();
+ }
+
+// void splitView_button_actionPerformed(ActionEvent e) {
+// AjdeUIManager.getDefault().getViewManager().setSplitViewMode(!slaveViewVisible);
+// }
+
+ static class ConfigsCellRenderer extends JLabel implements ListCellRenderer {
+ public ConfigsCellRenderer() {
+ setOpaque(true);
+ }
+
+ public Component getListCellRendererComponent(JList list,
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus) {
+ if (value == null) return this;
+
+ java.io.File file = new File(value.toString());
+ setText(file.getName());
+ setBackground(isSelected ? Color.gray : Color.lightGray);
+// setForeground(isSelected ? Color.lightGray : Color.gray);
+ return this;
+ }
+ }
+
+ void configDesigner_button_mouseClicked(MouseEvent e) {
+
+ }
+ void configDesigner_button_mousePressed(MouseEvent e) {
+
+ }
+ void configDesigner_button_mouseReleased(MouseEvent e) {
+
+ }
+ void configDesigner_button_mouseEntered(MouseEvent e) {
+
+ }
+ void configDesigner_button_mouseExited(MouseEvent e) {
+
+ }
+ void configDesigner_button_actionPerformed(ActionEvent e) {
+
+ }
+ void viewManager_button_mouseClicked(MouseEvent e) {
+
+ }
+ void viewManager_button_mousePressed(MouseEvent e) {
+
+ }
+ void viewManager_button_mouseReleased(MouseEvent e) {
+
+ }
+ void viewManager_button_mouseEntered(MouseEvent e) {
+
+ }
+ void viewManager_button_mouseExited(MouseEvent e) {
+
+ }
+ void viewManager_button_actionPerformed(ActionEvent e) {
+
+ }
+
+// void zoomToFile_button_actionPerformed(ActionEvent e) {
+// AjdeUIManager.getDefault().getViewManager().setGlobalMode(!AjdeUIManager.getDefault().getViewManager().isGlobalMode());
+// AjdeUIManager.getDefault().getViewManager().updateView();
+// }
+
+ void configs_comboBox_actionPerformed(ActionEvent e) {
+ if (configs_comboBox.getSelectedItem() != null) {
+ if (!configs_comboBox.getSelectedItem().toString().equals(lastSelectedConfig)) {
+ //TopManager.INSTANCE.VIEW_MANAGER.readStructureView();
+ lastSelectedConfig = configs_comboBox.getSelectedItem().toString();
+ Ajde.getDefault().getConfigurationManager().setActiveConfigFile(lastSelectedConfig);
+ }
+ }
+ }
+
+ private void joinpointProbe_button_actionPerformed(ActionEvent e) {
+ //joinpointProbeWizard();
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java
new file mode 100644
index 000000000..77ff0dceb
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewManager.java
@@ -0,0 +1,105 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.util.*;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.*;
+
+/**
+ * Responsible for displaying and controlling the configuration and output of a
+ * master and slave structure view.
+ *
+ * @author Mik Kersten
+ */
+public class BrowserViewManager {
+
+ private StructureViewPanel browserPanel = null;
+ private boolean globalMode = true;
+ private boolean splitViewMode = false;
+ private IconRegistry icons;
+
+ private Stack backHistory = new Stack();
+ private Stack forwardHistory = new Stack();
+ private ProgramElementNode currNode = null;
+
+ private final GlobalStructureView DECLARATION_VIEW;
+ private final GlobalStructureView CROSSCUTTING_VIEW;
+ private final GlobalStructureView INHERITANCE_VIEW;
+
+ private final GlobalViewProperties DECLARATION_VIEW_PROPERTIES;
+ private final GlobalViewProperties CROSSCUTTING_VIEW_PROPERTIES;
+ private final GlobalViewProperties INHERITANCE_VIEW_PROPERTIES;
+
+ public BrowserViewManager() {
+ java.util.List views = new ArrayList();
+ views.add(DECLARATION_VIEW);
+ views.add(CROSSCUTTING_VIEW);
+ views.add(INHERITANCE_VIEW);
+ browserPanel = new StructureViewPanel(views);
+ }
+
+ public StructureViewPanel getBrowserPanel() {
+ return browserPanel;
+ }
+
+ public void showSourcesNodes(java.util.List nodes) {
+ for (Iterator it = nodes.iterator(); it.hasNext(); ) {
+ ProgramElementNode currNode = null;
+ StructureNode structureNode = (StructureNode)it.next();
+ if (structureNode instanceof LinkNode) {
+ currNode = ((LinkNode)structureNode).getProgramElementNode();
+ } else {
+ currNode = (ProgramElementNode)structureNode;
+ }
+ Ajde.getDefault().getEditorManager().addViewForSourceLine(currNode.getSourceLocation().getSourceFile().getAbsolutePath(),
+ currNode.getSourceLocation().getLine());
+ }
+ }
+
+ 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);
+ }
+
+ {
+ DECLARATION_VIEW_PROPERTIES = new GlobalViewProperties(StructureViewProperties.Hierarchy.DECLARATION);
+ CROSSCUTTING_VIEW_PROPERTIES = new GlobalViewProperties(StructureViewProperties.Hierarchy.CROSSCUTTING);
+ INHERITANCE_VIEW_PROPERTIES = new GlobalViewProperties(StructureViewProperties.Hierarchy.INHERITANCE);
+
+ CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.METHOD_RELATION);
+ CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.METHOD_CALL_SITE_RELATION);
+ CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.CONSTRUCTOR_RELATION);
+ CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.CONSTRUCTOR_CALL_SITE_RELATION);
+ CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.HANDLER_RELATION);
+ CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.INITIALIZER_RELATION);
+ CROSSCUTTING_VIEW_PROPERTIES.addRelation(AdviceAssociation.FIELD_ACCESS_RELATION);
+
+ INHERITANCE_VIEW_PROPERTIES.addRelation(InheritanceAssociation.IMPLEMENTS_RELATION);
+ INHERITANCE_VIEW_PROPERTIES.addRelation(InheritanceAssociation.INHERITS_MEMBERS_RELATION);
+ INHERITANCE_VIEW_PROPERTIES.addRelation(InheritanceAssociation.INHERITS_RELATION);
+
+ DECLARATION_VIEW_PROPERTIES.setRelations(Ajde.getDefault().getStructureViewManager().getAvailableRelations());
+
+ CROSSCUTTING_VIEW = Ajde.getDefault().getStructureViewManager().createGlobalView(CROSSCUTTING_VIEW_PROPERTIES);
+ INHERITANCE_VIEW = Ajde.getDefault().getStructureViewManager().createGlobalView(INHERITANCE_VIEW_PROPERTIES);
+ DECLARATION_VIEW = Ajde.getDefault().getStructureViewManager().createGlobalView(DECLARATION_VIEW_PROPERTIES);
+ }
+}
+
+
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewPanel.java
new file mode 100644
index 000000000..96adbff63
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewPanel.java
@@ -0,0 +1,152 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.util.Iterator;
+
+import javax.swing.*;
+import javax.swing.event.*;
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.ui.*;
+
+/**
+ * Represents the configuration of a structure view of the system, rendered
+ * by the <CODE>StructureTreeManager</CODE>.
+ *
+ * @author Mik Kersten
+ */
+public class BrowserViewPanel extends JPanel implements StructureViewRenderer {
+
+ private StructureTreeManager treeManager;
+ //private StructureView structureView = null;
+ private int depthSliderVal = 0;
+ private JComboBox view_comboBox = null;
+
+ private BorderLayout borderLayout1 = new BorderLayout();
+ private JToolBar view_toolBar = new JToolBar();
+ private JSlider depth_slider = new JSlider();
+ JScrollPane tree_ScrollPane = new JScrollPane();
+ JPanel tree_panel = new JPanel();
+ BorderLayout borderLayout2 = new BorderLayout();
+
+// private final StructureViewRenderer VIEW_LISTENER = new StructureViewRenderer() {
+// public void viewUpdated() {
+// updateTree();
+// }
+// };
+
+ public BrowserViewPanel(IconRegistry icons, java.util.List views, StructureViewProperties.Hierarchy visibleViewHierarchy) {
+ try {
+ view_comboBox = new JComboBox(views.toArray());
+ for (Iterator it = views.iterator(); it.hasNext(); ) {
+ StructureViewProperties.Hierarchy hierarchy = (StructureViewProperties.Hierarchy)it.next();
+ if (hierarchy == visibleViewHierarchy) {
+ view_comboBox.setSelectedItem(hierarchy);
+ }
+ }
+ //GlobalViewProperties visibleView = (GlobalViewProperties)viewProperties.get(visibleViewHierarchy.toString());
+ treeManager = new StructureTreeManager();//, visibleView);
+ jbInit();
+ initDepthSlider();
+ tree_ScrollPane.getViewport().add(treeManager.getStructureTree(), null);
+
+ //Ajde.getDefault().getViewManager().getFileStructureView().addListener(VIEW_LISTENER);
+ }
+ catch(Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e);
+ }
+ }
+
+ public void setActiveNode(StructureViewNode node) {
+ throw new RuntimeException("not implemented");
+ }
+
+ public void setActiveNode(StructureViewNode activeNode, int lineOffset) {
+ throw new RuntimeException("not implemented");
+ }
+
+// public void highlightNode(ProgramElementNode node) {
+// treeManager.navigationAction(node, true, true);
+// }
+
+// void updateTree() {
+// StructureViewProperties.Hierarchy hierarchy = ((StructureViewProperties.Hierarchy)view_comboBox.getSelectedItem());
+// GlobalStructureView structureView = Ajde.getDefault().getStructureViewManager().getGlobalStructureView(hierarchy);
+// treeManager.updateTree(structureView, depthSliderVal);
+// }
+
+ public void updateView(StructureView structureView) {
+ if (structureView instanceof GlobalStructureView) {
+ treeManager.updateTree((GlobalStructureView)structureView);
+ }
+ }
+
+ void updateTree(String filePath) {
+ //treeManager.updateTree(Ajde.getDefault().getViewManager().getFileStructureView(filePath));
+ }
+
+ private void initDepthSlider() {
+ depth_slider.setMinimum(0);
+ depth_slider.setMaximum(9);
+ depth_slider.setMinorTickSpacing(1);
+ depth_slider.setValue(9);
+ depth_slider.setSnapToTicks(true);
+ depth_slider.setPaintTrack(true);
+ depth_slider.setPaintTicks(true);
+ this.depth_slider.addChangeListener(
+ new ChangeListener() {
+ public void stateChanged(ChangeEvent e) {
+ depthSliderVal = depth_slider.getValue();
+ //AjdeUIManager.getDefault().getViewManager().updateView();
+ }
+ });
+ depthSliderVal = depth_slider.getValue();
+ }
+
+ private void view_comboBox_actionPerformed(ActionEvent e) {
+ //updateTree(DECLARATION_VIEW);
+ throw new RuntimeException("not implemented");
+ }
+
+ private void jbInit() throws Exception {
+ tree_panel.setLayout(borderLayout2);
+ this.setLayout(borderLayout1);
+ view_comboBox.setPreferredSize(new Dimension(200, 20));
+ view_comboBox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ view_comboBox_actionPerformed(e);
+ }
+ });
+ view_comboBox.setMinimumSize(new Dimension(40, 20));
+ view_comboBox.setFont(new java.awt.Font("SansSerif", 0, 11));
+ depth_slider.setMaximumSize(new Dimension(32767, 25));
+ depth_slider.setToolTipText("");
+ depth_slider.setMinimumSize(new Dimension(30, 20));
+ depth_slider.setBorder(null);
+ depth_slider.setPreferredSize(new Dimension(30, 25));
+ depth_slider.setMaximum(3);
+ depth_slider.setPaintTicks(true);
+ depth_slider.setValue(1);
+ depth_slider.setPaintLabels(true);
+ view_toolBar.setFloatable(false);
+ this.add(view_toolBar, BorderLayout.NORTH);
+ view_toolBar.add(view_comboBox, null);
+ view_toolBar.add(depth_slider, null);
+ this.add(tree_panel, BorderLayout.CENTER);
+ tree_panel.add(tree_ScrollPane, BorderLayout.CENTER);
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewTreeListener.java b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewTreeListener.java
new file mode 100644
index 000000000..f795541c4
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BrowserViewTreeListener.java
@@ -0,0 +1,129 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.event.*;
+import java.util.*;
+
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.tree.TreePath;
+import org.aspectj.asm.*;
+
+/**
+ * @author Mik Kersten
+ */
+class BrowserViewTreeListener implements TreeSelectionListener, MouseListener {
+ private StructureTree tree = null;
+
+ public BrowserViewTreeListener(StructureTree tree) {
+ this.tree = tree;
+ }
+
+ public void valueChanged(TreeSelectionEvent e) { }
+
+ public void mouseEntered(MouseEvent e) { }
+
+ public void mouseExited(MouseEvent e) { }
+
+ public void mousePressed(MouseEvent e) { }
+
+ public void mouseReleased(MouseEvent e) { }
+
+ public void mouseClicked(MouseEvent e) {
+ singleClickNavigation(e);
+ //doubleClickNavigation(e);
+ maybeShowPopup(e);
+ }
+
+ public void singleClickNavigation(MouseEvent e) {
+ SwingTreeViewNode treeNode = (SwingTreeViewNode)tree.getLastSelectedPathComponent();
+ if (treeNode != null && !e.isControlDown() && !e.isShiftDown() && e.getModifiers() != 4) {
+ StructureNode currNode = (StructureNode)treeNode.getUserObject();
+ if (currNode instanceof ProgramElementNode && !e.isControlDown()
+ && !e.isShiftDown() && e.getModifiers() != 4) {
+ //AjdeUIManager.getDefault().getViewManager().showNodeInMasterView((ProgramElementNode)currNode);
+ //if (AjdeUIManager.getDefault().getViewManager().isSplitViewMode()) {
+ // AjdeUIManager.getDefault().getViewManager().showNodeInSlaveView((ProgramElementNode)currNode);
+ //}
+ } else if (currNode instanceof LinkNode) {
+ //if (!AjdeUIManager.getDefault().getViewManager().isSplitViewMode()) {
+ // AjdeUIManager.getDefault().getViewManager().showNodeInMasterView((LinkNode)currNode);
+ //} else {
+ // AjdeUIManager.getDefault().getViewManager().showNodeInSlaveView(((LinkNode)currNode).getProgramElementNode());
+ //}
+ }
+ }
+ }
+
+ public void doubleClickNavigation(MouseEvent e) {
+ int clickCount = e.getClickCount();
+ SwingTreeViewNode treeNode = (SwingTreeViewNode)tree.getLastSelectedPathComponent();
+ if (treeNode != null) {
+ StructureNode currNode = (StructureNode)treeNode.getUserObject();
+ if (currNode instanceof ProgramElementNode && !e.isControlDown() && !e.isShiftDown()
+ && e.getModifiers() != 4) {
+ //AjdeUIManager.getDefault().getViewManager().showNodeInMasterView(((LinkNode)currNode).getProgramElementNode());
+ //AjdeUIManager.getDefault().getViewManager().showNodeInSlaveView(((LinkNode)currNode).getProgramElementNode());
+ } else if (currNode instanceof LinkNode) {
+ if (clickCount == 1) {
+ //AjdeUIManager.getDefault().getViewManager().showLink((LinkNode)currNode);
+ } else if (clickCount == 2) {
+ //navigationAction((ProgramElementNode)((LinkNode)currNode).getProgramElementNode(), true, true);
+ }
+ }
+ }
+ }
+
+ /**
+ * @todo this should probably use <CODE>e.isPopupTrigger()</CODE> but that
+ * doesn't work for some reason, so we just check if the right mouse button
+ * has been clicked.
+ */
+ private void maybeShowPopup(MouseEvent e) {
+ if (e.getModifiers() == e.BUTTON3_MASK && tree.getSelectionCount() > 0) {
+ TreePath[] selectionPaths = tree.getSelectionPaths();
+ final List signatures = new ArrayList();
+ for (int i = 0; i < selectionPaths.length; i++) {
+ StructureNode currNode = (StructureNode)((SwingTreeViewNode)selectionPaths[i].getLastPathComponent()).getUserObject();
+ if (currNode instanceof LinkNode || currNode instanceof ProgramElementNode) {
+ signatures.add(currNode);
+ }
+ }
+
+ JPopupMenu popup = new JPopupMenu();
+ JMenuItem showSourcesItem = new JMenuItem("Display sources", AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.CODE));
+ showSourcesItem.setFont(new java.awt.Font("Dialog", 0, 11));
+ showSourcesItem.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ //AjdeUIManager.getDefault().getViewManager().showSourcesNodes(signatures);
+ }
+ });
+ popup.add(showSourcesItem);
+
+ popup.addSeparator();
+ JMenuItem generatePCD = new JMenuItem("Pointcut Wizard (alpha)...", AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.POINTCUT));
+ generatePCD.setFont(new java.awt.Font("Dialog", 0, 11));
+ generatePCD.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ AjdeUIManager.getDefault().getViewManager().extractAndInsertSignatures(signatures, true);
+ }
+ });
+ popup.add(generatePCD);
+
+ popup.show(e.getComponent(), e.getX(), e.getY());
+ }
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java b/ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java
new file mode 100644
index 000000000..5accf747c
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BuildConfigPopupMenu.java
@@ -0,0 +1,46 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Iterator;
+
+import javax.swing.*;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.asm.ProgramElementNode;
+
+public class BuildConfigPopupMenu extends JPopupMenu {
+
+ public BuildConfigPopupMenu(final AbstractAction action) {
+ java.util.List configFiles = Ajde.getDefault().getProjectProperties().getBuildConfigFiles();
+ for (Iterator it = configFiles.iterator(); it.hasNext(); ) {
+ final String buildConfig = (String)it.next();
+ JMenuItem buildItem = new JMenuItem(buildConfig);
+ buildItem.setFont(AjdeWidgetStyles.DEFAULT_LABEL_FONT);
+ buildItem.addActionListener(
+ new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ Ajde.getDefault().getConfigurationManager().setActiveConfigFile(buildConfig);
+ Ajde.getDefault().getBuildManager().build();
+ action.actionPerformed(e);
+ }
+ });
+ buildItem.setIcon((Icon)AjdeUIManager.getDefault().getIconRegistry().getStructureIcon(ProgramElementNode.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
new file mode 100644
index 000000000..90dad5e95
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BuildOptionsPanel.java
@@ -0,0 +1,248 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import javax.swing.*;
+import java.io.*;
+import java.awt.*;
+import javax.swing.border.*;
+import org.aspectj.ajde.*;
+
+/**
+ * @author Mik Kersten
+ */
+public class BuildOptionsPanel extends OptionsPanel {
+
+ protected static 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 JLabel spacer_label = new JLabel();
+ private JTextField workingDir_field = new JTextField();
+ private JPanel jPanel2 = new JPanel();
+ private JPanel jPanel1 = new JPanel();
+ private Box options_box = Box.createVerticalBox();
+ private JPanel build_panel = new JPanel();
+ private JTextField nonStandard_field = new JTextField();
+ private JCheckBox pre1_checkBox = new JCheckBox();
+ private JCheckBox assertions_checkBox = new JCheckBox();
+ private JCheckBox useJavac_checkBox = new JCheckBox();
+ private JCheckBox preprocess_checkBox = new JCheckBox();
+ 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();
+
+ 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 {
+ assertions_checkBox.setSelected(
+ Ajde.getDefault().getBuildManager().getBuildOptions().getSourceOnePointFourMode()
+ );
+ preprocess_checkBox.setSelected(
+ Ajde.getDefault().getBuildManager().getBuildOptions().getPreprocessMode()
+ );
+ useJavac_checkBox.setSelected(
+ Ajde.getDefault().getBuildManager().getBuildOptions().getUseJavacMode()
+ );
+ pre1_checkBox.setSelected(
+ Ajde.getDefault().getBuildManager().getBuildOptions().getPortingMode()
+ );
+
+ 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 {
+ AjdeUIManager.getDefault().getBuildOptions().setSourceOnePointFourMode(
+ assertions_checkBox.isSelected()
+ );
+ AjdeUIManager.getDefault().getBuildOptions().setPreprocessMode(
+ preprocess_checkBox.isSelected()
+ );
+ AjdeUIManager.getDefault().getBuildOptions().setUseJavacMode(
+ useJavac_checkBox.isSelected()
+ );
+ AjdeUIManager.getDefault().getBuildOptions().setPortingMode(
+ pre1_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");
+ border3 =
+ BorderFactory.createCompoundBorder(
+ new TitledBorder(
+ BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158)),
+ "ajc Options"),
+ BorderFactory.createEmptyBorder(5, 5, 5, 5));
+ border4 =
+ 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));
+ spacer_label.setText(" ");
+ workingDir_field.setFont(new java.awt.Font("SansSerif", 0, 11));
+ workingDir_field.setMinimumSize(new Dimension(200, 21));
+ workingDir_field.setPreferredSize(new Dimension(210, 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(100, 21));
+ nonStandard_field.setPreferredSize(new Dimension(210, 21));
+ pre1_checkBox.setText(
+ "Signal warnings for pre-1.0 language use to ease porting");
+ pre1_checkBox.setToolTipText("");
+ pre1_checkBox.setFont(new java.awt.Font("Dialog", 0, 11));
+ assertions_checkBox.setFont(new java.awt.Font("Dialog", 0, 11));
+ assertions_checkBox.setText("Support assertions from 1.4 Java specification");
+ 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");
+ compileOptions_panel.setLayout(borderLayout1);
+ nonStandard_label.setText("Non-standard compiler options:");
+ nonStandard_label.setFont(new java.awt.Font("Dialog", 0, 11));
+ nonStandard_label.setPreferredSize(new Dimension(100, 16));
+ nonStandard_label.setToolTipText("");
+ jPanel3.setLayout(borderLayout7);
+ workingDir_label.setFont(new java.awt.Font("Dialog", 0, 11));
+ workingDir_label.setPreferredSize(new Dimension(150, 16));
+ workingDir_label.setText("Working directory (for preprocess and use-javac): ");
+ this.add(jPanel3, BorderLayout.NORTH);
+ jPanel2.add(workingDir_label, BorderLayout.CENTER);
+ jPanel2.add(workingDir_field, BorderLayout.EAST);
+ 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(options_box, BorderLayout.NORTH);
+ compileOptions_panel.add(fields_box, BorderLayout.SOUTH);
+ options_box.add(assertions_checkBox, null);
+ options_box.add(preprocess_checkBox, null);
+ options_box.add(useJavac_checkBox, null);
+ //options_box.add(pre1_checkBox, null);
+ options_box.add(spacer_label, null);
+ 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
new file mode 100644
index 000000000..68f1fe45d
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BuildProgressPanel.java
@@ -0,0 +1,132 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+
+import javax.swing.*;
+
+import org.aspectj.ajde.Ajde;
+
+/**
+ * @author Mik Kersten
+ */
+class BuildProgressPanel extends JPanel {
+
+ private static final int MAX_VAL = 100;
+ //private JDialog dialog = null;
+
+ BorderLayout borderLayout1 = new BorderLayout();
+ JPanel cancel_panel = new JPanel();
+ JButton cancel_button = new JButton();
+ JPanel jPanel2 = new JPanel();
+ JLabel progress_label = new JLabel();
+ JLabel configFile_label = new JLabel();
+ BorderLayout borderLayout3 = new BorderLayout();
+ JPanel jPanel1 = new JPanel();
+ JProgressBar compile_progressBar = new JProgressBar();
+
+ /**
+ * @param maxVal the value to which value to which the progress bar will
+ * count up to (in seconds)
+ */
+ public BuildProgressPanel() {
+ try {
+ jbInit();
+ compile_progressBar.setMaximum(MAX_VAL);
+ } catch (Exception e) {
+ throw new RuntimeException(e.toString());
+ }
+ }
+
+// public void start() {
+// dialog =
+// new JDialog(TopManager.INSTANCE.getRootFrame(), "ajc Build Progress", false);
+// // progressDialog = new CompileProgressPanel();
+// dialog.setContentPane(this);
+// dialog.setSize(500, 110);
+// dialog.setLocationRelativeTo(TopManager.INSTANCE.getRootFrame());
+// dialog.setVisible(true);
+// }
+
+ public void setProgressText(String text) {
+ progress_label.setText(" " + text);
+ }
+
+ public void setConfigFile(String configFile) {
+ configFile_label.setText(" Build configuration: " + configFile);
+ }
+
+ /**
+ * Jumps the progress bar <CODE>newVal</CODE> seconds ahead.
+ */
+ public void setProgressBarVal(int newVal) {
+ compile_progressBar.setValue(newVal);
+ }
+
+ public void setProgressBarMax(int maxVal) {
+ compile_progressBar.setMaximum(maxVal);
+ }
+
+ public int getProgressBarMax() {
+ return compile_progressBar.getMaximum();
+ }
+
+ /**
+ * Makes the progress bar move one second ahead.
+ */
+ public void incrementProgressBarVal() {
+ int newVal = compile_progressBar.getValue() + 1;
+ compile_progressBar.setValue(newVal);
+ }
+
+ /**
+ * Jumps the progress bar to the end.
+ */
+ public void finish() {
+ compile_progressBar.setValue(compile_progressBar.getMaximum());
+ }
+
+ private void jbInit() throws Exception {
+ this.setLayout(borderLayout1);
+ cancel_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ cancel_button.setText("Cancel");
+ cancel_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ cancel_button_actionPerformed(e);
+ }
+ });
+ progress_label.setFont(new java.awt.Font("Dialog", 0, 11));
+ progress_label.setText("");
+ jPanel2.setPreferredSize(new Dimension(360, 24));
+ jPanel2.setLayout(borderLayout3);
+ configFile_label.setFont(new java.awt.Font("Dialog", 0, 11));
+ configFile_label.setText("");
+ compile_progressBar.setPreferredSize(new Dimension(330, 14));
+ this.add(cancel_panel, BorderLayout.SOUTH);
+ cancel_panel.add(cancel_button, null);
+ this.add(jPanel2, BorderLayout.CENTER);
+ jPanel2.add(configFile_label, BorderLayout.NORTH);
+ jPanel2.add(progress_label, BorderLayout.SOUTH);
+ jPanel2.add(jPanel1, BorderLayout.CENTER);
+ jPanel1.add(compile_progressBar, null);
+ }
+
+ void cancel_button_actionPerformed(ActionEvent e) {
+ Ajde.getDefault().getBuildManager().abortBuild();
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/CompilerMessage.java b/ajde/src/org/aspectj/ajde/ui/swing/CompilerMessage.java
new file mode 100644
index 000000000..28540c6b0
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/CompilerMessage.java
@@ -0,0 +1,50 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.ISourceLocation;
+
+/**
+ * @author Mik Kersten
+ */
+public class CompilerMessage {
+ public String message;
+ public ISourceLocation sourceLocation;
+ public IMessage.Kind kind;
+
+ public CompilerMessage(String message, IMessage.Kind kind) {
+ this.message = message;
+ this.sourceLocation = null;
+ this.kind = kind;
+ }
+
+ public CompilerMessage(String message, ISourceLocation sourceLocation, IMessage.Kind kind) {
+ this.message = message;
+ this.sourceLocation = sourceLocation;
+ this.kind = kind;
+ }
+
+ public String toString() {
+ if (sourceLocation != null) {
+ return sourceLocation.getSourceFile().getAbsolutePath() + ":"
+ + " " + message
+ + " at line " + sourceLocation.getLine()
+ + ", column " + sourceLocation.getColumn();
+ } else {
+ return message;
+ }
+ }
+ }
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/CompilerMessagesCellRenderer.java b/ajde/src/org/aspectj/ajde/ui/swing/CompilerMessagesCellRenderer.java
new file mode 100644
index 000000000..9046b979c
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/CompilerMessagesCellRenderer.java
@@ -0,0 +1,59 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.Component;
+
+import javax.swing.*;
+
+import org.aspectj.bridge.IMessage;
+
+/**
+ * @author Mik Kersten
+ */
+public class CompilerMessagesCellRenderer extends JLabel implements ListCellRenderer {
+
+ public Component getListCellRendererComponent(
+ JList list,
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus) {
+ if (value != null) {
+ setText(value.toString());
+ } else {
+ setText("");
+ }
+ IMessage.Kind kind = ((CompilerMessage)value).kind;
+ if (kind.equals(IMessage.WARNING)) {
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getWarningIcon());
+ } else if (kind.equals(IMessage.INFO)) {
+ setIcon(null);
+ } else {
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getErrorIcon());
+ }
+ if (isSelected) {
+ setBackground(list.getSelectionBackground());
+ setForeground(list.getSelectionForeground());
+ } else {
+ setBackground(list.getBackground());
+ setForeground(list.getForeground());
+ }
+ setEnabled(list.isEnabled());
+ setFont(list.getFont());
+ setOpaque(true);
+ return this;
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/DefaultBuildProgressMonitor.java b/ajde/src/org/aspectj/ajde/ui/swing/DefaultBuildProgressMonitor.java
new file mode 100644
index 000000000..5caa9cbec
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/DefaultBuildProgressMonitor.java
@@ -0,0 +1,95 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.Frame;
+
+import javax.swing.JDialog;
+
+import org.aspectj.ajde.BuildProgressMonitor;
+
+/**
+ * This dialog box is open while ajc is compiling the system and displays
+ * a corresponding progress bar.
+ *
+ * @author Mik Kersten
+ */
+public class DefaultBuildProgressMonitor extends Thread implements BuildProgressMonitor {
+
+ private BuildProgressPanel progressDialog = null;
+ private JDialog dialog = null;
+
+ public DefaultBuildProgressMonitor(Frame parent) {
+ dialog = new JDialog(parent, PROGRESS_HEADING, false);
+ progressDialog = new BuildProgressPanel();
+ dialog.setContentPane(progressDialog);
+ dialog.setSize(550, 120);
+ dialog.setLocationRelativeTo(parent);
+ }
+
+ /**
+ * Start the progress monitor.
+ */
+ public void start(String configFilePath) {
+ progressDialog.setConfigFile(configFilePath);
+ progressDialog.setProgressBarVal(0);
+ progressDialog.setProgressText("starting build...");
+ dialog.setLocationRelativeTo(AjdeUIManager.getDefault().getRootFrame());
+ dialog.setVisible(true);
+ }
+
+ /**
+ * Sets the label describing the current progress phase.
+ */
+ public void setProgressText(String text) {
+ progressDialog.setProgressText(text);
+ }
+
+ /**
+ * 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() {
+ progressDialog.finish();
+ dialog.dispose();
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/ErrorDialog.java b/ajde/src/org/aspectj/ajde/ui/swing/ErrorDialog.java
new file mode 100644
index 000000000..636293945
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/ErrorDialog.java
@@ -0,0 +1,94 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.border.*;
+
+class ErrorDialog extends JDialog {
+ JPanel top_panel = new JPanel();
+ BorderLayout borderLayout2 = new BorderLayout();
+ JPanel button_panel = new JPanel();
+ JButton close_button = new JButton();
+ JScrollPane jScrollPane1 = new JScrollPane();
+ JTextArea stackTrace_textArea = new JTextArea();
+ JPanel jPanel1 = new JPanel();
+ JLabel error_label1 = new JLabel();
+ JLabel error_label2 = new JLabel();
+ BorderLayout borderLayout1 = new BorderLayout();
+ Border border1;
+ BorderLayout borderLayout3 = new BorderLayout();
+
+ public ErrorDialog(Frame owner, String title, Throwable throwable, String message, String details) {
+ super(owner, title, true);
+ try {
+ jbInit();
+ String exceptionName = "<unknown exception>";
+ if (throwable != null) exceptionName = throwable.getClass().getName();
+ this.error_label1.setText("A " + exceptionName + " exception has occured.");
+ this.error_label2.setText("Please copy the following report and submit it at http://aspectj.org/bugs");
+ this.stackTrace_textArea.setText("Message: " + message + '\n' + "Stack trace: " + details);
+ this.setSize(420, 330);
+ this.setLocationRelativeTo(owner);
+ this.getContentPane().setLayout(borderLayout1);
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void jbInit() throws Exception {
+ border1 = BorderFactory.createEmptyBorder(5,5,5,5);
+ this.getContentPane().setLayout(borderLayout1);
+ top_panel.setLayout(borderLayout2);
+ close_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ close_button.setText("Close");
+ close_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ close_button_actionPerformed(e);
+ }
+ });
+ top_panel.setBorder(border1);
+ top_panel.setPreferredSize(new Dimension(400, 290));
+ stackTrace_textArea.setFont(new java.awt.Font("Monospaced", 0, 11));
+ error_label1.setFont(new java.awt.Font("Dialog", 0, 11));
+ error_label1.setFont(new java.awt.Font("Dialog", 0, 11));
+ error_label1.setForeground(Color.black);
+ error_label1.setMaximumSize(new Dimension(400, 16));
+ error_label1.setPreferredSize(new Dimension(390, 16));
+ error_label1.setText("label1");
+ jPanel1.setLayout(borderLayout3);
+ error_label2.setFont(new java.awt.Font("Dialog", 0, 11));
+ error_label2.setMaximumSize(new Dimension(400, 16));
+ error_label2.setPreferredSize(new Dimension(390, 16));
+ error_label2.setText("label2");
+ error_label2.setForeground(Color.black);
+ jPanel1.setPreferredSize(new Dimension(600, 44));
+ this.getContentPane().add(top_panel, BorderLayout.CENTER);
+ top_panel.add(button_panel, BorderLayout.SOUTH);
+ button_panel.add(close_button, null);
+ top_panel.add(jScrollPane1, BorderLayout.CENTER);
+ top_panel.add(jPanel1, BorderLayout.NORTH);
+ jPanel1.add(error_label1, BorderLayout.NORTH);
+ jPanel1.add(error_label2, BorderLayout.CENTER);
+ jScrollPane1.getViewport().add(stackTrace_textArea, null);
+ }
+
+ void close_button_actionPerformed(ActionEvent e) {
+ this.dispose();
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/GoToLineThread.java b/ajde/src/org/aspectj/ajde/ui/swing/GoToLineThread.java
new file mode 100644
index 000000000..2082b4d93
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/GoToLineThread.java
@@ -0,0 +1,78 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde.ui.swing;
+
+import javax.swing.SwingUtilities;
+import org.aspectj.ajde.*;
+
+/**
+ * Used to ensure that a source line has been seeked to. Will repeatedly attempt
+ * to seek to the line until this has succeeded.
+ *
+ * @author Mik Kersten
+ */
+public class GoToLineThread extends Thread {
+ private EditorAdapter editorAdapter = null;
+
+ private int lineNumber = 0;
+ private String fileToSeekTo = "";
+ private boolean finished = false;
+
+ public boolean isFinished() {
+ return finished;
+ }
+
+ public boolean needsRetry() {
+ return !this.isAlive() && !finished;
+ }
+
+ public GoToLineThread(String fileToSeekTo, int lineNumber, EditorAdapter editorAdapter) {
+ this.lineNumber = lineNumber;
+ this.fileToSeekTo = fileToSeekTo;
+ this.editorAdapter = editorAdapter;
+ }
+
+ public void run() {
+
+ while(true) {
+ String file = editorAdapter.getCurrFile();
+ if (file != null) {
+ if (file.equals(this.fileToSeekTo)) {
+ try {
+ SwingUtilities.invokeAndWait( new Runnable() {
+ public void run() {
+ editorAdapter.showSourceLine(lineNumber, true);
+ }
+ });
+ } catch (Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not seek to line.", e);
+ }
+ finished = true;
+ break;
+ }
+ shortPause();
+ }
+ }
+ }
+
+ private void shortPause() {
+ try {
+ this.sleep(100);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e.getMessage());
+ }
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java b/ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java
new file mode 100644
index 000000000..875ba9ed1
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/IconRegistry.java
@@ -0,0 +1,160 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import org.aspectj.ajde.ui.AbstractIcon;
+import org.aspectj.ajde.ui.AbstractIconRegistry;
+import org.aspectj.asm.ProgramElementNode;
+import org.aspectj.asm.Relation;
+
+/**
+ * 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(Relation relation) {
+ return convertToSwingIcon(getRelationIcon(relation));
+ }
+
+ protected AbstractIcon getStructureIcon(ProgramElementNode.Kind kind, ProgramElementNode.Accessibility accessibility) {
+ return getStructureIcon(kind);
+ }
+
+ public Icon getStructureSwingIcon(ProgramElementNode.Kind kind, ProgramElementNode.Accessibility accessibility) {
+ return convertToSwingIcon(getStructureIcon(kind, accessibility));
+ }
+
+ public Icon getStructureSwingIcon(ProgramElementNode.Kind kind) {
+ return convertToSwingIcon(getStructureIcon(kind));
+ }
+
+ public Icon getAccessibilitySwingIcon(ProgramElementNode.Accessibility accessibility) {
+ if (accessibility == ProgramElementNode.Accessibility.PUBLIC) {
+ return ACCESSIBILITY_PUBLIC;
+ } else if (accessibility == ProgramElementNode.Accessibility.PACKAGE) {
+ return ACCESSIBILITY_PACKAGE;
+ } else if (accessibility == ProgramElementNode.Accessibility.PROTECTED) {
+ return ACCESSIBILITY_PROTECTED;
+ } else if (accessibility == ProgramElementNode.Accessibility.PRIVATE) {
+ return ACCESSIBILITY_PRIVATE;
+ } else if (accessibility == ProgramElementNode.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
new file mode 100644
index 000000000..3d973bd24
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/MultiStructureViewPanel.java
@@ -0,0 +1,48 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JPanel;
+import javax.swing.JSplitPane;
+
+import org.aspectj.ajde.Ajde;
+
+/**
+ * @author Mik Kersten
+ */
+public class MultiStructureViewPanel extends JPanel {
+ JSplitPane views_splitPane;
+ BorderLayout borderLayout1 = new BorderLayout();
+
+ public MultiStructureViewPanel(StructureViewPanel topPanel, StructureViewPanel bottomPanel) {
+ super();
+ try {
+ views_splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, bottomPanel);
+ jbInit();
+ } catch(Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e);
+ }
+ }
+
+ private void jbInit() throws Exception {
+ this.setLayout(borderLayout1);
+ this.add(views_splitPane, BorderLayout.CENTER);
+ views_splitPane.setDividerSize(4);
+ views_splitPane.setDividerLocation(300);
+ }
+
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/OptionsFrame.java b/ajde/src/org/aspectj/ajde/ui/swing/OptionsFrame.java
new file mode 100644
index 000000000..8690a8070
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/OptionsFrame.java
@@ -0,0 +1,257 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.util.Date;
+
+import javax.swing.*;
+import javax.swing.border.Border;
+import javax.swing.border.TitledBorder;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.bridge.Version;
+
+/**
+ * UI for setting user-configureable options.
+ *
+ * @author Mik Kersten
+ */
+public class OptionsFrame extends JFrame {
+
+ private static final String ABOUT_TEXT =
+ "\nPlease submit bugs at http://aspectj.org/bugs\n" +
+ "For support questions email support@aspectj.org\n\n" +
+ "The AspectJ compiler and core tools are distributed under\n" +
+ "the Mozilla Public License version 1.1.  This license has\n" +
+ "been approved by the Open Source Initiative as conforming\n" +
+ "to the Open Source Definition.  For more information and the\n" +
+ "license please visit http://aspectj.org/license\n";
+
+ private JTabbedPane main_tabbedPane = new JTabbedPane();
+ private JPanel button_panel = new JPanel();
+ private JButton apply_button = new JButton();
+ private JButton cancel_button = new JButton();
+ private JButton ok_button = new JButton();
+ private TitledBorder titledBorder1;
+ private TitledBorder titledBorder2;
+ private TitledBorder titledBorder3;
+ private Border border1;
+ private TitledBorder titledBorder4;
+ private TitledBorder titledBorder5;
+ private Border border2;
+ private TitledBorder titledBorder6;
+ private Box temp_box = Box.createVerticalBox();
+ private Border border3;
+ private TitledBorder titledBorder7;
+ private Border border4;
+ private TitledBorder titledBorder8;
+ private Border border5;
+ private TitledBorder titledBorder9;
+ private Border border6;
+ private TitledBorder titledBorder10;
+ private ButtonGroup views_buttonGroup = new ButtonGroup();
+ private Border border7;
+ private TitledBorder titledBorder11;
+ private Border border8;
+ private TitledBorder titledBorder12;
+ private JPanel about_panel = new JPanel();
+ private BorderLayout borderLayout9 = new BorderLayout();
+ JTextArea jTextArea1 = new JTextArea();
+ JPanel jPanel1 = new JPanel();
+ JLabel version_label = new JLabel();
+ JLabel jLabel1 = new JLabel();
+ BorderLayout borderLayout1 = new BorderLayout();
+ Border border9;
+ JLabel built_label = new JLabel();
+
+ public OptionsFrame(IconRegistry icons) {
+ try {
+ jbInit();
+
+ this.setTitle("AJDE Settings");
+ this.setIconImage(((ImageIcon)icons.getBrowserOptionsIcon()).getImage());
+ this.setSize(500, 500);
+ this.setLocation(200, 100);
+
+ version_label.setText("Version: " + Version.text);
+ built_label.setText("Built: " + new Date(Version.time).toString());
+
+ addOptionsPanel(new BuildOptionsPanel());
+ loadOptions();
+ }
+ catch(Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not open OptionsFrame", e);
+ }
+ }
+
+ /**
+ * Adds the panel in the second-to-last postion.
+ */
+ public void addOptionsPanel(OptionsPanel panel) {
+ main_tabbedPane.add(panel, main_tabbedPane.getComponentCount()-1);
+ loadOptions();
+ }
+
+ public void removeOptionsPanel(OptionsPanel panel) {
+ main_tabbedPane.remove(panel);
+ }
+
+ public void showPanel(OptionsPanel panel) {
+ setVisible(true);
+ main_tabbedPane.setSelectedComponent(panel);
+ }
+
+ private void loadOptions() {
+ try {
+ Component[] components = main_tabbedPane.getComponents();
+ for
+(int i = 0; i < components.length; i++) {
+ if (components[i] instanceof OptionsPanel) {
+ ((OptionsPanel)components[i]).loadOptions();
+ }
+ }
+ } catch (IOException ioe) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not load options.", ioe);
+ }
+ }
+
+ private void saveOptions() {
+ try {
+ Component[] components = main_tabbedPane.getComponents();
+ for (int i = 0; i < components.length; i++) {
+ if (components[i] instanceof OptionsPanel) {
+ ((OptionsPanel)components[i]).saveOptions();
+ }
+ }
+ } catch (IOException ioe) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not load options.", ioe);
+ }
+ }
+
+ private void close() {
+ this.setVisible(false);
+ }
+
+ private void apply_button_actionPerformed(ActionEvent e) {
+ saveOptions();
+ }
+
+ private void ok_button_actionPerformed(ActionEvent e) {
+ saveOptions();
+ close();
+ }
+
+ private void cancel_button_actionPerformed(ActionEvent e) {
+ close();
+ }
+
+ private void jbInit() throws Exception {
+ titledBorder1 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(156, 156, 158)),"Sorting");
+ titledBorder2 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(148, 145, 140)),"Associations (navigeable relations between sturcture nodes)");
+ titledBorder3 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(156, 156, 158)),"Member Filtering (nodes to exclude from view)");
+ border1 = BorderFactory.createLineBorder(Color.black,2);
+ titledBorder4 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(148, 145, 140)),"Compile Options");
+ titledBorder5 = new TitledBorder("");
+ border2 = BorderFactory.createLineBorder(Color.black,2);
+ titledBorder6 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(148, 145, 140)),"Run Options");
+ border3 = BorderFactory.createEtchedBorder(Color.white,new Color(156, 156, 158));
+ titledBorder7 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(156, 156, 158)),"Granularity (all nodes below selected level will be hidden)");
+ border4 = BorderFactory.createEtchedBorder(Color.white,new Color(156, 156, 158));
+ titledBorder8 = new TitledBorder(border4,"Member Visibility");
+ border5 = BorderFactory.createEtchedBorder(Color.white,new Color(156, 156, 158));
+ titledBorder9 = new TitledBorder(border5,"Member Modifiers");
+ border6 = BorderFactory.createEmptyBorder();
+ titledBorder10 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(148, 145, 140)),"Structure View Properties");
+ border7 = BorderFactory.createEtchedBorder(Color.white,new Color(156, 156, 158));
+ titledBorder11 = new TitledBorder(border7,"Member Kinds");
+ border8 = BorderFactory.createEtchedBorder(Color.white,new Color(148, 145, 140));
+ titledBorder12 = new TitledBorder(border8,"Build Paths");
+ border9 = BorderFactory.createEmptyBorder(6,6,6,6);
+ jPanel1.setLayout(borderLayout1);
+ jLabel1.setFont(new java.awt.Font("Dialog", 1, 14));
+ jLabel1.setText("AspectJ Development Environment (AJDE)");
+ version_label.setFont(new java.awt.Font("Dialog", 1, 12));
+ version_label.setText("Version: ");
+ apply_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ apply_button.setMaximumSize(new Dimension(70, 24));
+ apply_button.setMinimumSize(new Dimension(63, 24));
+ apply_button.setPreferredSize(new Dimension(70, 24));
+ apply_button.setText("Apply");
+ apply_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ apply_button_actionPerformed(e);
+ }
+ });
+ cancel_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ cancel_button.setMaximumSize(new Dimension(70, 24));
+ cancel_button.setMinimumSize(new Dimension(67, 24));
+ cancel_button.setPreferredSize(new Dimension(70, 24));
+ cancel_button.setText("Cancel");
+ cancel_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ cancel_button_actionPerformed(e);
+ }
+ });
+ ok_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ ok_button.setMaximumSize(new Dimension(70, 24));
+ ok_button.setMinimumSize(new Dimension(49, 24));
+ ok_button.setPreferredSize(new Dimension(70, 24));
+ ok_button.setText("OK");
+ ok_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ ok_button_actionPerformed(e);
+ }
+ });
+ main_tabbedPane.setFont(new java.awt.Font("Dialog", 0, 11));
+ titledBorder1.setTitle("Ordering (sort order of nodes)");
+ titledBorder1.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ titledBorder2.setTitle("Associations (navigeable relations between structure nodes)");
+ titledBorder2.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ 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.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ titledBorder7.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ titledBorder8.setTitle("Access Modifiers");
+ titledBorder8.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ titledBorder9.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ titledBorder10.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ titledBorder11.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ titledBorder12.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ about_panel.setLayout(borderLayout9);
+ jTextArea1.setBackground(UIManager.getColor("ColorChooser.background"));
+ jTextArea1.setFont(new java.awt.Font("SansSerif", 0, 12));
+ jTextArea1.setEditable(false);
+ jTextArea1.setText(ABOUT_TEXT);
+ about_panel.setBorder(border9);
+ built_label.setText("Built: ");
+ built_label.setFont(new java.awt.Font("Dialog", 1, 12));
+ main_tabbedPane.add(about_panel, "About AJDE");
+ this.getContentPane().add(button_panel, BorderLayout.SOUTH);
+ button_panel.add(ok_button, null);
+ button_panel.add(cancel_button, null);
+ button_panel.add(apply_button, null);
+ this.getContentPane().add(main_tabbedPane, BorderLayout.CENTER);
+ about_panel.add(jTextArea1, BorderLayout.CENTER);
+ about_panel.add(jPanel1, BorderLayout.NORTH);
+ jPanel1.add(jLabel1, BorderLayout.NORTH);
+ jPanel1.add(version_label, BorderLayout.CENTER);
+ jPanel1.add(built_label, BorderLayout.SOUTH);
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/OptionsPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/OptionsPanel.java
new file mode 100644
index 000000000..31fc3e821
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/OptionsPanel.java
@@ -0,0 +1,28 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import javax.swing.*;
+import java.io.*;
+
+/**
+ * @author Mik Kersten
+ */
+public abstract class OptionsPanel extends JPanel {
+
+ public abstract void loadOptions() throws IOException;
+
+ public abstract void saveOptions() throws IOException;
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/PointcutWizard.java b/ajde/src/org/aspectj/ajde/ui/swing/PointcutWizard.java
new file mode 100644
index 000000000..a3044c08a
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/PointcutWizard.java
@@ -0,0 +1,157 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.util.*;
+
+import javax.swing.*;
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.*;
+
+/**
+ * @author Mik Kersten
+ */
+class PointcutWizard extends JFrame {
+ private BrowserViewPanel typeTreeView = null;
+ private java.util.List signatures = null;
+
+ JPanel jPanel1 = new JPanel();
+ JPanel jPanel2 = new JPanel();
+ JPanel jPanel4 = new JPanel();
+ JLabel jLabel1 = new JLabel();
+ BorderLayout borderLayout1 = new BorderLayout();
+ BorderLayout borderLayout2 = new BorderLayout();
+ BorderLayout borderLayout3 = new BorderLayout();
+ JLabel jLabel4 = new JLabel();
+ JPanel jPanel3 = new JPanel();
+ JCheckBox jCheckBox5 = new JCheckBox();
+ JCheckBox jCheckBox4 = new JCheckBox();
+ JCheckBox jCheckBox3 = new JCheckBox();
+ JCheckBox jCheckBox2 = new JCheckBox();
+ JCheckBox jCheckBox1 = new JCheckBox();
+ JButton cancel_button = new JButton();
+ JButton ok_button = new JButton();
+ JPanel jPanel5 = new JPanel();
+
+ public PointcutWizard(java.util.List signatures) {
+ this.signatures = signatures;
+ ArrayList views = new ArrayList();
+ views.add(StructureViewProperties.Hierarchy.INHERITANCE);
+ typeTreeView = new BrowserViewPanel(AjdeUIManager.getDefault().getIconRegistry(), views, StructureViewProperties.Hierarchy.INHERITANCE);
+ typeTreeView.updateTree(Ajde.getDefault().getEditorManager().getCurrFile());
+ try {
+ jbInit();
+ }
+ catch(Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e);
+ }
+ this.setSize(400, 400);
+ this.setIconImage(((ImageIcon)AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.POINTCUT)).getImage());
+ }
+
+ private Map getViewProperties() {
+ Map views = new HashMap();
+ GlobalViewProperties INHERITANCE_VIEW = new GlobalViewProperties(StructureViewProperties.Hierarchy.INHERITANCE);
+ INHERITANCE_VIEW.addRelation(InheritanceAssociation.INHERITS_RELATION);
+ views.put(INHERITANCE_VIEW.toString(), INHERITANCE_VIEW);
+ return views;
+ }
+
+ private void jbInit() throws Exception {
+ jLabel1.setFont(new java.awt.Font("Dialog", 0, 11));
+ jLabel1.setText("Generate pointcut designator for corresponding joinpoints:");
+ jPanel1.setLayout(borderLayout1);
+ jPanel4.setLayout(borderLayout2);
+ jPanel2.setLayout(borderLayout3);
+ jLabel4.setText("Select the target type that will host the generated pointcut:");
+ jLabel4.setFont(new java.awt.Font("Dialog", 0, 11));
+ jLabel4.setToolTipText("");
+ jPanel3.setMaximumSize(new Dimension(32767, 34));
+ jCheckBox5.setEnabled(false);
+ jCheckBox5.setFont(new java.awt.Font("Dialog", 0, 11));
+ jCheckBox5.setSelected(true);
+ jCheckBox5.setText("call");
+ jCheckBox4.setEnabled(false);
+ jCheckBox4.setFont(new java.awt.Font("Dialog", 0, 11));
+ jCheckBox4.setText("execution");
+ jCheckBox3.setEnabled(false);
+ jCheckBox3.setFont(new java.awt.Font("Dialog", 0, 11));
+ jCheckBox3.setText("initialization");
+ jCheckBox2.setEnabled(false);
+ jCheckBox2.setFont(new java.awt.Font("Dialog", 0, 11));
+ jCheckBox2.setText("static initialization");
+ jCheckBox1.setEnabled(false);
+ jCheckBox1.setFont(new java.awt.Font("Dialog", 0, 11));
+ jCheckBox1.setText("field get/set");
+ cancel_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ cancel_button.setText("Cancel");
+ cancel_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ cancel_button_actionPerformed(e);
+ }
+ });
+ ok_button.setText("OK");
+ ok_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ ok_button_actionPerformed(e);
+ }
+ });
+ ok_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ this.setTitle("Pointcut Wizard");
+ this.getContentPane().add(jPanel1, BorderLayout.CENTER);
+ jPanel1.add(jPanel4, BorderLayout.NORTH);
+ jPanel4.add(jLabel1, BorderLayout.NORTH);
+ jPanel4.add(jPanel3, BorderLayout.CENTER);
+ jPanel3.add(jCheckBox5, null);
+ jPanel3.add(jCheckBox4, null);
+ jPanel3.add(jCheckBox3, null);
+ jPanel3.add(jCheckBox2, null);
+ jPanel3.add(jCheckBox1, null);
+ jPanel1.add(jPanel2, BorderLayout.CENTER);
+ jPanel2.add(jLabel4, BorderLayout.NORTH);
+ jPanel2.add(typeTreeView, BorderLayout.CENTER);
+ jPanel1.add(jPanel5, BorderLayout.SOUTH);
+ jPanel5.add(ok_button, null);
+ jPanel5.add(cancel_button, null);
+ }
+
+ private void ok_button_actionPerformed(ActionEvent e) {
+ Ajde.getDefault().getEditorManager().pasteToCaretPos(generatePcd());
+ this.dispose();
+ }
+
+ private void cancel_button_actionPerformed(ActionEvent e) {
+ this.dispose();
+ }
+
+ private String generatePcd() {
+ String pcd = "\n\n" +
+ " pointcut temp(): \n";
+ for (Iterator it = signatures.iterator(); it.hasNext(); ) {
+ pcd += " call(* " + it.next() + ")";
+ if (it.hasNext()) {
+ pcd += " ||";
+ } else {
+ pcd += ";";
+ }
+ pcd += "\n";
+ }
+ return pcd;
+ }
+}
+
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java
new file mode 100644
index 000000000..532d9dc5d
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/SimpleStructureViewToolPanel.java
@@ -0,0 +1,247 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.util.ArrayList;
+
+import javax.swing.*;
+import javax.swing.border.*;
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.*;
+
+public class SimpleStructureViewToolPanel extends JPanel {
+
+ private StructureView currentView;
+ private 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 StructureModelListener MODEL_LISTENER = new StructureModelListener() {
+ public void modelUpdated(StructureModel model) {
+ String path = Ajde.getDefault().getConfigurationManager().getActiveConfigFile();
+ 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();
+
+ public SimpleStructureViewToolPanel(StructureView currentView) {
+ this.currentView = currentView;
+ Ajde.getDefault().getStructureModelManager().addListener(MODEL_LISTENER);
+ try {
+ jbInit();
+ } catch (Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e);
+ }
+ 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(AjdeUIManager.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(AjdeUIManager.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(AjdeUIManager.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(AjdeUIManager.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(AjdeUIManager.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(AjdeUIManager.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 back_button_actionPerformed(ActionEvent e) {
+ Ajde.getDefault().getStructureViewManager().fireNavigateBackAction(currentView);
+ }
+
+ void structureView_button_actionPerformed(ActionEvent e) {
+
+ }
+
+ private void hideNonAJ_button_actionPerformed(ActionEvent e) {
+ if (hideNonAJEnabled) {
+ hideNonAJ_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
+ hideNonAJEnabled = false;
+ currentView.getViewProperties().setFilteredMemberKinds(new ArrayList());
+ } else {
+ hideNonAJ_button.setBorder(AjdeWidgetStyles.LOWERED_BEVEL_BORDER);
+ hideNonAJEnabled = true;
+ currentView.getViewProperties().setFilteredMemberKinds(
+ ProgramElementNode.Kind.getNonAJMemberKinds()
+ );
+ }
+ Ajde.getDefault().getStructureViewManager().refreshView(currentView);
+ }
+
+ private void hideAssociations_button_actionPerformed(ActionEvent e) {
+ if (hideAssociationsEnabled) {
+ hideAssociations_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
+ hideAssociationsEnabled = false;
+ 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) {
+ if (sortEnabled) {
+ sort_button.setBorder(AjdeWidgetStyles.DEFAULT_BORDER);
+ sortEnabled = false;
+ currentView.getViewProperties().setSorting(
+ StructureViewProperties.Sorting.DECLARATIONAL
+ );
+ } else {
+ sort_button.setBorder(AjdeWidgetStyles.LOWERED_BEVEL_BORDER);
+ sortEnabled = true;
+ currentView.getViewProperties().setSorting(
+ StructureViewProperties.Sorting.ALPHABETICAL
+ );
+ }
+ Ajde.getDefault().getStructureViewManager().refreshView(currentView);
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/StructureTree.java b/ajde/src/org/aspectj/ajde/ui/swing/StructureTree.java
new file mode 100644
index 000000000..b3c318792
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/StructureTree.java
@@ -0,0 +1,56 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.Font;
+
+import javax.swing.JTree;
+
+import org.aspectj.ajde.Ajde;
+
+/**
+ * @author Mik Kersten
+ */
+class StructureTree extends JTree {
+
+ public static final Font DEFAULT_FONT = new java.awt.Font("Dialog", 0, 11);
+
+ private String rootFilePath = null;
+
+ public StructureTree() {
+ try {
+ jbInit();
+ }
+ catch(Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not initialize GUI.", e);
+ }
+ }
+
+ public void setRootFilePath(String rootFilePath) {
+ this.rootFilePath = rootFilePath;
+ }
+
+ public String getRootFilePath() {
+ return rootFilePath;
+ }
+
+ private void jbInit() throws Exception {
+ this.setFont(DEFAULT_FONT);
+ }
+
+ public int getToggleClickCount() {
+ return 1;
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/StructureTreeManager.java b/ajde/src/org/aspectj/ajde/ui/swing/StructureTreeManager.java
new file mode 100644
index 000000000..57dcac9d5
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/StructureTreeManager.java
@@ -0,0 +1,429 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.event.MouseListener;
+import java.util.ArrayList;
+
+import javax.swing.SwingUtilities;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.*;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.*;
+
+/**
+ * @author Mik Kersten
+ */
+class StructureTreeManager {
+
+ private StructureTree structureTree;
+ private SwingTreeViewNodeRenderer cellRenderer = null;
+ private TreeSelectionListener treeListener = null;
+
+ private final StructureTreeModel NO_STRUCTURE_MODEL
+ = new StructureTreeModel(new SwingTreeViewNode(StructureModel.NO_STRUCTURE, new AbstractIcon(null), new ArrayList()));
+
+ /**
+ * @todo should probably avoid that MouseListener cast
+ */
+ public StructureTreeManager() {
+ structureTree = new StructureTree();
+ structureTree.setModel(NO_STRUCTURE_MODEL);
+ cellRenderer = new SwingTreeViewNodeRenderer();
+ structureTree.setCellRenderer(cellRenderer);
+ //if (fileView) {
+ treeListener = new StructureViewTreeListener(structureTree);
+ //} else {
+ // treeListener = new BrowserViewTreeListener(structureTree);
+ //}
+ structureTree.addTreeSelectionListener(treeListener);
+ structureTree.addMouseListener((MouseListener)treeListener);
+ }
+
+ public void highlightNode(ProgramElementNode node) {
+ highlightNode((SwingTreeViewNode)structureTree.getModel().getRoot(), node);
+ }
+
+ public StructureNode getSelectedStructureNode() {
+ return (StructureNode)((SwingTreeViewNode)structureTree.getLastSelectedPathComponent()).getUserObject();
+ }
+
+ public void scrollToHighlightedNode() {
+ structureTree.scrollPathToVisible(structureTree.getSelectionPath());
+ }
+
+ private void highlightNode(SwingTreeViewNode parent, ProgramElementNode node) {
+ for (int i = 0; i < parent.getChildCount(); i++) {
+ SwingTreeViewNode currNode = (SwingTreeViewNode)parent.getChildAt(i);
+ StructureNode sNode = (StructureNode)currNode.getUserObject();
+ if (sNode instanceof ProgramElementNode &&
+ ((ProgramElementNode)sNode).equals(node)) {
+ TreePath path = new TreePath(currNode.getPath());
+ structureTree.setSelectionPath(path);
+ int currRow = structureTree.getRowForPath(path);
+ structureTree.expandRow(currRow);
+ structureTree.scrollRowToVisible(currRow);
+ } else {
+ highlightNode(currNode, node);
+ }
+ }
+ }
+
+// public void updateTree(StructureView structureView) {
+// displayTree(structureView, 10);
+// }
+//
+// public void updateTree(GlobalStructureView structureView) {
+// displayTree(structureView, depth);
+// }
+
+ public void updateTree(final StructureView structureView) {
+ if (structureView == null) return;
+ Runnable update = new Runnable() {
+ public void run() {
+ structureTree.removeAll();
+ SwingTreeViewNode currNode;
+ if (structureView.getRootNode() == null) {
+ structureTree.setModel(NO_STRUCTURE_MODEL);
+ } else {
+ structureTree.setModel(new StructureTreeModel((SwingTreeViewNode)structureView.getRootNode()));
+ }
+
+ if (structureView instanceof GlobalStructureView) {
+ GlobalStructureView view = (GlobalStructureView)structureView;
+ if (view.getGlobalViewProperties().getHierarchy() == StructureViewProperties.Hierarchy.DECLARATION) {
+ expandTreeToFiles();
+ } else {
+ expandTree(15);
+ }
+ } else {
+ expandTree(10);
+ }
+
+ }
+ };
+
+ if (SwingUtilities.isEventDispatchThread()) {
+ update.run();
+ } else {
+ try {
+ SwingUtilities.invokeAndWait(update);
+ } catch (Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not update tree.", e);
+ }
+ }
+ }
+
+ StructureTree getStructureTree() {
+ return structureTree;
+ }
+
+ private void expandTreeToFiles() {
+ for (int i = 0; i < structureTree.getRowCount(); i++) {
+ TreePath path = structureTree.getPathForRow(i);
+ SwingTreeViewNode node = (SwingTreeViewNode)path.getLastPathComponent();
+ if (node.getUserObject() instanceof ProgramElementNode) {
+ ProgramElementNode pNode = (ProgramElementNode)node.getUserObject();
+ ProgramElementNode.Kind kind = pNode.getProgramElementKind();
+ if (kind == ProgramElementNode.Kind.PROJECT
+ || kind == ProgramElementNode.Kind.PACKAGE) {
+ structureTree.expandPath(path);
+ } else {
+ structureTree.collapsePath(path);
+ }
+ } else {
+ structureTree.collapsePath(path);
+ }
+ }
+ structureTree.expandPath(structureTree.getPathForRow(0));
+ }
+
+ private void expandTree(int depth) {
+ for (int i = 0; i < structureTree.getRowCount(); i++) {
+ TreePath path = structureTree.getPathForRow(i);
+ SwingTreeViewNode node = (SwingTreeViewNode)path.getLastPathComponent();
+ if (path.getPath().length-1 > depth || node.getUserObject() instanceof RelationNode) {
+ structureTree.collapsePath(path);
+ } else {
+ structureTree.expandPath(path);
+ }
+ }
+ structureTree.expandPath(structureTree.getPathForRow(0));
+ }
+
+ private class StructureTreeModel extends DefaultTreeModel implements TreeModel {
+ public StructureTreeModel(TreeNode newRoot) {
+ super(newRoot);
+ }
+
+ public void valueForPathChanged(TreePath path, Object newValue) {
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
+ nodeChanged(node);
+ }
+ }
+}
+
+// /**
+// * @param node if null assume root
+// */
+// public void navigationAction(ProgramElementNode node, boolean followedLink, boolean forward) {
+// if (node == null) {
+// structureTree.setSelectionRow(0);
+// structureTree.scrollRowToVisible(0);
+// } else if (node.getSourceLocation().getSourceFilePath() != null) {
+// final String fileName = node.getSourceLocation().getSourceFilePath();
+// final int lineNumber = node.getSourceLocation().getLineNumber();
+// if (fileName != null && lineNumber > 0) {
+// Runnable update = new Runnable() {
+// public void run() {
+// Ajde.getDefault().getEditorManager().showSourceLine(fileName, lineNumber, true);
+// }
+// };
+//
+// if (SwingUtilities.isEventDispatchThread()) {
+// update.run();
+// } else {
+// try {
+// SwingUtilities.invokeAndWait(update);
+// } catch (Exception ee) {
+//
+// }
+// }
+// }
+// if (followedLink) {
+// highlightNode((SwingTreeViewNode)structureTree.getModel().getRoot(), node);
+// }
+// }
+// }
+
+
+// if (node instanceof ProgramElementNode) {
+// ProgramElementNode lexicalNode = (ProgramElementNode)node;
+// setIcon(getProgramElementNodeIcon(lexicalNode));
+// } else if (node instanceof RelationNode) {
+// RelationNode relationNode = (RelationNode)node;
+//
+// setIcon(icons.getAssociationSwingIcon(relationNode.getRelation()));
+// this.setFont(new Font(this.getFont().getName(), Font.ITALIC, this.getFont().getSize()));
+//
+// } else if (node instanceof LinkNode) {
+// LinkNode link = (LinkNode)node;
+// setIcon(getProgramElementNodeIcon(link.getProgramElementNode()));
+// } else {
+// if (node != null && ProgramElementNode.Kind.PACKAGE.equals(node.getKind())) {
+// setIcon(icons.getStructureSwingIcon(ProgramElementNode.Kind.PACKAGE));
+// } else if (node != null && ProgramElementNode.Kind.PROJECT.equals(node.getKind())) {
+// setIcon(icons.getStructureSwingIcon(ProgramElementNode.Kind.PROJECT));
+// } else if (node != null && ProgramElementNode.Kind.FILE.equals(node.getKind())) {
+// setIcon(icons.getStructureSwingIcon(ProgramElementNode.Kind.CLASS));
+// } else {
+// setIcon(null);
+// }
+// }
+
+// void updateTree(int depth, GlobalViewProperties properties) {
+// this.hierarchy = properties.getHierarchy();
+// displayTree(depth, null);
+// }
+//
+// void updateTree(String filePath, int depth, GlobalViewProperties properties) {
+// this.hierarchy = properties.getHierarchy();
+// if (filePath == null || filePath.equals("")) {
+// structureTree.setModel(NO_FILE_SELECTED_MODEL);
+// } else {
+// structureTree.setRootFilePath(filePath);
+// displayTree(depth, filePath);
+// }
+// }
+
+// int accessibility = 0;
+// if (pNode.getAccessibility().contains(ProgramElementNode.Accessibility.PUBLIC)) {
+// accessibility = 1;
+// } else if (pNode.getAccessibility().contains(ProgramElementNode.Accessibility.PROTECTED)) {
+// accessibility = 2;
+// } else if (pNode.getAccessibility().contains(ProgramElementNode.Accessibility.PRIVATE)) {
+// accessibility = 3;
+// } else if (pNode.getAccessibility().contains(ProgramElementNode.Accessibility.PRIVILEGED)) {
+// accessibility = 3;
+// }
+//
+// if (pNode == null || pNode.getKind() == null) {
+// return null;
+// } else if (ProgramElementNode.Kind.PROJECT.equals(pNode.getKind())) {
+// return icons.getStructureSwingIcon(ProgramElementNode.Kind.PROJECT);
+// } else if (ProgramElementNode.Kind.PACKAGE.equals(pNode.getKind())) {
+// return icons.getStructureSwingIcon(ProgramElementNode.Kind.PACKAGE);
+// } else if (ProgramElementNode.Kind.FILE.equals(pNode.getKind())) {
+// return icons.getStructureSwingIcon(ProgramElementNode.Kind.CLASS);
+// } else if (ProgramElementNode.Kind.CLASS.equals(pNode.getKind())) {
+// switch (accessibility) {
+// case 1: return icons.getClassPublicIcon();
+// case 2: return icons.getClassProtectedIcon();
+// case 3: return icons.getClassPrivateIcon();
+// default: return icons.getClassPackageIcon();
+// }
+// } else if (ProgramElementNode.Kind.INTERFACE.equals(pNode.getKind())) {
+// switch (accessibility) {
+// case 1: return icons.getInterfacePublicIcon();
+// case 2: return icons.getInterfaceProtectedIcon();
+// case 3: return icons.getInterfacePrivateIcon();
+// default: return icons.getInterfacePackageIcon();
+// }
+// } else if (ProgramElementNode.Kind.ASPECT.equals(pNode.getKind())) {
+// switch (accessibility) {
+// case 1: return icons.getAspectPublicIcon();
+// case 2: return icons.getAspectProtectedIcon();
+// case 3: return icons.getAspectPrivateIcon();
+// case 4: return icons.getAspectPrivilegedIcon();
+// default: return icons.getAspectPackageIcon();
+// }
+// } else if (ProgramElementNode.Kind.METHOD.equals(pNode.getKind())
+// || ProgramElementNode.Kind.INITIALIZER.equals(pNode.getKind())
+// || ProgramElementNode.Kind.CONSTRUCTOR.equals(pNode.getKind())) {
+// switch (accessibility) {
+// case 1: return icons.getMethodPublicIcon();
+// case 2: return icons.getMethodProtectedIcon();
+// case 3: return icons.getMethodPrivateIcon();
+// default: return icons.getMethodPackageIcon();
+// }
+// } else if (ProgramElementNode.Kind.FIELD.equals(pNode.getKind())) {
+// switch (accessibility) {
+// case 1: return icons.getFieldPublicIcon();
+// case 2: return icons.getFieldProtectedIcon();
+// case 3: return icons.getFieldPrivateIcon();
+// default: return icons.getFieldPackageIcon();
+// }
+// } else if (ProgramElementNode.Kind.INTRODUCTION.equals(pNode.getKind())) {
+// switch (accessibility) {
+// case 1: return icons.getIntroductionPublicIcon();
+// case 2: return icons.getIntroductionProtectedIcon();
+// case 3: return icons.getIntroductionPrivateIcon();
+// default: return icons.getIntroductionPackageIcon();
+// }
+// } else if (ProgramElementNode.Kind.POINTCUT.equals(pNode.getKind())) {
+// switch (accessibility) {
+// case 1: return icons.getJoinpointPublicIcon();
+// case 2: return icons.getJoinpointProtectedIcon();
+// case 3: return icons.getJoinpointPrivateIcon();
+// default: return icons.getJoinpointPackageIcon();
+// }
+// } else if (ProgramElementNode.Kind.ADVICE.equals(pNode.getKind())) {
+// return icons.getAdviceIcon();
+// } else if (ProgramElementNode.Kind.DECLARE_PARENTS.equals(pNode.getKind())) {
+// return icons.getDeclareParentsIcon();
+// } else if (ProgramElementNode.Kind.DECLARE_ERROR.equals(pNode.getKind())) {
+// return icons.getDeclareErrorIcon();
+// } else if (ProgramElementNode.Kind.DECLARE_WARNING.equals(pNode.getKind())) {
+// return icons.getDeclareWarningIcon();
+// } else if (ProgramElementNode.Kind.DECLARE_SOFT.equals(pNode.getKind())) {
+// return icons.getDeclareSoftIcon();
+// } else if (ProgramElementNode.Kind.CODE.equals(pNode.getKind())) {
+// return icons.getCodeIcon();
+// } else {
+// return null;
+// }
+
+//
+// if (relationNode.getKind().equals(org.aspectj.asm.associations.Advice.NAME) ||
+// relationNode.getKind().equals(org.aspectj.asm.associations.Introduction.NAME)) {
+// if (relationNode.getRelation().getBackNavigationName().equals(relationNode.getName()) ){
+// setIcon(icons.getRelationAdviceBackIcon());
+// } else {
+// setIcon(icons.getAssociationSwingIcon(relationNode.getRelation()));
+// setIcon(icons.getRelationAdviceForwardIcon());
+// }
+// } else if (relationNode.getKind().equals(org.aspectj.asm.associations.Inheritance.NAME)) {
+// if (relationNode.getRelation().getBackNavigationName().equals(relationNode.getName()) ){
+// setIcon(icons.getRelationInheritanceBackIcon());
+// } else {
+// setIcon(icons.getRelationInheritanceForwardIcon());
+// }
+// } else {
+// if (relationNode.getRelation().getBackNavigationName().equals(relationNode.getName()) ){
+// setIcon(icons.getRelationReferenceBackIcon());
+// } else {
+// setIcon(icons.getRelationReferenceForwardIcon());
+// }
+// }
+
+// public ProgramElementNode getRootProgramElementNode() {
+// StructureNode node = (StructureNode)((SwingTreeViewNode)structureTree.getModel().getRoot()).getUserObject();
+// if (node instanceof ProgramElementNode) {
+// return (ProgramElementNode)node;
+// } else {
+// return null;
+// }
+// }
+
+// /**
+// * @todo HACK: this is a workaround and can break
+// */
+// private static ProgramElementNode mapResult = null;
+// private ProgramElementNode getNodeForLink(LinkNode node, StructureNode rootNode) {
+// ProgramElementNode result = null;
+// if (rootNode instanceof ProgramElementNode &&
+// ((ProgramElementNode)rootNode).getName().equals(node.getProgramElementNode().getName())) {
+// mapResult = (ProgramElementNode)rootNode;
+// } else {
+// ProgramElementNode linkedNode = node.getProgramElementNode();
+// for (Iterator it = rootNode.getChildren().iterator(); it.hasNext(); ) {
+// StructureNode child = (StructureNode)it.next();
+// getNodeForLink(node, child);
+// }
+// }
+// return mapResult;
+// }
+
+// private void sortNodes(List nodes) {
+// if (sortNodes) {
+// Collections.sort(nodes, structureNodeComparator);
+// }
+// }
+
+// private class StructureNodeComparator implements Comparator {
+// public int compare(Object o1, Object o2) {
+// StructureNode t1 = (StructureNode) ((SwingTreeViewNode) o1).getUserObject();
+// StructureNode t2 = (StructureNode) ((SwingTreeViewNode) o2).getUserObject();
+// if (t1 instanceof ProgramElementNode && t2 instanceof ProgramElementNode) {
+// ProgramElementNode p1 = (ProgramElementNode) t1;
+// ProgramElementNode p2 = (ProgramElementNode) t2;
+// return p1.getName().compareTo(p2.getName());
+// } else {
+// return 0;
+// }
+// }
+// }
+
+// private class StructureViewNodeAdapter extends DefaultMutableTreeNode {
+//
+// private StructureViewNode nodeInfo = null;
+//
+// public StructureViewNodeAdapter(StructureViewNode nodeInfo) {
+// super(nodeInfo, true);
+// this.nodeInfo = nodeInfo;
+// }
+//
+// public String toString() {
+// if (nodeInfo != null) {
+// return nodeInfo.toString();
+// } else {
+// return "";
+// }
+// }
+// }
+
+
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/StructureViewPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/StructureViewPanel.java
new file mode 100644
index 000000000..471e3c4e7
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/StructureViewPanel.java
@@ -0,0 +1,126 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.util.Iterator;
+
+import javax.swing.*;
+import javax.swing.border.BevelBorder;
+import javax.swing.border.Border;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.ProgramElementNode;
+import org.aspectj.asm.StructureNode;
+
+/**
+ * Represents the configuration of a structure view of the system, rendered
+ * by the <CODE>StructureTreeManager</CODE>.
+ *
+ * @author Mik Kersten
+ */
+public class StructureViewPanel extends JPanel implements StructureViewRenderer {
+
+ protected StructureTreeManager treeManager = new StructureTreeManager();
+ protected StructureView currentView = null;
+ private java.util.List structureViews = null;
+
+ protected Border border1;
+ protected Border border2;
+ JScrollPane tree_ScrollPane = new JScrollPane();
+ JPanel structureToolBar_panel = null;
+ BorderLayout borderLayout1 = new BorderLayout();
+
+ public StructureViewPanel(FileStructureView structureView) {
+ currentView = structureView;
+ initView(structureView);
+ structureToolBar_panel = new SimpleStructureViewToolPanel(currentView);
+ init();
+ }
+
+ public StructureViewPanel(java.util.List structureViews) {
+ this.structureViews = structureViews;
+
+ for (Iterator it = structureViews.iterator(); it.hasNext(); ) {
+ initView((StructureView)it.next());
+ }
+ currentView = (StructureView)structureViews.get(0);
+ structureToolBar_panel = new BrowserStructureViewToolPanel(structureViews, currentView, this);
+ init();
+ }
+
+ private void init() {
+ try {
+ jbInit();
+ } catch (Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not initialize view panel.", e);
+ }
+ updateView(currentView);
+ }
+
+ public void setCurrentView(StructureView view) {
+ currentView = view;
+ treeManager.updateTree(view);
+ }
+
+ public void updateView(StructureView structureView) {
+ if (structureView == currentView) {
+ treeManager.updateTree(structureView);
+ }
+ }
+
+ private void initView(StructureView view) {
+ view.setRenderer(this);
+ }
+
+ public void setActiveNode(StructureViewNode node) {
+ setActiveNode(node, 0);
+ }
+
+ public void setActiveNode(StructureViewNode node, int lineOffset) {
+ if (node == null) return;
+ if (!(node.getStructureNode() instanceof ProgramElementNode)) return;
+ ProgramElementNode pNode = (ProgramElementNode)node.getStructureNode();
+ treeManager.highlightNode(pNode);
+ if (pNode.getSourceLocation() != null) {
+ Ajde.getDefault().getEditorManager().showSourceLine(
+ pNode.getSourceLocation().getSourceFile().getAbsolutePath(),
+ pNode.getSourceLocation().getLine() + lineOffset,
+ true
+ );
+ }
+ }
+
+ public void highlightActiveNode() {
+ if (currentView.getActiveNode() == null) return;
+ StructureNode node = currentView.getActiveNode().getStructureNode();
+ if (node instanceof ProgramElementNode) {
+ treeManager.highlightNode((ProgramElementNode)node);
+ }
+ }
+
+ protected void jbInit() {
+ 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);
+
+ this.setLayout(borderLayout1);
+ this.add(tree_ScrollPane, BorderLayout.CENTER);
+ this.add(structureToolBar_panel, BorderLayout.NORTH);
+
+ tree_ScrollPane.getViewport().add(treeManager.getStructureTree(), null);
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/StructureViewTreeListener.java b/ajde/src/org/aspectj/ajde/ui/swing/StructureViewTreeListener.java
new file mode 100644
index 000000000..749aa570c
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/StructureViewTreeListener.java
@@ -0,0 +1,63 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+
+import org.aspectj.ajde.Ajde;
+
+/**
+ * @author Mik Kersten
+ */
+class StructureViewTreeListener implements TreeSelectionListener, MouseListener {
+ private StructureTree tree;
+ private SwingTreeViewNode lastSelectedNode = null;
+
+ public StructureViewTreeListener(StructureTree tree) {
+ this.tree = tree;
+ }
+
+ public void valueChanged(TreeSelectionEvent e) { }
+
+ public void mouseEntered(MouseEvent e) { }
+
+ public void mouseExited(MouseEvent e) { }
+
+ public void mousePressed(MouseEvent e) { }
+
+ public void mouseReleased(MouseEvent e) { }
+
+ public void mouseClicked(MouseEvent e) {
+ navigate(e);
+ }
+
+ public void navigate(MouseEvent e) {
+ SwingTreeViewNode treeNode = (SwingTreeViewNode)tree.getLastSelectedPathComponent();
+ if (treeNode == null || lastSelectedNode == treeNode) return;
+ lastSelectedNode = treeNode;
+
+ //if (e.getClickCount() == 2) {
+ Ajde.getDefault().getStructureViewManager().fireNavigationAction(
+ treeNode.getStructureNode()
+ );
+ //}
+ }
+}
+
+
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNode.java b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNode.java
new file mode 100644
index 000000000..d73b7ad61
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNode.java
@@ -0,0 +1,69 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.util.*;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import org.aspectj.ajde.ui.AbstractIcon;
+import org.aspectj.ajde.ui.StructureViewNode;
+import org.aspectj.asm.StructureNode;
+
+/**
+ * @author Mik Kersten
+ */
+public class SwingTreeViewNode extends DefaultMutableTreeNode implements StructureViewNode {
+
+ private StructureNode structureNode;
+ private AbstractIcon icon;
+
+ public SwingTreeViewNode(StructureNode structureNode, AbstractIcon icon, List children) {
+ super(structureNode, true);
+ this.structureNode = structureNode;
+ this.icon = icon;
+
+ if (children != null) {
+ for (Iterator it = children.iterator(); it.hasNext(); ) {
+ super.add((SwingTreeViewNode)it.next());
+ }
+ }
+ }
+
+ public StructureNode getStructureNode() {
+ return structureNode;
+ }
+
+ public AbstractIcon getIcon() {
+ return icon;
+ }
+
+ public void add(StructureViewNode child) {
+ super.add((DefaultMutableTreeNode)child);
+ }
+
+ public void remove(StructureViewNode child) {
+ super.remove((DefaultMutableTreeNode)child);
+ }
+
+ public List getChildren() {
+ if (children == null) {
+ return new ArrayList();
+ } else {
+ return children;
+ }
+ }
+}
+
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeFactory.java b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeFactory.java
new file mode 100644
index 000000000..b10e28a97
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeFactory.java
@@ -0,0 +1,33 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.util.*;
+import org.aspectj.asm.*;
+import org.aspectj.ajde.ui.*;
+
+/**
+ * @author Mik Kersten
+ */
+public class SwingTreeViewNodeFactory extends StructureViewNodeFactory {
+
+ public SwingTreeViewNodeFactory(IconRegistry iconRegistry) {
+ super(iconRegistry);
+ }
+
+ protected StructureViewNode createConcreteNode(StructureNode node, AbstractIcon icon, List children) {
+ return new SwingTreeViewNode(node, icon, children);
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java
new file mode 100644
index 000000000..ff8eff318
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/SwingTreeViewNodeRenderer.java
@@ -0,0 +1,89 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.*;
+
+import javax.swing.Icon;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultTreeCellRenderer;
+
+import org.aspectj.asm.*;
+import org.aspectj.bridge.IMessage;
+
+/**
+ * @author Mik Kersten
+ */
+class SwingTreeViewNodeRenderer extends DefaultTreeCellRenderer {
+
+ public Component getTreeCellRendererComponent(JTree tree,
+ Object treeNode,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus) {
+ if (treeNode == null) return null;
+ SwingTreeViewNode viewNode = (SwingTreeViewNode)treeNode;
+ StructureNode node = viewNode.getStructureNode();
+
+ if (node instanceof LinkNode) {
+ if (((LinkNode)node).getProgramElementNode().getSourceLocation().getSourceFile().getAbsolutePath() == null) {
+ setTextNonSelectionColor(AjdeWidgetStyles.LINK_NODE_NO_SOURCE_COLOR);
+ } else {
+ setTextNonSelectionColor(AjdeWidgetStyles.LINK_NODE_COLOR);
+ }
+ } else {
+ setTextNonSelectionColor(new Color(0, 0, 0));
+ }
+
+ super.getTreeCellRendererComponent(tree, treeNode, sel, expanded, leaf, row, hasFocus);
+ this.setFont(StructureTree.DEFAULT_FONT);
+
+ if (viewNode.getIcon() != null && viewNode.getIcon().getIconResource() != null) {
+ setIcon((Icon)viewNode.getIcon().getIconResource());
+ } else {
+ setIcon(null);
+ }
+
+ if (node instanceof ProgramElementNode) {
+ ProgramElementNode pNode = (ProgramElementNode)node;
+ if (pNode.isRunnable()) {
+ //setIcon(AjdeUIManager.getDefault().getIconRegistry().getExecuteIcon());
+ }
+ if (pNode.isImplementor()) {
+ //this.setText("<implementor>");
+ }
+ if (pNode.isOverrider()) {
+ //this.setText("<overrider>");
+ }
+ } else if (node instanceof RelationNode) {
+ this.setFont(new Font(this.getFont().getName(), Font.ITALIC, this.getFont().getSize()));
+ }
+
+ if (node.getMessage() != null) {
+ if (node.getMessage().getKind().equals(IMessage.WARNING)) {
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getWarningIcon());
+ } else if (node.getMessage().getKind().equals(IMessage.ERROR)) {
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getErrorIcon());
+ } else {
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getInfoIcon());
+ }
+ }
+
+ return this;
+ }
+}
+
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/TreeViewBuildConfigEditor.java b/ajde/src/org/aspectj/ajde/ui/swing/TreeViewBuildConfigEditor.java
new file mode 100644
index 000000000..f7e9d2c2a
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/TreeViewBuildConfigEditor.java
@@ -0,0 +1,270 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.swing.*;
+import javax.swing.tree.*;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.ProgramElementNode;
+/**
+ * UI for editing build configuration (".lst") files via a graphical tree-based
+ * representation.
+ *
+ * @author Mik Kersten
+ */
+public class TreeViewBuildConfigEditor extends JPanel implements BuildConfigEditor {
+
+ private ConfigTreeNode root;
+ private ConfigTreeNode currNode;
+ private BuildConfigModel model = null;
+
+ private static java.util.List selectedEntries = new ArrayList();
+ private String configFile = null;
+ private File sourcePath = null;
+ //private BuildConfigModelBuilder configTreeBuilder = new BuildConfigModelBuilder();
+
+ BorderLayout borderLayout1 = new BorderLayout();
+ JPanel jPanel1 = new JPanel();
+ JLabel jLabel1 = new JLabel();
+ JPanel jPanel2 = new JPanel();
+ JButton cancel_button = new JButton();
+ BorderLayout borderLayout2 = new BorderLayout();
+ JButton save_button = new JButton();
+ JScrollPane jScrollPane = new JScrollPane();
+ JTree buildConfig_tree = new JTree();
+
+ public void openFile(String configFile) throws IOException, InvalidResourceException {
+ try {
+ if (configFile == null) {
+ Ajde.getDefault().getErrorHandler().handleError("No structure is selected for editing.");
+ return;
+ }
+ this.configFile = configFile;
+ sourcePath = new File(new File(configFile).getParent());
+ jbInit();
+ jLabel1.setText(" Build configuration: " + configFile);
+
+ model = Ajde.getDefault().getConfigurationManager().buildModel(configFile);
+ root = buildTree((BuildConfigNode)model.getRoot());
+
+ buildConfig_tree.setModel(new DefaultTreeModel(root));
+ buildConfig_tree.addMouseListener(new ConfigFileMouseAdapter(buildConfig_tree));
+ buildConfig_tree.setCellRenderer(new ConfigTreeCellRenderer());
+
+ for (int j = 0; j < buildConfig_tree.getRowCount(); j++) {
+ buildConfig_tree.expandPath(buildConfig_tree.getPathForRow(j));
+ }
+ } catch(Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not open file.", e);
+ }
+ }
+
+ private ConfigTreeNode buildTree(BuildConfigNode node) {
+ ConfigTreeNode treeNode = new ConfigTreeNode(node);
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ BuildConfigNode childNode = (BuildConfigNode)it.next();
+ treeNode.add(buildTree(childNode));
+ }
+ return treeNode;
+ }
+
+ private void saveModel() {
+ Ajde.getDefault().getConfigurationManager().writeModel(model);
+ }
+
+ private void jbInit() throws Exception {
+ this.setLayout(borderLayout1);
+ jLabel1.setFont(new java.awt.Font("Dialog", 0, 11));
+ jLabel1.setMaximumSize(new Dimension(80, 30));
+ jLabel1.setMinimumSize(new Dimension(80, 20));
+ jLabel1.setPreferredSize(new Dimension(80, 20));
+ jLabel1.setText("Config File Editor");
+ cancel_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ cancel_button.setMaximumSize(new Dimension(73, 20));
+ cancel_button.setMinimumSize(new Dimension(73, 20));
+ cancel_button.setPreferredSize(new Dimension(73, 20));
+ cancel_button.setText("Cancel");
+ cancel_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ cancel_button_actionPerformed(e);
+ }
+ });
+ jPanel1.setLayout(borderLayout2);
+ save_button.setText("Save");
+ save_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ save_button_actionPerformed(e);
+ }
+ });
+ save_button.setPreferredSize(new Dimension(73, 20));
+ save_button.setMinimumSize(new Dimension(73, 20));
+ save_button.setMaximumSize(new Dimension(73, 20));
+ save_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ this.add(jPanel1, BorderLayout.NORTH);
+ jPanel1.add(jPanel2, BorderLayout.EAST);
+ jPanel2.add(save_button, null);
+ //jPanel2.add(cancel_button, null);
+ jPanel1.add(jLabel1, BorderLayout.CENTER);
+ this.add(jScrollPane, BorderLayout.CENTER);
+ jScrollPane.getViewport().add(buildConfig_tree, null);
+ }
+
+ private class ConfigTreeNode extends DefaultMutableTreeNode {
+ public JCheckBox checkBox = null;
+ public BuildConfigNode modelNode;
+
+ public ConfigTreeNode(BuildConfigNode modelNode) {
+ super(modelNode.getName(), true);
+ this.modelNode = modelNode;
+ checkBox = new JCheckBox();
+ }
+ public BuildConfigNode getModelNode() {
+ return modelNode;
+ }
+
+ public void setModelNode(BuildConfigNode modelNode) {
+ this.modelNode = modelNode;
+ }
+
+ }
+
+ private class ConfigFileMouseAdapter extends MouseAdapter {
+ private JTree tree = null;
+ final JCheckBox checkBoxProto = new JCheckBox();
+ final int width = checkBoxProto.getPreferredSize().width;
+
+ public ConfigFileMouseAdapter(JTree tree) {
+ super();
+ this.tree = tree;
+ }
+
+ public void mousePressed(MouseEvent e) {
+ int x = e.getX();
+ int y = e.getY();
+ TreePath path = tree.getClosestPathForLocation(x,y);
+ ConfigTreeNode node = (ConfigTreeNode)path.getLastPathComponent();
+
+ // if (isCheckBox(x, tree.getPathBounds(path).x)) {
+ if (node.checkBox.isSelected()) {
+ node.getModelNode().setActive(false);
+ node.checkBox.setSelected(false);
+ } else {
+ node.getModelNode().setActive(true);
+ node.checkBox.setSelected(true);
+ }
+
+ ((DefaultTreeModel)tree.getModel()).nodeChanged(node);
+ if (node.getModelNode().getName() != null) {
+ if (node.checkBox.isSelected()) {
+ selectedEntries.add(node.getModelNode().getName());
+ } else {
+ selectedEntries.remove(node.getModelNode().getName());
+ }
+ }
+ super.mousePressed(e);
+
+ }
+
+ boolean isCheckBox(int x, int x_) {
+ int d = x - x_;
+ return (d < width) && (d > 0);
+ }
+ }
+
+ static class ConfigTreeCellRenderer extends DefaultTreeCellRenderer {
+ public Component getTreeCellRendererComponent(JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus) {
+ super.getTreeCellRendererComponent(tree, value, sel, expanded,
+ leaf, row, hasFocus);
+ JPanel p = new JPanel();
+ p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
+ p.setBackground(Color.white);
+ //if (leaf) {
+ setFont(new Font("Dialog", Font.PLAIN, 11));
+ final JCheckBox cbox = ((ConfigTreeNode)value).checkBox;
+ cbox.setBackground(Color.white);
+ if (row != 0) {
+ p.add(cbox);
+ }
+
+ ConfigTreeNode ctn = (ConfigTreeNode)value;
+ //if (TreeViewBuildConfigEditor.selectedEntries.contains(ctn.getSourceFile())) {
+ if (ctn.getModelNode().isActive()) {
+ cbox.setSelected(true);
+ }
+
+ if (!ctn.getModelNode().isValidResource()) {
+ ctn.checkBox.setEnabled(false);
+ }
+
+ //}
+ BuildConfigNode.Kind kind = ctn.getModelNode().getBuildConfigNodeKind();
+ if (kind.equals(BuildConfigNode.Kind.FILE_ASPECTJ)) {
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.FILE_ASPECTJ));
+ } else if (kind.equals(BuildConfigNode.Kind.FILE_JAVA)) {
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.FILE_JAVA));
+ } else if (kind.equals(BuildConfigNode.Kind.FILE_LST)) {
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.FILE_LST));
+ } else if (kind.equals(BuildConfigNode.Kind.DIRECTORY)) {
+ setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.PACKAGE));
+ } else {
+ setIcon((Icon)AjdeUIManager.getDefault().getIconRegistry().getStructureIcon(ProgramElementNode.Kind.ERROR).getIconResource());
+ p.remove(cbox);
+ }
+
+// if (ctn.getModelNode().getResourcePath() != null) {
+// if (ctn.getModelNode().getResourcePath().endsWith(".java")) {
+// this.setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.CLASS));
+// } else if (ctn.getModelNode().getResourcePath().endsWith(".aj")) {
+// this.setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.ASPECT));
+// } else {
+// this.setIcon(AjdeUIManager.getDefault().getIconRegistry().getStructureSwingIcon(ProgramElementNode.Kind.PACKAGE));
+// }
+// }
+
+ p.add(this);
+ return p;
+ }
+ }
+
+ void cancel_button_actionPerformed(ActionEvent e) {
+ //resetEditorFrame();
+ }
+
+ void save_button_actionPerformed(ActionEvent e) {
+ saveModel();
+ //resetEditorFrame();
+ }
+
+// private void resetEditorFrame() {
+// BrowserManager.getDefault().resetEditorFrame();
+// }
+}
+
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/UpdateConfigurationDialog.java b/ajde/src/org/aspectj/ajde/ui/swing/UpdateConfigurationDialog.java
new file mode 100644
index 000000000..3bc360f28
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/swing/UpdateConfigurationDialog.java
@@ -0,0 +1,212 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde.ui.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.Vector;
+
+import javax.swing.*;
+import javax.swing.border.TitledBorder;
+
+import org.aspectj.ajde.Ajde;
+
+/**
+ * Used for automatically updating build configuration files (".lst") when a
+ * project configuration has changed.
+ *
+ * @author Mik Kersten
+ */
+public class UpdateConfigurationDialog extends JFrame {
+ private Vector buildConfigFiles;
+ private Vector filesToUpdate;
+ private boolean addToConfiguration;
+
+ private String message1 = " Project has been updated.";
+ private String message2 = " File list below.";
+ private Box box5;
+ private JButton cancel_button = new JButton();
+ private JButton ok_button = new JButton();
+ private FlowLayout flowLayout1 = new FlowLayout();
+ private JPanel globalButton_panel = new JPanel();
+ private JPanel jPanel1 = new JPanel();
+ private JPanel jPanel2 = new JPanel();
+ private TitledBorder titledBorder1;
+ private TitledBorder titledBorder2;
+ private BorderLayout borderLayout1 = new BorderLayout();
+ private BorderLayout borderLayout2 = new BorderLayout();
+ private BorderLayout borderLayout3 = new BorderLayout();
+ private JPanel jPanel3 = new JPanel();
+ private GridLayout gridLayout1 = new GridLayout();
+ private JScrollPane jScrollPane1 = new JScrollPane();
+ private JList updatedFilesList = new JList();
+ private JScrollPane jScrollPane2 = new JScrollPane();
+ private JList buildConfigList = new JList();
+ private Box box2;
+ private JLabel messageLabel1 = new JLabel();
+ private JLabel messageLabel2 = new JLabel();
+
+ public UpdateConfigurationDialog(Vector filesToUpdate, Vector buildConfigFiles, boolean addToConfiguration, Component parentComponent) {
+ try {
+ this.buildConfigFiles = buildConfigFiles;
+ this.filesToUpdate = filesToUpdate;
+ this.addToConfiguration = addToConfiguration;
+
+ updatedFilesList.setListData(filesToUpdate);
+ String action = "removed from";
+ if (addToConfiguration) action = "added to";
+ message1 = " Files have been " + action + " the project, which will affect the build configurations\n";
+ message2 = " listed below. These build configurations listed can be updated automatically.";
+
+ //buildConfigList.setCellRenderer(new CheckListCellRenderer());
+ //CheckListener listener = new CheckListener(buildConfigList);
+ buildConfigList.setListData(buildConfigFiles);
+
+ jbInit();
+
+ this.doLayout();
+ this.setTitle("Build Configuration Update");
+ this.setSize(500, 320);
+
+ // center it
+ int posX = parentComponent.getX() + 100;//(parentComponent.getWidth()/2);
+ int posY = parentComponent.getY() + 100;//(parentComponent.getHeight()/2);
+ this.setLocation(posX, posY);
+ }
+ catch(Exception e) {
+ Ajde.getDefault().getErrorHandler().handleError("Could not open configuration dialog", e);
+ }
+ }
+
+ void cancel_button_actionPerformed(ActionEvent e) {
+ this.dispose();
+ }
+ void ok_button_actionPerformed(ActionEvent e) {
+ Object[] selected = buildConfigList.getSelectedValues();
+ //LstBuildConfigFileUpdater.updateBuildConfigFiles(buildConfigFiles, filesToUpdate, addToConfiguration);
+ this.dispose();
+ }
+
+ private void jbInit() throws Exception {
+ box5 = Box.createVerticalBox();
+ titledBorder1 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140)),"Project Files Added/Removed");
+ titledBorder2 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140)),"Build Configurations Affected");
+ box2 = Box.createVerticalBox();
+ this.getContentPane().setLayout(borderLayout1);
+ cancel_button.setText("Cancel");
+ cancel_button.addActionListener(new java.awt.event.ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ cancel_button_actionPerformed(e);
+ }
+ });
+ ok_button.setText("Update Selected Configurations");
+ ok_button.addActionListener(new java.awt.event.ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ ok_button_actionPerformed(e);
+ }
+ });
+ globalButton_panel.setLayout(flowLayout1);
+ jPanel1.setLayout(borderLayout3);
+ jPanel1.setBorder(titledBorder1);
+ jPanel1.setMinimumSize(new Dimension(154, 20));
+ jPanel1.setPreferredSize(new Dimension(154, 50));
+ jPanel2.setBorder(titledBorder2);
+ jPanel2.setMinimumSize(new Dimension(36, 50));
+ jPanel2.setPreferredSize(new Dimension(272, 50));
+ jPanel2.setLayout(borderLayout2);
+ globalButton_panel.setMinimumSize(new Dimension(297, 37));
+ globalButton_panel.setPreferredSize(new Dimension(297, 37));
+ jPanel3.setLayout(gridLayout1);
+ jPanel3.setMinimumSize(new Dimension(154, 20));
+ jPanel3.setPreferredSize(new Dimension(154, 40));
+ buildConfigList.setBorder(BorderFactory.createLoweredBevelBorder());
+ messageLabel1.setText(message1);
+ messageLabel2.setText(message2);
+ updatedFilesList.setFont(new java.awt.Font("Dialog", 0, 10));
+ this.getContentPane().add(box5, BorderLayout.CENTER);
+ box5.add(jPanel3, null);
+ jPanel3.add(box2, null);
+ box2.add(messageLabel1, null);
+ box2.add(messageLabel2, null);
+ box5.add(jPanel1, null);
+ jPanel1.add(jScrollPane1, BorderLayout.CENTER);
+ jScrollPane1.getViewport().add(updatedFilesList, null);
+ box5.add(jPanel2, null);
+ jPanel2.add(jScrollPane2, BorderLayout.CENTER);
+ jScrollPane2.getViewport().add(buildConfigList, null);
+ box5.add(globalButton_panel, null);
+ globalButton_panel.add(ok_button, null);
+ globalButton_panel.add(cancel_button, null);
+ }
+}
+
+class CheckListCellRenderer extends JCheckBox implements ListCellRenderer {
+ public CheckListCellRenderer() {
+ super();
+ setOpaque(true);
+ }
+
+ public Component getListCellRendererComponent(JList list,
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus) {
+ setText(value.toString());
+ setFont(new java.awt.Font("Dialog", 0, 10));
+ setBackground(new Color(255, 255, 255));
+
+ setBackground(isSelected ? list.getSelectionBackground() : list.getBackground());
+ setForeground(isSelected ? list.getSelectionForeground() : list.getForeground());
+ setSelected(isSelected);
+
+ return this;
+ }
+}
+
+class CheckListener implements MouseListener, KeyListener {
+
+ protected JList list;
+
+ public CheckListener(JList list) {
+ this.list = list;
+ }
+
+ public void mouseClicked(MouseEvent e) {
+ doCheck();
+ }
+
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyChar() == ' ') doCheck();
+ }
+
+ protected void doCheck() {
+ int index = list.getSelectedIndex();
+ if (index < 0) {
+ return;
+ }
+ list.getModel().getElementAt(index);
+ list.repaint();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {}
+ public void keyTyped(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) { }
+}
diff --git a/ajde/testdata/AspectJBuildManagerTest/.cvsignore b/ajde/testdata/AspectJBuildManagerTest/.cvsignore
new file mode 100644
index 000000000..3be9773da
--- /dev/null
+++ b/ajde/testdata/AspectJBuildManagerTest/.cvsignore
@@ -0,0 +1,2 @@
+bin
+empty.ajsym
diff --git a/ajde/testdata/LstBuildConfigManagerTest/.cvsignore b/ajde/testdata/LstBuildConfigManagerTest/.cvsignore
new file mode 100644
index 000000000..bd4e1a00b
--- /dev/null
+++ b/ajde/testdata/LstBuildConfigManagerTest/.cvsignore
@@ -0,0 +1 @@
+configs.ajsym
diff --git a/ajde/testdata/LstBuildConfigManagerTest/A.java b/ajde/testdata/LstBuildConfigManagerTest/A.java
new file mode 100644
index 000000000..6ee47fe17
--- /dev/null
+++ b/ajde/testdata/LstBuildConfigManagerTest/A.java
@@ -0,0 +1,5 @@
+
+package configs;
+
+
+
diff --git a/ajde/testdata/LstBuildConfigManagerTest/B.aj b/ajde/testdata/LstBuildConfigManagerTest/B.aj
new file mode 100644
index 000000000..cf841814a
--- /dev/null
+++ b/ajde/testdata/LstBuildConfigManagerTest/B.aj
@@ -0,0 +1,5 @@
+
+package configs;
+
+
+
diff --git a/ajde/testdata/LstBuildConfigManagerTest/moduleB/B1.java b/ajde/testdata/LstBuildConfigManagerTest/moduleB/B1.java
new file mode 100644
index 000000000..b9d136653
--- /dev/null
+++ b/ajde/testdata/LstBuildConfigManagerTest/moduleB/B1.java
@@ -0,0 +1,4 @@
+
+package configs.moduleB;
+
+class B1 { } \ No newline at end of file
diff --git a/ajde/testdata/LstBuildConfigManagerTest/moduleB/B2.java b/ajde/testdata/LstBuildConfigManagerTest/moduleB/B2.java
new file mode 100644
index 000000000..9d149fdd8
--- /dev/null
+++ b/ajde/testdata/LstBuildConfigManagerTest/moduleB/B2.java
@@ -0,0 +1,3 @@
+package configs.moduleB;
+
+class B2 { } \ No newline at end of file
diff --git a/ajde/testdata/LstBuildConfigManagerTest/moduleB/B3.java b/ajde/testdata/LstBuildConfigManagerTest/moduleB/B3.java
new file mode 100644
index 000000000..88938d463
--- /dev/null
+++ b/ajde/testdata/LstBuildConfigManagerTest/moduleB/B3.java
@@ -0,0 +1,3 @@
+package configs.moduleB;
+
+class B3 { }
diff --git a/ajde/testdata/LstBuildConfigManagerTest/moduleB/moduleC/C1.java b/ajde/testdata/LstBuildConfigManagerTest/moduleB/moduleC/C1.java
new file mode 100644
index 000000000..f13a74561
--- /dev/null
+++ b/ajde/testdata/LstBuildConfigManagerTest/moduleB/moduleC/C1.java
@@ -0,0 +1,3 @@
+package configs.moduleB.moduleC;
+
+class C1 { } \ No newline at end of file
diff --git a/ajde/testdata/LstBuildConfigManagerTest/moduleB/moduleC/C2.java b/ajde/testdata/LstBuildConfigManagerTest/moduleB/moduleC/C2.java
new file mode 100644
index 000000000..beb877352
--- /dev/null
+++ b/ajde/testdata/LstBuildConfigManagerTest/moduleB/moduleC/C2.java
@@ -0,0 +1,3 @@
+package configs.moduleB.moduleC;
+
+class C2 { } \ No newline at end of file
diff --git a/ajde/testdata/LstBuildConfigManagerTest/moduleB/moduleC/moduleD/D.java b/ajde/testdata/LstBuildConfigManagerTest/moduleB/moduleC/moduleD/D.java
new file mode 100644
index 000000000..f13a74561
--- /dev/null
+++ b/ajde/testdata/LstBuildConfigManagerTest/moduleB/moduleC/moduleD/D.java
@@ -0,0 +1,3 @@
+package configs.moduleB.moduleC;
+
+class C1 { } \ No newline at end of file
diff --git a/ajde/testdata/SimpleStructureModelTest/Foo.java b/ajde/testdata/SimpleStructureModelTest/Foo.java
new file mode 100644
index 000000000..6eb5d5627
--- /dev/null
+++ b/ajde/testdata/SimpleStructureModelTest/Foo.java
@@ -0,0 +1,3 @@
+public class Foo {
+// int x = b
+} \ No newline at end of file
diff --git a/ajde/testdata/SimpleStructureModelTest/Good.java b/ajde/testdata/SimpleStructureModelTest/Good.java
new file mode 100644
index 000000000..7cb30443d
--- /dev/null
+++ b/ajde/testdata/SimpleStructureModelTest/Good.java
@@ -0,0 +1,18 @@
+public class Good {
+
+ public void foo() {
+ int i = 0;
+ i += 1;
+ i += 2;
+ }
+
+ int x = 3;
+}
+
+aspect A {
+ before(): call(* *(..)) {
+ System.out.println("");
+ }
+}
+
+
diff --git a/ajde/testdata/StructureModelRegressionTest/.cvsignore b/ajde/testdata/StructureModelRegressionTest/.cvsignore
new file mode 100644
index 000000000..14314ab36
--- /dev/null
+++ b/ajde/testdata/StructureModelRegressionTest/.cvsignore
@@ -0,0 +1 @@
+example.ajsym
diff --git a/ajde/testdata/StructureModelRegressionTest/pkg/.cvsignore b/ajde/testdata/StructureModelRegressionTest/pkg/.cvsignore
new file mode 100644
index 000000000..14314ab36
--- /dev/null
+++ b/ajde/testdata/StructureModelRegressionTest/pkg/.cvsignore
@@ -0,0 +1 @@
+example.ajsym
diff --git a/ajde/testdata/StructureModelRegressionTest/pkg/Example.java b/ajde/testdata/StructureModelRegressionTest/pkg/Example.java
new file mode 100644
index 000000000..df5e94bd5
--- /dev/null
+++ b/ajde/testdata/StructureModelRegressionTest/pkg/Example.java
@@ -0,0 +1,16 @@
+package pkg;
+
+class Example {
+ public void foo() {
+ }
+
+ public int goo() {
+ return 37;
+ }
+
+ double d = 37;
+
+ Example(int i) {
+ d = d + i;
+ }
+} \ No newline at end of file
diff --git a/ajde/testdata/StructureModelTest/.cvsignore b/ajde/testdata/StructureModelTest/.cvsignore
new file mode 100644
index 000000000..ba077a403
--- /dev/null
+++ b/ajde/testdata/StructureModelTest/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/ajde/testdata/StructureSearchManagerTest/.cvsignore b/ajde/testdata/StructureSearchManagerTest/.cvsignore
new file mode 100644
index 000000000..ba077a403
--- /dev/null
+++ b/ajde/testdata/StructureSearchManagerTest/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/ajde/testdata/StructureViewManagerTest/.cvsignore b/ajde/testdata/StructureViewManagerTest/.cvsignore
new file mode 100644
index 000000000..ba077a403
--- /dev/null
+++ b/ajde/testdata/StructureViewManagerTest/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/ajde/testdata/StructureViewManagerTest/pkg/Example.java b/ajde/testdata/StructureViewManagerTest/pkg/Example.java
new file mode 100644
index 000000000..df5e94bd5
--- /dev/null
+++ b/ajde/testdata/StructureViewManagerTest/pkg/Example.java
@@ -0,0 +1,16 @@
+package pkg;
+
+class Example {
+ public void foo() {
+ }
+
+ public int goo() {
+ return 37;
+ }
+
+ double d = 37;
+
+ Example(int i) {
+ d = d + i;
+ }
+} \ No newline at end of file
diff --git a/ajde/testdata/examples/configs/.cvsignore b/ajde/testdata/examples/configs/.cvsignore
new file mode 100644
index 000000000..bd4e1a00b
--- /dev/null
+++ b/ajde/testdata/examples/configs/.cvsignore
@@ -0,0 +1 @@
+configs.ajsym
diff --git a/ajde/testdata/examples/figures-coverage/.cvsignore b/ajde/testdata/examples/figures-coverage/.cvsignore
new file mode 100644
index 000000000..c6495af69
--- /dev/null
+++ b/ajde/testdata/examples/figures-coverage/.cvsignore
@@ -0,0 +1 @@
+all.ajsym
diff --git a/ajde/testdata/examples/figures-coverage/editor/Editor.java b/ajde/testdata/examples/figures-coverage/editor/Editor.java
new file mode 100644
index 000000000..99e2b5d5b
--- /dev/null
+++ b/ajde/testdata/examples/figures-coverage/editor/Editor.java
@@ -0,0 +1,4 @@
+
+package editor;
+
+class Editor { }
diff --git a/ajde/testdata/examples/figures-coverage/figures/.cvsignore b/ajde/testdata/examples/figures-coverage/figures/.cvsignore
new file mode 100644
index 000000000..9a2b438e3
--- /dev/null
+++ b/ajde/testdata/examples/figures-coverage/figures/.cvsignore
@@ -0,0 +1,8 @@
+Checks.class
+Debug.class
+Element.class
+Figure.class
+FigureElement.class
+Main.class
+Main$TestGUI.class
+Test.class
diff --git a/ajde/testdata/examples/figures-coverage/figures/Debug.java b/ajde/testdata/examples/figures-coverage/figures/Debug.java
new file mode 100644
index 000000000..01e895abc
--- /dev/null
+++ b/ajde/testdata/examples/figures-coverage/figures/Debug.java
@@ -0,0 +1,7 @@
+
+package figures;
+
+aspect Debug {
+
+}
+
diff --git a/ajde/testdata/examples/figures-coverage/figures/Figure.java b/ajde/testdata/examples/figures-coverage/figures/Figure.java
new file mode 100644
index 000000000..9bf5e0f8b
--- /dev/null
+++ b/ajde/testdata/examples/figures-coverage/figures/Figure.java
@@ -0,0 +1,88 @@
+
+package figures;
+
+//import figures.primitives.planar.Point;
+
+import java.awt.Canvas;
+
+aspect Figure {
+ //pointcut sendSuccess(): cflow(setX()) && !handler(Exception);
+
+ public String Point.getName() {
+ return Point.name;
+ }
+
+ public int figures.primitives.planar.Point.DEFAULT_X = 0;
+
+ public pointcut constructions(): call(Point.new(int, int)) || call(SolidPoint.new(int, int, int));
+
+ public pointcut moves(FigureElement fe): target(fe) &&
+ (call(String Point.getName()) ||
+ call(void FigureElement.incrXY(int, int)) ||
+ call(void Point.setX(int)) ||
+ call(void Point.setY(int)) ||
+ call(void SolidPoint.setZ(int)));
+
+ pointcut mainExecution():
+ execution(int main(*));
+
+ pointcut runtimeHandlers(): mainExecution()
+ || handler(RuntimeException);
+
+ public pointcut mumble(): runtimeHandlers();
+
+ before(int newValue): set(int *.*) && args(newValue) { }
+
+ before(): get(int *.*) { }
+
+ before(): constructions() {
+ System.out.println("> before construction, jp: " + thisJoinPoint.getSignature());
+ }
+
+ before(FigureElement fe): moves(fe) {
+ System.out.println("> about to move FigureElement at X-coord: ");
+ }
+
+ after(): initialization(Point.new(..)) || staticinitialization(Point) {
+ System.out.println("> Point initialized");
+ }
+
+ // should be around
+ after(): mumble() {
+ System.err.println(">> in after advice...");
+ //proceed();
+ }
+
+ after(FigureElement fe): target(fe) &&
+ (call(void FigureElement.incrXY(int, int)) ||
+ call(void Point.setX(int)) ||
+ call(void Point.setY(int)) ||
+ call(void SolidPoint.setZ(int))) {
+ System.out.println("> yo.");
+ }
+
+ after(FigureElement fe):
+ target(fe) &&
+ (call(void FigureElement.incrXY(int, int)) ||
+ call(void Line.setP1(Point)) ||
+ call(void Line.setP2(Point)) ||
+ call(void Point.setX(int)) ||
+ call(void Point.setY(int))) { }
+
+ declare parents: Point extends java.io.Serializable;
+
+ declare parents: Point implements java.util.Observable;
+
+ declare soft: Point: call(* *(..));
+}
+
+aspect Checks {
+ pointcut illegalNewFigElt(): call(FigureElement+.new(..)) &&
+ !withincode(* Main.main(..));
+
+ declare error: illegalNewFigElt():
+ "Illegal figure element constructor call.";
+
+ declare warning: illegalNewFigElt():
+ "Illegal figure element constructor call.";
+}
diff --git a/ajde/testdata/examples/figures-coverage/figures/FigureElement.java b/ajde/testdata/examples/figures-coverage/figures/FigureElement.java
new file mode 100644
index 000000000..d2ce9eb82
--- /dev/null
+++ b/ajde/testdata/examples/figures-coverage/figures/FigureElement.java
@@ -0,0 +1,9 @@
+
+package figures;
+
+public interface FigureElement extends Element {
+
+ public void incrXY(int dx, int dy);
+}
+
+interface Element { }
diff --git a/ajde/testdata/examples/figures-coverage/figures/Main.java b/ajde/testdata/examples/figures-coverage/figures/Main.java
new file mode 100644
index 000000000..bbb2869b7
--- /dev/null
+++ b/ajde/testdata/examples/figures-coverage/figures/Main.java
@@ -0,0 +1,54 @@
+
+package figures;
+
+import figures.primitives.planar.Point;
+import figures.primitives.solid.SolidPoint;
+
+class Main {
+
+ private static Point startPoint;
+
+ public static void main(String[] args) {
+ try {
+ System.out.println("> starting...");
+
+ startPoint = makeStartPoint();
+ //startPoint.setX(3); new Point(0, 0);
+// SolidPoint sp1 = new SolidPoint(1, 3, 3);
+
+// sp1.setZ(1);
+// p1.incrXY(3, 3);
+ } catch (RuntimeException re) {
+ re.printStackTrace();
+ }
+ System.out.println("> finished.");
+ }
+
+ /** @deprecated use something else */
+ public static Point makeStartPoint() {
+ //return new Point(1, 2);
+ return null;
+ }
+
+ /** This should produce a deprecation warning with JDK > 1.2 */
+ static class TestGUI extends javax.swing.JFrame {
+ TestGUI() {
+ this.disable();
+ }
+ }
+
+ /** This should produce a porting-deprecation warning. */
+ //static pointcut mainExecution(): execution(void main(*));
+}
+
+privileged aspect Test {
+ before(Point p, int newval): target(p) && set(int Point.xx) && args(newval) {
+ System.err.println("> new value of x is: " + p.x + ", setting to: " + newval);
+ }
+
+ before(int newValue): set(int Point.*) && args(newValue) {
+ if (newValue < 0) {
+ throw new IllegalArgumentException("too small");
+ }
+ }
+}
diff --git a/ajde/testdata/examples/figures-coverage/figures/composites/.cvsignore b/ajde/testdata/examples/figures-coverage/figures/composites/.cvsignore
new file mode 100644
index 000000000..d9011a888
--- /dev/null
+++ b/ajde/testdata/examples/figures-coverage/figures/composites/.cvsignore
@@ -0,0 +1,3 @@
+BoundedLine.class
+Line.class
+Square.class
diff --git a/ajde/testdata/examples/figures-coverage/figures/composites/Line.java b/ajde/testdata/examples/figures-coverage/figures/composites/Line.java
new file mode 100644
index 000000000..1f7ee5dc8
--- /dev/null
+++ b/ajde/testdata/examples/figures-coverage/figures/composites/Line.java
@@ -0,0 +1,6 @@
+
+package figures.composites;
+
+class Line { }
+
+class BoundedLine extends Line { }
diff --git a/ajde/testdata/examples/figures-coverage/figures/composites/Square.java b/ajde/testdata/examples/figures-coverage/figures/composites/Square.java
new file mode 100644
index 000000000..8ba3825d6
--- /dev/null
+++ b/ajde/testdata/examples/figures-coverage/figures/composites/Square.java
@@ -0,0 +1,6 @@
+
+package figures.composites;
+
+class Square {
+ private String name = "Square";
+}
diff --git a/ajde/testdata/examples/figures-coverage/figures/primitives/planar/.cvsignore b/ajde/testdata/examples/figures-coverage/figures/primitives/planar/.cvsignore
new file mode 100644
index 000000000..1dd78c3c0
--- /dev/null
+++ b/ajde/testdata/examples/figures-coverage/figures/primitives/planar/.cvsignore
@@ -0,0 +1,4 @@
+StrictlyBoundedPoint.class
+PointBoundsException.class
+Point.class
+BoundedPoint.class
diff --git a/ajde/testdata/examples/figures-coverage/figures/primitives/planar/Point.java b/ajde/testdata/examples/figures-coverage/figures/primitives/planar/Point.java
new file mode 100644
index 000000000..d389be386
--- /dev/null
+++ b/ajde/testdata/examples/figures-coverage/figures/primitives/planar/Point.java
@@ -0,0 +1,73 @@
+
+package figures.primitives.planar;
+
+import figures.*;
+import java.util.Collection;
+
+public class Point implements FigureElement {
+
+ static int xx = -1;
+ private int x;
+ private int y;
+ transient int currVal = 0;
+ public static String name;
+
+ {
+ y = -1;
+ }
+
+ static {
+ xx = -10;
+ }
+
+ int c; int b; int a;
+ {
+ x = 0;
+ y = 0;
+ }
+
+ static {
+ Point.name = "2-Dimensional Point";
+ }
+
+ public Point(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ int getCurrVal() {
+ return currVal;
+ }
+
+ /**
+ * @see Figure#moves
+ */
+ public int getX() { return x; }
+
+ public int getY() { return y; }
+
+ public void setX(int x) { this.x = x; }
+
+ public void setY(int x) { this.y = x; }
+
+ public void incrXY(int dx, int dy) {
+ setX(getX() + dx);
+ setY(getY() + dy);
+ }
+ public void check(int dx, int dy)
+ throws ArithmeticException, PointBoundsException {
+ if (dx < 0 || dy < 0) throw new PointBoundsException();
+ }
+}
+
+class PointBoundsException extends Exception { }
+
+class BoundedPoint extends Point {
+ public BoundedPoint(int x, int y) { super(x, y); }
+}
+
+class StrictlyBoundedPoint extends BoundedPoint {
+ public StrictlyBoundedPoint(int x, int y) { super(x, y); }
+}
+
+
diff --git a/ajde/testdata/examples/figures-coverage/figures/primitives/solid/.cvsignore b/ajde/testdata/examples/figures-coverage/figures/primitives/solid/.cvsignore
new file mode 100644
index 000000000..fd0572c5e
--- /dev/null
+++ b/ajde/testdata/examples/figures-coverage/figures/primitives/solid/.cvsignore
@@ -0,0 +1 @@
+SolidPoint.class
diff --git a/ajde/testdata/examples/figures-coverage/figures/primitives/solid/SolidPoint.java b/ajde/testdata/examples/figures-coverage/figures/primitives/solid/SolidPoint.java
new file mode 100644
index 000000000..80c1fc1ca
--- /dev/null
+++ b/ajde/testdata/examples/figures-coverage/figures/primitives/solid/SolidPoint.java
@@ -0,0 +1,24 @@
+
+package figures.primitives.solid;
+
+import java.util.Collection;
+import java.lang.String;
+import figures.primitives.planar.*;
+
+public class SolidPoint extends Point {
+ private int z;
+
+ public SolidPoint(int x, int y, int z) {
+ super(x, y);
+ this.z = z;
+ }
+
+ public int getZ() { return z; }
+
+ public void setZ(int z) { this.z = z; }
+
+ public void incrXY(int dx, int dy) {
+ super.incrXY(dx, dy);
+ setZ(getZ() + dx + dy);
+ }
+}
diff --git a/ajde/testdata/examples/figures-demo/.cvsignore b/ajde/testdata/examples/figures-demo/.cvsignore
new file mode 100644
index 000000000..ad69a1aa9
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/.cvsignore
@@ -0,0 +1 @@
+figures-demo-all.ajsym
diff --git a/ajde/testdata/examples/figures-demo/figures/Box.java b/ajde/testdata/examples/figures-demo/figures/Box.java
new file mode 100644
index 000000000..4db7f439d
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/figures/Box.java
@@ -0,0 +1,55 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Box extends ShapeFigureElement {
+ private Point _p0;
+ private Point _p1;
+ private Point _p2;
+ private Point _p3;
+
+ public Box(int x0, int y0, int width, int height) {
+ _p0 = new Point(x0, y0);
+ _p1 = new Point(x0+width, y0);
+ _p2 = new Point(x0+width, y0+height);
+ _p3 = new Point(x0, y0+height);
+ }
+
+ public Point getP0() { return _p0; }
+ public Point getP1() { return _p1; }
+ public Point getP2() { return _p2; }
+ public Point getP3() { return _p3; }
+
+ public void move(int dx, int dy) {
+ _p0.move(dx, dy);
+ _p1.move(dx, dy);
+ _p2.move(dx, dy);
+ _p3.move(dx, dy);
+ }
+
+ public void checkBoxness() {
+ if ((_p0.getX() == _p3.getX()) &&
+ (_p1.getX() == _p2.getX()) &&
+ (_p0.getY() == _p1.getY()) &&
+ (_p2.getY() == _p3.getY()))
+ return;
+ throw new IllegalStateException("This is not a square.");
+ }
+
+ public String toString() {
+ return "Box(" + _p0 + ", " + _p1 + ", " + _p2 + ", " + _p3 + ")";
+ }
+
+ public Shape getShape() {
+ return new Rectangle(getP1().getX(),
+ getP1().getY(),
+ getP3().getX() - getP1().getX(),
+ getP3().getY() - getP1().getY());
+ }
+}
+
diff --git a/ajde/testdata/examples/figures-demo/figures/Canvas.java b/ajde/testdata/examples/figures-demo/figures/Canvas.java
new file mode 100644
index 000000000..e5491d7cb
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/figures/Canvas.java
@@ -0,0 +1,11 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+public class Canvas {
+ public static void updateHistory() {
+ // not implemented
+ }
+}
diff --git a/ajde/testdata/examples/figures-demo/figures/ColorControl.java b/ajde/testdata/examples/figures-demo/figures/ColorControl.java
new file mode 100644
index 000000000..46d1ba428
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/figures/ColorControl.java
@@ -0,0 +1,20 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.Color;
+import figures.FigureElement;
+
+public aspect ColorControl {
+ public static void setFillColor(FigureElement fe, Color color) {
+ // fill in here
+ }
+
+ public static void setLineColor(FigureElement fe, Color color) {
+ // fill in here
+ }
+
+ // fill in here
+}
diff --git a/ajde/testdata/examples/figures-demo/figures/FigureElement.java b/ajde/testdata/examples/figures-demo/figures/FigureElement.java
new file mode 100644
index 000000000..ae06c132b
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/figures/FigureElement.java
@@ -0,0 +1,21 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public interface FigureElement {
+ public static final int MIN_VALUE = 0;
+ public static final int MAX_VALUE = 500;
+
+ public abstract void move(int dx, int dy);
+
+ public abstract Rectangle getBounds();
+
+ public abstract boolean contains(Point2D p);
+
+ public abstract void paint(Graphics2D g2);
+}
diff --git a/ajde/testdata/examples/figures-demo/figures/Group.java b/ajde/testdata/examples/figures-demo/figures/Group.java
new file mode 100644
index 000000000..59c1a17cf
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/figures/Group.java
@@ -0,0 +1,88 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.util.*;
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Group implements FigureElement {
+ private Collection _members;
+ private String _identifier;
+
+ public Group(FigureElement first) {
+ this._members = new ArrayList();
+ add(first);
+ }
+
+ public void add(FigureElement fe) {
+ _members.add(fe);
+ }
+
+ public Iterator members() {
+ return _members.iterator();
+ }
+
+ public void move(int dx, int dy) {
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ fe.move(dx, dy);
+ }
+ }
+
+ public void resetIdentifier(String identifier) {
+ resetIdentifier(identifier);
+ }
+
+ public String toString() {
+ if (_identifier != null) {
+ return _identifier;
+ }
+
+ StringBuffer buf = new StringBuffer("Group(");
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ buf.append(i.next().toString());
+ if (i.hasNext()) {
+ buf.append(", ");
+ }
+ }
+ buf.append(")");
+ return buf.toString();
+ }
+
+ public Rectangle getBounds() {
+ Rectangle previous = null;
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ Rectangle rect = fe.getBounds();
+ if (previous != null) {
+ previous = previous.union(rect);
+ } else {
+ previous = rect;
+ }
+ }
+ return previous;
+ }
+
+ public boolean contains(Point2D p) {
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ if (fe.contains(p)) return true;
+ }
+ return false;
+ }
+
+ public void paint(Graphics2D g2) {
+ for (Iterator i = _members.iterator(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ fe.paint(g2);
+ }
+ }
+
+ public int size() {
+ return _members.size();
+ }
+}
+
diff --git a/ajde/testdata/examples/figures-demo/figures/Line.java b/ajde/testdata/examples/figures-demo/figures/Line.java
new file mode 100644
index 000000000..45324646e
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/figures/Line.java
@@ -0,0 +1,73 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Line extends ShapeFigureElement {
+ private Point _p1;
+ private Point _p2;
+
+ public Line(Point p1, Point p2) {
+ _p1 = p1;
+ _p2 = p2;
+ }
+
+ public Point getP1() {
+ return _p1;
+ }
+
+ public void setP1(Point p1) {
+ _p1 = p1;
+ Canvas.updateHistory();
+ }
+
+ public Point getP2() {
+ return _p2;
+ }
+
+ public void setP2(Point p2) {
+ _p2 = p2;
+ Canvas.updateHistory();
+ }
+
+ public void move(int dx, int dy) {
+ //_x = dx;
+ //_y = dy;
+
+ //_p1.move(dx, dy);
+ //_p2.move(dx, dy);
+ }
+
+ public String toString() {
+ return "Line(" + _p1 + ", " + _p2 + ")";
+ }
+
+ /**
+ * Used to determine if this line {@link contains(Point2D)} a point.
+ */
+ final static int THRESHHOLD = 5;
+
+ /**
+ * Returns <code>true</code> if the point segment distance is less than
+ * {@link THRESHHOLD}.
+ */
+ public boolean contains(Point2D p) {
+ return getLine2D().ptLineDist(p) < THRESHHOLD;
+ }
+
+ private Line2D getLine2D() {
+ return new Line2D.Float((float)getP1().getX(),
+ (float)getP1().getY(),
+ (float)getP2().getX(),
+ (float)getP2().getY());
+ }
+
+ public Shape getShape() {
+ return getLine2D();
+ }
+}
+
diff --git a/ajde/testdata/examples/figures-demo/figures/Point.java b/ajde/testdata/examples/figures-demo/figures/Point.java
new file mode 100644
index 000000000..e8783a560
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/figures/Point.java
@@ -0,0 +1,59 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Point extends ShapeFigureElement {
+ private int _x;
+ private int _y;
+
+ public Point(int x, int y) {
+ _x = x;
+ _y = y;
+ }
+
+ public int getX() {
+ return _x;
+ }
+
+ public void setX(int x) {
+ _x = x;
+ //Canvas.updateHistory();
+ }
+
+ public int getY() {
+ return _y;
+ }
+
+ public void setY(int y) {
+ _y = y;
+ //Canvas.updateHistory();
+ }
+
+ public void move(int dx, int dy) {
+ setX(_x + dx);
+ setY(_y + dy);
+ }
+
+ public String toString() {
+ return "Point(" + _x + ", " + _y + ")";
+ }
+
+ /** The height of displayed {@link Point}s. */
+ private final static int HEIGHT = 10;
+
+ /** The width of displayed {@link Point}s. -- same as {@link HEIGHT}. */
+ private final static int WIDTH = Point.HEIGHT;
+
+ public Shape getShape() {
+ return new Ellipse2D.Float((float)getX()-Point.WIDTH/2,
+ (float)getY()-Point.HEIGHT/2,
+ (float)Point.HEIGHT,
+ (float)Point.WIDTH);
+ }
+}
+
diff --git a/ajde/testdata/examples/figures-demo/figures/ShapeFigureElement.java b/ajde/testdata/examples/figures-demo/figures/ShapeFigureElement.java
new file mode 100644
index 000000000..29a4a89ad
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/figures/ShapeFigureElement.java
@@ -0,0 +1,38 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public abstract class ShapeFigureElement implements FigureElement {
+ public abstract void move(int dx, int dy);
+
+ public abstract Shape getShape();
+
+ public Rectangle getBounds() {
+ return getShape().getBounds();
+ }
+
+ public boolean contains(Point2D p) {
+ return getShape().contains(p);
+ }
+
+ public Color getLineColor() {
+ return Color.black;
+ }
+
+ public Color getFillColor() {
+ return Color.red;
+ }
+
+ public final void paint(Graphics2D g2) {
+ Shape shape = getShape();
+ g2.setPaint(getFillColor());
+ g2.fill(shape);
+ g2.setPaint(getLineColor());
+ g2.draw(shape);
+ }
+}
diff --git a/ajde/testdata/examples/figures-demo/figures/SlothfulPoint.java b/ajde/testdata/examples/figures-demo/figures/SlothfulPoint.java
new file mode 100644
index 000000000..35c8fb635
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/figures/SlothfulPoint.java
@@ -0,0 +1,42 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+/**
+ * This class makes mistakes to be caught by invariant checkers.
+ */
+public class SlothfulPoint extends ShapeFigureElement {
+ private int _x;
+ private int _y;
+
+ public SlothfulPoint(int x, int y) {
+ }
+
+ public void setX(int x) {
+ _x = x;
+ }
+
+ public void setY(int y) {
+ _y = y;
+ }
+
+ public void move(int dx, int dy) {
+ //_x += dx;
+ //_y += dy;
+ }
+
+ public String toString() {
+ return "SlothfulPoint";
+ }
+
+ public Shape getShape() {
+ return new Ellipse2D.Float((float)_x,
+ (float)_y, 1.0f, 1.0f);
+ }
+}
+
diff --git a/ajde/testdata/examples/figures-demo/figures/gui/FigurePanel.java b/ajde/testdata/examples/figures-demo/figures/gui/FigurePanel.java
new file mode 100644
index 000000000..8e777c3df
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/figures/gui/FigurePanel.java
@@ -0,0 +1,172 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures.gui;
+
+import figures.Point;
+import figures.Line;
+import figures.FigureElement;
+import figures.Group;
+
+
+import java.awt.*;
+import java.awt.geom.*;
+import java.awt.event.*;
+import java.io.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.border.*;
+
+public class FigurePanel extends JComponent {
+
+ ButtonsPanel bp = new ButtonsPanel();
+ FigureSurface fs = new FigureSurface();
+ ConsolePanel cp = new ConsolePanel();
+
+
+ public FigurePanel() {
+ setLayout(new BorderLayout());
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+ panel.add(fs);
+ panel.add(bp);
+ JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, panel, cp);
+ sp.setPreferredSize(new Dimension(500, 400));
+ sp.setDividerLocation(250);
+ add(BorderLayout.CENTER, sp);
+ }
+
+ class ButtonsPanel extends JPanel {
+ private JLabel msgs = new JLabel("click to add a point or line");
+ public ButtonsPanel() {
+ setLayout(new FlowLayout(FlowLayout.LEFT));
+ add(new JButton(new AbstractAction("Main") {
+ public void actionPerformed(ActionEvent e) {
+ Main.main(new String[]{});
+ fs.repaint();
+ }
+ }));
+ add(msgs);
+ }
+
+ public void log(String msg) {
+ msgs.setText(msg);
+ }
+ }
+
+ static class ConsolePanel extends JPanel {
+
+ JTextArea text = new JTextArea();
+
+ public ConsolePanel() {
+ super(new BorderLayout());
+ text.setFont(StyleContext.getDefaultStyleContext().getFont("SansSerif", Font.PLAIN, 10));
+ JScrollPane scroller = new JScrollPane(text);
+ scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ add(BorderLayout.CENTER, scroller);
+ }
+
+ public void println(String msg) {
+ text.append(msg + '\n');
+ }
+ }
+
+ final static Color BACKGROUND = Color.white;
+
+ static class FigureSurface extends JPanel implements MouseListener, MouseMotionListener {
+ private Group canvas;
+
+ public FigureSurface() {
+ canvas = new Group(new Point(250, 250));
+ addMouseMotionListener(this);
+ addMouseListener(this);
+ setPreferredSize(new Dimension(500,500));
+ }
+
+ private Point addPoint(int x, int y) {
+ Point p = new Point(x, y);
+ canvas.add(p);
+ repaint();
+ return p;
+ }
+
+ private Line addLine(Point p1, Point p2) {
+ if (Math.abs(p1.getX()-p2.getX()) < 5 ||
+ Math.abs(p1.getY()-p2.getY()) < 5) {
+ return null;
+ }
+
+ Line line = null;
+ if (p1 != null && p2 != null) {
+ line = new Line(p1, p2);
+ canvas.add(line);
+ }
+ repaint();
+ return line;
+ }
+
+ public void paint(Graphics g) {
+ Graphics2D g2 = (Graphics2D) g;
+ g2.setPaint(BACKGROUND);
+ g2.fill(new Rectangle2D.Float(0f, 0f, (float)g2.getClipBounds().width, (float)g2.getClipBounds().height));
+ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ canvas.paint(g2);
+ }
+
+
+ int lastX, lastY;
+ int pressX, pressY;
+
+ FigureElement first = null;
+ Point point1 = null;
+
+ public void mousePressed(MouseEvent e){
+ int x = e.getX(), y = e.getY();
+ pressX = lastX = x; pressY = lastY = y;
+ first = findFigureElement(x, y);
+ if (first == null) {
+ point1 = addPoint(x, y);
+ }
+ }
+
+ public void mouseDragged(MouseEvent e) {
+ int x = e.getX(), y = e.getY(), dx = lastX-x, dy = lastY-y;
+ lastX = x;
+ lastY = y;
+ if (first == null) {
+ Line line = addLine(point1, new Point(x, y));
+ if (line != null) {
+ canvas.add(line.getP2());
+ first = line.getP2();
+ canvas.add(line);
+ }
+ } else {
+ first.move(-dx, -dy);
+ }
+ repaint();
+ }
+
+ public void mouseReleased(MouseEvent e){
+ mouseDragged(e);
+ first = null;
+ point1 = null;
+ }
+
+
+ public void mouseMoved(MouseEvent e){}
+ public void mouseClicked(MouseEvent e){}
+ public void mouseExited(MouseEvent e){}
+ public void mouseEntered(MouseEvent e){}
+
+ private FigureElement findFigureElement(int x, int y) {
+ Point2D p = new Point2D.Float((float)x, (float)y);
+ for (Iterator i = canvas.members(); i.hasNext(); ) {
+ FigureElement fe = (FigureElement)i.next();
+ if (fe.contains(p)) return fe;
+ }
+ return null;
+ }
+ }
+}
diff --git a/ajde/testdata/examples/figures-demo/figures/gui/LogAdapter.java b/ajde/testdata/examples/figures-demo/figures/gui/LogAdapter.java
new file mode 100644
index 000000000..078ab01cb
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/figures/gui/LogAdapter.java
@@ -0,0 +1,16 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures.gui;
+
+import support.Log;
+
+aspect LogAdapter {
+
+ before(String s): call(void Log.log(String)) && args(s) {
+ if (Main.panel != null) {
+ Main.panel.cp.println(s);
+ }
+ }
+}
diff --git a/ajde/testdata/examples/figures-demo/figures/gui/Main.java b/ajde/testdata/examples/figures-demo/figures/gui/Main.java
new file mode 100644
index 000000000..15fac91a0
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/figures/gui/Main.java
@@ -0,0 +1,26 @@
+/*
+Copyright (c) 2001-2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package figures.gui;
+
+import javax.swing.*;
+import support.Log;
+import figures.Point;
+
+public class Main {
+ static FigurePanel panel;
+
+ public static void main(String[] args) {
+ JFrame figureFrame = new JFrame("Figure Editor");
+ panel = new FigurePanel();
+ figureFrame.setContentPane(panel);
+ figureFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ figureFrame.pack();
+ figureFrame.setVisible(true);
+
+ // for testing--remove!
+ //Point p = new Point(0, 0);
+ //p.setX(-10);
+ }
+}
diff --git a/ajde/testdata/examples/figures-demo/figures/support/Enforcement.java b/ajde/testdata/examples/figures-demo/figures/support/Enforcement.java
new file mode 100644
index 000000000..a7c806ac6
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/figures/support/Enforcement.java
@@ -0,0 +1,67 @@
+/*
+ * (c) Copyright 2001 MyCorporation.
+ * All Rights Reserved.
+ */
+
+package figures.support;
+
+import figures.*;
+
+public aspect Enforcement {
+
+ before(int newValue): set(int Point.*) && args(newValue) {
+ if (newValue < 0) {
+ throw new IllegalArgumentException("> val: " + newValue + " is too small");
+ }
+ }
+
+ declare warning: call(void Canvas.updateHistory(..)) && !within(Enforcement): "";
+
+ after() returning: call(void FigureElement+.set*(..)) {
+ //Canvas.updateHistory();
+ }
+
+ declare error:
+ set(private * FigureElement+.*) &&
+ !(withincode(* FigureElement+.set*(..)) || withincode(FigureElement+.new(..))):
+ "should only assign to fileds from set methods";
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// before(int newValue): set(int Point.*) && args(newValue) {
+// if (newValue < 0) {
+// throw new IllegalArgumentException("> value: " + newValue + " too small");
+// }
+// }
+//
+// declare warning: call(void Canvas.updateHistory(..)) && !within(Enforcement):
+// "found call";
+//
+// after() returning: call(void FigureElement+.set*(..)) {
+// Canvas.updateHistory();
+// }
+//
+// declare error:
+// set(private * FigureElement+.*) &&
+// !(withincode(* FigureElement+.set*(..)) || withincode(FigureElement+.new(..))):
+// "should only assign to fields from set methods";
diff --git a/ajde/testdata/examples/figures-demo/figures/support/Log.java b/ajde/testdata/examples/figures-demo/figures/support/Log.java
new file mode 100644
index 000000000..ed395696a
--- /dev/null
+++ b/ajde/testdata/examples/figures-demo/figures/support/Log.java
@@ -0,0 +1,36 @@
+/*
+Copyright (c) 2002 Palo Alto Research Center Incorporated. All Rights Reserved.
+ */
+
+package support;
+
+public class Log {
+ private static StringBuffer data = new StringBuffer();
+
+ public static void traceObject(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ public static void log(String s) {
+ data.append(s);
+ data.append(';');
+ }
+
+ public static void logClassName(Class _class) {
+ String name = _class.getName();
+ int dot = name.lastIndexOf('.');
+ if (dot == -1) {
+ log(name);
+ } else {
+ log(name.substring(dot+1, name.length()));
+ }
+ }
+
+ public static String getString() {
+ return data.toString();
+ }
+
+ public static void clear() {
+ data.setLength(0);
+ }
+}
diff --git a/ajde/testdata/examples/inheritance/.cvsignore b/ajde/testdata/examples/inheritance/.cvsignore
new file mode 100644
index 000000000..a5f90a68e
--- /dev/null
+++ b/ajde/testdata/examples/inheritance/.cvsignore
@@ -0,0 +1 @@
+inheritance.ajsym
diff --git a/ajde/testdata/examples/inheritance/A.java b/ajde/testdata/examples/inheritance/A.java
new file mode 100644
index 000000000..899b409f0
--- /dev/null
+++ b/ajde/testdata/examples/inheritance/A.java
@@ -0,0 +1,22 @@
+
+package inheritance;
+
+public abstract class A {
+
+ public abstract void bar();
+
+ public void foo() { }
+
+ public String toString() {
+ // mumble
+
+ return "";
+ }
+}
+
+class B extends A {
+
+ public void bar() { }
+
+ public void foo() { }
+}
diff --git a/ajde/testdata/examples/plainJava/apples/Apple.java b/ajde/testdata/examples/plainJava/apples/Apple.java
new file mode 100644
index 000000000..725d7f4b1
--- /dev/null
+++ b/ajde/testdata/examples/plainJava/apples/Apple.java
@@ -0,0 +1,115 @@
+
+package apples;
+
+import java.io.Serializable;
+import java.io.IOException;
+
+/**
+ * This class represents an apple that has the following two attributes
+ * <UL>
+ * <LI>a variety (i.e. "Macintosh" or "Granny Smith")
+ * <LI>a brusing factor represnting how badly bruised the apple is
+ * </UL>
+ *
+ * @author Mik Kersten
+ * @version $Version$
+ */
+
+public class Apple implements Serializable
+{
+ private String variety = null;
+ private int bruising = 0;
+
+ /**
+ * Default constructor.
+ *
+ * @param newVariety the type of variety for this apple
+ */
+ public Apple( String newVariety )
+ {
+ variety = newVariety;
+ }
+
+ /**
+ * This inner class represents apple seeds.
+ */
+ public class AppleSeed {
+ private int weight = 0;
+ private SeedContents seedContents = null;
+
+ /**
+ * This is how you get poison from the apple.
+ */
+ public void getArsenic() {
+ System.out.println( ">> getting arsenic" );
+ }
+
+ /**
+ * Reperesents the contents of the seeds.
+ */
+ public class SeedContents {
+ public String core = null;
+ public String shell = null;
+ }
+ }
+
+ /**
+ * Sets the bruising factor of the apple.
+ *
+ * @param bruiseFactor the new bruising factor
+ */
+ public void bruise( int bruiseFactor )
+ {
+ bruising = bruising + bruiseFactor;
+
+ if ( bruising > 100 ) bruising = 100;
+ if ( bruising < 0 ) bruising = 0;
+ }
+
+ /**
+ * Returns the bruising factor.
+ *
+ * @return bruising the bruising factor associated with the apple
+ */
+ public int getBruising()
+ {
+ return bruising;
+ }
+
+
+ /**
+ * Serializes the apple object.
+ *
+ * @param oos stream that the object is written to
+ */
+ private void writeObject( java.io.ObjectOutputStream oos )
+ throws IOException
+ {
+ // TODO: implement
+ }
+
+
+ /**
+ * Reads in the apple object.
+ *
+ * @param ois stream that the object is read from
+ */
+ private void readObject( java.io.ObjectInputStream ois )
+ throws IOException, ClassNotFoundException
+ {
+ // TODO: implement
+ }
+}
+
+/**
+ * Stub class to represent apple peeling.
+ */
+class ApplePealer
+{
+ /**
+ * Stub for peeling the apple.
+ */
+ public void peelApple() {
+ System.out.println( ">> peeling the apple..." );
+ }
+}
diff --git a/ajde/testdata/examples/plainJava/apples/AppleCrate.java b/ajde/testdata/examples/plainJava/apples/AppleCrate.java
new file mode 100644
index 000000000..82a33b4ed
--- /dev/null
+++ b/ajde/testdata/examples/plainJava/apples/AppleCrate.java
@@ -0,0 +1,54 @@
+
+package apples;
+
+import java.io.Serializable;
+import java.io.IOException;
+
+/**
+ * This class represents an apple crate that is used for transporting apples.
+ * The apples are contained in an array of <CODE>Apple</CODE> objects.
+ *
+ * @author Mik Kersten
+ * @version $Version$
+ *
+ * @see Apple
+ */
+
+public class AppleCrate implements Serializable
+{
+ Apple[] crateContents = null;
+
+ /**
+ * Default constructor.
+ *
+ * @param newCrateContents an array of <CODE>Apple</CODE> objects
+ */
+ public AppleCrate( Apple[] newCrateContents )
+ {
+ crateContents = newCrateContents;
+ }
+
+ /**
+ * A crate is sellable if the apples are bruised 50% or less on average.
+ *
+ * @return <CODE>true</CODE> if the the apples can be sold
+ */
+ public boolean isSellable()
+ {
+ int bruising = 0;
+ for ( int i = 0; i < crateContents.length; i++ )
+ {
+ bruising = bruising + crateContents[i].getBruising();
+ }
+
+ if ( (bruising/crateContents.length) > 50 )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/ajde/testdata/examples/plainJava/apples/BigRigAspect.java b/ajde/testdata/examples/plainJava/apples/BigRigAspect.java
new file mode 100644
index 000000000..a9c3a8db4
--- /dev/null
+++ b/ajde/testdata/examples/plainJava/apples/BigRigAspect.java
@@ -0,0 +1,17 @@
+
+package apples;
+
+/**
+ * This aspect represents upacking apples after an airplane trip.
+ *
+ * @author Mik Kersten
+ * @version $Version$
+ */
+
+public class BigRigAspect extends TransportAspect
+{
+ /**
+ * Default constructor
+ */
+ public BigRigAspect() {}
+}
diff --git a/ajde/testdata/examples/plainJava/apples/TransportAspect.java b/ajde/testdata/examples/plainJava/apples/TransportAspect.java
new file mode 100644
index 000000000..0649986a6
--- /dev/null
+++ b/ajde/testdata/examples/plainJava/apples/TransportAspect.java
@@ -0,0 +1,26 @@
+
+package apples;
+
+/**
+ * This aspect crosscuts the process of shipping apples.
+ *
+ * @author Mik Kersten
+ * @version $Version$
+ */
+
+public class TransportAspect
+{
+ private String crateName = "temp crate";
+
+ /**
+ * Bruises each apple in the crate according to the bruise facor. The bruise
+ * factor is an integer that is passed as a parameter.
+ */
+ private void bruiser( int bruiseFactor )
+ {
+ for ( int i = 0; i < 5; i++ )
+ {
+ System.out.println( "bruising" );
+ }
+ }
+}
diff --git a/ajde/testdata/test-script.html b/ajde/testdata/test-script.html
new file mode 100644
index 000000000..2128e8cf1
--- /dev/null
+++ b/ajde/testdata/test-script.html
@@ -0,0 +1,304 @@
+<html>
+
+<head>
+<meta http-equiv="Content-Language" content="en-us">
+<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
+<meta name="ProgId" content="FrontPage.Editor.Document">
+<title>AJDE Browser</title>
+<STYLE TYPE="text/css">
+<!--
+
+ /* FOR THE SDA PAGE */
+
+ /*
+ BODY {margin-top: 15px; margin-left: 15px; margin-right: 15px;}
+ */
+
+ A:link {
+ color:#4756AC;
+ }
+ A:visited {
+ color:#60657B;
+ }
+ A:hover {
+ color:red
+ }
+
+ INPUT {font:12px "Courier New", sans-serif;}
+
+ H2 {
+ font:18px/18px Verdana, Arial, Helvetica, sans-serif;
+ color:black;
+ font-weight:bold;
+ margin-left: 10px;
+ line-height:110%;
+ }
+ H3 {
+ font:18px/18px Verdana, Arial, Helvetica, sans-serif;
+ color:black;
+ font-weight:bold;
+ margin-left: 10px;
+ line-height:110%;
+ }
+ H4 {
+ font:15px/16px Verdana, Arial, Helvetica, sans-serif;
+ color:black;
+ font-weight:bold;
+ margin-left: 10px;
+ line-height:140%;
+ }
+ P {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ margin-left: 10px;
+ line-height:130%;
+ }
+ .paragraph {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ margin-left: 10px;
+ line-height:130%;
+ }
+ .smallParagraph {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ margin-left: 10px;
+ line-height:130%;
+ }
+ LI {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ margin-right: 10px;
+ margin-left: 15px;
+ line-height:120%;
+ }
+ /*
+ UL {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ margin-right: 10px;
+ margin-left: 15px;
+ line-height:120%;
+ }*/
+ CODE {
+ font:11px/11px Courier New, Courier, sans-serif;
+ text-align:justify;
+ margin-right: 10px;
+ margin-left: 15px;
+ line-height:120%;
+ }
+
+ DL {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ margin-right: 10px;
+ margin-left: 15px;
+ line-height:120%;
+ }
+ .footer {
+ font:10px/10px Verdana, Arial, Helvetica, sans-serif;
+ color:#888888;
+ text-align:left
+ }
+ .figureTitle {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ text-align:justify;
+ text-align:center
+ }
+ .copyrightNotice {
+ font:10px/10px Verdana, Arial, Helvetica, sans-serif;
+ color:#999999;
+ line-height:110%;
+ }
+ .smallHeading {
+ font:13px/13px Verdana, Arial, Helvetica, sans-serif;
+ font-weight:bold;
+ line-height:110%;
+ }
+ .tinyHeading {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ font-weight:bold;
+ line-height:120%;
+ }
+ .newsText {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ line-height:130%;
+ }
+ .smallParagraph {
+ font:11px/11px Verdana, Arial, Helvetica, sans-serif;
+ line-height:130%;
+ }
+ .fancyHeading {
+ font:20px/20px Chantilly, Arial, Helvetica, sans-serif;
+ margin-right: 10px;
+ color:#6f7a92;
+ margin-left: 10px;
+ line-height:130%;
+ }
+
+-->
+</STYLE>
+</head>
+
+<BODY BGCOLOR="white">
+
+<h3 align="center">AJDE Test Script</h3>
+
+<p><b>Structure Browser</b></p>
+
+
+<ul>
+ <li>Select link node corresponding to code (nodes not in structure view):
+ navigation should seek to the source line for the corresponding node, and the
+ parent declaration should be selected in the structure view.</li>
+ <li>seeking on compiler messages doesn't highlight, seeking on structure does
+ and sets cursor in editor</li>
+ <li>after successful compile task is removed</li>
+ <li>JBuilder (and all?): save all happens before build</li>
+</ul>
+
+<p><b>AJBrowser Script</b></p>
+
+
+<p>Steps 3-6 apply should be re-tested in JBuilder and Forte seperately. </p>
+
+
+<ol>
+ <li>launch browser &amp; manipulate config file set<ul>
+ <li>with no config file passed as command line parameter: error message</li>
+ <li>open config file by browsing filesystem<ul>
+ <li>browse and add</li>
+ <li>close config</li>
+ <li>close config: silent fail</li>
+ <li>compile: error message</li>
+ </ul>
+ </li>
+ <li>with multiple config files passed as command line parameters<ul>
+ <li>a file specified by its full path</li>
+ <li>a file specified by its relative path</li>
+ <li>non &quot;.lst&quot; file: file not added to configs list</li>
+ <li>a file with an incorrect suffix: not added to list</li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ <li><font color="#000080">run</font><ul>
+ <li><font color="#000080">with no class selected: error dialog</font></li>
+ <li><font color="#000080">with a non-main class selected: error dialog</font></li>
+ <li><font color="#000080">with a correct main class selected</font></li>
+ </ul>
+ </li>
+ <li><font color="#000080">debug</font><ul>
+ <li><font color="#000080">with no class selected: error dialog</font></li>
+ <li><font color="#000080">with a non-main class selected: error dialog</font></li>
+ <li><font color="#000080">with a correct main class selected</font></li>
+ </ul>
+ </li>
+ <li>compile<ul>
+ <li>no config file present: error message</li>
+ <li>non-existing config file: error message</li>
+ <li>invalid config file: error dialog<ul>
+ <li><font color="#008080">incorrect entry: error message seeks to
+ corresponding line</font></li>
+ <li><font color="#008080">non-existing file: error message seeks to
+ corresponding line</font></li>
+ </ul>
+ </li>
+ <li>compile error-generating code: compiler error, failed build reported<ul>
+ <li>seek to compiler message</li>
+ <li>recompile: messages pane disappears</li>
+ </ul>
+ </li>
+ <li>compile warning-generating code: compiler warning, successful build
+ reported</li>
+ <li><font color="#008080">compile and generate compiler error: error message</font></li>
+ <li><font color="#008080">compile and generate OutOfMemoryError: error
+ message</font></li>
+ <li><font color="#008080">compile and abort: aborted build reported</font></li>
+ <li>compile valid code: successful build reported</li>
+ </ul>
+ </li>
+ <li>browse structure (expand this section)<ul>
+ <li>test modes<ul>
+ <li>global view</li>
+ <li>file view</li>
+ <li>split views</li>
+ </ul>
+ </li>
+ <li>expand/collapse tree levels using slider</li>
+ <li>close and re-launch browser: previously saved structure tree should be
+ present</li>
+ </ul>
+ </li>
+ <li><font color="#008080">edit &quot;.lst&quot; file</font><ul>
+ <li><font color="#008080">select for editing and verify integrity of package/file structure</font></li>
+ <li><font color="#008080">select/deselect nodes and save</font></li>
+ <li><font color="#008080">verify saves committed to disk</font></li>
+ <li><font color="#008080">break &quot;.lst&quot; file on disk: error dialog</font></li>
+ <li><font color="#008080">coverage: when compilation breaks</font></li>
+ <li><font color="#008080">coverage: when aspectjrt.jar not present on
+ classpath</font></li>
+ </ul>
+ </li>
+ <li>user preferences<ul>
+ <li>set options in &quot;Properties&quot; window</li>
+ <li>close and re-launch browser</li>
+ <li>verify properties<ul>
+ <li>Build Options<ul>
+ <li>non-standard options</li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ <li>error handler<ul>
+ <li>verify that the error handler shows stack trace</li>
+ </ul>
+ </li>
+</ol>
+
+
+<p><b>AJDE/JBuilder</b></p>
+<ol>
+ <li>launch<ul>
+ <li>AJDE startup message appears</li>
+ <li>no AJDE listeners are enabled until AJDE started (whitebox)</li>
+ </ul>
+ </li>
+ <li>make new project<ul>
+ <li>*any* combination of parameters to the new project wizard should work</li>
+ <li>add packages</li>
+ <li>add single files</li>
+ </ul>
+ </li>
+ <li>start AJDE</li>
+ <li>repeat AJBrowser tests</li>
+ <li>inline annotations<ul>
+ <li>line with a single annotation</li>
+ <li>line with multiple annotations</li>
+ </ul>
+ </li>
+</ol>
+<p><b>AJDE/Forte</b></p>
+<ol>
+ <li>launch<ul>
+ <li>AJDE startup message appears</li>
+ <li>no AJDE listeners are enabled until AJDE started (whitebox)</li>
+ </ul>
+ </li>
+ <li>make new project<ul>
+ <li>*any* combination of parameters to the new project wizard should work</li>
+ <li>add packages</li>
+ <li>add single files</li>
+ </ul>
+ </li>
+ <li>start AJDE</li>
+ <li>repeat AJBrowser tests</li>
+</ol>
+
+
+</body>
+
+</html> \ No newline at end of file
diff --git a/ajde/testsrc/AjdeModuleTests.java b/ajde/testsrc/AjdeModuleTests.java
new file mode 100644
index 000000000..c26330ed9
--- /dev/null
+++ b/ajde/testsrc/AjdeModuleTests.java
@@ -0,0 +1,31 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+// default package
+
+import junit.framework.*;
+
+public class AjdeModuleTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AjdeModuleTests.class.getName());
+ suite.addTest(org.aspectj.ajde.AjdeTests.suite());
+ suite.addTest(org.aspectj.ajde.internal.AjdeInternalTests.suite());
+ suite.addTest(org.aspectj.ajde.ui.AjdeUiTests.suite());
+ return suite;
+ }
+
+ public AjdeModuleTests(String name) { super(name); }
+
+}
diff --git a/ajde/testsrc/org/aspectj/ajde/AjdeTestCase.java b/ajde/testsrc/org/aspectj/ajde/AjdeTestCase.java
new file mode 100644
index 000000000..8561f04d6
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/AjdeTestCase.java
@@ -0,0 +1,65 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import java.io.*;
+import junit.framework.TestCase;
+
+public class AjdeTestCase extends TestCase {
+
+ private static final String TEST_DATA_PATH = "testdata";
+ //private static final String TEST_DATA_PATH = "C:/Dev/aspectj/modules/ajde/testdata";
+
+ protected NullIdeManager ideManager = new NullIdeManager();
+ protected TestBuildListener testerBuildListener = new TestBuildListener();
+ protected String currTestDataPath;
+
+ public AjdeTestCase(String name) {
+ super(name);
+ }
+
+ protected File createFile(String path) {
+ return new File(currTestDataPath + File.separatorChar + path);
+ }
+
+ /**
+ * Waits on the build complete.
+ */
+ protected void doSynchronousBuild(String configFilePath) {
+ testerBuildListener.reset();
+ File configFile = createFile(configFilePath);
+ Ajde.getDefault().getBuildManager().build(configFile.getAbsolutePath());
+ while(!testerBuildListener.getBuildFinished()) {
+ try {
+ Thread.sleep(300);
+ } catch (InterruptedException ie) { }
+ }
+ }
+
+ protected void setUp(String testDataPath) throws Exception {
+ currTestDataPath = TEST_DATA_PATH + File.separatorChar + testDataPath;
+ ideManager.init(currTestDataPath);
+ super.setUp();
+ Ajde.getDefault().getBuildManager().addListener(testerBuildListener);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ protected String genStructureModelExternFilePath(String configFilePath) {
+ return configFilePath.substring(0, configFilePath.lastIndexOf(".lst")) + ".ajsym";
+ }
+
+}
diff --git a/ajde/testsrc/org/aspectj/ajde/AjdeTests.java b/ajde/testsrc/org/aspectj/ajde/AjdeTests.java
new file mode 100644
index 000000000..d2cd8fe9f
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/AjdeTests.java
@@ -0,0 +1,34 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import junit.framework.*;
+
+public class AjdeTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AjdeTests.class.getName());
+ //$JUnit-BEGIN$
+ suite.addTestSuite(BuildOptionsTest.class);
+ suite.addTestSuite(StructureModelRegressionTest.class);
+ suite.addTestSuite(StructureModelTest.class);
+ suite.addTestSuite(VersionTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+ public AjdeTests(String name) { super(name); }
+
+}
diff --git a/ajde/testsrc/org/aspectj/ajde/BuildOptionsTest.java b/ajde/testsrc/org/aspectj/ajde/BuildOptionsTest.java
new file mode 100644
index 000000000..5f5df1329
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/BuildOptionsTest.java
@@ -0,0 +1,63 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import junit.framework.TestSuite;
+
+import org.aspectj.ajde.ui.UserPreferencesAdapter;
+import org.aspectj.ajde.ui.internal.AjcBuildOptions;
+import org.aspectj.ajde.ui.internal.UserPreferencesStore;
+
+public class BuildOptionsTest extends AjdeTestCase {
+
+ private AjcBuildOptions buildOptions = null;
+ private UserPreferencesAdapter preferencesAdapter = null;
+
+ public BuildOptionsTest(String name) {
+ super(name);
+ }
+
+ public static void main(String[] args) {
+ junit.swingui.TestRunner.run(BuildOptionsTest.class);
+ }
+
+ public static TestSuite suite() {
+ TestSuite result = new TestSuite();
+ result.addTestSuite(BuildOptionsTest.class);
+ return result;
+ }
+
+ public void testCharacterEncoding() {
+ buildOptions.setCharacterEncoding("mumble");
+ assertTrue("character encoding", buildOptions.getCharacterEncoding().equals("mumble"));
+ }
+
+ public void testPortingMode() {
+ buildOptions.setPortingMode(true);
+ assertTrue("porting mode", buildOptions.getPortingMode());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ preferencesAdapter = new UserPreferencesStore();
+ buildOptions = new AjcBuildOptions(preferencesAdapter);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ buildOptions.setCharacterEncoding("");
+ buildOptions.setPortingMode(true);
+ }
+}
+
diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeManager.java b/ajde/testsrc/org/aspectj/ajde/NullIdeManager.java
new file mode 100644
index 000000000..2269fcaba
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/NullIdeManager.java
@@ -0,0 +1,54 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import javax.swing.JFrame;
+
+import org.aspectj.ajde.ui.IdeUIAdapter;
+import org.aspectj.ajde.ui.UserPreferencesAdapter;
+import org.aspectj.ajde.ui.internal.UserPreferencesStore;
+import org.aspectj.ajde.ui.swing.*;
+
+/**
+ * @author Mik Kersten
+ */
+public class NullIdeManager {
+
+ public void init(String testProjectPath) {
+ try {
+ UserPreferencesAdapter preferencesAdapter = new UserPreferencesStore();
+ ProjectPropertiesAdapter browserProjectProperties = new NullIdeProperties(testProjectPath);
+ TaskListManager taskListManager = new NullIdeTaskListManager();
+ BasicEditor ajdeEditor = new BasicEditor();
+ IdeUIAdapter uiAdapter = new NullIdeUIAdapter();
+ JFrame nullFrame = new JFrame();
+ //configurationManager.setConfigFiles(getConfigFilesList(configFiles));
+
+ AjdeUIManager.getDefault().init(
+ ajdeEditor,
+ taskListManager,
+ browserProjectProperties,
+ preferencesAdapter,
+ uiAdapter,
+ new IconRegistry(),
+ nullFrame,
+ true);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ Ajde.getDefault().getErrorHandler().handleError(
+ "Null IDE failed to initialize.",
+ t);
+ }
+ }
+}
diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeProperties.java b/ajde/testsrc/org/aspectj/ajde/NullIdeProperties.java
new file mode 100644
index 000000000..0369954f8
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/NullIdeProperties.java
@@ -0,0 +1,87 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import java.io.File;
+import java.util.*;
+
+/**
+ * @author Mik Kersten
+ */
+public class NullIdeProperties implements ProjectPropertiesAdapter {
+
+ private String testProjectPath = "";
+ private List buildConfigFiles = new ArrayList();
+
+ public NullIdeProperties(String testProjectPath) {
+ this.testProjectPath = testProjectPath;
+ }
+
+ public List getBuildConfigFiles() {
+ return buildConfigFiles;
+ }
+
+ public String getLastActiveBuildConfigFile() {
+ return null;
+ }
+
+ public String getDefaultBuildConfigFile() {
+ return null;
+ }
+
+ public String getProjectName() {
+ return "test";
+ }
+
+ public String getRootProjectDir() {
+ return testProjectPath;
+ }
+
+ public List getProjectSourceFiles() {
+ return null;
+ }
+
+ public String getProjectSourcePath() {
+ return testProjectPath + "/src";
+ }
+
+ public String getClasspath() {
+ //XXX
+ return testProjectPath + System.getProperty("sun.boot.class.path") + File.pathSeparator + "../../../runtime/bin";
+ }
+
+ public String getOutputPath() {
+ return testProjectPath + "/bin";
+ }
+
+ public String getAjcWorkingDir() {
+ return testProjectPath + "/ajworkingdir";
+ }
+
+ public String getBootClasspath() {
+ return null;
+ }
+
+ public String getClassToExecute() {
+ return "figures.Main";
+ }
+
+ public String getExecutionArgs() {
+ return null;
+ }
+
+ public String getVmArgs() {
+ return null;
+ }
+}
diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java b/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java
new file mode 100644
index 000000000..44566ff32
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java
@@ -0,0 +1,38 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import org.aspectj.bridge.*;
+
+/**
+ * Used for displaying tasks, such as compiler messages, to the user.
+ *
+ * @author Mik Kersten
+ */
+public class NullIdeTaskListManager implements TaskListManager {
+
+ public void addSourcelineTask(String message, ISourceLocation sourceLocation, IMessage.Kind kind) {
+ System.out.println("> added sourceline task: " + message + ", file: " + sourceLocation.getSourceFile().getAbsolutePath()
+ + ": " + sourceLocation.getLine());
+ }
+
+ public void addProjectTask(String message, IMessage.Kind kind) {
+ System.out.println("> added project task: " + message + ", kind: " + kind);
+ }
+
+ public void clearTasks() {
+ System.out.println("> cleared tasks");
+ }
+}
+
diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java b/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java
new file mode 100644
index 000000000..78549b895
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java
@@ -0,0 +1,27 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import org.aspectj.ajde.ui.*;
+
+public class NullIdeUIAdapter implements IdeUIAdapter {
+
+ public void displayStatusInformation(String message) {
+ System.out.println("> status message: " + message);
+ }
+
+ public void resetGUI() {
+ // not implemented
+ }
+}
diff --git a/ajde/testsrc/org/aspectj/ajde/SimpleStructureModelTest.java b/ajde/testsrc/org/aspectj/ajde/SimpleStructureModelTest.java
new file mode 100644
index 000000000..4acc5673e
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/SimpleStructureModelTest.java
@@ -0,0 +1,32 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+package org.aspectj.ajde;
+
+public class SimpleStructureModelTest extends AjdeTestCase {
+
+ private String CONFIG_FILE_PATH = "test.lst";
+
+ public SimpleStructureModelTest(String name) {
+ super(name);
+ }
+
+ public void testModel() {
+
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp("SimpleStructureModelTest");
+ doSynchronousBuild(CONFIG_FILE_PATH);
+ }
+
+}
diff --git a/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java b/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java
new file mode 100644
index 000000000..be06bdf20
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java
@@ -0,0 +1,87 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import java.io.File;
+
+import junit.framework.TestSuite;
+
+import org.aspectj.asm.StructureModel;
+
+public class StructureModelRegressionTest extends AjdeTestCase {
+
+ public StructureModelRegressionTest(String name) {
+ super(name);
+ }
+
+ public static void main(String[] args) {
+ junit.swingui.TestRunner.run(StructureModelRegressionTest.class);
+ }
+
+ public static TestSuite suite() {
+ TestSuite result = new TestSuite();
+ result.addTestSuite(StructureModelRegressionTest.class);
+ return result;
+ }
+
+ public void test() {
+ String testLstFile = "StructureModelRegressionTest/example.lst";
+ File f = new File(testLstFile);
+ assertTrue(testLstFile, f.canRead());
+ assertTrue("saved model: " + testLstFile, verifyAgainstSavedModel(testLstFile));
+ }
+
+ public boolean verifyAgainstSavedModel(String lstFile) {
+ File modelFile = new File(genStructureModelExternFilePath(lstFile));
+ StructureModel model = getModelForFile(lstFile);
+ System.out.println(">> model: " + model.getRoot());
+
+ if (modelFile.exists()) {
+ Ajde.getDefault().getStructureModelManager().readStructureModel(lstFile);
+ StructureModel savedModel = Ajde.getDefault().getStructureModelManager().getStructureModel();
+ //System.err.println( savedModel.getRoot().getClass() + ", " + savedModel.getRoot());
+
+ return savedModel.getRoot().equals(model.getRoot());
+ } else {
+ Ajde.getDefault().getStructureModelManager().writeStructureModel(lstFile);
+ return true;
+ }
+ //return true;
+ }
+
+ private StructureModel getModelForFile(String lstFile) {
+ Ajde.getDefault().getConfigurationManager().setActiveConfigFile(lstFile);
+ Ajde.getDefault().getBuildManager().buildStructure();
+ while(!testerBuildListener.getBuildFinished()) {
+ try {
+ Thread.sleep(300);
+ } catch (InterruptedException ie) { }
+ }
+ return Ajde.getDefault().getStructureModelManager().getStructureModel();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp("StructureModelRegressionTest");
+ Ajde.getDefault().getStructureModelManager().setShouldSaveModel(false);
+ }
+
+ public void testModelExists() {
+ assertTrue(Ajde.getDefault().getStructureModelManager().getStructureModel() != null);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
+
diff --git a/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java b/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java
new file mode 100644
index 000000000..244a26b25
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java
@@ -0,0 +1,145 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+package org.aspectj.ajde;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestSuite;
+
+import org.aspectj.asm.*;
+
+/**
+ * @author Mik Kersten
+ */
+public class StructureModelTest extends AjdeTestCase {
+
+ private final String CONFIG_FILE_PATH = "../examples/figures-coverage/all.lst";
+
+ public StructureModelTest(String name) {
+ super(name);
+ }
+
+ public static void main(String[] args) {
+ junit.swingui.TestRunner.run(StructureModelTest.class);
+ }
+
+ public static TestSuite suite() {
+ TestSuite result = new TestSuite();
+ result.addTestSuite(StructureModelTest.class);
+ return result;
+ }
+
+ public void testFieldInitializerCorrespondence() throws IOException {
+ File testFile = createFile("../examples/figures-coverage/figures/Figure.java");
+ StructureNode node = Ajde.getDefault().getStructureModelManager().getStructureModel().findNodeForSourceLine(
+ testFile.getCanonicalPath(), 28);
+ assertTrue("find result", node != null) ;
+ ProgramElementNode pNode = (ProgramElementNode)node;
+ ProgramElementNode foundNode = null;
+ final List list = pNode.getRelations();
+ assertNotNull("pNode.getRelations()", list);
+ for (Iterator it = list.iterator(); it.hasNext(); ) {
+ RelationNode relation = (RelationNode)it.next();
+ if (relation.getRelation().equals(AdviceAssociation.FIELD_ACCESS_RELATION)) {
+ for (Iterator it2 = relation.getChildren().iterator(); it2.hasNext(); ) {
+ LinkNode linkNode = (LinkNode)it2.next();
+ if (linkNode.getProgramElementNode().getName().equals("this.currVal = 0")) {
+ foundNode = linkNode.getProgramElementNode();
+ }
+ }
+ }
+ }
+
+ assertTrue("find associated node", foundNode != null) ;
+
+ File pointFile = createFile("../examples/figures-coverage/figures/primitives/planar/Point.java");
+ StructureNode fieldNode = Ajde.getDefault().getStructureModelManager().getStructureModel().findNodeForSourceLine(
+ pointFile.getCanonicalPath(), 12);
+ assertTrue("find result", fieldNode != null);
+
+ assertTrue("matches", foundNode.getParent() == fieldNode.getParent());
+ }
+
+ public void testFileNodeFind() throws IOException {
+ File testFile = createFile("../examples/figures-coverage/figures/Main.java");
+ StructureNode node = Ajde.getDefault().getStructureModelManager().getStructureModel().findNodeForSourceLine(
+ testFile.getCanonicalPath(), 1);
+ assertTrue("find result", node != null) ;
+ ProgramElementNode pNode = (ProgramElementNode)node;
+ assertTrue("found node: " + pNode.getName(), pNode.getProgramElementKind().equals(ProgramElementNode.Kind.FILE_JAVA));
+ }
+
+ /**
+ * @todo add negative test to make sure things that aren't runnable aren't annotated
+ */
+ public void testMainClassNodeInfo() throws IOException {
+ assertTrue("root exists", Ajde.getDefault().getStructureModelManager().getStructureModel().getRoot() != null);
+ File testFile = createFile("../examples/figures-coverage/figures/Main.java");
+ StructureNode node = Ajde.getDefault().getStructureModelManager().getStructureModel().findNodeForSourceLine(
+ testFile.getCanonicalPath(), 11);
+ assertTrue("find result", node != null);
+
+ ProgramElementNode pNode = (ProgramElementNode)((ProgramElementNode)node).getParent();
+ assertTrue("found node: " + pNode.getName(), pNode.isRunnable());
+ }
+
+ /**
+ * Integrity could be checked somewhere in the API.
+ */
+ public void testModelIntegrity() {
+ StructureNode modelRoot = Ajde.getDefault().getStructureModelManager().getStructureModel().getRoot();
+ assertTrue("root exists", modelRoot != null);
+
+ try {
+ testModelIntegrityHelper(modelRoot);
+ } catch (Exception e) {
+ assertTrue(e.toString(), false);
+ }
+ }
+
+ private void testModelIntegrityHelper(StructureNode node) throws Exception {
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ StructureNode child = (StructureNode)it.next();
+ if (node == child.getParent()) {
+ testModelIntegrityHelper(child);
+ } else {
+ throw new Exception("parent-child check failed for child: " + child.toString());
+ }
+ }
+ }
+
+ public void testNoChildIsNull() {
+ ModelWalker walker = new ModelWalker() {
+ public void preProcess(StructureNode node) {
+ if (node.getChildren() == null) return;
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ if (it.next() == null) throw new NullPointerException("null child on node: " + node.getName());
+ }
+ }
+ };
+ Ajde.getDefault().getStructureModelManager().getStructureModel().getRoot().walk(walker);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp("StructureModelTest");
+ doSynchronousBuild(CONFIG_FILE_PATH);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
+
diff --git a/ajde/testsrc/org/aspectj/ajde/TestBuildListener.java b/ajde/testsrc/org/aspectj/ajde/TestBuildListener.java
new file mode 100644
index 000000000..c53feed45
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/TestBuildListener.java
@@ -0,0 +1,45 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+
+public class TestBuildListener implements BuildListener {
+
+ public boolean buildFinished = false;
+ public boolean buildSucceeded = false;
+
+ public void reset() {
+ buildFinished = false;
+ }
+
+ public void compileStarted(String buildConfigFile) { }
+
+ public void compileFinished(String buildConfigFile, int buildTime, boolean succeeded, boolean warnings) {
+ int timeInSeconds = buildTime/1000;
+ buildSucceeded = succeeded;
+ buildFinished = true;
+ }
+
+ public void compileAborted(String buildConfigFile, String message) { }
+
+ public boolean getBuildFinished() {
+ return buildFinished;
+ }
+
+ public boolean getBuildSucceeded() {
+ return buildSucceeded;
+ }
+}
+
+
diff --git a/ajde/testsrc/org/aspectj/ajde/VersionTest.java b/ajde/testsrc/org/aspectj/ajde/VersionTest.java
new file mode 100644
index 000000000..6e8617005
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/VersionTest.java
@@ -0,0 +1,49 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import junit.framework.TestSuite;
+
+import org.aspectj.bridge.Version;
+
+/**
+ * @author Mik Kersten
+ */
+public class VersionTest extends AjdeTestCase {
+
+ public VersionTest(String name) {
+ super(name);
+ }
+
+ public static TestSuite suite() {
+ TestSuite result = new TestSuite();
+ result.addTestSuite(VersionTest.class);
+ return result;
+ }
+
+ public void testVersionMatch() {
+ String ajdeVersion = Ajde.getDefault().getVersion();
+ String compilerVersion = Version.text;
+ System.out.println("> ajde version: " + ajdeVersion + " <-> compiler version: " + compilerVersion);
+ assertTrue("version check", ajdeVersion.equals(compilerVersion));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp("");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
diff --git a/ajde/testsrc/org/aspectj/ajde/internal/AjdeInternalTests.java b/ajde/testsrc/org/aspectj/ajde/internal/AjdeInternalTests.java
new file mode 100644
index 000000000..b910fd686
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/internal/AjdeInternalTests.java
@@ -0,0 +1,32 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.internal;
+
+import junit.framework.*;
+
+public class AjdeInternalTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AjdeInternalTests.class.getName());
+ //$JUnit-BEGIN$
+ suite.addTestSuite(AspectJBuildManagerTest.class);
+ suite.addTestSuite(LstBuildConfigManagerTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+ public AjdeInternalTests(String name) { super(name); }
+
+}
diff --git a/ajde/testsrc/org/aspectj/ajde/internal/AspectJBuildManagerTest.java b/ajde/testsrc/org/aspectj/ajde/internal/AspectJBuildManagerTest.java
new file mode 100644
index 000000000..569fa6ef7
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/internal/AspectJBuildManagerTest.java
@@ -0,0 +1,80 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.internal;
+
+import junit.framework.*;
+import org.aspectj.ajde.*;
+import java.io.*;
+
+/**
+ * @author Mik Kersten
+ */
+public class AspectJBuildManagerTest extends AjdeTestCase {
+
+ public AspectJBuildManagerTest(String name) {
+ super(name);
+ }
+
+ public static TestSuite suite() {
+ TestSuite result = new TestSuite();
+ result.addTestSuite(AspectJBuildManagerTest.class);
+ return result;
+ }
+
+ public void testInit() {
+ assertTrue("initialization", ideManager != null);
+ }
+
+ public void testCompileNonExistingConfig() {
+ assertTrue("compile of non-existing build config success", !testerBuildListener.getBuildSucceeded());
+ }
+
+ public void testCompileEmptyConfig() {
+ doSynchronousBuild("empty.lst");
+ assertTrue("compile of empty build config success", testerBuildListener.getBuildSucceeded());
+ }
+
+ public void testCompileSuccess() {
+ doSynchronousBuild("../examples/figures-coverage/all.lst");
+ assertTrue("compile success", testerBuildListener.getBuildSucceeded());
+ }
+
+ public void testCompileOutput() {
+ File classFile = new File(Ajde.getDefault().getProjectProperties().getOutputPath() + "/figures/Main.class");
+ if (classFile != null) {
+ assertTrue("class file generated", classFile.exists());
+ classFile.delete();
+ } else {
+ assertTrue("class file generated", false);
+ }
+ }
+
+ public void testSymbolFileGenerated() {
+ File symFile = createFile("../examples/figures-coverage/all.ajsym");
+ if (symFile != null) {
+ assertTrue("sym file generated", symFile.exists());
+ symFile.delete();
+ } else {
+ assertTrue("sym file generated", false);
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp("AspectJBuildManagerTest");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
diff --git a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java
new file mode 100644
index 000000000..5d9f78af8
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java
@@ -0,0 +1,157 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+
+import junit.framework.TestSuite;
+
+import org.aspectj.ajde.AjdeTestCase;
+import org.aspectj.ajde.BuildConfigManager;
+import org.aspectj.ajde.ui.BuildConfigModel;
+import org.aspectj.ajde.ui.internal.AjcBuildOptions;
+
+public class LstBuildConfigManagerTest extends AjdeTestCase {
+
+ private AjcBuildOptions buildOptions = null;
+ private BuildConfigManager buildConfigManager = new LstBuildConfigManager();
+ private LstBuildConfigFileUpdater fileUpdater = new LstBuildConfigFileUpdater();
+
+ public LstBuildConfigManagerTest(String name) {
+ super(name);
+ }
+
+ public static void main(String[] args) {
+ junit.swingui.TestRunner.run(LstBuildConfigManagerTest.class);
+ }
+
+ public static TestSuite suite() {
+ TestSuite result = new TestSuite();
+ result.addTestSuite(LstBuildConfigManagerTest.class);
+ return result;
+ }
+
+ public void testNonExistentConfigFile() throws IOException {
+ File file = createFile("mumbleDoesNotExist.lst");
+ assertTrue("valid non-existing file", !file.exists());
+ BuildConfigModel model = buildConfigManager.buildModel(file.getCanonicalPath());
+ System.err.println(model.getRoot().getChildren());
+ assertTrue("root: " + model.getRoot(), model.getRoot() != null);
+ }
+
+ public void testFileRelativePathSameDir() throws IOException {
+ File file = createFile("file-relPath-sameDir.lst");
+ System.err.println("> " + file.getCanonicalPath());
+ BuildConfigModel model = buildConfigManager.buildModel(file.getCanonicalPath());
+ System.err.println("> " + model.getRoot());
+ assertTrue("single file", true);
+ }
+
+// public void testWildcards() {
+// verifyFile(WILDCARDS_FILE, WILDCARDS_FILE_CONTENTS);
+// }
+//
+// public void testIncludes() {
+// verifyFile(INCLUDES_FILE, INCLUDES_FILE_CONTENTS);
+// }
+
+ private void verifyFile(String configFile, String fileContents) {
+ StringTokenizer st = new StringTokenizer(fileContents, ";");
+ BuildConfigModel model1 = buildConfigManager.buildModel(configFile);
+ File testFile = new File(configFile + "-test.lst");
+ model1.setSourceFile(testFile.getPath());
+ buildConfigManager.writeModel(model1);
+ List newList = fileUpdater.readConfigFile(testFile.getPath());
+ testFile.delete();
+
+ assertTrue("contents: " + newList, verifyLists(st, newList));
+ }
+
+ private boolean verifyLists(StringTokenizer st, List list) {
+ Iterator it = list.iterator();
+ while (st.hasMoreElements()) {
+ String s1 = (String)st.nextElement();
+ System.out.print("comparing: " + s1 + " <-> ");
+ String s2 = (String)it.next();
+ System.out.println(s2);
+ if (!s1.equals(s2)) return false;
+ }
+ if (it.hasNext()) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp("LstBuildConfigManagerTest");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ private static final String WILDCARDS_FILE = "C:/Dev/aspectj/tests/ajde/examples/figures-coverage/test-config.lst";
+ private static final String BAD_PATHS_FILE = "C:/Dev/aspectj/tests/ajde/examples/figures-coverage/test-error.lst";
+ private static final String INCLUDES_FILE = "C:/Dev/aspectj/tests/ajde/examples/spacewar/spacewar/demo.lst";
+
+ private static final String WILDCARDS_FILE_CONTENTS;
+ private static final String BAD_PATHS_FILE_CONTENTS;
+ private static final String INCLUDES_FILE_CONTENTS;
+
+ static {
+ WILDCARDS_FILE_CONTENTS =
+ "figures/Debug.java;" +
+ "figures/Figure.java;" +
+ "figures/FigureElement.java;" +
+ "figures/Main.java;" +
+ "figures/composites/Line.java;" +
+ "figures/composites/Square.java;" +
+ "figures/primitives/planar/Point.java;" +
+ "figures/primitives/solid/SolidPoint.java;";
+
+ BAD_PATHS_FILE_CONTENTS = WILDCARDS_FILE_CONTENTS;
+
+ INCLUDES_FILE_CONTENTS =
+ "../coordination/Condition.java;" +
+ "../coordination/CoordinationAction.java;" +
+ "../coordination/Coordinator.java;" +
+ "../coordination/Exclusion.java;" +
+ "../coordination/MethodState.java;" +
+ "../coordination/Mutex.java;" +
+ "../coordination/Selfex.java;" +
+ "../coordination/TimeoutException.java;" +
+ "Bullet.java;" +
+ "Display.java;" +
+ "Display1.java;" +
+ "Display2.java;" +
+ "EnergyPacket.java;" +
+ "EnergyPacketProducer.java;" +
+ "EnsureShipIsAlive.java;" +
+ "Game.java;" +
+ "GameSynchronization.java;" +
+ "Pilot.java;" +
+ "Player.java;" +
+ "Registry.java;" +
+ "RegistrySynchronization.java;" +
+ "Robot.java;" +
+ "SWFrame.java;" +
+ "Ship.java;" +
+ "SpaceObject.java;" +
+ "Timer.java;";
+ }
+}
+
diff --git a/ajde/testsrc/org/aspectj/ajde/ui/AjdeUiTests.java b/ajde/testsrc/org/aspectj/ajde/ui/AjdeUiTests.java
new file mode 100644
index 000000000..d717a09e1
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/ui/AjdeUiTests.java
@@ -0,0 +1,33 @@
+/* *******************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import junit.framework.*;
+
+public class AjdeUiTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AjdeUiTests.class.getName());
+ //$JUnit-BEGIN$
+ suite.addTestSuite(StructureModelUtilTest.class);
+ suite.addTestSuite(StructureSearchManagerTest.class);
+ suite.addTestSuite(StructureViewManagerTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+ public AjdeUiTests(String name) { super(name); }
+
+}
diff --git a/ajde/testsrc/org/aspectj/ajde/ui/NullIdeFileStructureView.java b/ajde/testsrc/org/aspectj/ajde/ui/NullIdeFileStructureView.java
new file mode 100644
index 000000000..5127387b7
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/ui/NullIdeFileStructureView.java
@@ -0,0 +1,39 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+
+/**
+ * @author Mik Kersten
+ */
+public class NullIdeFileStructureView extends FileStructureView {
+
+ private String sourceFilePath = null;
+
+ public NullIdeFileStructureView(StructureViewProperties viewProperties) {
+ super(viewProperties);
+ }
+ public String getSourceFile() {
+ return sourceFilePath;
+ }
+
+ public void setSourceFile(String sourceFile) {
+ this.sourceFilePath = sourceFile;
+ }
+
+ public void setRootNode(StructureViewNode rootNode) {
+ super.setRootNode(rootNode);
+ notifyViewUpdated();
+ }
+}
diff --git a/ajde/testsrc/org/aspectj/ajde/ui/NullIdeStructureViewRenderer.java b/ajde/testsrc/org/aspectj/ajde/ui/NullIdeStructureViewRenderer.java
new file mode 100644
index 000000000..d013e76d7
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/ui/NullIdeStructureViewRenderer.java
@@ -0,0 +1,44 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+
+/**
+ * @author Mik Kersten
+ */
+public class NullIdeStructureViewRenderer implements StructureViewRenderer {
+
+ private boolean hasBeenNotified = false;
+
+ public void updateView(StructureView structureView) {
+ hasBeenNotified = true;
+ }
+
+ public void setActiveNode(StructureViewNode node) {
+ // ignored
+ }
+
+ public void setActiveNode(StructureViewNode node, int lineOffset) {
+ // ignored
+ }
+
+ public boolean getHasBeenNotified() {
+ return hasBeenNotified;
+ }
+
+ public void setHasBeenNotified(boolean hasBeenNotified) {
+ this.hasBeenNotified = hasBeenNotified;
+ }
+}
+
diff --git a/ajde/testsrc/org/aspectj/ajde/ui/StructureModelUtilTest.java b/ajde/testsrc/org/aspectj/ajde/ui/StructureModelUtilTest.java
new file mode 100644
index 000000000..0a0ee544d
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/ui/StructureModelUtilTest.java
@@ -0,0 +1,78 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import java.util.*;
+
+import junit.framework.TestSuite;
+
+import org.aspectj.ajde.AjdeTestCase;
+import org.aspectj.asm.ProgramElementNode;
+
+/**
+ * @author Mik Kersten
+ */
+public class StructureModelUtilTest extends AjdeTestCase {
+
+ private final String CONFIG_FILE_PATH = "../examples/figures-coverage/all.lst";
+
+ public StructureModelUtilTest(String name) {
+ super(name);
+ }
+
+ public static void main(String[] args) {
+ junit.swingui.TestRunner.run(StructureModelUtilTest.class);
+ }
+
+ public static TestSuite suite() {
+ TestSuite result = new TestSuite();
+ result.addTestSuite(StructureModelUtilTest.class);
+ return result;
+ }
+
+ public void testPackageViewUtil() {
+ List packages = StructureModelUtil.getPackagesInModel();
+ assertTrue("packages list not null", packages != null);
+ System.err.println("> packages: " + packages);
+
+ ProgramElementNode packageNode = (ProgramElementNode)((Object[])packages.get(0))[0];
+ assertTrue("package node not null", packageNode != null);
+ System.err.println("> package node: " + packageNode);
+
+ List files = StructureModelUtil.getFilesInPackage(packageNode);
+ assertTrue("fle list not null", files != null);
+ System.err.println("> file list: " + files);
+
+ Map lineAdviceMap = StructureModelUtil.getLinesToAspectMap(
+ ((ProgramElementNode)files.get(0)).getSourceLocation().getSourceFile().getAbsolutePath()
+ );
+ assertTrue("line->advice map not null", lineAdviceMap != null);
+ System.err.println("> line->advice map: " + lineAdviceMap);
+
+ Set aspects = StructureModelUtil.getAspectsAffectingPackage(packageNode);
+ assertTrue("aspect list not null", aspects != null);
+ System.err.println("> aspects affecting package: " + aspects);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp("StructureModelUtilTest");
+ doSynchronousBuild(CONFIG_FILE_PATH);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
+
diff --git a/ajde/testsrc/org/aspectj/ajde/ui/StructureSearchManagerTest.java b/ajde/testsrc/org/aspectj/ajde/ui/StructureSearchManagerTest.java
new file mode 100644
index 000000000..418a4743b
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/ui/StructureSearchManagerTest.java
@@ -0,0 +1,80 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import java.util.List;
+
+import junit.framework.TestSuite;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.AjdeTestCase;
+import org.aspectj.asm.ProgramElementNode;
+
+/**
+ * @author Mik Kersten
+ */
+public class StructureSearchManagerTest extends AjdeTestCase {
+
+ private final String CONFIG_FILE_PATH = "../examples/figures-coverage/all.lst";
+
+ public StructureSearchManagerTest(String name) {
+ super(name);
+ }
+
+ public static void main(String[] args) {
+ junit.swingui.TestRunner.run(StructureSearchManagerTest.class);
+ }
+
+ public static TestSuite suite() {
+ TestSuite result = new TestSuite();
+ result.addTestSuite(StructureSearchManagerTest.class);
+ return result;
+ }
+
+ public void testFindPatternMatch() {
+ List matches = Ajde.getDefault().getStructureSearchManager().findMatches(
+ "Point",
+ null
+ );
+ System.err.println(matches);
+ assertTrue("non existent node", true);
+ }
+
+ public void testFindPatternAndKindMatch() {
+ List matches = Ajde.getDefault().getStructureSearchManager().findMatches(
+ "Point",
+ ProgramElementNode.Kind.CONSTRUCTOR
+ );
+ System.err.println(matches);
+ assertTrue("non existent node", true);
+ }
+
+ public void testFindNonExistent() {
+ List matches = Ajde.getDefault().getStructureSearchManager().findMatches(
+ "mumbleNodeDesNotExist",
+ null
+ );
+ assertTrue("non existent", matches.isEmpty());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp("StructureSearchManagerTest");
+ doSynchronousBuild(CONFIG_FILE_PATH);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
+
diff --git a/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java b/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java
new file mode 100644
index 000000000..e6b7f8ae9
--- /dev/null
+++ b/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java
@@ -0,0 +1,167 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.ui;
+
+import java.io.File;
+import java.util.Iterator;
+
+import junit.framework.TestSuite;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.AjdeTestCase;
+import org.aspectj.asm.StructureModelManager;
+import org.aspectj.asm.StructureNode;
+
+/**
+ * @author Mik Kersten
+ */
+public class StructureViewManagerTest extends AjdeTestCase {
+
+ private final String CONFIG_FILE_PATH = "../examples/figures-coverage/all.lst";
+ private final String CONFIG_FILE_PATH_2 = "../examples/inheritance/inheritance.lst";
+
+ private FileStructureView currentView;
+ private NullIdeStructureViewRenderer renderer = new NullIdeStructureViewRenderer();
+ private File testFile;
+ private StructureViewProperties properties;
+
+ public StructureViewManagerTest(String name) {
+ super(name);
+ }
+
+ public static void main(String[] args) {
+ junit.swingui.TestRunner.run(StructureViewManagerTest.class);
+ }
+
+ public static TestSuite suite() {
+ TestSuite result = new TestSuite();
+ result.addTestSuite(StructureViewManagerTest.class);
+ return result;
+ }
+
+ public void testModelExists() {
+ assertTrue(Ajde.getDefault().getStructureModelManager().getStructureModel() != null);
+ }
+
+ public void testNotificationAfterConfigFileChange() {
+ doSynchronousBuild(CONFIG_FILE_PATH_2);
+ renderer.setHasBeenNotified(false);
+ assertTrue("not yet notified", !renderer.getHasBeenNotified());
+ Ajde.getDefault().getConfigurationManager().setActiveConfigFile(CONFIG_FILE_PATH_2);
+ assertTrue("notified", renderer.getHasBeenNotified());
+ renderer.setHasBeenNotified(false);
+ Ajde.getDefault().getConfigurationManager().setActiveConfigFile("MumbleDoesNotExist.lst");
+ assertTrue("notified", renderer.getHasBeenNotified());
+ assertTrue(
+ "no structure",
+ currentView.getRootNode().getStructureNode().getChildren().get(0)
+ == StructureModelManager.INSTANCE.getStructureModel().NO_STRUCTURE
+ );
+ }
+
+ /**
+ * @todo this should be moved to a StructureModelManager test
+ */
+ public void testFreshStructureModelCreation() {
+ renderer.setHasBeenNotified(false);
+ String modelPath = genStructureModelExternFilePath(CONFIG_FILE_PATH);
+ createFile(modelPath).delete();
+ //System.err.println("> path: " + modelPath);
+
+ Ajde.getDefault().getStructureModelManager().readStructureModel(CONFIG_FILE_PATH);
+
+ assertTrue("notified", renderer.getHasBeenNotified());
+ //System.err.println(">>>>>> " + currentView.getRootNode().getStructureNode());
+ assertTrue(
+ "no structure",
+ currentView.getRootNode().getStructureNode().getChildren().get(0)
+ == StructureModelManager.INSTANCE.getStructureModel().NO_STRUCTURE
+ );
+ }
+
+ public void testModelIntegrity() {
+ doSynchronousBuild(CONFIG_FILE_PATH);
+ StructureNode modelRoot = Ajde.getDefault().getStructureModelManager().getStructureModel().getRoot();
+ assertTrue("root exists", modelRoot != null);
+
+ try {
+ testModelIntegrityHelper(modelRoot);
+ } catch (Exception e) {
+ assertTrue(e.toString(), false);
+ }
+ }
+
+ private void testModelIntegrityHelper(StructureNode node) throws Exception {
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ StructureNode child = (StructureNode)it.next();
+ if (node == child.getParent()) {
+ testModelIntegrityHelper(child);
+ } else {
+ throw new Exception("parent-child check failed for child: " + child.toString());
+ }
+ }
+ }
+
+ public void testNotificationAfterBuild() {
+ renderer.setHasBeenNotified(false);
+ doSynchronousBuild(CONFIG_FILE_PATH);
+ assertTrue("notified", renderer.getHasBeenNotified());
+ }
+
+ public void testViewCreationWithNullSourceFileAndProperties() {
+ currentView = Ajde.getDefault().getStructureViewManager().createViewForSourceFile(null, null);
+ assertTrue(
+ "no structure",
+ currentView.getRootNode().getStructureNode()
+ == StructureModelManager.INSTANCE.getStructureModel().NO_STRUCTURE
+ );
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp("StructureViewManagerTest");
+ doSynchronousBuild(CONFIG_FILE_PATH);
+
+ properties = Ajde.getDefault().getStructureViewManager().getDefaultViewProperties();
+ testFile = createFile("../examples/figures-coverage/figures/Figure.java");
+ currentView = Ajde.getDefault().getStructureViewManager().createViewForSourceFile(testFile.getAbsolutePath(), properties);
+ currentView.setRenderer(renderer);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+// public void testViewListenerRegistrations() {
+// System.err.println("> starting...");
+// Ajde.getDefault().getBuildManager().build("C:/Dev/aspectj/tests/ajde/examples/coverage-figures/src/AllFiles.lst");
+// while(!testerBuildListener.getBuildFinished()) {
+// try {
+// Thread.sleep(300);
+// } catch (InterruptedException ie) { }
+// }
+// List renderers = Ajde.getDefault().getStructureViewManager().getDefaultFileStructureView().getRenderers();
+// System.err.println("> renderers (1): " + renderers);
+//
+// testerBuildListener.reset();
+// Ajde.getDefault().getBuildManager().build("C:/Dev/aspectj/tests/ajde/examples/coverage-figures/src/AllFiles.lst");
+// while(!testerBuildListener.getBuildFinished()) {
+// try {
+// Thread.sleep(300);
+// } catch (InterruptedException ie) { }
+// }
+// System.err.println("> renderers (2): " + renderers);
+// assertTrue("checking renderers", true);
+// }
+}
+