+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="testsrc"/>
- <classpathentry kind="src" path="/ajde"/>
- <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="/taskdefs"/>
- <classpathentry kind="src" path="/ajdoc"/>
- <classpathentry kind="src" path="/loadtime"/>
- <classpathentry combineaccessrules="false" kind="src" path="/weaver5"/>
- <classpathentry combineaccessrules="false" kind="src" path="/ajde.core"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry combineaccessrules="false" kind="src" path="/org.aspectj.ajdt.core"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="testsrc"/>
+ <classpathentry kind="src" path="/ajde"/>
+ <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="/taskdefs"/>
+ <classpathentry kind="src" path="/ajdoc"/>
+ <classpathentry kind="src" path="/loadtime"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/weaver5"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/ajde.core"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/org.aspectj.ajdt.core"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
+++ /dev/null
-bin
-bintest
+++ /dev/null
-
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>ajbrowser</name>
- <comment></comment>
- <projects>
- <project>ajde</project>
- <project>ajdoc</project>
- <project>asm</project>
- <project>bridge</project>
- <project>taskdefs</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>
+++ /dev/null
-<?xml version="1.0"?>
-<!-- see ../build/*.html for explanation -->
-<project name="ajbrowser" default="test" basedir=".">
- <import file="${basedir}/../build/build.xml"/>
-</project>
-
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectj-parent</artifactId>
+ <version>1.9.3.BUILD-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>ajbrowser</artifactId>
+ <packaging>jar</packaging>
+ <name>ajbrowser</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>ajde</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>util</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>bridge</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>asm</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>taskdefs</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>ajdoc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>loadtime</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>ajde.core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>weaver</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>org.aspectj.ajdt.core</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * Helen Hawkins Converted to new interface (bug 148190)
+ * ******************************************************************/
+package org.aspectj.tools.ajbrowser;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JFrame;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.IconRegistry;
+import org.aspectj.ajde.internal.BuildConfigManager;
+import org.aspectj.ajde.ui.FileStructureView;
+import org.aspectj.ajde.ui.InvalidResourceException;
+import org.aspectj.ajde.ui.UserPreferencesAdapter;
+import org.aspectj.ajde.ui.internal.UserPreferencesStore;
+import org.aspectj.ajde.ui.javaoptions.JavaBuildOptions;
+import org.aspectj.ajde.ui.javaoptions.JavaCompilerWarningsOptionsPanel;
+import org.aspectj.ajde.ui.javaoptions.JavaComplianceOptionsPanel;
+import org.aspectj.ajde.ui.javaoptions.JavaDebugOptionsPanel;
+import org.aspectj.ajde.ui.javaoptions.JavaOtherOptionsPanel;
+import org.aspectj.ajde.ui.swing.MultiStructureViewPanel;
+import org.aspectj.asm.IHierarchy;
+import org.aspectj.asm.IHierarchyListener;
+import org.aspectj.tools.ajbrowser.core.BrowserBuildProgressMonitor;
+import org.aspectj.tools.ajbrowser.core.BrowserCompilerConfiguration;
+import org.aspectj.tools.ajbrowser.core.BrowserErrorHandler;
+import org.aspectj.tools.ajbrowser.ui.BasicEditor;
+import org.aspectj.tools.ajbrowser.ui.BrowserMessageHandler;
+import org.aspectj.tools.ajbrowser.ui.BrowserRuntimeProperties;
+import org.aspectj.tools.ajbrowser.ui.BrowserUIAdapter;
+import org.aspectj.tools.ajbrowser.ui.EditorManager;
+import org.aspectj.tools.ajbrowser.ui.swing.BrowserOptionsPanel;
+import org.aspectj.tools.ajbrowser.ui.swing.MessageHandlerPanel;
+import org.aspectj.tools.ajbrowser.ui.swing.TopFrame;
+import org.aspectj.util.FileUtil;
+
+/**
+ * IDE manager for standalone AJDE application.
+ *
+ * @author Mik Kersten
+ */
+public class BrowserManager {
+
+ public static final String TITLE = "AspectJ Browser";
+
+ private static final BrowserManager INSTANCE = new BrowserManager();
+ private EditorManager editorManager;
+ private UserPreferencesAdapter preferencesAdapter;
+ private static TopFrame topFrame = null;
+
+ private List<String> configFiles = new ArrayList<String>();
+ private JavaBuildOptions javaBuildOptions;
+
+ public static BrowserManager getDefault() {
+ return INSTANCE;
+ }
+
+ public final IHierarchyListener VIEW_LISTENER = new IHierarchyListener() {
+ public void elementsUpdated(IHierarchy model) {
+ FileStructureView fsv = Ajde.getDefault().getStructureViewManager().getDefaultFileView();
+ if (fsv != null) {
+ fsv.setSourceFile(BrowserManager.getDefault().getEditorManager().getCurrFile());
+ }
+ }
+ };
+
+ public void init(String[] configFilesArgs, boolean visible) {
+ try {
+ javaBuildOptions = new JavaBuildOptions();
+ preferencesAdapter = new UserPreferencesStore(true);
+ topFrame = new TopFrame();
+
+ BasicEditor ajdeEditor = new BasicEditor();
+ editorManager = new EditorManager(ajdeEditor);
+
+ BrowserMessageHandler messageHandler = new BrowserMessageHandler();
+
+ Ajde.getDefault().init(new BrowserCompilerConfiguration(preferencesAdapter), messageHandler,
+ new BrowserBuildProgressMonitor(messageHandler), ajdeEditor, new BrowserUIAdapter(), new IconRegistry(),
+ topFrame, new BrowserRuntimeProperties(preferencesAdapter), true);
+
+ setUpTopFrame(visible);
+ addOptionsPanels();
+
+ setUpConfigFiles(configFilesArgs);
+
+ Ajde.getDefault().getModel().addListener(VIEW_LISTENER);
+
+ } catch (Throwable t) {
+ t.printStackTrace();
+ BrowserErrorHandler.handleError("AJDE failed to initialize.", t);
+ }
+ }
+
+ /**
+ * Find and create the set of build configuration files
+ *
+ * @param configFilesArgs
+ */
+ private void setUpConfigFiles(String[] configFilesArgs) {
+ configFiles = getConfigFilesList(configFilesArgs);
+ if (configFiles.size() == 0) {
+ BrowserErrorHandler.handleWarning("No build configuration selected. "
+ + "Select a \".lst\" build configuration file in order to compile and navigate structure.");
+ } else {
+ Ajde.getDefault().getBuildConfigManager().setActiveConfigFile((String) configFiles.get(0));
+ }
+ }
+
+ /**
+ * Create the top frame of the browser
+ */
+ private void setUpTopFrame(boolean visible) {
+ MultiStructureViewPanel multiViewPanel = new MultiStructureViewPanel(Ajde.getDefault().getViewManager().getBrowserPanel(),
+ Ajde.getDefault().getFileStructurePanel());
+
+ topFrame.init(multiViewPanel, new MessageHandlerPanel(), editorManager.getEditorPanel());
+
+ if (visible)
+ topFrame.setVisible(true);
+ }
+
+ public void resetEditorFrame() {
+ topFrame.resetSourceEditorPanel();
+ }
+
+ public void resetEditor() {
+ BrowserManager
+ .getDefault()
+ .getRootFrame()
+ .setSize(BrowserManager.getDefault().getRootFrame().getWidth() + 1,
+ BrowserManager.getDefault().getRootFrame().getHeight() + 1);
+ BrowserManager.getDefault().getRootFrame().doLayout();
+ BrowserManager.getDefault().getRootFrame().repaint();
+ }
+
+ public void setStatusInformation(String text) {
+ topFrame.statusText_label.setText(text);
+ }
+
+ public void setEditorStatusText(String text) {
+ topFrame.setTitle(BrowserManager.TITLE + " - " + text);
+ }
+
+ public void saveAll() {
+ editorManager.saveContents();
+ }
+
+ public JFrame getRootFrame() {
+ return topFrame;
+ }
+
+ public void openFile(String filePath) {
+ try {
+ if (filePath.endsWith(".lst")) {
+ Ajde.getDefault().getBuildConfigEditor().openFile(filePath);
+ topFrame.setEditorPanel(Ajde.getDefault().getBuildConfigEditor());
+ } else if (FileUtil.hasSourceSuffix(filePath)) {
+ editorManager.showSourceLine(filePath, 0, false);
+ } else {
+ BrowserErrorHandler.handleError("File: " + filePath
+ + " could not be opened because the extension was not recoginzed.");
+ }
+ } catch (IOException ioe) {
+ BrowserErrorHandler.handleError("Could not open file: " + filePath, ioe);
+ } catch (InvalidResourceException ire) {
+ BrowserErrorHandler.handleError("Invalid file: " + filePath, ire);
+ }
+ }
+
+ private List<String> getConfigFilesList(String[] configFiles) {
+ List<String> configs = new ArrayList<String>();
+ for (int i = 0; i < configFiles.length; i++) {
+ if (configFiles[i].endsWith(BuildConfigManager.CONFIG_FILE_SUFFIX)) {
+ configs.add(configFiles[i]);
+ }
+ }
+ return configs;
+ }
+
+ /**
+ * Add the different options panels to the main options frame (adds panels for java compliance, compiler warnings, debug
+ * warnings, other java options and options specific to ajbrowser)
+ */
+ private void addOptionsPanels() {
+ Ajde.getDefault().getOptionsFrame().addOptionsPanel(new JavaComplianceOptionsPanel(javaBuildOptions));
+ Ajde.getDefault().getOptionsFrame().addOptionsPanel(new JavaCompilerWarningsOptionsPanel(javaBuildOptions));
+ Ajde.getDefault().getOptionsFrame().addOptionsPanel(new JavaOtherOptionsPanel(javaBuildOptions));
+ Ajde.getDefault().getOptionsFrame().addOptionsPanel(new JavaDebugOptionsPanel(javaBuildOptions));
+ Ajde.getDefault().getOptionsFrame().addOptionsPanel(new BrowserOptionsPanel());
+ }
+
+ /**
+ * @return the EditorManager
+ */
+ public EditorManager getEditorManager() {
+ return editorManager;
+ }
+
+ /**
+ * @return the UserPreferencesAdapter
+ */
+ public UserPreferencesAdapter getPreferencesAdapter() {
+ return preferencesAdapter;
+ }
+
+ /**
+ * @return the JavaBuildOptions instance being used
+ */
+ public JavaBuildOptions getJavaBuildOptions() {
+ return javaBuildOptions;
+ }
+
+}
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+package org.aspectj.tools.ajbrowser;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * Run ajbrowser if 0+ .lst file arguments, and ajc otherwise.
+ */
+public class Main {
+
+ /**
+ * Run ajbrowser if args contains only .lst files and ajc otherwise.
+ *
+ * @param args the String[] of args to interpret
+ */
+ public static void main(String[] args) {
+ if (!compilerMain(args)) {
+ BrowserManager.getDefault().init(args, true);
+ }
+ }
+
+ /**
+ * Invoke the compiler if there are arguments and some are not .lst files.
+ *
+ * @return false if compiler was not invoked and the browser main should be
+ */
+ static boolean compilerMain(String[] args) {
+ if ((null == args) || (0 == args.length)) {
+ return false;
+ }
+ int numConfigFiles = 0;
+ for (int i = 0; i < args.length; i++) {
+ if ((null != args[i]) && args[i].endsWith(".lst")) {
+ numConfigFiles++;
+ }
+ }
+ if (numConfigFiles != args.length) {
+ try {
+ Class<?> ajc = Class.forName("org.aspectj.tools.ajc.Main");
+ Method main = ajc.getMethod("main", new Class[] { String[].class });
+ main.invoke(null, new Object[] { args });
+ return true;
+ } catch (ClassNotFoundException e) {
+ report(e);
+ } catch (NoSuchMethodException e) {
+ report(e);
+ } catch (IllegalAccessException e) {
+ report(e);
+ } catch (InvocationTargetException e) {
+ report(e.getTargetException());
+ }
+ }
+ return false;
+ }
+
+ private static void report(Throwable t) {
+ t.printStackTrace(System.err);
+ }
+}
--- /dev/null
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.tools.ajbrowser.core;
+
+import javax.swing.JDialog;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.core.IBuildProgressMonitor;
+import org.aspectj.ajde.ui.swing.BuildProgressPanel;
+import org.aspectj.tools.ajbrowser.BrowserManager;
+import org.aspectj.tools.ajbrowser.ui.BrowserMessageHandler;
+import org.aspectj.tools.ajbrowser.ui.swing.TopFrame;
+
+/**
+ * Build progress monitor that shows the progress in a dialog containing
+ * a JProgressBar. Also updates the progress bar at the bottom of AjBrowser
+ * with the build progress information.
+ */
+public class BrowserBuildProgressMonitor extends Thread implements IBuildProgressMonitor {
+
+ public static final String PROGRESS_HEADING = "AspectJ Build";
+
+ private BuildProgressPanel progressDialog = null;
+ private JDialog dialog = null;
+ private TopFrame topFrame;
+
+ private BrowserMessageHandler handler;
+
+ public BrowserBuildProgressMonitor(BrowserMessageHandler handler) {
+ this.handler = handler;
+ topFrame = (TopFrame) BrowserManager.getDefault().getRootFrame();
+ dialog = new JDialog(topFrame, PROGRESS_HEADING, false);
+ progressDialog = new BuildProgressPanel();
+ dialog.setContentPane(progressDialog);
+ dialog.setSize(550, 120);
+ try {
+ dialog.setLocationRelativeTo(topFrame);
+ } catch (NoSuchMethodError nsme) {
+ // running on 1.3
+ }
+ }
+
+ public void finish(boolean wasFullBuild) {
+ Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("build finished...");
+ progressDialog.finish();
+ dialog.dispose();
+ if (handler.getMessages().isEmpty()) {
+ topFrame.hideMessagesPanel(handler);
+ } else {
+ topFrame.showMessagesPanel(handler);
+ }
+ }
+
+ public boolean isCancelRequested() {
+ boolean isCancel = progressDialog.isCancelRequested();
+ if (isCancel) {
+ Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("Compile aborted");
+ }
+ return isCancel;
+ }
+
+ public void setProgress(double percentDone) {
+ progressDialog.setProgressBarVal((int) (percentDone*progressDialog.getProgressBarMax()));
+ }
+
+ public void setProgressText(String text) {
+ Ajde.getDefault().getIdeUIAdapter().displayStatusInformation(text);
+ progressDialog.setProgressText(text);
+ }
+
+ public void begin() {
+ Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("starting build...");
+ handler.reset();
+ progressDialog.setProgressBarVal(0);
+ progressDialog.setProgressText("starting build...");
+ dialog.setLocationRelativeTo(Ajde.getDefault().getRootFrame());
+ dialog.setVisible(true);
+ }
+
+}
--- /dev/null
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.tools.ajbrowser.core;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.aspectj.ajde.core.ICompilerConfiguration;
+import org.aspectj.ajde.core.IOutputLocationManager;
+import org.aspectj.ajde.ui.UserPreferencesAdapter;
+import org.aspectj.tools.ajbrowser.BrowserManager;
+
+/**
+ * AjBrowser implementation of ICompilerConfiguration which returns something for getClasspath(), getJavaOptionsMap(),
+ * getNonStandardOptions() and getOutputLocationManager() and null for everything else. The reason it doesn't return anything for
+ * getProjectSourceFiles() is that it uses .lst files to record what is needed to build (via BuildConfigManager).
+ */
+public class BrowserCompilerConfiguration implements ICompilerConfiguration {
+
+ private UserPreferencesAdapter preferencesAdapter;
+ private IOutputLocationManager locationManager;
+
+ public BrowserCompilerConfiguration(UserPreferencesAdapter preferencesAdapter) {
+ this.preferencesAdapter = preferencesAdapter;
+ }
+
+ public String getClasspath() {
+ StringBuffer classpath = new StringBuffer();
+ String userPath = preferencesAdapter.getProjectPreference(PreferenceStoreConstants.BUILD_CLASSPATH);
+ if (userPath != null && userPath.trim().length() != 0) {
+ classpath.append(userPath);
+ }
+ List<File> outputDirs = getOutputLocationManager().getAllOutputLocations();
+ for (Iterator<File> iterator = outputDirs.iterator(); iterator.hasNext();) {
+ File dir = (File) iterator.next();
+ classpath.append(File.pathSeparator + dir.getAbsolutePath() + File.pathSeparator);
+ }
+ classpath.append(System.getProperty("java.class.path", "."));
+ // System.out.println("classpath: " + classpath.toString());
+ return classpath.toString();
+ }
+
+ public Map<String,String> getJavaOptionsMap() {
+ return BrowserManager.getDefault().getJavaBuildOptions().getJavaBuildOptionsMap();
+ }
+
+ public String getNonStandardOptions() {
+ return preferencesAdapter.getProjectPreference(PreferenceStoreConstants.NONSTANDARD_OPTIONS);
+ }
+
+ public IOutputLocationManager getOutputLocationManager() {
+ if (locationManager == null) {
+ locationManager = new BrowserOutputLocationManager(preferencesAdapter);
+ }
+ return locationManager;
+ }
+
+ public List<String> getProjectSourceFiles() {
+ // unimplemented in AjBrowser (uses BuildConfigManager instead)
+ return null;
+ }
+
+ public List getProjectSourceFilesChanged() {
+ // unimplemented in AjBrowser (uses BuildConfigManager instead)
+ return null;
+ }
+
+ public Map getSourcePathResources() {
+ // unimplemented in AjBrowser
+ return null;
+ }
+
+ public Set<File> getAspectPath() {
+ // unimplemented in AjBrowser
+ return null;
+ }
+
+ public Set<File> getInpath() {
+ // unimplemented in AjBrowser
+ return null;
+ }
+
+ public String getOutJar() {
+ // unimplemented in AjBrowser
+ return null;
+ }
+
+ public int getConfigurationChanges() {
+ return ICompilerConfiguration.EVERYTHING;
+ }
+
+ public void configurationRead() {
+ }
+
+ public List getClasspathElementsWithModifiedContents() {
+ return null;
+ }
+
+ public List<String> getProjectXmlConfigFiles() {
+ return Collections.emptyList();
+ }
+
+ public String getProjectEncoding() {
+ return null;
+ }
+
+ public String getProcessor() {
+ return null;
+ }
+
+ public String getProcessorPath() {
+ return null;
+ }
+
+ @Override
+ public String getModulepath() {
+ return null;
+ }
+
+ @Override
+ public String getModuleSourcepath() {
+ return null;
+ }
+
+}
--- /dev/null
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.tools.ajbrowser.core;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import javax.swing.JOptionPane;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.ui.swing.ErrorDialog;
+import org.aspectj.tools.ajbrowser.BrowserManager;
+
+/**
+ * Error handler used by AjBrowser. Handles errors and warnings by
+ * producing an error/warning dialog.
+ */
+public class BrowserErrorHandler {
+
+ public static void handleWarning(String message) {
+ JOptionPane.showMessageDialog(BrowserManager.getDefault()
+ .getRootFrame(), message, "AJBrowser Warning",
+ JOptionPane.WARNING_MESSAGE);
+ }
+
+ public static void handleError(String errorMessage) {
+ handleError(errorMessage, null);
+ }
+
+ public static void handleError(String message, Throwable t) {
+ String stack = getStackTraceAsString(t);
+ ErrorDialog errorDialog = new ErrorDialog(Ajde.getDefault()
+ .getRootFrame(), "AJBrowser Error", t, message, stack);
+ errorDialog.setVisible(true);
+ }
+
+ private static String getStackTraceAsString(Throwable t) {
+ StringWriter stringWriter = new StringWriter();
+ if (t != null) {
+ t.printStackTrace(new PrintWriter(stringWriter));
+ return stringWriter.getBuffer().toString();
+ }
+ return "<no stack trace available>";
+ }
+
+}
--- /dev/null
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.tools.ajbrowser.core;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.aspectj.ajde.core.IOutputLocationManager;
+import org.aspectj.ajde.ui.UserPreferencesAdapter;
+
+/**
+ * IOutputLocationManager which returns the same output location for all files and resources.
+ */
+public class BrowserOutputLocationManager implements IOutputLocationManager {
+
+ private UserPreferencesAdapter preferencesAdapter;
+
+ public BrowserOutputLocationManager(UserPreferencesAdapter preferencesAdapter) {
+ this.preferencesAdapter = preferencesAdapter;
+ }
+
+ public File getOutputLocationForClass(File compilationUnit) {
+ return new File(getCommonOutputDir());
+ }
+
+ public File getOutputLocationForResource(File resource) {
+ return new File(getCommonOutputDir());
+ }
+
+ private String getCommonOutputDir() {
+ String outputPath = preferencesAdapter.getProjectPreference(PreferenceStoreConstants.BUILD_OUTPUTPATH);
+ if (outputPath == null) {
+ return ".";
+ }
+ return outputPath;
+ }
+
+ public List<File> getAllOutputLocations() {
+ List<File> outputDirs = new ArrayList<File>();
+ outputDirs.add(new File(getCommonOutputDir()));
+ return outputDirs;
+ }
+
+ public File getDefaultOutputLocation() {
+ return new File(getCommonOutputDir());
+ }
+
+ public String getSourceFolderForFile(File sourceFile) {
+ return null;
+ }
+
+ public void reportFileWrite(String outputfile, int filetype) {
+ }
+
+ public void reportFileRemove(String outputfile, int filetype) {
+ }
+
+ public int discoverChangesSince(File dir, long buildtime) {
+ return 0;
+ }
+
+ public Map<File, String> getInpathMap() {
+ return Collections.emptyMap();
+ }
+
+}
--- /dev/null
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.tools.ajbrowser.core;
+
+/**
+ * Constants used by the preference store
+ */
+public class PreferenceStoreConstants {
+
+ public static final String BUILD_CLASSPATH = "build.classpath";
+ public static final String RUNTIME_MAINCLASS = "runtime.mainClass";
+ public static final String BUILD_OUTPUTPATH = "build.outputpath";
+ public static final String JAVA_CLASSPATH = "java.class.path";
+ public static final String NONSTANDARD_OPTIONS = "ajc.nonStandardOptions";
+
+}
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * Helen Hawkins Converted to new interface (bug 148190)
+ * ******************************************************************/
+
+
+package org.aspectj.tools.ajbrowser.ui;
+
+import java.awt.BorderLayout;
+import java.awt.Font;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+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;
+import org.aspectj.tools.ajbrowser.BrowserManager;
+import org.aspectj.tools.ajbrowser.core.BrowserErrorHandler;
+
+/**
+ * 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) {
+ BrowserErrorHandler.handleError("Could not initialize GUI.", e);
+ }
+ }
+
+ public String getCurrFile() {
+ return filePath;
+ }
+
+ public void showSourceLine(ISourceLocation sourceLocation, boolean highlight) {
+ try {
+ showSourceLine(sourceLocation.getSourceFile().getAbsolutePath(), sourceLocation.getLine(), highlight);
+ } catch (NullPointerException npe) {
+ Ajde.getDefault().getIdeUIAdapter().displayStatusInformation(" no corresponding source line to seek to");
+ }
+ }
+
+ 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();
+
+ 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) {
+ BrowserErrorHandler.handleError("Could not highlight location.", ble);
+ }
+ BrowserManager.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.equals(NO_FILE) && !filePath.equals("") && !editorPane.getText().equals("")) {
+ BufferedWriter writer = new BufferedWriter(new FileWriter(filePath));
+ writer.write(editorPane.getText());
+ writer.close();
+ }
+ }
+
+ 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 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();
+ }
+ reader.close();
+ 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);
+ }
+}
--- /dev/null
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.tools.ajbrowser.ui;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.IUIBuildMessageHandler;
+import org.aspectj.ajde.ui.swing.ErrorDialog;
+import org.aspectj.bridge.AbortException;
+import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.IMessage.Kind;
+
+/**
+ * MessageHandler used by AjBrowser that displays ERROR messages with exceptions and ABORT messages in an error dialog. Other
+ * messages are displayed by the MessageHandlerPanel. By default INFO and WEAVEINFO messages are ignored.
+ */
+public class BrowserMessageHandler implements IUIBuildMessageHandler {
+
+ private List<IMessage.Kind> ignoring;
+ private List<IMessage> messages;
+
+ public BrowserMessageHandler() {
+ ignoring = new ArrayList<IMessage.Kind>();
+ messages = new ArrayList<IMessage>();
+ ignore(IMessage.INFO);
+ ignore(IMessage.WEAVEINFO);
+ }
+
+ public boolean handleMessage(IMessage message) throws AbortException {
+ Kind messageKind = message.getKind();
+ if (isIgnoring(messageKind)) {
+ return true;
+ }
+ if (messageKind.equals(IMessage.ABORT) || (message.getThrown() != null)) {
+ String stack = getStackTraceAsString(message.getThrown());
+ ErrorDialog errorDialog = new ErrorDialog(Ajde.getDefault().getRootFrame(), "AJDE Error", message.getThrown(),
+ message.getMessage(), stack);
+ errorDialog.setVisible(true);
+ return true;
+ }
+ messages.add(message);
+ return true;
+ }
+
+ public void dontIgnore(Kind kind) {
+ if (null != kind) {
+ ignoring.remove(kind);
+ }
+ }
+
+ public boolean isIgnoring(Kind kind) {
+ return ((null != kind) && (ignoring.contains(kind)));
+ }
+
+ public void ignore(Kind kind) {
+ if ((null != kind) && (!ignoring.contains(kind))) {
+ ignoring.add(kind);
+ }
+ }
+
+ public List<IMessage> getMessages() {
+ return messages;
+ }
+
+ private String getStackTraceAsString(Throwable t) {
+ StringWriter stringWriter = new StringWriter();
+ if (t != null) {
+ t.printStackTrace(new PrintWriter(stringWriter));
+ return stringWriter.getBuffer().toString();
+ }
+ return "<no stack trace available>";
+ }
+
+ public void reset() {
+ messages.clear();
+ }
+
+}
--- /dev/null
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.tools.ajbrowser.ui;
+
+import org.aspectj.ajde.IRuntimeProperties;
+import org.aspectj.ajde.ui.UserPreferencesAdapter;
+import org.aspectj.tools.ajbrowser.core.PreferenceStoreConstants;
+
+/**
+ * AjBrowser implementation of IRuntimeProperties which uses the PreferenceStoreConstant
+ * to decide which class the user has specified contains the main method
+ */
+public class BrowserRuntimeProperties implements IRuntimeProperties {
+
+ private UserPreferencesAdapter preferencesAdapter;
+
+ public BrowserRuntimeProperties(UserPreferencesAdapter preferencesAdapter) {
+ this.preferencesAdapter = preferencesAdapter;
+ }
+
+ public String getClassToExecute() {
+ return preferencesAdapter.getProjectPreference(PreferenceStoreConstants.RUNTIME_MAINCLASS);
+ }
+
+ public String getExecutionArgs() {
+ // not implemented by ajbrowser
+ return null;
+ }
+
+}
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.tools.ajbrowser.ui;
+
+import org.aspectj.ajde.IdeUIAdapter;
+import org.aspectj.tools.ajbrowser.BrowserManager;
+
+/**
+ * AjBrowser implementation if IdeUIAdapter which displays the provided
+ * information in the status bar at the bottom of the AjBrowser GUI.
+ */
+public class BrowserUIAdapter implements IdeUIAdapter {
+
+ public void displayStatusInformation(String message) {
+ BrowserManager.getDefault().setStatusInformation(message);
+ }
+}
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+package org.aspectj.tools.ajbrowser.ui;
+
+import java.awt.BorderLayout;
+import java.awt.event.KeyEvent;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Vector;
+
+import javax.swing.Box;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+import org.aspectj.ajde.EditorAdapter;
+import org.aspectj.ajde.EditorListener;
+import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.tools.ajbrowser.core.BrowserErrorHandler;
+
+/**
+ * Responsible for controlling the editor.
+ *
+ * @todo remove coupling to <CODE>BasicEditor</CODE>
+ * @author Mik Kersten
+ */
+public class EditorManager {
+
+ /** @return true if input modifiers have shift down */
+ public static boolean isShiftDown(int modifiers) {
+ return (0 != (modifiers & KeyEvent.SHIFT_MASK));
+ }
+
+ private EditorAdapter editor = null;
+ private BasicEditor basicEditor = null;
+ private ArrayList<EditorListener> editorListeners = new ArrayList<EditorListener>();
+ private Vector<EditorAdapter> editors = new Vector<EditorAdapter>();
+ 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 (EditorListener editorListener : editorListeners) {
+ editorListener.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) {
+ BrowserErrorHandler.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 (EditorAdapter editorAdapter : editors) {
+ editorAdapter.saveContents();
+ }
+ } catch (IOException ioe) {
+ BrowserErrorHandler.handleError("Editor could not save the current file.", ioe);
+ }
+ }
+
+ public JPanel getEditorPanel() {
+ if (editor_panel != null) {
+ return editor_panel;
+ } else {
+ return basicEditor.getPanel();
+ }
+ }
+}
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * Helen Hawkins Converted to new interface (bug 148190)
+ * ******************************************************************/
+
+
+package org.aspectj.tools.ajbrowser.ui.swing;
+
+import java.io.*;
+import javax.swing.*;
+import java.awt.*;
+import javax.swing.border.*;
+import org.aspectj.ajde.ui.swing.*;
+import org.aspectj.tools.ajbrowser.BrowserManager;
+import org.aspectj.tools.ajbrowser.core.PreferenceStoreConstants;
+
+/**
+ * Panel the displays both ajc and runtime options
+ *
+ * @author Mik Kersten
+ */
+public class BrowserOptionsPanel extends OptionsPanel {
+
+ private static final long serialVersionUID = 4491319302490183151L;
+ private JPanel runOptions_panel = new JPanel();
+ private JPanel build_panel = new JPanel();
+ private FlowLayout flowLayout1 = new FlowLayout();
+ private JTextField classToRun_field = new JTextField();
+ private JLabel jLabel4 = new JLabel();
+ private BorderLayout borderLayout4 = new BorderLayout();
+ private JPanel buildPaths_panel = new JPanel();
+ private Box compileOptions_box2 = Box.createVerticalBox();
+ private JTextField classpath_field = new JTextField();
+ private JTextField outputPath_field = new JTextField();
+ private JTextField nonStandardOptions_field = new JTextField();
+ private JLabel jLabel16 = new JLabel();
+ private JLabel jLabel15 = new JLabel();
+ private JLabel nonStandardOptions_label = new JLabel();
+ private Box compileOptions_box3 = Box.createVerticalBox();
+ private BorderLayout borderLayout1 = new BorderLayout();
+ private Border border1;
+ private TitledBorder titledBorder1;
+ private Border border2;
+ private Border border3;
+ private TitledBorder titledBorder2;
+ private Border border4;
+
+ public BrowserOptionsPanel() {
+ try {
+ jbInit();
+ this.setName("AJBrowser Options");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void loadOptions() throws IOException {
+ outputPath_field.setText(
+ BrowserManager.getDefault().getPreferencesAdapter().
+ getProjectPreference(PreferenceStoreConstants.BUILD_OUTPUTPATH)
+ );
+ nonStandardOptions_field.setText(
+ BrowserManager.getDefault().getPreferencesAdapter().
+ getProjectPreference(PreferenceStoreConstants.NONSTANDARD_OPTIONS)
+ );
+ classpath_field.setText(
+ BrowserManager.getDefault().getPreferencesAdapter().
+ getProjectPreference(PreferenceStoreConstants.BUILD_CLASSPATH)
+ );
+ classToRun_field.setText(
+ BrowserManager.getDefault().getPreferencesAdapter().
+ getProjectPreference(PreferenceStoreConstants.RUNTIME_MAINCLASS)
+ );
+ }
+
+ public void saveOptions() throws IOException {
+ BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference(
+ PreferenceStoreConstants.BUILD_OUTPUTPATH, outputPath_field.getText());
+ BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference(
+ PreferenceStoreConstants.NONSTANDARD_OPTIONS, nonStandardOptions_field.getText());
+ BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference(
+ PreferenceStoreConstants.BUILD_CLASSPATH, classpath_field.getText());
+ BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference(
+ PreferenceStoreConstants.RUNTIME_MAINCLASS, classToRun_field.getText());
+ }
+
+ private void jbInit() throws Exception {
+ border1 =
+ BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158));
+ titledBorder1 = new TitledBorder(border1, "Ajc Options");
+ border2 =
+ BorderFactory.createCompoundBorder(
+ titledBorder1,
+ BorderFactory.createEmptyBorder(5, 5, 5, 5));
+ border3 =
+ BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158));
+ titledBorder2 = new TitledBorder(border3, "Run Options");
+ border4 =
+ BorderFactory.createCompoundBorder(
+ titledBorder2,
+ BorderFactory.createEmptyBorder(5, 5, 5, 5));
+ this.setLayout(borderLayout1);
+ build_panel.setLayout(borderLayout4);
+ classToRun_field.setFont(new java.awt.Font("SansSerif", 0, 11));
+ classToRun_field.setMinimumSize(new Dimension(200, 21));
+ classToRun_field.setPreferredSize(new Dimension(250, 21));
+ jLabel4.setFont(new java.awt.Font("Dialog", 0, 11));
+ jLabel4.setText("Fully qualified name for main class to run: ");
+ buildPaths_panel.setLayout(flowLayout1);
+ runOptions_panel.setBorder(border4);
+ buildPaths_panel.setBorder(border2);
+ classpath_field.setFont(new java.awt.Font("SansSerif", 0, 11));
+ classpath_field.setMinimumSize(new Dimension(100, 21));
+ classpath_field.setPreferredSize(new Dimension(150, 21));
+ outputPath_field.setPreferredSize(new Dimension(225, 21));
+ outputPath_field.setMinimumSize(new Dimension(100, 21));
+ outputPath_field.setFont(new java.awt.Font("SansSerif", 0, 11));
+ nonStandardOptions_field.setPreferredSize(new Dimension(225, 21));
+ nonStandardOptions_field.setMinimumSize(new Dimension(100, 21));
+ nonStandardOptions_field.setFont(new java.awt.Font("SansSerif", 0, 11));
+ jLabel16.setText("Classpath (defaults to current directory): ");
+ jLabel16.setPreferredSize(new Dimension(200, 25));
+ jLabel16.setMaximumSize(new Dimension(400, 25));
+ jLabel16.setFont(new java.awt.Font("Dialog", 0, 11));
+ jLabel15.setMaximumSize(new Dimension(400, 25));
+ jLabel15.setFont(new java.awt.Font("Dialog", 0, 11));
+ jLabel15.setPreferredSize(new Dimension(230, 25));
+ jLabel15.setText("Output path (defaults to current directory): ");
+ nonStandardOptions_label.setMaximumSize(new Dimension(400, 25));
+ nonStandardOptions_label.setFont(new java.awt.Font("Dialog", 0, 11));
+ nonStandardOptions_label.setPreferredSize(new Dimension(230, 25));
+ nonStandardOptions_label.setText("Non-standard compiler options: ");
+ titledBorder1.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ titledBorder2.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ runOptions_panel.add(jLabel4, null);
+ runOptions_panel.add(classToRun_field, null);
+ build_panel.add(buildPaths_panel, BorderLayout.CENTER);
+ build_panel.add(runOptions_panel, BorderLayout.SOUTH);
+ compileOptions_box2.add(outputPath_field, null);
+ compileOptions_box2.add(nonStandardOptions_field, null);
+ compileOptions_box2.add(classpath_field, null);
+ compileOptions_box3.add(jLabel15, null);
+ compileOptions_box3.add(nonStandardOptions_label, null);
+ compileOptions_box3.add(jLabel16, null);
+ buildPaths_panel.add(compileOptions_box3, null);
+ buildPaths_panel.add(compileOptions_box2, null);
+ this.add(build_panel, BorderLayout.NORTH);
+ }
+
+}
--- /dev/null
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.tools.ajbrowser.ui.swing;
+
+import java.awt.BorderLayout;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.swing.DefaultListModel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.ui.swing.CompilerMessagesCellRenderer;
+import org.aspectj.bridge.IMessage;
+import org.aspectj.tools.ajbrowser.ui.BrowserMessageHandler;
+
+/**
+ * Panel used to display messages from the message handler
+ */
+public class MessageHandlerPanel extends JPanel {
+
+ private static final long serialVersionUID = -2251912345065588977L;
+ private JScrollPane jScrollPane1 = new JScrollPane();
+ private JList list;
+ private DefaultListModel listModel;
+ private BorderLayout borderLayout1 = new BorderLayout();
+
+ public void showMessageHandlerPanel(BrowserMessageHandler handler, boolean showPanel) {
+ if (!showPanel) {
+ setVisible(false);
+ return;
+ }
+ createList(handler.getMessages());
+
+ try {
+ jbInit();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ list.setModel(listModel);
+
+ MouseListener mouseListener = new MouseAdapter() {
+ public void mouseClicked(MouseEvent e) {
+ if (e.getClickCount() >= 1) {
+ int index = list.locationToIndex(e.getPoint());
+ if (listModel.getSize() >= index && index != -1) {
+ IMessage message = (IMessage) listModel
+ .getElementAt(index);
+ Ajde.getDefault().getEditorAdapter().showSourceLine(
+ message.getSourceLocation(), true);
+ }
+ }
+ }
+ };
+ list.addMouseListener(mouseListener);
+ list.setCellRenderer(new CompilerMessagesCellRenderer());
+ setVisible(showPanel);
+ }
+
+ private void createList(List messages) {
+ list = new JList();
+ listModel = new DefaultListModel();
+ for (Iterator iterator = messages.iterator(); iterator.hasNext();) {
+ listModel.addElement(iterator.next());
+ }
+ }
+
+ private void jbInit() throws Exception {
+ this.setLayout(borderLayout1);
+ this.add(jScrollPane1, BorderLayout.CENTER);
+ jScrollPane1.getViewport().add(list, null);
+ }
+
+}
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+package org.aspectj.tools.ajbrowser.ui.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowEvent;
+import java.io.File;
+
+import javax.swing.AbstractAction;
+import javax.swing.BorderFactory;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JSplitPane;
+import javax.swing.JToolBar;
+import javax.swing.KeyStroke;
+import javax.swing.border.Border;
+import javax.swing.filechooser.FileFilter;
+
+import org.aspectj.ajde.Ajde;
+import org.aspectj.ajde.ui.swing.AJButtonMenuCombo;
+import org.aspectj.ajde.ui.swing.BuildConfigPopupMenu;
+import org.aspectj.ajde.ui.swing.MultiStructureViewPanel;
+import org.aspectj.asm.IProgramElement;
+import org.aspectj.tools.ajbrowser.BrowserManager;
+import org.aspectj.tools.ajbrowser.ui.BrowserMessageHandler;
+import org.aspectj.tools.ajbrowser.ui.EditorManager;
+
+/**
+ * UI for standalone operation.
+ *
+ * @author Mik Kersten
+ */
+public class TopFrame extends JFrame {
+
+ private static final long serialVersionUID = 1007473581156451702L;
+
+ private static final File CURRENT_DIR = new File(".");
+
+ public JLabel statusText_label = new JLabel();
+
+ private JPanel editor_panel = null;
+ private JPanel sourceEditor_panel = null;
+
+ private JMenuBar menuBar = new JMenuBar();
+ private JMenu jMenu1 = new JMenu();
+ private JMenu jMenu2 = new JMenu();
+ private JMenuItem projectBuild_menuItem = new JMenuItem();
+ private FlowLayout left_flowLayout = new FlowLayout();
+ private JMenuItem jMenuItem1 = new JMenuItem();
+ private JMenuItem exit_menuItem = new JMenuItem();
+ private JSplitPane top_splitPane = new JSplitPane();
+ private BorderLayout borderLayout3 = new BorderLayout();
+ private JMenuItem projectRun_menuItem = new JMenuItem();
+ private JMenuItem projectRunOther_menuItem = new JMenuItem();
+ private JPanel status_panel = new JPanel();
+ private BorderLayout borderLayout4 = new BorderLayout();
+ private Border emptyBorder = BorderFactory.createEmptyBorder();
+ private JPanel toolbar_panel = new JPanel();
+ private JSplitPane right_splitPane = new JSplitPane();
+ private MessageHandlerPanel messages_panel = null;
+ private JMenu tools_menu = new JMenu();
+ private JMenuItem joinpointProbe_menuItem = new JMenuItem();
+ private JMenuItem projectDebug_menuItem = new JMenuItem();
+ private JMenuItem svProperties_menuItem = new JMenuItem();
+ private File lastChosenDir = CURRENT_DIR;
+
+ JPanel toolBar_panel = new JPanel();
+ JToolBar build_toolBar = new JToolBar();
+ JButton closeConfig_button = new JButton();
+ JButton openConfig_button = new JButton();
+ JButton run_button = new JButton();
+ JToolBar project_toolBar = new JToolBar();
+ JButton save_button = new JButton();
+ JButton options_button = new JButton();
+ JButton editConfig_button = new JButton();
+ JToolBar file_toolBar = new JToolBar();
+ JPanel filler_panel = new JPanel();
+ BorderLayout borderLayout5 = new BorderLayout();
+ BorderLayout borderLayout6 = new BorderLayout();
+ Border border8;
+ JLabel jLabel1 = new JLabel();
+ JLabel jLabel2 = new JLabel();
+ JPanel multiView_panel;
+
+ private AJButtonMenuCombo buildCombo;
+
+ public void init(MultiStructureViewPanel multiViewPanel,
+ MessageHandlerPanel compilerMessagesPanel, JPanel editorPanel) {
+ try {
+ this.multiView_panel = multiViewPanel;
+ this.messages_panel = compilerMessagesPanel;
+ this.editor_panel = editorPanel;
+ this.sourceEditor_panel = editorPanel;
+
+ jbInit();
+ svProperties_menuItem.setIcon(Ajde.getDefault()
+ .getIconRegistry().getBrowserOptionsIcon());
+ projectBuild_menuItem.setIcon(Ajde.getDefault()
+ .getIconRegistry().getBuildIcon());
+ projectRun_menuItem.setIcon(Ajde.getDefault()
+ .getIconRegistry().getExecuteIcon());
+ projectRunOther_menuItem.setIcon(Ajde.getDefault()
+ .getIconRegistry().getExecuteIcon());
+ projectDebug_menuItem.setIcon(Ajde.getDefault()
+ .getIconRegistry().getDebugIcon());
+
+ this.setJMenuBar(menuBar);
+ this.setIconImage(((ImageIcon) Ajde.getDefault()
+ .getIconRegistry().getStructureSwingIcon(
+ IProgramElement.Kind.ADVICE)).getImage());
+ this.setLocation(75, 10);
+ this.setSize(900, 650);
+ this.setTitle(BrowserManager.TITLE);
+ // bindKeys();
+ fixButtonBorders();
+ messages_panel.setVisible(false);
+
+ JPopupMenu orderMenu = new BuildConfigPopupMenu(
+ new AbstractAction() {
+
+ private static final long serialVersionUID = 1L;
+
+ public void actionPerformed(ActionEvent arg0) {
+ BrowserManager.getDefault().saveAll();
+ }
+ });
+
+ buildCombo = new AJButtonMenuCombo("Build", "Build", Ajde
+ .getDefault().getIconRegistry().getBuildIcon(), orderMenu,
+ false);
+
+ build_toolBar.add(buildCombo, 1);
+ refreshBuildMenu();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void refreshBuildMenu() {
+ JPopupMenu orderMenu = new BuildConfigPopupMenu(new AbstractAction() {
+ private static final long serialVersionUID = -3204840278758386318L;
+
+ public void actionPerformed(ActionEvent arg0) {
+ BrowserManager.getDefault().saveAll();
+ }
+ });
+
+ buildCombo.setMenu(orderMenu);
+ }
+
+ public void setEditorPanel(JPanel panel) {
+ editor_panel = panel;
+ right_splitPane.remove(editor_panel);
+ right_splitPane.add(panel, JSplitPane.TOP);
+ panel.setVisible(true);
+ }
+
+ /**
+ * @todo get rid of this method and make jbinit() work properly
+ */
+ private void fixButtonBorders() {
+ run_button.setBorder(null);
+ options_button.setBorder(null);
+ openConfig_button.setBorder(null);
+ closeConfig_button.setBorder(null);
+ save_button.setBorder(null);
+ editConfig_button.setBorder(null);
+ }
+
+ private void jbInit() throws Exception {
+ border8 = BorderFactory.createCompoundBorder(BorderFactory
+ .createEtchedBorder(Color.white, new Color(156, 156, 158)),
+ BorderFactory.createEmptyBorder(2, 2, 2, 2));
+ emptyBorder = BorderFactory.createEmptyBorder(2, 2, 2, 2);
+ jMenu1.setFont(new java.awt.Font("Dialog", 0, 11));
+ jMenu1.setText("File");
+ jMenu1.setMnemonic(KeyEvent.VK_F);
+ jMenu2.setFont(new java.awt.Font("Dialog", 0, 11));
+ jMenu2.setText("Project");
+ jMenu2.setMnemonic(KeyEvent.VK_P);
+ projectBuild_menuItem.setFont(new java.awt.Font("Dialog", 0, 11));
+ projectBuild_menuItem.setText("Build");
+ projectBuild_menuItem.setMnemonic(KeyEvent.VK_B);
+ projectBuild_menuItem.setAccelerator(KeyStroke.getKeyStroke(
+ KeyEvent.VK_B, ActionEvent.ALT_MASK));
+
+ projectBuild_menuItem
+ .addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ projectBuild_menuItem_actionPerformed(e);
+ }
+ });
+ left_flowLayout.setAlignment(FlowLayout.LEFT);
+ jMenuItem1.setFont(new java.awt.Font("Dialog", 0, 11));
+ jMenuItem1.setText("Save");
+ jMenuItem1.setMnemonic(KeyEvent.VK_S);
+ jMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
+ ActionEvent.ALT_MASK));
+ jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ jMenuItem1_actionPerformed(e);
+ }
+ });
+ exit_menuItem.setFont(new java.awt.Font("Dialog", 0, 11));
+ exit_menuItem.setText("Exit");
+ exit_menuItem.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ exit_menuItem_actionPerformed(e);
+ }
+ });
+ top_splitPane.setPreferredSize(new Dimension(706, 800));
+ top_splitPane.setDividerSize(4);
+ this.getContentPane().setLayout(borderLayout3);
+ projectRun_menuItem.setEnabled(true);
+ projectRun_menuItem.setFont(new java.awt.Font("Dialog", 0, 11));
+ projectRun_menuItem.setText("Run in same VM");
+ projectRun_menuItem
+ .setToolTipText("Run in same VM (hold shift down to run in separate process)");
+ projectRun_menuItem.setMnemonic(KeyEvent.VK_R);
+ projectRun_menuItem.setAccelerator(KeyStroke.getKeyStroke(
+ KeyEvent.VK_R, ActionEvent.ALT_MASK));
+ projectRun_menuItem
+ .addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ projectRun_menuItem_actionPerformed(e);
+ }
+ });
+ projectRunOther_menuItem.setEnabled(true);
+ projectRunOther_menuItem.setFont(new java.awt.Font("Dialog", 0, 11));
+ projectRunOther_menuItem.setText("Run in separate process");
+ projectRunOther_menuItem.setMnemonic(KeyEvent.VK_P);
+ projectRunOther_menuItem.setAccelerator(KeyStroke.getKeyStroke(
+ KeyEvent.VK_P, ActionEvent.ALT_MASK));
+ projectRunOther_menuItem
+ .addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ projectRunOther_menuItem_actionPerformed(e);
+ }
+ });
+ statusText_label.setFont(new java.awt.Font("Dialog", 0, 11));
+ statusText_label.setBorder(BorderFactory.createLoweredBevelBorder());
+ statusText_label.setMaximumSize(new Dimension(2000, 20));
+ statusText_label.setPreferredSize(new Dimension(300, 20));
+ status_panel.setLayout(borderLayout4);
+ this.addWindowListener(new java.awt.event.WindowAdapter() {
+ public void windowClosed(WindowEvent e) {
+ this_windowClosed(e);
+ }
+
+ public void windowClosing(WindowEvent e) {
+ this_windowClosing(e);
+ }
+ });
+ toolbar_panel.setLayout(borderLayout5);
+ right_splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
+ right_splitPane.setBorder(null);
+ right_splitPane.setDividerSize(4);
+ tools_menu.setFont(new java.awt.Font("Dialog", 0, 11));
+ tools_menu.setText("Tools");
+ tools_menu.setMnemonic(KeyEvent.VK_T);
+ projectDebug_menuItem.setEnabled(false);
+ projectDebug_menuItem.setFont(new java.awt.Font("Dialog", 0, 11));
+ projectDebug_menuItem.setText("Debug");
+ svProperties_menuItem
+ .addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ svProperties_menuItem_actionPerformed(e);
+ }
+ });
+ svProperties_menuItem.setText("Options...");
+ svProperties_menuItem.setActionCommand("AJDE Console...");
+ svProperties_menuItem.setFont(new java.awt.Font("Dialog", 0, 11));
+ svProperties_menuItem.setMnemonic(KeyEvent.VK_O);
+ svProperties_menuItem.setAccelerator(KeyStroke.getKeyStroke(
+ KeyEvent.VK_O, ActionEvent.ALT_MASK));
+ build_toolBar.setBorder(emptyBorder);
+ build_toolBar.setFloatable(false);
+ closeConfig_button.setMaximumSize(new Dimension(100, 20));
+ closeConfig_button.setEnabled(true);
+ closeConfig_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ closeConfig_button.setBorder(null);
+ closeConfig_button.setMinimumSize(new Dimension(24, 20));
+ closeConfig_button.setPreferredSize(new Dimension(20, 20));
+ closeConfig_button.setToolTipText("Close build configuration");
+ closeConfig_button.setIcon(Ajde.getDefault().getIconRegistry()
+ .getCloseConfigIcon());
+ closeConfig_button
+ .addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ closeConfig_button_actionPerformed(e);
+ }
+ });
+ openConfig_button.setMaximumSize(new Dimension(100, 20));
+ openConfig_button.setEnabled(true);
+ openConfig_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ openConfig_button.setBorder(null);
+ openConfig_button.setMinimumSize(new Dimension(24, 20));
+ openConfig_button.setPreferredSize(new Dimension(20, 20));
+ openConfig_button.setToolTipText("Select build configuration...");
+ openConfig_button.setIcon(Ajde.getDefault().getIconRegistry()
+ .getOpenConfigIcon());
+ openConfig_button
+ .addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ openConfig_button_actionPerformed(e);
+ }
+ });
+ run_button.setMaximumSize(new Dimension(60, 20));
+ run_button.setEnabled(true);
+ run_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ run_button.setBorder(null);
+ run_button.setMinimumSize(new Dimension(24, 20));
+ run_button.setPreferredSize(new Dimension(20, 20));
+ run_button
+ .setToolTipText("Run in same VM (hold shift down to run in separate process)");
+ run_button.setIcon(Ajde.getDefault().getIconRegistry()
+ .getExecuteIcon());
+ run_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ run_button_actionPerformed(e);
+ }
+ });
+ project_toolBar.setBorder(emptyBorder);
+ save_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ save_button_actionPerformed(e);
+ }
+ });
+ save_button.setIcon(Ajde.getDefault().getIconRegistry()
+ .getSaveIcon());
+ save_button.setText("Save");
+ save_button.setToolTipText("Save");
+ save_button.setPreferredSize(new Dimension(55, 20));
+ save_button.setMinimumSize(new Dimension(24, 20));
+ save_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ save_button.setBorder(null);
+ save_button.setMaximumSize(new Dimension(60, 20));
+ options_button.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ options_button_actionPerformed(e);
+ }
+ });
+ options_button.setIcon(Ajde.getDefault().getIconRegistry()
+ .getBrowserOptionsIcon());
+ options_button.setText("Options");
+ options_button.setToolTipText("Options...");
+ options_button.setPreferredSize(new Dimension(60, 20));
+ options_button.setMinimumSize(new Dimension(24, 20));
+ options_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ options_button.setBorder(null);
+ options_button.setMaximumSize(new Dimension(80, 20));
+ editConfig_button
+ .addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ editConfig_button_actionPerformed(e);
+ }
+ });
+ editConfig_button.setIcon(Ajde.getDefault().getIconRegistry()
+ .getStructureSwingIcon(IProgramElement.Kind.FILE_LST));
+ editConfig_button.setText("Edit Config");
+ editConfig_button.setToolTipText("Edit Config...");
+ editConfig_button.setPreferredSize(new Dimension(80, 20));
+ editConfig_button.setMinimumSize(new Dimension(24, 20));
+ editConfig_button.setFont(new java.awt.Font("Dialog", 0, 11));
+ editConfig_button.setBorder(null);
+ editConfig_button.setMaximumSize(new Dimension(80, 20));
+ file_toolBar.setBorder(emptyBorder);
+ toolBar_panel.setLayout(borderLayout6);
+ jLabel1.setFont(new java.awt.Font("Dialog", 0, 11));
+ jLabel1.setText(" Build: ");
+ jLabel2.setText(" Run: ");
+ jLabel2.setFont(new java.awt.Font("Dialog", 0, 11));
+ // fileStructure_panel.setFont(new java.awt.Font("Dialog", 0, 11));
+ // browser_panel.setFont(new java.awt.Font("Dialog", 0, 11));
+ this.getContentPane().add(top_splitPane, BorderLayout.CENTER);
+ top_splitPane.add(right_splitPane, JSplitPane.RIGHT);
+ top_splitPane.add(multiView_panel, JSplitPane.LEFT);
+ right_splitPane.add(messages_panel, JSplitPane.BOTTOM);
+ right_splitPane.add(editor_panel, JSplitPane.TOP);
+ // structureView_pane.add(fileStructure_panel, JSplitPane.RIGHT);
+ // structureView_pane.add(browser_panel, JSplitPane.LEFT);
+ this.getContentPane().add(status_panel, BorderLayout.SOUTH);
+ status_panel.add(statusText_label, BorderLayout.CENTER);
+ this.getContentPane().add(toolbar_panel, BorderLayout.NORTH);
+ toolbar_panel.add(filler_panel, BorderLayout.CENTER);
+ toolbar_panel.add(toolBar_panel, BorderLayout.WEST);
+ // file_toolBar.add(editConfig_button, null);
+ file_toolBar.add(save_button, null);
+ file_toolBar.add(options_button, null);
+ toolBar_panel.add(build_toolBar, BorderLayout.WEST);
+ toolBar_panel.add(project_toolBar, BorderLayout.CENTER);
+ project_toolBar.add(jLabel2, null);
+ project_toolBar.add(run_button, null);
+ build_toolBar.add(jLabel1, null);
+ build_toolBar.add(openConfig_button, null);
+ build_toolBar.add(closeConfig_button, null);
+ toolBar_panel.add(file_toolBar, BorderLayout.EAST);
+ menuBar.add(jMenu1);
+ menuBar.add(jMenu2);
+ menuBar.add(tools_menu);
+ jMenu1.add(jMenuItem1);
+ jMenu1.addSeparator();
+ jMenu1.add(exit_menuItem);
+ jMenu2.add(projectBuild_menuItem);
+ jMenu2.add(projectRun_menuItem);
+ jMenu2.add(projectRunOther_menuItem);
+ // jMenu2.add(projectDebug_menuItem);
+ tools_menu.add(joinpointProbe_menuItem);
+ tools_menu.add(svProperties_menuItem);
+ top_splitPane.setDividerLocation(380);
+ right_splitPane.setDividerLocation(500);
+ project_toolBar.addSeparator();
+ project_toolBar.addSeparator();
+ }
+
+ private void exit_menuItem_actionPerformed(ActionEvent e) {
+ quit();
+ }
+
+ private void this_windowClosing(WindowEvent e) {
+ quit();
+ }
+
+ private void quit() {
+ this.dispose();
+ System.exit(0);
+ }
+
+ void treeMode_comboBox_actionPerformed(ActionEvent e) {
+ }
+
+ void save_button_actionPerformed(ActionEvent e) {
+ BrowserManager.getDefault().getEditorManager().saveContents();
+ }
+
+ void this_windowClosed(WindowEvent e) {
+ quit();
+ }
+
+ public void showMessagesPanel(BrowserMessageHandler handler) {
+ right_splitPane.setDividerLocation(right_splitPane.getHeight() - 100);
+ messages_panel.showMessageHandlerPanel(handler, true);
+ }
+
+ public void hideMessagesPanel(BrowserMessageHandler handler) {
+ right_splitPane.setDividerLocation(right_splitPane.getHeight());
+ messages_panel.showMessageHandlerPanel(handler, false);
+ }
+
+ void jMenuItem1_actionPerformed(ActionEvent e) {
+ BrowserManager.getDefault().getEditorManager().saveContents();
+ }
+
+ void projectBuild_menuItem_actionPerformed(ActionEvent e) {
+ BrowserManager.getDefault().saveAll();
+ if (EditorManager.isShiftDown(e.getModifiers())) {
+ buildFresh();
+ } else {
+ build();
+ }
+ }
+
+ void run_button_actionPerformed(ActionEvent e) {
+ if (EditorManager.isShiftDown(e.getModifiers())) {
+ runInNewVM();
+ } else {
+ runInSameVM();
+ }
+ }
+
+ void projectRunOther_menuItem_actionPerformed(ActionEvent e) {
+ runInNewVM();
+ }
+
+ void projectRun_menuItem_actionPerformed(ActionEvent e) {
+ if (EditorManager.isShiftDown(e.getModifiers())) {
+ runInNewVM();
+ } else {
+ runInSameVM();
+ }
+ }
+
+ void build_button_actionPerformed(ActionEvent e) {
+ BrowserManager.getDefault().saveAll();
+ if (EditorManager.isShiftDown(e.getModifiers())) {
+ buildFresh();
+ } else {
+ build();
+ }
+ }
+
+ void options_button_actionPerformed(ActionEvent e) {
+ Ajde.getDefault().showOptionsFrame();
+ }
+
+ void editConfig_button_actionPerformed(ActionEvent e) {
+ BrowserManager.getDefault().openFile(
+ Ajde.getDefault().getBuildConfigManager()
+ .getActiveConfigFile());
+ refreshBuildMenu();
+ }
+
+ public void resetSourceEditorPanel() {
+ right_splitPane.removeAll();
+ right_splitPane.add(sourceEditor_panel, JSplitPane.TOP);
+ }
+
+ private void svProperties_menuItem_actionPerformed(ActionEvent e) {
+ Ajde.getDefault().showOptionsFrame();
+ }
+
+ private void openConfig_button_actionPerformed(ActionEvent e) {
+ JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setCurrentDirectory(lastChosenDir);
+ fileChooser.setFileFilter(new FileFilter() {
+ public boolean accept(File f) {
+ return (f.getPath().endsWith(".lst") || f.isDirectory());
+ }
+
+ public String getDescription() {
+ return "AspectJ Build Configuration (*.lst)";
+ }
+ });
+ int returnVal = fileChooser.showOpenDialog(this);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File result = fileChooser.getSelectedFile();
+ String path = result.getAbsolutePath();// .replace('\\', '/');
+ if (!Ajde.getDefault().getBuildConfigManager()
+ .getAllBuildConfigFiles().contains(path)) {
+ Ajde.getDefault().getBuildConfigManager()
+ .getAllBuildConfigFiles().add(0, path);
+ }
+ Ajde.getDefault().getBuildConfigManager().setActiveConfigFile(
+ path);
+ lastChosenDir = result.getParentFile();
+ if (null == lastChosenDir) {
+ lastChosenDir = CURRENT_DIR;
+ }
+ refreshBuildMenu();
+ }
+ }
+
+ private void closeConfig_button_actionPerformed(ActionEvent e) {
+ Ajde.getDefault().getBuildConfigManager()
+ .getAllBuildConfigFiles().remove(
+ Ajde.getDefault().getBuildConfigManager()
+ .getActiveConfigFile());
+ if (!Ajde.getDefault().getBuildConfigManager()
+ .getAllBuildConfigFiles().isEmpty()) {
+ Ajde.getDefault().getBuildConfigManager().setActiveConfigFile(
+ (String) Ajde.getDefault().getBuildConfigManager()
+ .getAllBuildConfigFiles().get(0));
+ }
+ refreshBuildMenu();
+ }
+
+ private void buildFresh() {
+ Ajde.getDefault().runBuildInDifferentThread(Ajde.getDefault()
+ .getBuildConfigManager().getActiveConfigFile(), true);
+ }
+
+ private void build() {
+ Ajde.getDefault().runBuildInDifferentThread(Ajde.getDefault()
+ .getBuildConfigManager().getActiveConfigFile(), false);
+ }
+
+ private void runInSameVM() {
+ Ajde.getDefault().runInSameVM();
+ }
+
+ private void runInNewVM() {
+ Ajde.getDefault().runInNewVM();
+ }
+
+}
+++ /dev/null
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * Helen Hawkins Converted to new interface (bug 148190)
- * ******************************************************************/
-package org.aspectj.tools.ajbrowser;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.JFrame;
-
-import org.aspectj.ajde.Ajde;
-import org.aspectj.ajde.IconRegistry;
-import org.aspectj.ajde.internal.BuildConfigManager;
-import org.aspectj.ajde.ui.FileStructureView;
-import org.aspectj.ajde.ui.InvalidResourceException;
-import org.aspectj.ajde.ui.UserPreferencesAdapter;
-import org.aspectj.ajde.ui.internal.UserPreferencesStore;
-import org.aspectj.ajde.ui.javaoptions.JavaBuildOptions;
-import org.aspectj.ajde.ui.javaoptions.JavaCompilerWarningsOptionsPanel;
-import org.aspectj.ajde.ui.javaoptions.JavaComplianceOptionsPanel;
-import org.aspectj.ajde.ui.javaoptions.JavaDebugOptionsPanel;
-import org.aspectj.ajde.ui.javaoptions.JavaOtherOptionsPanel;
-import org.aspectj.ajde.ui.swing.MultiStructureViewPanel;
-import org.aspectj.asm.IHierarchy;
-import org.aspectj.asm.IHierarchyListener;
-import org.aspectj.tools.ajbrowser.core.BrowserBuildProgressMonitor;
-import org.aspectj.tools.ajbrowser.core.BrowserCompilerConfiguration;
-import org.aspectj.tools.ajbrowser.core.BrowserErrorHandler;
-import org.aspectj.tools.ajbrowser.ui.BasicEditor;
-import org.aspectj.tools.ajbrowser.ui.BrowserMessageHandler;
-import org.aspectj.tools.ajbrowser.ui.BrowserRuntimeProperties;
-import org.aspectj.tools.ajbrowser.ui.BrowserUIAdapter;
-import org.aspectj.tools.ajbrowser.ui.EditorManager;
-import org.aspectj.tools.ajbrowser.ui.swing.BrowserOptionsPanel;
-import org.aspectj.tools.ajbrowser.ui.swing.MessageHandlerPanel;
-import org.aspectj.tools.ajbrowser.ui.swing.TopFrame;
-import org.aspectj.util.FileUtil;
-
-/**
- * IDE manager for standalone AJDE application.
- *
- * @author Mik Kersten
- */
-public class BrowserManager {
-
- public static final String TITLE = "AspectJ Browser";
-
- private static final BrowserManager INSTANCE = new BrowserManager();
- private EditorManager editorManager;
- private UserPreferencesAdapter preferencesAdapter;
- private static TopFrame topFrame = null;
-
- private List<String> configFiles = new ArrayList<String>();
- private JavaBuildOptions javaBuildOptions;
-
- public static BrowserManager getDefault() {
- return INSTANCE;
- }
-
- public final IHierarchyListener VIEW_LISTENER = new IHierarchyListener() {
- public void elementsUpdated(IHierarchy model) {
- FileStructureView fsv = Ajde.getDefault().getStructureViewManager().getDefaultFileView();
- if (fsv != null) {
- fsv.setSourceFile(BrowserManager.getDefault().getEditorManager().getCurrFile());
- }
- }
- };
-
- public void init(String[] configFilesArgs, boolean visible) {
- try {
- javaBuildOptions = new JavaBuildOptions();
- preferencesAdapter = new UserPreferencesStore(true);
- topFrame = new TopFrame();
-
- BasicEditor ajdeEditor = new BasicEditor();
- editorManager = new EditorManager(ajdeEditor);
-
- BrowserMessageHandler messageHandler = new BrowserMessageHandler();
-
- Ajde.getDefault().init(new BrowserCompilerConfiguration(preferencesAdapter), messageHandler,
- new BrowserBuildProgressMonitor(messageHandler), ajdeEditor, new BrowserUIAdapter(), new IconRegistry(),
- topFrame, new BrowserRuntimeProperties(preferencesAdapter), true);
-
- setUpTopFrame(visible);
- addOptionsPanels();
-
- setUpConfigFiles(configFilesArgs);
-
- Ajde.getDefault().getModel().addListener(VIEW_LISTENER);
-
- } catch (Throwable t) {
- t.printStackTrace();
- BrowserErrorHandler.handleError("AJDE failed to initialize.", t);
- }
- }
-
- /**
- * Find and create the set of build configuration files
- *
- * @param configFilesArgs
- */
- private void setUpConfigFiles(String[] configFilesArgs) {
- configFiles = getConfigFilesList(configFilesArgs);
- if (configFiles.size() == 0) {
- BrowserErrorHandler.handleWarning("No build configuration selected. "
- + "Select a \".lst\" build configuration file in order to compile and navigate structure.");
- } else {
- Ajde.getDefault().getBuildConfigManager().setActiveConfigFile((String) configFiles.get(0));
- }
- }
-
- /**
- * Create the top frame of the browser
- */
- private void setUpTopFrame(boolean visible) {
- MultiStructureViewPanel multiViewPanel = new MultiStructureViewPanel(Ajde.getDefault().getViewManager().getBrowserPanel(),
- Ajde.getDefault().getFileStructurePanel());
-
- topFrame.init(multiViewPanel, new MessageHandlerPanel(), editorManager.getEditorPanel());
-
- if (visible)
- topFrame.setVisible(true);
- }
-
- public void resetEditorFrame() {
- topFrame.resetSourceEditorPanel();
- }
-
- public void resetEditor() {
- BrowserManager
- .getDefault()
- .getRootFrame()
- .setSize(BrowserManager.getDefault().getRootFrame().getWidth() + 1,
- BrowserManager.getDefault().getRootFrame().getHeight() + 1);
- BrowserManager.getDefault().getRootFrame().doLayout();
- BrowserManager.getDefault().getRootFrame().repaint();
- }
-
- public void setStatusInformation(String text) {
- topFrame.statusText_label.setText(text);
- }
-
- public void setEditorStatusText(String text) {
- topFrame.setTitle(BrowserManager.TITLE + " - " + text);
- }
-
- public void saveAll() {
- editorManager.saveContents();
- }
-
- public JFrame getRootFrame() {
- return topFrame;
- }
-
- public void openFile(String filePath) {
- try {
- if (filePath.endsWith(".lst")) {
- Ajde.getDefault().getBuildConfigEditor().openFile(filePath);
- topFrame.setEditorPanel(Ajde.getDefault().getBuildConfigEditor());
- } else if (FileUtil.hasSourceSuffix(filePath)) {
- editorManager.showSourceLine(filePath, 0, false);
- } else {
- BrowserErrorHandler.handleError("File: " + filePath
- + " could not be opened because the extension was not recoginzed.");
- }
- } catch (IOException ioe) {
- BrowserErrorHandler.handleError("Could not open file: " + filePath, ioe);
- } catch (InvalidResourceException ire) {
- BrowserErrorHandler.handleError("Invalid file: " + filePath, ire);
- }
- }
-
- private List<String> getConfigFilesList(String[] configFiles) {
- List<String> configs = new ArrayList<String>();
- for (int i = 0; i < configFiles.length; i++) {
- if (configFiles[i].endsWith(BuildConfigManager.CONFIG_FILE_SUFFIX)) {
- configs.add(configFiles[i]);
- }
- }
- return configs;
- }
-
- /**
- * Add the different options panels to the main options frame (adds panels for java compliance, compiler warnings, debug
- * warnings, other java options and options specific to ajbrowser)
- */
- private void addOptionsPanels() {
- Ajde.getDefault().getOptionsFrame().addOptionsPanel(new JavaComplianceOptionsPanel(javaBuildOptions));
- Ajde.getDefault().getOptionsFrame().addOptionsPanel(new JavaCompilerWarningsOptionsPanel(javaBuildOptions));
- Ajde.getDefault().getOptionsFrame().addOptionsPanel(new JavaOtherOptionsPanel(javaBuildOptions));
- Ajde.getDefault().getOptionsFrame().addOptionsPanel(new JavaDebugOptionsPanel(javaBuildOptions));
- Ajde.getDefault().getOptionsFrame().addOptionsPanel(new BrowserOptionsPanel());
- }
-
- /**
- * @return the EditorManager
- */
- public EditorManager getEditorManager() {
- return editorManager;
- }
-
- /**
- * @return the UserPreferencesAdapter
- */
- public UserPreferencesAdapter getPreferencesAdapter() {
- return preferencesAdapter;
- }
-
- /**
- * @return the JavaBuildOptions instance being used
- */
- public JavaBuildOptions getJavaBuildOptions() {
- return javaBuildOptions;
- }
-
-}
+++ /dev/null
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-package org.aspectj.tools.ajbrowser;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/**
- * Run ajbrowser if 0+ .lst file arguments, and ajc otherwise.
- */
-public class Main {
-
- /**
- * Run ajbrowser if args contains only .lst files and ajc otherwise.
- *
- * @param args the String[] of args to interpret
- */
- public static void main(String[] args) {
- if (!compilerMain(args)) {
- BrowserManager.getDefault().init(args, true);
- }
- }
-
- /**
- * Invoke the compiler if there are arguments and some are not .lst files.
- *
- * @return false if compiler was not invoked and the browser main should be
- */
- static boolean compilerMain(String[] args) {
- if ((null == args) || (0 == args.length)) {
- return false;
- }
- int numConfigFiles = 0;
- for (int i = 0; i < args.length; i++) {
- if ((null != args[i]) && args[i].endsWith(".lst")) {
- numConfigFiles++;
- }
- }
- if (numConfigFiles != args.length) {
- try {
- Class<?> ajc = Class.forName("org.aspectj.tools.ajc.Main");
- Method main = ajc.getMethod("main", new Class[] { String[].class });
- main.invoke(null, new Object[] { args });
- return true;
- } catch (ClassNotFoundException e) {
- report(e);
- } catch (NoSuchMethodException e) {
- report(e);
- } catch (IllegalAccessException e) {
- report(e);
- } catch (InvocationTargetException e) {
- report(e.getTargetException());
- }
- }
- return false;
- }
-
- private static void report(Throwable t) {
- t.printStackTrace(System.err);
- }
-}
+++ /dev/null
-/********************************************************************
- * Copyright (c) 2007 Contributors. All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- * Helen Hawkins - initial version (bug 148190)
- *******************************************************************/
-package org.aspectj.tools.ajbrowser.core;
-
-import javax.swing.JDialog;
-
-import org.aspectj.ajde.Ajde;
-import org.aspectj.ajde.core.IBuildProgressMonitor;
-import org.aspectj.ajde.ui.swing.BuildProgressPanel;
-import org.aspectj.tools.ajbrowser.BrowserManager;
-import org.aspectj.tools.ajbrowser.ui.BrowserMessageHandler;
-import org.aspectj.tools.ajbrowser.ui.swing.TopFrame;
-
-/**
- * Build progress monitor that shows the progress in a dialog containing
- * a JProgressBar. Also updates the progress bar at the bottom of AjBrowser
- * with the build progress information.
- */
-public class BrowserBuildProgressMonitor extends Thread implements IBuildProgressMonitor {
-
- public static final String PROGRESS_HEADING = "AspectJ Build";
-
- private BuildProgressPanel progressDialog = null;
- private JDialog dialog = null;
- private TopFrame topFrame;
-
- private BrowserMessageHandler handler;
-
- public BrowserBuildProgressMonitor(BrowserMessageHandler handler) {
- this.handler = handler;
- topFrame = (TopFrame) BrowserManager.getDefault().getRootFrame();
- dialog = new JDialog(topFrame, PROGRESS_HEADING, false);
- progressDialog = new BuildProgressPanel();
- dialog.setContentPane(progressDialog);
- dialog.setSize(550, 120);
- try {
- dialog.setLocationRelativeTo(topFrame);
- } catch (NoSuchMethodError nsme) {
- // running on 1.3
- }
- }
-
- public void finish(boolean wasFullBuild) {
- Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("build finished...");
- progressDialog.finish();
- dialog.dispose();
- if (handler.getMessages().isEmpty()) {
- topFrame.hideMessagesPanel(handler);
- } else {
- topFrame.showMessagesPanel(handler);
- }
- }
-
- public boolean isCancelRequested() {
- boolean isCancel = progressDialog.isCancelRequested();
- if (isCancel) {
- Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("Compile aborted");
- }
- return isCancel;
- }
-
- public void setProgress(double percentDone) {
- progressDialog.setProgressBarVal((int) (percentDone*progressDialog.getProgressBarMax()));
- }
-
- public void setProgressText(String text) {
- Ajde.getDefault().getIdeUIAdapter().displayStatusInformation(text);
- progressDialog.setProgressText(text);
- }
-
- public void begin() {
- Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("starting build...");
- handler.reset();
- progressDialog.setProgressBarVal(0);
- progressDialog.setProgressText("starting build...");
- dialog.setLocationRelativeTo(Ajde.getDefault().getRootFrame());
- dialog.setVisible(true);
- }
-
-}
+++ /dev/null
-/********************************************************************
- * Copyright (c) 2007 Contributors. All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- * Helen Hawkins - initial version (bug 148190)
- *******************************************************************/
-package org.aspectj.tools.ajbrowser.core;
-
-import java.io.File;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.aspectj.ajde.core.ICompilerConfiguration;
-import org.aspectj.ajde.core.IOutputLocationManager;
-import org.aspectj.ajde.ui.UserPreferencesAdapter;
-import org.aspectj.tools.ajbrowser.BrowserManager;
-
-/**
- * AjBrowser implementation of ICompilerConfiguration which returns something for getClasspath(), getJavaOptionsMap(),
- * getNonStandardOptions() and getOutputLocationManager() and null for everything else. The reason it doesn't return anything for
- * getProjectSourceFiles() is that it uses .lst files to record what is needed to build (via BuildConfigManager).
- */
-public class BrowserCompilerConfiguration implements ICompilerConfiguration {
-
- private UserPreferencesAdapter preferencesAdapter;
- private IOutputLocationManager locationManager;
-
- public BrowserCompilerConfiguration(UserPreferencesAdapter preferencesAdapter) {
- this.preferencesAdapter = preferencesAdapter;
- }
-
- public String getClasspath() {
- StringBuffer classpath = new StringBuffer();
- String userPath = preferencesAdapter.getProjectPreference(PreferenceStoreConstants.BUILD_CLASSPATH);
- if (userPath != null && userPath.trim().length() != 0) {
- classpath.append(userPath);
- }
- List<File> outputDirs = getOutputLocationManager().getAllOutputLocations();
- for (Iterator<File> iterator = outputDirs.iterator(); iterator.hasNext();) {
- File dir = (File) iterator.next();
- classpath.append(File.pathSeparator + dir.getAbsolutePath() + File.pathSeparator);
- }
- classpath.append(System.getProperty("java.class.path", "."));
- // System.out.println("classpath: " + classpath.toString());
- return classpath.toString();
- }
-
- public Map<String,String> getJavaOptionsMap() {
- return BrowserManager.getDefault().getJavaBuildOptions().getJavaBuildOptionsMap();
- }
-
- public String getNonStandardOptions() {
- return preferencesAdapter.getProjectPreference(PreferenceStoreConstants.NONSTANDARD_OPTIONS);
- }
-
- public IOutputLocationManager getOutputLocationManager() {
- if (locationManager == null) {
- locationManager = new BrowserOutputLocationManager(preferencesAdapter);
- }
- return locationManager;
- }
-
- public List<String> getProjectSourceFiles() {
- // unimplemented in AjBrowser (uses BuildConfigManager instead)
- return null;
- }
-
- public List getProjectSourceFilesChanged() {
- // unimplemented in AjBrowser (uses BuildConfigManager instead)
- return null;
- }
-
- public Map getSourcePathResources() {
- // unimplemented in AjBrowser
- return null;
- }
-
- public Set<File> getAspectPath() {
- // unimplemented in AjBrowser
- return null;
- }
-
- public Set<File> getInpath() {
- // unimplemented in AjBrowser
- return null;
- }
-
- public String getOutJar() {
- // unimplemented in AjBrowser
- return null;
- }
-
- public int getConfigurationChanges() {
- return ICompilerConfiguration.EVERYTHING;
- }
-
- public void configurationRead() {
- }
-
- public List getClasspathElementsWithModifiedContents() {
- return null;
- }
-
- public List<String> getProjectXmlConfigFiles() {
- return Collections.emptyList();
- }
-
- public String getProjectEncoding() {
- return null;
- }
-
- public String getProcessor() {
- return null;
- }
-
- public String getProcessorPath() {
- return null;
- }
-
- @Override
- public String getModulepath() {
- return null;
- }
-
- @Override
- public String getModuleSourcepath() {
- return null;
- }
-
-}
+++ /dev/null
-/********************************************************************
- * Copyright (c) 2007 Contributors. All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- * Helen Hawkins - initial version (bug 148190)
- *******************************************************************/
-package org.aspectj.tools.ajbrowser.core;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.swing.JOptionPane;
-
-import org.aspectj.ajde.Ajde;
-import org.aspectj.ajde.ui.swing.ErrorDialog;
-import org.aspectj.tools.ajbrowser.BrowserManager;
-
-/**
- * Error handler used by AjBrowser. Handles errors and warnings by
- * producing an error/warning dialog.
- */
-public class BrowserErrorHandler {
-
- public static void handleWarning(String message) {
- JOptionPane.showMessageDialog(BrowserManager.getDefault()
- .getRootFrame(), message, "AJBrowser Warning",
- JOptionPane.WARNING_MESSAGE);
- }
-
- public static void handleError(String errorMessage) {
- handleError(errorMessage, null);
- }
-
- public static void handleError(String message, Throwable t) {
- String stack = getStackTraceAsString(t);
- ErrorDialog errorDialog = new ErrorDialog(Ajde.getDefault()
- .getRootFrame(), "AJBrowser Error", t, message, stack);
- errorDialog.setVisible(true);
- }
-
- private static String getStackTraceAsString(Throwable t) {
- StringWriter stringWriter = new StringWriter();
- if (t != null) {
- t.printStackTrace(new PrintWriter(stringWriter));
- return stringWriter.getBuffer().toString();
- }
- return "<no stack trace available>";
- }
-
-}
+++ /dev/null
-/********************************************************************
- * Copyright (c) 2007 Contributors. All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- * Helen Hawkins - initial version (bug 148190)
- *******************************************************************/
-package org.aspectj.tools.ajbrowser.core;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.aspectj.ajde.core.IOutputLocationManager;
-import org.aspectj.ajde.ui.UserPreferencesAdapter;
-
-/**
- * IOutputLocationManager which returns the same output location for all files and resources.
- */
-public class BrowserOutputLocationManager implements IOutputLocationManager {
-
- private UserPreferencesAdapter preferencesAdapter;
-
- public BrowserOutputLocationManager(UserPreferencesAdapter preferencesAdapter) {
- this.preferencesAdapter = preferencesAdapter;
- }
-
- public File getOutputLocationForClass(File compilationUnit) {
- return new File(getCommonOutputDir());
- }
-
- public File getOutputLocationForResource(File resource) {
- return new File(getCommonOutputDir());
- }
-
- private String getCommonOutputDir() {
- String outputPath = preferencesAdapter.getProjectPreference(PreferenceStoreConstants.BUILD_OUTPUTPATH);
- if (outputPath == null) {
- return ".";
- }
- return outputPath;
- }
-
- public List<File> getAllOutputLocations() {
- List<File> outputDirs = new ArrayList<File>();
- outputDirs.add(new File(getCommonOutputDir()));
- return outputDirs;
- }
-
- public File getDefaultOutputLocation() {
- return new File(getCommonOutputDir());
- }
-
- public String getSourceFolderForFile(File sourceFile) {
- return null;
- }
-
- public void reportFileWrite(String outputfile, int filetype) {
- }
-
- public void reportFileRemove(String outputfile, int filetype) {
- }
-
- public int discoverChangesSince(File dir, long buildtime) {
- return 0;
- }
-
- public Map<File, String> getInpathMap() {
- return Collections.emptyMap();
- }
-
-}
+++ /dev/null
-/********************************************************************
- * Copyright (c) 2007 Contributors. All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- * Helen Hawkins - initial version (bug 148190)
- *******************************************************************/
-package org.aspectj.tools.ajbrowser.core;
-
-/**
- * Constants used by the preference store
- */
-public class PreferenceStoreConstants {
-
- public static final String BUILD_CLASSPATH = "build.classpath";
- public static final String RUNTIME_MAINCLASS = "runtime.mainClass";
- public static final String BUILD_OUTPUTPATH = "build.outputpath";
- public static final String JAVA_CLASSPATH = "java.class.path";
- public static final String NONSTANDARD_OPTIONS = "ajc.nonStandardOptions";
-
-}
+++ /dev/null
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * Helen Hawkins Converted to new interface (bug 148190)
- * ******************************************************************/
-
-
-package org.aspectj.tools.ajbrowser.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Font;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-
-import javax.swing.JEditorPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-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;
-import org.aspectj.tools.ajbrowser.BrowserManager;
-import org.aspectj.tools.ajbrowser.core.BrowserErrorHandler;
-
-/**
- * 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) {
- BrowserErrorHandler.handleError("Could not initialize GUI.", e);
- }
- }
-
- public String getCurrFile() {
- return filePath;
- }
-
- public void showSourceLine(ISourceLocation sourceLocation, boolean highlight) {
- try {
- showSourceLine(sourceLocation.getSourceFile().getAbsolutePath(), sourceLocation.getLine(), highlight);
- } catch (NullPointerException npe) {
- Ajde.getDefault().getIdeUIAdapter().displayStatusInformation(" no corresponding source line to seek to");
- }
- }
-
- 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();
-
- 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) {
- BrowserErrorHandler.handleError("Could not highlight location.", ble);
- }
- BrowserManager.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.equals(NO_FILE) && !filePath.equals("") && !editorPane.getText().equals("")) {
- BufferedWriter writer = new BufferedWriter(new FileWriter(filePath));
- writer.write(editorPane.getText());
- writer.close();
- }
- }
-
- 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 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();
- }
- reader.close();
- 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);
- }
-}
+++ /dev/null
-/********************************************************************
- * Copyright (c) 2007 Contributors. All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- * Helen Hawkins - initial version (bug 148190)
- *******************************************************************/
-package org.aspectj.tools.ajbrowser.ui;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.aspectj.ajde.Ajde;
-import org.aspectj.ajde.IUIBuildMessageHandler;
-import org.aspectj.ajde.ui.swing.ErrorDialog;
-import org.aspectj.bridge.AbortException;
-import org.aspectj.bridge.IMessage;
-import org.aspectj.bridge.IMessage.Kind;
-
-/**
- * MessageHandler used by AjBrowser that displays ERROR messages with exceptions and ABORT messages in an error dialog. Other
- * messages are displayed by the MessageHandlerPanel. By default INFO and WEAVEINFO messages are ignored.
- */
-public class BrowserMessageHandler implements IUIBuildMessageHandler {
-
- private List<IMessage.Kind> ignoring;
- private List<IMessage> messages;
-
- public BrowserMessageHandler() {
- ignoring = new ArrayList<IMessage.Kind>();
- messages = new ArrayList<IMessage>();
- ignore(IMessage.INFO);
- ignore(IMessage.WEAVEINFO);
- }
-
- public boolean handleMessage(IMessage message) throws AbortException {
- Kind messageKind = message.getKind();
- if (isIgnoring(messageKind)) {
- return true;
- }
- if (messageKind.equals(IMessage.ABORT) || (message.getThrown() != null)) {
- String stack = getStackTraceAsString(message.getThrown());
- ErrorDialog errorDialog = new ErrorDialog(Ajde.getDefault().getRootFrame(), "AJDE Error", message.getThrown(),
- message.getMessage(), stack);
- errorDialog.setVisible(true);
- return true;
- }
- messages.add(message);
- return true;
- }
-
- public void dontIgnore(Kind kind) {
- if (null != kind) {
- ignoring.remove(kind);
- }
- }
-
- public boolean isIgnoring(Kind kind) {
- return ((null != kind) && (ignoring.contains(kind)));
- }
-
- public void ignore(Kind kind) {
- if ((null != kind) && (!ignoring.contains(kind))) {
- ignoring.add(kind);
- }
- }
-
- public List<IMessage> getMessages() {
- return messages;
- }
-
- private String getStackTraceAsString(Throwable t) {
- StringWriter stringWriter = new StringWriter();
- if (t != null) {
- t.printStackTrace(new PrintWriter(stringWriter));
- return stringWriter.getBuffer().toString();
- }
- return "<no stack trace available>";
- }
-
- public void reset() {
- messages.clear();
- }
-
-}
+++ /dev/null
-/********************************************************************
- * Copyright (c) 2007 Contributors. All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- * Helen Hawkins - initial version (bug 148190)
- *******************************************************************/
-package org.aspectj.tools.ajbrowser.ui;
-
-import org.aspectj.ajde.IRuntimeProperties;
-import org.aspectj.ajde.ui.UserPreferencesAdapter;
-import org.aspectj.tools.ajbrowser.core.PreferenceStoreConstants;
-
-/**
- * AjBrowser implementation of IRuntimeProperties which uses the PreferenceStoreConstant
- * to decide which class the user has specified contains the main method
- */
-public class BrowserRuntimeProperties implements IRuntimeProperties {
-
- private UserPreferencesAdapter preferencesAdapter;
-
- public BrowserRuntimeProperties(UserPreferencesAdapter preferencesAdapter) {
- this.preferencesAdapter = preferencesAdapter;
- }
-
- public String getClassToExecute() {
- return preferencesAdapter.getProjectPreference(PreferenceStoreConstants.RUNTIME_MAINCLASS);
- }
-
- public String getExecutionArgs() {
- // not implemented by ajbrowser
- return null;
- }
-
-}
+++ /dev/null
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.tools.ajbrowser.ui;
-
-import org.aspectj.ajde.IdeUIAdapter;
-import org.aspectj.tools.ajbrowser.BrowserManager;
-
-/**
- * AjBrowser implementation if IdeUIAdapter which displays the provided
- * information in the status bar at the bottom of the AjBrowser GUI.
- */
-public class BrowserUIAdapter implements IdeUIAdapter {
-
- public void displayStatusInformation(String message) {
- BrowserManager.getDefault().setStatusInformation(message);
- }
-}
+++ /dev/null
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-package org.aspectj.tools.ajbrowser.ui;
-
-import java.awt.BorderLayout;
-import java.awt.event.KeyEvent;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Vector;
-
-import javax.swing.Box;
-import javax.swing.JPanel;
-import javax.swing.SwingUtilities;
-
-import org.aspectj.ajde.EditorAdapter;
-import org.aspectj.ajde.EditorListener;
-import org.aspectj.bridge.ISourceLocation;
-import org.aspectj.tools.ajbrowser.core.BrowserErrorHandler;
-
-/**
- * Responsible for controlling the editor.
- *
- * @todo remove coupling to <CODE>BasicEditor</CODE>
- * @author Mik Kersten
- */
-public class EditorManager {
-
- /** @return true if input modifiers have shift down */
- public static boolean isShiftDown(int modifiers) {
- return (0 != (modifiers & KeyEvent.SHIFT_MASK));
- }
-
- private EditorAdapter editor = null;
- private BasicEditor basicEditor = null;
- private ArrayList<EditorListener> editorListeners = new ArrayList<EditorListener>();
- private Vector<EditorAdapter> editors = new Vector<EditorAdapter>();
- 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 (EditorListener editorListener : editorListeners) {
- editorListener.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) {
- BrowserErrorHandler.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 (EditorAdapter editorAdapter : editors) {
- editorAdapter.saveContents();
- }
- } catch (IOException ioe) {
- BrowserErrorHandler.handleError("Editor could not save the current file.", ioe);
- }
- }
-
- public JPanel getEditorPanel() {
- if (editor_panel != null) {
- return editor_panel;
- } else {
- return basicEditor.getPanel();
- }
- }
-}
+++ /dev/null
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * Helen Hawkins Converted to new interface (bug 148190)
- * ******************************************************************/
-
-
-package org.aspectj.tools.ajbrowser.ui.swing;
-
-import java.io.*;
-import javax.swing.*;
-import java.awt.*;
-import javax.swing.border.*;
-import org.aspectj.ajde.ui.swing.*;
-import org.aspectj.tools.ajbrowser.BrowserManager;
-import org.aspectj.tools.ajbrowser.core.PreferenceStoreConstants;
-
-/**
- * Panel the displays both ajc and runtime options
- *
- * @author Mik Kersten
- */
-public class BrowserOptionsPanel extends OptionsPanel {
-
- private static final long serialVersionUID = 4491319302490183151L;
- private JPanel runOptions_panel = new JPanel();
- private JPanel build_panel = new JPanel();
- private FlowLayout flowLayout1 = new FlowLayout();
- private JTextField classToRun_field = new JTextField();
- private JLabel jLabel4 = new JLabel();
- private BorderLayout borderLayout4 = new BorderLayout();
- private JPanel buildPaths_panel = new JPanel();
- private Box compileOptions_box2 = Box.createVerticalBox();
- private JTextField classpath_field = new JTextField();
- private JTextField outputPath_field = new JTextField();
- private JTextField nonStandardOptions_field = new JTextField();
- private JLabel jLabel16 = new JLabel();
- private JLabel jLabel15 = new JLabel();
- private JLabel nonStandardOptions_label = new JLabel();
- private Box compileOptions_box3 = Box.createVerticalBox();
- private BorderLayout borderLayout1 = new BorderLayout();
- private Border border1;
- private TitledBorder titledBorder1;
- private Border border2;
- private Border border3;
- private TitledBorder titledBorder2;
- private Border border4;
-
- public BrowserOptionsPanel() {
- try {
- jbInit();
- this.setName("AJBrowser Options");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void loadOptions() throws IOException {
- outputPath_field.setText(
- BrowserManager.getDefault().getPreferencesAdapter().
- getProjectPreference(PreferenceStoreConstants.BUILD_OUTPUTPATH)
- );
- nonStandardOptions_field.setText(
- BrowserManager.getDefault().getPreferencesAdapter().
- getProjectPreference(PreferenceStoreConstants.NONSTANDARD_OPTIONS)
- );
- classpath_field.setText(
- BrowserManager.getDefault().getPreferencesAdapter().
- getProjectPreference(PreferenceStoreConstants.BUILD_CLASSPATH)
- );
- classToRun_field.setText(
- BrowserManager.getDefault().getPreferencesAdapter().
- getProjectPreference(PreferenceStoreConstants.RUNTIME_MAINCLASS)
- );
- }
-
- public void saveOptions() throws IOException {
- BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference(
- PreferenceStoreConstants.BUILD_OUTPUTPATH, outputPath_field.getText());
- BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference(
- PreferenceStoreConstants.NONSTANDARD_OPTIONS, nonStandardOptions_field.getText());
- BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference(
- PreferenceStoreConstants.BUILD_CLASSPATH, classpath_field.getText());
- BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference(
- PreferenceStoreConstants.RUNTIME_MAINCLASS, classToRun_field.getText());
- }
-
- private void jbInit() throws Exception {
- border1 =
- BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158));
- titledBorder1 = new TitledBorder(border1, "Ajc Options");
- border2 =
- BorderFactory.createCompoundBorder(
- titledBorder1,
- BorderFactory.createEmptyBorder(5, 5, 5, 5));
- border3 =
- BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158));
- titledBorder2 = new TitledBorder(border3, "Run Options");
- border4 =
- BorderFactory.createCompoundBorder(
- titledBorder2,
- BorderFactory.createEmptyBorder(5, 5, 5, 5));
- this.setLayout(borderLayout1);
- build_panel.setLayout(borderLayout4);
- classToRun_field.setFont(new java.awt.Font("SansSerif", 0, 11));
- classToRun_field.setMinimumSize(new Dimension(200, 21));
- classToRun_field.setPreferredSize(new Dimension(250, 21));
- jLabel4.setFont(new java.awt.Font("Dialog", 0, 11));
- jLabel4.setText("Fully qualified name for main class to run: ");
- buildPaths_panel.setLayout(flowLayout1);
- runOptions_panel.setBorder(border4);
- buildPaths_panel.setBorder(border2);
- classpath_field.setFont(new java.awt.Font("SansSerif", 0, 11));
- classpath_field.setMinimumSize(new Dimension(100, 21));
- classpath_field.setPreferredSize(new Dimension(150, 21));
- outputPath_field.setPreferredSize(new Dimension(225, 21));
- outputPath_field.setMinimumSize(new Dimension(100, 21));
- outputPath_field.setFont(new java.awt.Font("SansSerif", 0, 11));
- nonStandardOptions_field.setPreferredSize(new Dimension(225, 21));
- nonStandardOptions_field.setMinimumSize(new Dimension(100, 21));
- nonStandardOptions_field.setFont(new java.awt.Font("SansSerif", 0, 11));
- jLabel16.setText("Classpath (defaults to current directory): ");
- jLabel16.setPreferredSize(new Dimension(200, 25));
- jLabel16.setMaximumSize(new Dimension(400, 25));
- jLabel16.setFont(new java.awt.Font("Dialog", 0, 11));
- jLabel15.setMaximumSize(new Dimension(400, 25));
- jLabel15.setFont(new java.awt.Font("Dialog", 0, 11));
- jLabel15.setPreferredSize(new Dimension(230, 25));
- jLabel15.setText("Output path (defaults to current directory): ");
- nonStandardOptions_label.setMaximumSize(new Dimension(400, 25));
- nonStandardOptions_label.setFont(new java.awt.Font("Dialog", 0, 11));
- nonStandardOptions_label.setPreferredSize(new Dimension(230, 25));
- nonStandardOptions_label.setText("Non-standard compiler options: ");
- titledBorder1.setTitleFont(new java.awt.Font("Dialog", 0, 11));
- titledBorder2.setTitleFont(new java.awt.Font("Dialog", 0, 11));
- runOptions_panel.add(jLabel4, null);
- runOptions_panel.add(classToRun_field, null);
- build_panel.add(buildPaths_panel, BorderLayout.CENTER);
- build_panel.add(runOptions_panel, BorderLayout.SOUTH);
- compileOptions_box2.add(outputPath_field, null);
- compileOptions_box2.add(nonStandardOptions_field, null);
- compileOptions_box2.add(classpath_field, null);
- compileOptions_box3.add(jLabel15, null);
- compileOptions_box3.add(nonStandardOptions_label, null);
- compileOptions_box3.add(jLabel16, null);
- buildPaths_panel.add(compileOptions_box3, null);
- buildPaths_panel.add(compileOptions_box2, null);
- this.add(build_panel, BorderLayout.NORTH);
- }
-
-}
+++ /dev/null
-/********************************************************************
- * Copyright (c) 2007 Contributors. All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- * Helen Hawkins - initial version (bug 148190)
- *******************************************************************/
-package org.aspectj.tools.ajbrowser.ui.swing;
-
-import java.awt.BorderLayout;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.swing.DefaultListModel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-
-import org.aspectj.ajde.Ajde;
-import org.aspectj.ajde.ui.swing.CompilerMessagesCellRenderer;
-import org.aspectj.bridge.IMessage;
-import org.aspectj.tools.ajbrowser.ui.BrowserMessageHandler;
-
-/**
- * Panel used to display messages from the message handler
- */
-public class MessageHandlerPanel extends JPanel {
-
- private static final long serialVersionUID = -2251912345065588977L;
- private JScrollPane jScrollPane1 = new JScrollPane();
- private JList list;
- private DefaultListModel listModel;
- private BorderLayout borderLayout1 = new BorderLayout();
-
- public void showMessageHandlerPanel(BrowserMessageHandler handler, boolean showPanel) {
- if (!showPanel) {
- setVisible(false);
- return;
- }
- createList(handler.getMessages());
-
- try {
- jbInit();
- } catch (Exception e) {
- e.printStackTrace();
- }
- list.setModel(listModel);
-
- MouseListener mouseListener = new MouseAdapter() {
- public void mouseClicked(MouseEvent e) {
- if (e.getClickCount() >= 1) {
- int index = list.locationToIndex(e.getPoint());
- if (listModel.getSize() >= index && index != -1) {
- IMessage message = (IMessage) listModel
- .getElementAt(index);
- Ajde.getDefault().getEditorAdapter().showSourceLine(
- message.getSourceLocation(), true);
- }
- }
- }
- };
- list.addMouseListener(mouseListener);
- list.setCellRenderer(new CompilerMessagesCellRenderer());
- setVisible(showPanel);
- }
-
- private void createList(List messages) {
- list = new JList();
- listModel = new DefaultListModel();
- for (Iterator iterator = messages.iterator(); iterator.hasNext();) {
- listModel.addElement(iterator.next());
- }
- }
-
- private void jbInit() throws Exception {
- this.setLayout(borderLayout1);
- this.add(jScrollPane1, BorderLayout.CENTER);
- jScrollPane1.getViewport().add(list, null);
- }
-
-}
+++ /dev/null
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-package org.aspectj.tools.ajbrowser.ui.swing;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowEvent;
-import java.io.File;
-
-import javax.swing.AbstractAction;
-import javax.swing.BorderFactory;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JSplitPane;
-import javax.swing.JToolBar;
-import javax.swing.KeyStroke;
-import javax.swing.border.Border;
-import javax.swing.filechooser.FileFilter;
-
-import org.aspectj.ajde.Ajde;
-import org.aspectj.ajde.ui.swing.AJButtonMenuCombo;
-import org.aspectj.ajde.ui.swing.BuildConfigPopupMenu;
-import org.aspectj.ajde.ui.swing.MultiStructureViewPanel;
-import org.aspectj.asm.IProgramElement;
-import org.aspectj.tools.ajbrowser.BrowserManager;
-import org.aspectj.tools.ajbrowser.ui.BrowserMessageHandler;
-import org.aspectj.tools.ajbrowser.ui.EditorManager;
-
-/**
- * UI for standalone operation.
- *
- * @author Mik Kersten
- */
-public class TopFrame extends JFrame {
-
- private static final long serialVersionUID = 1007473581156451702L;
-
- private static final File CURRENT_DIR = new File(".");
-
- public JLabel statusText_label = new JLabel();
-
- private JPanel editor_panel = null;
- private JPanel sourceEditor_panel = null;
-
- private JMenuBar menuBar = new JMenuBar();
- private JMenu jMenu1 = new JMenu();
- private JMenu jMenu2 = new JMenu();
- private JMenuItem projectBuild_menuItem = new JMenuItem();
- private FlowLayout left_flowLayout = new FlowLayout();
- private JMenuItem jMenuItem1 = new JMenuItem();
- private JMenuItem exit_menuItem = new JMenuItem();
- private JSplitPane top_splitPane = new JSplitPane();
- private BorderLayout borderLayout3 = new BorderLayout();
- private JMenuItem projectRun_menuItem = new JMenuItem();
- private JMenuItem projectRunOther_menuItem = new JMenuItem();
- private JPanel status_panel = new JPanel();
- private BorderLayout borderLayout4 = new BorderLayout();
- private Border emptyBorder = BorderFactory.createEmptyBorder();
- private JPanel toolbar_panel = new JPanel();
- private JSplitPane right_splitPane = new JSplitPane();
- private MessageHandlerPanel messages_panel = null;
- private JMenu tools_menu = new JMenu();
- private JMenuItem joinpointProbe_menuItem = new JMenuItem();
- private JMenuItem projectDebug_menuItem = new JMenuItem();
- private JMenuItem svProperties_menuItem = new JMenuItem();
- private File lastChosenDir = CURRENT_DIR;
-
- JPanel toolBar_panel = new JPanel();
- JToolBar build_toolBar = new JToolBar();
- JButton closeConfig_button = new JButton();
- JButton openConfig_button = new JButton();
- JButton run_button = new JButton();
- JToolBar project_toolBar = new JToolBar();
- JButton save_button = new JButton();
- JButton options_button = new JButton();
- JButton editConfig_button = new JButton();
- JToolBar file_toolBar = new JToolBar();
- JPanel filler_panel = new JPanel();
- BorderLayout borderLayout5 = new BorderLayout();
- BorderLayout borderLayout6 = new BorderLayout();
- Border border8;
- JLabel jLabel1 = new JLabel();
- JLabel jLabel2 = new JLabel();
- JPanel multiView_panel;
-
- private AJButtonMenuCombo buildCombo;
-
- public void init(MultiStructureViewPanel multiViewPanel,
- MessageHandlerPanel compilerMessagesPanel, JPanel editorPanel) {
- try {
- this.multiView_panel = multiViewPanel;
- this.messages_panel = compilerMessagesPanel;
- this.editor_panel = editorPanel;
- this.sourceEditor_panel = editorPanel;
-
- jbInit();
- svProperties_menuItem.setIcon(Ajde.getDefault()
- .getIconRegistry().getBrowserOptionsIcon());
- projectBuild_menuItem.setIcon(Ajde.getDefault()
- .getIconRegistry().getBuildIcon());
- projectRun_menuItem.setIcon(Ajde.getDefault()
- .getIconRegistry().getExecuteIcon());
- projectRunOther_menuItem.setIcon(Ajde.getDefault()
- .getIconRegistry().getExecuteIcon());
- projectDebug_menuItem.setIcon(Ajde.getDefault()
- .getIconRegistry().getDebugIcon());
-
- this.setJMenuBar(menuBar);
- this.setIconImage(((ImageIcon) Ajde.getDefault()
- .getIconRegistry().getStructureSwingIcon(
- IProgramElement.Kind.ADVICE)).getImage());
- this.setLocation(75, 10);
- this.setSize(900, 650);
- this.setTitle(BrowserManager.TITLE);
- // bindKeys();
- fixButtonBorders();
- messages_panel.setVisible(false);
-
- JPopupMenu orderMenu = new BuildConfigPopupMenu(
- new AbstractAction() {
-
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- BrowserManager.getDefault().saveAll();
- }
- });
-
- buildCombo = new AJButtonMenuCombo("Build", "Build", Ajde
- .getDefault().getIconRegistry().getBuildIcon(), orderMenu,
- false);
-
- build_toolBar.add(buildCombo, 1);
- refreshBuildMenu();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void refreshBuildMenu() {
- JPopupMenu orderMenu = new BuildConfigPopupMenu(new AbstractAction() {
- private static final long serialVersionUID = -3204840278758386318L;
-
- public void actionPerformed(ActionEvent arg0) {
- BrowserManager.getDefault().saveAll();
- }
- });
-
- buildCombo.setMenu(orderMenu);
- }
-
- public void setEditorPanel(JPanel panel) {
- editor_panel = panel;
- right_splitPane.remove(editor_panel);
- right_splitPane.add(panel, JSplitPane.TOP);
- panel.setVisible(true);
- }
-
- /**
- * @todo get rid of this method and make jbinit() work properly
- */
- private void fixButtonBorders() {
- run_button.setBorder(null);
- options_button.setBorder(null);
- openConfig_button.setBorder(null);
- closeConfig_button.setBorder(null);
- save_button.setBorder(null);
- editConfig_button.setBorder(null);
- }
-
- private void jbInit() throws Exception {
- border8 = BorderFactory.createCompoundBorder(BorderFactory
- .createEtchedBorder(Color.white, new Color(156, 156, 158)),
- BorderFactory.createEmptyBorder(2, 2, 2, 2));
- emptyBorder = BorderFactory.createEmptyBorder(2, 2, 2, 2);
- jMenu1.setFont(new java.awt.Font("Dialog", 0, 11));
- jMenu1.setText("File");
- jMenu1.setMnemonic(KeyEvent.VK_F);
- jMenu2.setFont(new java.awt.Font("Dialog", 0, 11));
- jMenu2.setText("Project");
- jMenu2.setMnemonic(KeyEvent.VK_P);
- projectBuild_menuItem.setFont(new java.awt.Font("Dialog", 0, 11));
- projectBuild_menuItem.setText("Build");
- projectBuild_menuItem.setMnemonic(KeyEvent.VK_B);
- projectBuild_menuItem.setAccelerator(KeyStroke.getKeyStroke(
- KeyEvent.VK_B, ActionEvent.ALT_MASK));
-
- projectBuild_menuItem
- .addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- projectBuild_menuItem_actionPerformed(e);
- }
- });
- left_flowLayout.setAlignment(FlowLayout.LEFT);
- jMenuItem1.setFont(new java.awt.Font("Dialog", 0, 11));
- jMenuItem1.setText("Save");
- jMenuItem1.setMnemonic(KeyEvent.VK_S);
- jMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
- ActionEvent.ALT_MASK));
- jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- jMenuItem1_actionPerformed(e);
- }
- });
- exit_menuItem.setFont(new java.awt.Font("Dialog", 0, 11));
- exit_menuItem.setText("Exit");
- exit_menuItem.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- exit_menuItem_actionPerformed(e);
- }
- });
- top_splitPane.setPreferredSize(new Dimension(706, 800));
- top_splitPane.setDividerSize(4);
- this.getContentPane().setLayout(borderLayout3);
- projectRun_menuItem.setEnabled(true);
- projectRun_menuItem.setFont(new java.awt.Font("Dialog", 0, 11));
- projectRun_menuItem.setText("Run in same VM");
- projectRun_menuItem
- .setToolTipText("Run in same VM (hold shift down to run in separate process)");
- projectRun_menuItem.setMnemonic(KeyEvent.VK_R);
- projectRun_menuItem.setAccelerator(KeyStroke.getKeyStroke(
- KeyEvent.VK_R, ActionEvent.ALT_MASK));
- projectRun_menuItem
- .addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- projectRun_menuItem_actionPerformed(e);
- }
- });
- projectRunOther_menuItem.setEnabled(true);
- projectRunOther_menuItem.setFont(new java.awt.Font("Dialog", 0, 11));
- projectRunOther_menuItem.setText("Run in separate process");
- projectRunOther_menuItem.setMnemonic(KeyEvent.VK_P);
- projectRunOther_menuItem.setAccelerator(KeyStroke.getKeyStroke(
- KeyEvent.VK_P, ActionEvent.ALT_MASK));
- projectRunOther_menuItem
- .addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- projectRunOther_menuItem_actionPerformed(e);
- }
- });
- statusText_label.setFont(new java.awt.Font("Dialog", 0, 11));
- statusText_label.setBorder(BorderFactory.createLoweredBevelBorder());
- statusText_label.setMaximumSize(new Dimension(2000, 20));
- statusText_label.setPreferredSize(new Dimension(300, 20));
- status_panel.setLayout(borderLayout4);
- this.addWindowListener(new java.awt.event.WindowAdapter() {
- public void windowClosed(WindowEvent e) {
- this_windowClosed(e);
- }
-
- public void windowClosing(WindowEvent e) {
- this_windowClosing(e);
- }
- });
- toolbar_panel.setLayout(borderLayout5);
- right_splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
- right_splitPane.setBorder(null);
- right_splitPane.setDividerSize(4);
- tools_menu.setFont(new java.awt.Font("Dialog", 0, 11));
- tools_menu.setText("Tools");
- tools_menu.setMnemonic(KeyEvent.VK_T);
- projectDebug_menuItem.setEnabled(false);
- projectDebug_menuItem.setFont(new java.awt.Font("Dialog", 0, 11));
- projectDebug_menuItem.setText("Debug");
- svProperties_menuItem
- .addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- svProperties_menuItem_actionPerformed(e);
- }
- });
- svProperties_menuItem.setText("Options...");
- svProperties_menuItem.setActionCommand("AJDE Console...");
- svProperties_menuItem.setFont(new java.awt.Font("Dialog", 0, 11));
- svProperties_menuItem.setMnemonic(KeyEvent.VK_O);
- svProperties_menuItem.setAccelerator(KeyStroke.getKeyStroke(
- KeyEvent.VK_O, ActionEvent.ALT_MASK));
- build_toolBar.setBorder(emptyBorder);
- build_toolBar.setFloatable(false);
- closeConfig_button.setMaximumSize(new Dimension(100, 20));
- closeConfig_button.setEnabled(true);
- closeConfig_button.setFont(new java.awt.Font("Dialog", 0, 11));
- closeConfig_button.setBorder(null);
- closeConfig_button.setMinimumSize(new Dimension(24, 20));
- closeConfig_button.setPreferredSize(new Dimension(20, 20));
- closeConfig_button.setToolTipText("Close build configuration");
- closeConfig_button.setIcon(Ajde.getDefault().getIconRegistry()
- .getCloseConfigIcon());
- closeConfig_button
- .addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- closeConfig_button_actionPerformed(e);
- }
- });
- openConfig_button.setMaximumSize(new Dimension(100, 20));
- openConfig_button.setEnabled(true);
- openConfig_button.setFont(new java.awt.Font("Dialog", 0, 11));
- openConfig_button.setBorder(null);
- openConfig_button.setMinimumSize(new Dimension(24, 20));
- openConfig_button.setPreferredSize(new Dimension(20, 20));
- openConfig_button.setToolTipText("Select build configuration...");
- openConfig_button.setIcon(Ajde.getDefault().getIconRegistry()
- .getOpenConfigIcon());
- openConfig_button
- .addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- openConfig_button_actionPerformed(e);
- }
- });
- run_button.setMaximumSize(new Dimension(60, 20));
- run_button.setEnabled(true);
- run_button.setFont(new java.awt.Font("Dialog", 0, 11));
- run_button.setBorder(null);
- run_button.setMinimumSize(new Dimension(24, 20));
- run_button.setPreferredSize(new Dimension(20, 20));
- run_button
- .setToolTipText("Run in same VM (hold shift down to run in separate process)");
- run_button.setIcon(Ajde.getDefault().getIconRegistry()
- .getExecuteIcon());
- run_button.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- run_button_actionPerformed(e);
- }
- });
- project_toolBar.setBorder(emptyBorder);
- save_button.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- save_button_actionPerformed(e);
- }
- });
- save_button.setIcon(Ajde.getDefault().getIconRegistry()
- .getSaveIcon());
- save_button.setText("Save");
- save_button.setToolTipText("Save");
- save_button.setPreferredSize(new Dimension(55, 20));
- save_button.setMinimumSize(new Dimension(24, 20));
- save_button.setFont(new java.awt.Font("Dialog", 0, 11));
- save_button.setBorder(null);
- save_button.setMaximumSize(new Dimension(60, 20));
- options_button.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- options_button_actionPerformed(e);
- }
- });
- options_button.setIcon(Ajde.getDefault().getIconRegistry()
- .getBrowserOptionsIcon());
- options_button.setText("Options");
- options_button.setToolTipText("Options...");
- options_button.setPreferredSize(new Dimension(60, 20));
- options_button.setMinimumSize(new Dimension(24, 20));
- options_button.setFont(new java.awt.Font("Dialog", 0, 11));
- options_button.setBorder(null);
- options_button.setMaximumSize(new Dimension(80, 20));
- editConfig_button
- .addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent e) {
- editConfig_button_actionPerformed(e);
- }
- });
- editConfig_button.setIcon(Ajde.getDefault().getIconRegistry()
- .getStructureSwingIcon(IProgramElement.Kind.FILE_LST));
- editConfig_button.setText("Edit Config");
- editConfig_button.setToolTipText("Edit Config...");
- editConfig_button.setPreferredSize(new Dimension(80, 20));
- editConfig_button.setMinimumSize(new Dimension(24, 20));
- editConfig_button.setFont(new java.awt.Font("Dialog", 0, 11));
- editConfig_button.setBorder(null);
- editConfig_button.setMaximumSize(new Dimension(80, 20));
- file_toolBar.setBorder(emptyBorder);
- toolBar_panel.setLayout(borderLayout6);
- jLabel1.setFont(new java.awt.Font("Dialog", 0, 11));
- jLabel1.setText(" Build: ");
- jLabel2.setText(" Run: ");
- jLabel2.setFont(new java.awt.Font("Dialog", 0, 11));
- // fileStructure_panel.setFont(new java.awt.Font("Dialog", 0, 11));
- // browser_panel.setFont(new java.awt.Font("Dialog", 0, 11));
- this.getContentPane().add(top_splitPane, BorderLayout.CENTER);
- top_splitPane.add(right_splitPane, JSplitPane.RIGHT);
- top_splitPane.add(multiView_panel, JSplitPane.LEFT);
- right_splitPane.add(messages_panel, JSplitPane.BOTTOM);
- right_splitPane.add(editor_panel, JSplitPane.TOP);
- // structureView_pane.add(fileStructure_panel, JSplitPane.RIGHT);
- // structureView_pane.add(browser_panel, JSplitPane.LEFT);
- this.getContentPane().add(status_panel, BorderLayout.SOUTH);
- status_panel.add(statusText_label, BorderLayout.CENTER);
- this.getContentPane().add(toolbar_panel, BorderLayout.NORTH);
- toolbar_panel.add(filler_panel, BorderLayout.CENTER);
- toolbar_panel.add(toolBar_panel, BorderLayout.WEST);
- // file_toolBar.add(editConfig_button, null);
- file_toolBar.add(save_button, null);
- file_toolBar.add(options_button, null);
- toolBar_panel.add(build_toolBar, BorderLayout.WEST);
- toolBar_panel.add(project_toolBar, BorderLayout.CENTER);
- project_toolBar.add(jLabel2, null);
- project_toolBar.add(run_button, null);
- build_toolBar.add(jLabel1, null);
- build_toolBar.add(openConfig_button, null);
- build_toolBar.add(closeConfig_button, null);
- toolBar_panel.add(file_toolBar, BorderLayout.EAST);
- menuBar.add(jMenu1);
- menuBar.add(jMenu2);
- menuBar.add(tools_menu);
- jMenu1.add(jMenuItem1);
- jMenu1.addSeparator();
- jMenu1.add(exit_menuItem);
- jMenu2.add(projectBuild_menuItem);
- jMenu2.add(projectRun_menuItem);
- jMenu2.add(projectRunOther_menuItem);
- // jMenu2.add(projectDebug_menuItem);
- tools_menu.add(joinpointProbe_menuItem);
- tools_menu.add(svProperties_menuItem);
- top_splitPane.setDividerLocation(380);
- right_splitPane.setDividerLocation(500);
- project_toolBar.addSeparator();
- project_toolBar.addSeparator();
- }
-
- private void exit_menuItem_actionPerformed(ActionEvent e) {
- quit();
- }
-
- private void this_windowClosing(WindowEvent e) {
- quit();
- }
-
- private void quit() {
- this.dispose();
- System.exit(0);
- }
-
- void treeMode_comboBox_actionPerformed(ActionEvent e) {
- }
-
- void save_button_actionPerformed(ActionEvent e) {
- BrowserManager.getDefault().getEditorManager().saveContents();
- }
-
- void this_windowClosed(WindowEvent e) {
- quit();
- }
-
- public void showMessagesPanel(BrowserMessageHandler handler) {
- right_splitPane.setDividerLocation(right_splitPane.getHeight() - 100);
- messages_panel.showMessageHandlerPanel(handler, true);
- }
-
- public void hideMessagesPanel(BrowserMessageHandler handler) {
- right_splitPane.setDividerLocation(right_splitPane.getHeight());
- messages_panel.showMessageHandlerPanel(handler, false);
- }
-
- void jMenuItem1_actionPerformed(ActionEvent e) {
- BrowserManager.getDefault().getEditorManager().saveContents();
- }
-
- void projectBuild_menuItem_actionPerformed(ActionEvent e) {
- BrowserManager.getDefault().saveAll();
- if (EditorManager.isShiftDown(e.getModifiers())) {
- buildFresh();
- } else {
- build();
- }
- }
-
- void run_button_actionPerformed(ActionEvent e) {
- if (EditorManager.isShiftDown(e.getModifiers())) {
- runInNewVM();
- } else {
- runInSameVM();
- }
- }
-
- void projectRunOther_menuItem_actionPerformed(ActionEvent e) {
- runInNewVM();
- }
-
- void projectRun_menuItem_actionPerformed(ActionEvent e) {
- if (EditorManager.isShiftDown(e.getModifiers())) {
- runInNewVM();
- } else {
- runInSameVM();
- }
- }
-
- void build_button_actionPerformed(ActionEvent e) {
- BrowserManager.getDefault().saveAll();
- if (EditorManager.isShiftDown(e.getModifiers())) {
- buildFresh();
- } else {
- build();
- }
- }
-
- void options_button_actionPerformed(ActionEvent e) {
- Ajde.getDefault().showOptionsFrame();
- }
-
- void editConfig_button_actionPerformed(ActionEvent e) {
- BrowserManager.getDefault().openFile(
- Ajde.getDefault().getBuildConfigManager()
- .getActiveConfigFile());
- refreshBuildMenu();
- }
-
- public void resetSourceEditorPanel() {
- right_splitPane.removeAll();
- right_splitPane.add(sourceEditor_panel, JSplitPane.TOP);
- }
-
- private void svProperties_menuItem_actionPerformed(ActionEvent e) {
- Ajde.getDefault().showOptionsFrame();
- }
-
- private void openConfig_button_actionPerformed(ActionEvent e) {
- JFileChooser fileChooser = new JFileChooser();
- fileChooser.setCurrentDirectory(lastChosenDir);
- fileChooser.setFileFilter(new FileFilter() {
- public boolean accept(File f) {
- return (f.getPath().endsWith(".lst") || f.isDirectory());
- }
-
- public String getDescription() {
- return "AspectJ Build Configuration (*.lst)";
- }
- });
- int returnVal = fileChooser.showOpenDialog(this);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- File result = fileChooser.getSelectedFile();
- String path = result.getAbsolutePath();// .replace('\\', '/');
- if (!Ajde.getDefault().getBuildConfigManager()
- .getAllBuildConfigFiles().contains(path)) {
- Ajde.getDefault().getBuildConfigManager()
- .getAllBuildConfigFiles().add(0, path);
- }
- Ajde.getDefault().getBuildConfigManager().setActiveConfigFile(
- path);
- lastChosenDir = result.getParentFile();
- if (null == lastChosenDir) {
- lastChosenDir = CURRENT_DIR;
- }
- refreshBuildMenu();
- }
- }
-
- private void closeConfig_button_actionPerformed(ActionEvent e) {
- Ajde.getDefault().getBuildConfigManager()
- .getAllBuildConfigFiles().remove(
- Ajde.getDefault().getBuildConfigManager()
- .getActiveConfigFile());
- if (!Ajde.getDefault().getBuildConfigManager()
- .getAllBuildConfigFiles().isEmpty()) {
- Ajde.getDefault().getBuildConfigManager().setActiveConfigFile(
- (String) Ajde.getDefault().getBuildConfigManager()
- .getAllBuildConfigFiles().get(0));
- }
- refreshBuildMenu();
- }
-
- private void buildFresh() {
- Ajde.getDefault().runBuildInDifferentThread(Ajde.getDefault()
- .getBuildConfigManager().getActiveConfigFile(), true);
- }
-
- private void build() {
- Ajde.getDefault().runBuildInDifferentThread(Ajde.getDefault()
- .getBuildConfigManager().getActiveConfigFile(), false);
- }
-
- private void runInSameVM() {
- Ajde.getDefault().runInSameVM();
- }
-
- private void runInNewVM() {
- Ajde.getDefault().runInNewVM();
- }
-
-}
--- /dev/null
+package org.aspectj.tools.ajbrowser;
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+// default package
+
+import junit.framework.*;
+
+public class AjbrowserModuleTests extends TestCase {
+
+ public static TestSuite suite() {
+ TestSuite suite = new TestSuite(AjbrowserModuleTests.class.getName());
+ suite.addTest(org.aspectj.tools.ajbrowser.AjbrowserTests.suite());
+ return suite;
+ }
+
+ public AjbrowserModuleTests(String name) { super(name); }
+
+}
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.tools.ajbrowser;
+
+import junit.framework.*;
+
+public class AjbrowserTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AjbrowserTests.class.getName());
+ suite.addTestSuite(AjbrowserTests.class);
+ //$JUnit-BEGIN$
+ //suite.addTestSuite(BrowserManagerTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+ public AjbrowserTests(String name) { super(name); }
+
+ // AjBrowser is waiting for some tests - have to have a placeholder to
+ // keep JUnit happy...
+ public void testNothing() {}
+}
--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.tools.ajbrowser;
+//
+//import org.netbeans.jemmy.Test;
+//import org.netbeans.jemmy.Scenario;
+//import org.netbeans.jemmy.ClassReference;
+//import org.netbeans.jemmy.operators.JFrameOperator;
+//import org.netbeans.jemmy.operators.JButtonOperator;
+//
+///**
+// * Programmatically drives AJBrowser gui,
+// * currently to do a build.
+// */
+//public class JemmyDriver implements Scenario {
+//
+// public static final String CUT
+// = "org.aspectj.tools.ajbrowser.Main";
+// public static final String DRIVER
+// = "org.aspectj.tools.ajbrowser.JemmyDriver";
+//
+// // XXX need to fix literal path locations
+// public static final String USERDIR
+// = "j:/home/wes/dev/tools/aj/examples";
+// public static final String FILENAME_RELATIVE
+// = USERDIR + "spacewar/debug.lst";
+// public static final String FILENAME
+// = USERDIR + "/" + FILENAME_RELATIVE;
+//
+// public static void main(String[] argv) {
+// // 0 is (this) class name
+// // 1 is the location of the work directory
+// // others are parameters
+// String[] params = {DRIVER, USERDIR, FILENAME};
+// Test.main(params);
+// }
+//
+// public int runIt(Object param) {
+// try {
+// String[] args = new String[]{};
+// // grab parameter - pass in .lst file
+// if (null != param) {
+// Class c = param.getClass();
+// if (c.isArray() &&
+// (String.class == c.getComponentType())) {
+// args = (String[]) param;
+// if (0 < args.length) {
+// if (FILENAME.equals(args[0])) {
+// System.out.println("got file...");
+// }
+// }
+// }
+// }
+// // start application with our .lst file
+// new ClassReference(CUT).startApplication(args);
+// // wait frame
+// JFrameOperator mainFrame = new JFrameOperator("AspectJ Browser");
+// // do a build - hangs if no list file
+// new JButtonOperator(mainFrame, "Build").push();
+//
+// } catch(Exception e) {
+// e.printStackTrace();
+// return(1);
+// }
+// return(0);
+// }
+//
+//}
+++ /dev/null
-package org.aspectj.tools.ajbrowser;
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-// default package
-
-import junit.framework.*;
-
-public class AjbrowserModuleTests extends TestCase {
-
- public static TestSuite suite() {
- TestSuite suite = new TestSuite(AjbrowserModuleTests.class.getName());
- suite.addTest(org.aspectj.tools.ajbrowser.AjbrowserTests.suite());
- return suite;
- }
-
- public AjbrowserModuleTests(String name) { super(name); }
-
-}
+++ /dev/null
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.tools.ajbrowser;
-
-import junit.framework.*;
-
-public class AjbrowserTests extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AjbrowserTests.class.getName());
- suite.addTestSuite(AjbrowserTests.class);
- //$JUnit-BEGIN$
- //suite.addTestSuite(BrowserManagerTest.class);
- //$JUnit-END$
- return suite;
- }
-
- public AjbrowserTests(String name) { super(name); }
-
- // AjBrowser is waiting for some tests - have to have a placeholder to
- // keep JUnit happy...
- public void testNothing() {}
-}
+++ /dev/null
-/* *******************************************************************
- * Copyright (c) 1999-2001 Xerox Corporation,
- * 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.tools.ajbrowser;
-//
-//import org.netbeans.jemmy.Test;
-//import org.netbeans.jemmy.Scenario;
-//import org.netbeans.jemmy.ClassReference;
-//import org.netbeans.jemmy.operators.JFrameOperator;
-//import org.netbeans.jemmy.operators.JButtonOperator;
-//
-///**
-// * Programmatically drives AJBrowser gui,
-// * currently to do a build.
-// */
-//public class JemmyDriver implements Scenario {
-//
-// public static final String CUT
-// = "org.aspectj.tools.ajbrowser.Main";
-// public static final String DRIVER
-// = "org.aspectj.tools.ajbrowser.JemmyDriver";
-//
-// // XXX need to fix literal path locations
-// public static final String USERDIR
-// = "j:/home/wes/dev/tools/aj/examples";
-// public static final String FILENAME_RELATIVE
-// = USERDIR + "spacewar/debug.lst";
-// public static final String FILENAME
-// = USERDIR + "/" + FILENAME_RELATIVE;
-//
-// public static void main(String[] argv) {
-// // 0 is (this) class name
-// // 1 is the location of the work directory
-// // others are parameters
-// String[] params = {DRIVER, USERDIR, FILENAME};
-// Test.main(params);
-// }
-//
-// public int runIt(Object param) {
-// try {
-// String[] args = new String[]{};
-// // grab parameter - pass in .lst file
-// if (null != param) {
-// Class c = param.getClass();
-// if (c.isArray() &&
-// (String.class == c.getComponentType())) {
-// args = (String[]) param;
-// if (0 < args.length) {
-// if (FILENAME.equals(args[0])) {
-// System.out.println("got file...");
-// }
-// }
-// }
-// }
-// // start application with our .lst file
-// new ClassReference(CUT).startApplication(args);
-// // wait frame
-// JFrameOperator mainFrame = new JFrameOperator("AspectJ Browser");
-// // do a build - hangs if no list file
-// new JButtonOperator(mainFrame, "Build").push();
-//
-// } catch(Exception e) {
-// e.printStackTrace();
-// return(1);
-// }
-// return(0);
-// }
-//
-//}