Closes #148. TODO: Should more AJDE stuff be removed? Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>tags/V1_9_19
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!--JBuilder XML Project--> | |||||
<project> | |||||
<property category="sys" name="BackupPath" value="bak" /> | |||||
<property category="sys" name="CheckStable" value="1" /> | |||||
<property category="sys" name="Company" value="" /> | |||||
<property category="sys" name="Copyright" value="Copyright (c) 2002" /> | |||||
<property category="sys" name="Description" value="" /> | |||||
<property category="sys" name="DocPath" value="doc" /> | |||||
<property category="sys" name="ExcludeClassEnabled" value="0" /> | |||||
<property category="sys" name="JDK" value="java 1.3.0_02" /> | |||||
<property category="sys" name="LastTag" value="0" /> | |||||
<property category="sys" name="Libraries" value="" /> | |||||
<property category="sys" name="MakeStable" value="0" /> | |||||
<property category="sys" name="OutPath" value="bin" /> | |||||
<property category="sys" name="SourcePath" value="src;../ajde/src;../compiler/src;../util/src" /> | |||||
<property category="sys" name="Title" value="" /> | |||||
<property category="sys" name="Version" value="1.0" /> | |||||
<property category="sys" name="WorkingDirectory" value="." /> | |||||
<property category="sys" name="uidesign.size.org.aspectj.tools.ajbrowser.TopFrame" value="612,471" /> | |||||
<node type="Package" name="org.aspectj.tools.ajbrowser" /> | |||||
</project> | |||||
<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.10-SNAPSHOT</version> | |||||
</parent> | |||||
<artifactId>ajbrowser</artifactId> | |||||
<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>ajde.core</artifactId> | |||||
<version>${project.version}</version> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.aspectj</groupId> | |||||
<artifactId>org.aspectj.ajdt.core</artifactId> | |||||
<version>${project.version}</version> | |||||
</dependency> | |||||
</dependencies> | |||||
</project> |
ajbrowser.lst | |||||
ajbrowserSrc.lst |
/* ******************************************************************* | |||||
* 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 v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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<>(); | |||||
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<>(); | |||||
for (String configFile : configFiles) { | |||||
if (configFile.endsWith(BuildConfigManager.CONFIG_FILE_SUFFIX)) { | |||||
configs.add(configFile); | |||||
} | |||||
} | |||||
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; | |||||
} | |||||
} |
/* ******************************************************************* | |||||
* 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 v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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 (String arg : args) { | |||||
if ((null != arg) && arg.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); | |||||
} | |||||
} |
/******************************************************************** | |||||
* Copyright (c) 2007 Contributors. All rights reserved. | |||||
* This program and the accompanying materials are made available | |||||
* under the terms of the Eclipse Public License v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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); | |||||
} | |||||
} |
/******************************************************************** | |||||
* Copyright (c) 2007 Contributors. All rights reserved. | |||||
* This program and the accompanying materials are made available | |||||
* under the terms of the Eclipse Public License v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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.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() { | |||||
StringBuilder classpath = new StringBuilder(); | |||||
String userPath = preferencesAdapter.getProjectPreference(PreferenceStoreConstants.BUILD_CLASSPATH); | |||||
if (userPath != null && userPath.trim().length() != 0) { | |||||
classpath.append(userPath); | |||||
} | |||||
List<File> outputDirs = getOutputLocationManager().getAllOutputLocations(); | |||||
for (File dir : outputDirs) { | |||||
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; | |||||
} | |||||
} |
/******************************************************************** | |||||
* Copyright (c) 2007 Contributors. All rights reserved. | |||||
* This program and the accompanying materials are made available | |||||
* under the terms of the Eclipse Public License v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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>"; | |||||
} | |||||
} |
/******************************************************************** | |||||
* Copyright (c) 2007 Contributors. All rights reserved. | |||||
* This program and the accompanying materials are made available | |||||
* under the terms of the Eclipse Public License v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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<>(); | |||||
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(); | |||||
} | |||||
} |
/******************************************************************** | |||||
* Copyright (c) 2007 Contributors. All rights reserved. | |||||
* This program and the accompanying materials are made available | |||||
* under the terms of the Eclipse Public License v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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"; | |||||
} |
/* ******************************************************************* | |||||
* 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 v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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)); | |||||
StringBuilder contents = new StringBuilder(); | |||||
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); | |||||
} | |||||
} |
/******************************************************************** | |||||
* Copyright (c) 2007 Contributors. All rights reserved. | |||||
* This program and the accompanying materials are made available | |||||
* under the terms of the Eclipse Public License v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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<>(); | |||||
messages = new ArrayList<>(); | |||||
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(); | |||||
} | |||||
} |
/******************************************************************** | |||||
* Copyright (c) 2007 Contributors. All rights reserved. | |||||
* This program and the accompanying materials are made available | |||||
* under the terms of the Eclipse Public License v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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; | |||||
} | |||||
} |
/* ******************************************************************* | |||||
* 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 v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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); | |||||
} | |||||
} |
/* ******************************************************************* | |||||
* 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 v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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.List; | |||||
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. | |||||
* | |||||
* <p><b>TODO:</b> remove coupling to <CODE>BasicEditor</CODE></p> | |||||
* @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 List<EditorListener> editorListeners = new ArrayList<>(); | |||||
private Vector<EditorAdapter> editors = new Vector<>(); | |||||
private JPanel editor_panel = null; | |||||
private Box editors_box = Box.createVerticalBox(); | |||||
public EditorManager(EditorAdapter ajdeEditor) { | |||||
if (ajdeEditor instanceof BasicEditor) { | |||||
this.basicEditor = (BasicEditor) ajdeEditor; | |||||
editors.add(basicEditor); | |||||
editors_box.add(basicEditor.getPanel()); | |||||
editor_panel = new JPanel(new BorderLayout()); | |||||
editor_panel.add(editors_box, BorderLayout.CENTER); | |||||
} else { | |||||
editors.add(ajdeEditor); | |||||
this.editor = ajdeEditor; | |||||
} | |||||
} | |||||
public void addListener(EditorListener editorListener) { | |||||
editorListeners.add(editorListener); | |||||
} | |||||
public void removeListener(EditorListener editorListener) { | |||||
editorListeners.remove(editorListener); | |||||
} | |||||
public void notifyCurrentFileChanged(String filePath) { | |||||
for (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); | |||||
} | |||||
} | |||||
/** | |||||
* <b>TODO</b>: 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(); | |||||
} | |||||
} | |||||
} |
/* ******************************************************************* | |||||
* 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 v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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); | |||||
} | |||||
} |
/******************************************************************** | |||||
* Copyright (c) 2007 Contributors. All rights reserved. | |||||
* This program and the accompanying materials are made available | |||||
* under the terms of the Eclipse Public License v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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.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<IMessage> messages) { | |||||
list = new JList(); | |||||
listModel = new DefaultListModel(); | |||||
for (IMessage message : messages) { | |||||
listModel.addElement(message); | |||||
} | |||||
} | |||||
private void jbInit() throws Exception { | |||||
this.setLayout(borderLayout1); | |||||
this.add(jScrollPane1, BorderLayout.CENTER); | |||||
jScrollPane1.getViewport().add(list, 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 v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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(); | |||||
} | |||||
} |
/* ******************************************************************* | |||||
* 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 v 2.0 | |||||
* which accompanies this distribution and is available at | |||||
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt | |||||
* | |||||
* 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); | |||||
// } | |||||
// | |||||
//} |
bin |
private final Icon BUILD = makeIcon("actions/build.gif"); | private final Icon BUILD = makeIcon("actions/build.gif"); | ||||
private final Icon DEBUG = makeIcon("actions/debug.gif"); | private final Icon DEBUG = makeIcon("actions/debug.gif"); | ||||
private final Icon EXECUTE = makeIcon("actions/execute.gif"); | private final Icon EXECUTE = makeIcon("actions/execute.gif"); | ||||
private final Icon AJBROWSER = makeIcon("structure/advice.gif"); | |||||
private final Icon AJBROWSER_ENABLED = makeIcon("actions/browserEnabled.gif"); | |||||
private final Icon AJBROWSER_DISABLED = makeIcon("actions/browserDisabled.gif"); | |||||
private final Icon STRUCTURE_VIEW = makeIcon("actions/structureView.gif"); | private final Icon STRUCTURE_VIEW = makeIcon("actions/structureView.gif"); | ||||
private final Icon HIDE_ASSOCIATIONS = makeIcon("actions/hideAssociations.gif"); | private final Icon HIDE_ASSOCIATIONS = makeIcon("actions/hideAssociations.gif"); | ||||
public Icon getErrorIcon() { return ERROR; } | public Icon getErrorIcon() { return ERROR; } | ||||
public Icon getWarningIcon() { return WARNING; } | public Icon getWarningIcon() { return WARNING; } | ||||
public Icon getInfoIcon() { return INFO; } | public Icon getInfoIcon() { return INFO; } | ||||
public Icon getAJBrowserIcon() { return AJBROWSER; } | |||||
public Icon getAJBrowserEnabledIcon() { return AJBROWSER_ENABLED; } | |||||
public Icon getAJBrowserDisabledIcon() { return AJBROWSER_DISABLED; } | |||||
public Icon getPopupIcon() { return POPUP; } | public Icon getPopupIcon() { return POPUP; } | ||||
public Icon getFilterIcon() { return FILTER; } | public Icon getFilterIcon() { return FILTER; } | ||||
public Icon getOrderIcon() { return ORDER; } | public Icon getOrderIcon() { return ORDER; } |
</fileSet> | </fileSet> | ||||
<!-- tools --> | <!-- tools --> | ||||
<fileSet> | |||||
<directory>../ajbrowser/target/classes</directory> | |||||
<outputDirectory>.</outputDirectory> | |||||
<excludes> | |||||
<exclude>META-INF/maven/**</exclude> | |||||
</excludes> | |||||
</fileSet> | |||||
<fileSet> | <fileSet> | ||||
<directory>../ajde/target/classes</directory> | <directory>../ajde/target/classes</directory> | ||||
<outputDirectory>.</outputDirectory> | <outputDirectory>.</outputDirectory> | ||||
</fileSets> | </fileSets> | ||||
</assembly> | </assembly> | ||||
</fileSet> | </fileSet> | ||||
<!-- Tools --> | <!-- Tools --> | ||||
<fileSet> | |||||
<directory>../ajbrowser/src/main/java</directory> | |||||
<outputDirectory>.</outputDirectory> | |||||
</fileSet> | |||||
<fileSet> | <fileSet> | ||||
<directory>../ajde/src/main/java</directory> | <directory>../ajde/src/main/java</directory> | ||||
<outputDirectory>.</outputDirectory> | <outputDirectory>.</outputDirectory> | ||||
</fileSets> | </fileSets> | ||||
</assembly> | </assembly> | ||||
<artifactId>loadtime</artifactId> | <artifactId>loadtime</artifactId> | ||||
<version>${project.version}</version> | <version>${project.version}</version> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>org.aspectj</groupId> | |||||
<artifactId>ajbrowser</artifactId> | |||||
<version>${project.version}</version> | |||||
</dependency> | |||||
<dependency> | <dependency> | ||||
<groupId>org.aspectj</groupId> | <groupId>org.aspectj</groupId> | ||||
<artifactId>ajde</artifactId> | <artifactId>ajde</artifactId> |
<property file="${aspectj.modules.build.dir}/junit-patterns.properties"/> | <property file="${aspectj.modules.build.dir}/junit-patterns.properties"/> | ||||
<property name="aspectj.tools.modules.13" | <property name="aspectj.tools.modules.13" | ||||
value="ajbrowser,ajde,ajde.core,ajdoc,asm,bridge,loadtime,org.aspectj.ajdt.core,runtime,taskdefs,util,weaver"/> | |||||
value="ajde,ajde.core,ajdoc,asm,bridge,loadtime,org.aspectj.ajdt.core,runtime,taskdefs,util,weaver"/> | |||||
<property name="aspectj.tools.modules.15" | <property name="aspectj.tools.modules.15" | ||||
value="loadtime5,aspectj5rt,weaver5"/> | value="loadtime5,aspectj5rt,weaver5"/> | ||||
<condition property="aspectj.tools.modules" | <condition property="aspectj.tools.modules" |
</antcall> | </antcall> | ||||
</target> | </target> | ||||
<target name="ajbrowser-all" > | |||||
<build-module-all module="ajbrowser"/> | |||||
</target> | |||||
<target name="ajdoc-all"> | <target name="ajdoc-all"> | ||||
<build-module-all module="ajdoc"/> | <build-module-all module="ajdoc"/> | ||||
</target> | </target> |
<body> | <body> | ||||
<p>The automatic installation process is complete. | |||||
<p>The automatic installation process is complete. | |||||
We recommend you complete the installation as follows:</p> | We recommend you complete the installation as follows:</p> | ||||
<ol> | <ol> | ||||
<li>Add <b><code>${installer.output.aspectjrt}</code></b> | |||||
<li>Add <b><code>${installer.output.aspectjrt}</code></b> | |||||
to your CLASSPATH. | to your CLASSPATH. | ||||
This small .jar file contains classes required by any | |||||
This small .jar file contains classes required by any | |||||
program compiled with the ajc compiler. | program compiled with the ajc compiler. | ||||
</li> | </li> | ||||
<li>Modify your PATH to include | |||||
<li>Modify your PATH to include | |||||
<code> <b>${installer.output.dir.bin}</b></code>. | <code> <b>${installer.output.dir.bin}</b></code>. | ||||
This will make it easier to run ajc and ajbrowser. | |||||
This will make it easier to run ajc. | |||||
</li> | </li> | ||||
</ol> | </ol> | ||||
LaunchScriptMaker lsm = new LaunchScriptMaker(context); | LaunchScriptMaker lsm = new LaunchScriptMaker(context); | ||||
lsm.writeScript("ajc"); | lsm.writeScript("ajc"); | ||||
lsm.writeScript("ajdoc"); | lsm.writeScript("ajdoc"); | ||||
//lsm.writeScript("ajdb"); | |||||
lsm.writeScript("ajbrowser"); | |||||
// Moved to the bin dir in 1.2.1 | // Moved to the bin dir in 1.2.1 | ||||
// we should now come back and make the generation of this | // we should now come back and make the generation of this |
<body> | <body> | ||||
<p>The automatic installation process is complete. | |||||
<p>The automatic installation process is complete. | |||||
We recommend you complete the installation as follows:</p> | We recommend you complete the installation as follows:</p> | ||||
<ol> | <ol> | ||||
<li>Add <b><code>${installer.output.aspectjrt}</code></b> | |||||
<li>Add <b><code>${installer.output.aspectjrt}</code></b> | |||||
to your CLASSPATH. | to your CLASSPATH. | ||||
This small .jar file contains classes required by any | |||||
This small .jar file contains classes required by any | |||||
program compiled with the ajc compiler. | program compiled with the ajc compiler. | ||||
</li> | </li> | ||||
<li>Modify your PATH to include | |||||
<li>Modify your PATH to include | |||||
<code> <b>${installer.output.dir.bin}</b></code>. | <code> <b>${installer.output.dir.bin}</b></code>. | ||||
This will make it easier to run ajc and ajbrowser. | |||||
This will make it easier to run ajc. | |||||
</li> | </li> | ||||
</ol> | </ol> | ||||
fail("" + UnknownFileCheck.STATIC_ERRORS); | fail("" + UnknownFileCheck.STATIC_ERRORS); | ||||
} | } | ||||
} | } | ||||
public void testLicense_ajbrowser() { | |||||
checkLicense("ajbrowser"); | |||||
} | |||||
public void testLicense_ajde() { | public void testLicense_ajde() { | ||||
checkLicense("ajde"); | checkLicense("ajde"); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
private static final String[] SKIPS | private static final String[] SKIPS | ||||
//= {}; | //= {}; | ||||
= {"aspectjtools", "ajdoc", "aspectj5rt", "run-all-junit-tests", | = {"aspectjtools", "ajdoc", "aspectj5rt", "run-all-junit-tests", | ||||
"ajbrowser", "testing", "testing-drivers", "org.aspectj.ajdt.core", "weaver"}; | |||||
"testing", "testing-drivers", "org.aspectj.ajdt.core", "weaver"}; | |||||
private static final String SKIP_MESSAGE = | private static final String SKIP_MESSAGE = | ||||
"BuildModuleTest: Define \"run.build.tests\" as a system " | "BuildModuleTest: Define \"run.build.tests\" as a system " | ||||
fail(dupError); | fail(dupError); | ||||
} | } | ||||
} | } | ||||
public void testAjbrowser() { | |||||
checkBuild("ajbrowser", | |||||
"org.aspectj.tools.ajbrowser.Main", | |||||
new String[] {"-noExit", "-version"}); // compiler version | |||||
} | |||||
public void testTestingUtils() { | public void testTestingUtils() { | ||||
checkBuild("testing-util"); | checkBuild("testing-util"); | ||||
} | } |
static { | static { | ||||
String[] names = { | String[] names = { | ||||
"ajbrowser", "ajde", "ajdoc", "asm", | |||||
"ajde", "ajdoc", "asm", | |||||
"bridge", "loadtime", "org.aspectj.ajdt.core", | "bridge", "loadtime", "org.aspectj.ajdt.core", | ||||
"runtime", "taskdefs", "testing-client", "testing-util", | "runtime", "taskdefs", "testing-client", "testing-util", | ||||
"tests", "util", "weaver"}; | "tests", "util", "weaver"}; |
<chapter id="ajbrowser" xreflabel="AspectJ Browser"> | |||||
<title>AspectJ Browser</title> | |||||
<sect1 id="ajbrowser-intro"> | |||||
<title>Introduction</title> | |||||
<para> | |||||
AJBrowser presents a GUI for compiling programs with ajc | |||||
and navigating crosscutting structure. | |||||
</para> | |||||
<para> | |||||
The AspectJ Browser can edit program source files, | |||||
compile using the AspectJ compiler <literal>ajc</literal> | |||||
run a program, | |||||
and graphically navigate the program's | |||||
crosscutting structure. | |||||
For more information on <literal>ajc</literal>, | |||||
see <xref linkend="ajc-ref"/>. | |||||
</para> | |||||
<para> | |||||
Launch the browser from the command line either | |||||
by typing "ajbrowser" to invoke the script in | |||||
<literal>{aspectj}/bin</literal> | |||||
(if AspectJ is installed correctly) | |||||
or by using the | |||||
<literal>aspectjtools.jar</literal> directly, | |||||
and specifying no arguments or some number of | |||||
build configuration files | |||||
(suffix <literal>.lst</literal>): | |||||
<programlisting> | |||||
java -jar aspectj1.1/lib/aspectjtools.jar aspectj1.1/doc/examples/spacewar/debug.lst | |||||
</programlisting> | |||||
</para> | |||||
</sect1> | |||||
<sect1 id="ajbrowser-building"> | |||||
<title>Building Programs</title> | |||||
<sect2 id="build-configurations" xreflabel="build-configurations"> | |||||
<title>Build Configurations</title> | |||||
<para>A build configuration is a set of files to compile for a | |||||
program (and optionally some additional compile arguments). | |||||
Because <literal>ajc</literal> requires all sources to be specified | |||||
(at least using the <literal>-sourceroots</literal> option), | |||||
most users create <literal>.lst</literal> files that list | |||||
the files to compile (one argument per line, globbing | |||||
permitted - for more details, see <xref linkend="ajc-ref"/>). | |||||
</para> | |||||
<para> | |||||
To work with a particular program, select the | |||||
corresponding ".lst" build configuration file | |||||
from the GUI using the File menu, "open" item, | |||||
or by using the | |||||
"Open Build Configuration" button | |||||
(<inlinemediaobject> | |||||
<imageobject> | |||||
<imagedata fileref="openConfig.gif"/> | |||||
</imageobject> | |||||
</inlinemediaobject>). | |||||
You can populate the build list from the command line | |||||
by passing any number of ".lst" paths. | |||||
(However, if you pass in any non-".lst" arguments, | |||||
it will run the command-line compiler directly.) | |||||
</para> | |||||
<para> | |||||
To switch between build configurations, | |||||
select, add, or remove them | |||||
using the corresponding toolbar buttons. | |||||
</para> | |||||
<para>Global build options are stored in an | |||||
<literal>.ajbrowser</literal> file in your HOME directory. | |||||
Edit these from the GUI by clicking the "Options" button | |||||
or selecting the Tools menu item "Options...". | |||||
This is how to set classpath, aspectpath, etc. | |||||
</para> | |||||
<para>The following sections walk through a build. | |||||
</para> | |||||
</sect2> | |||||
<sect2 id="compiling-a-program-build-configuration" xreflabel="compiling-a-program-build-configuration"> | |||||
<title>Compiling a Program Build Configuration</title> | |||||
<para> | |||||
To compile click the "Build" button | |||||
(<inlinemediaobject> | |||||
<imageobject> | |||||
<imagedata fileref="build.gif"/> | |||||
</imageobject> | |||||
</inlinemediaobject>), or | |||||
or use the tools menu. | |||||
</para> | |||||
<!-- | |||||
<para>To build using AspectJ 1.1's incremental mode, | |||||
click the <literal>incremental compile</literal> checkbox in | |||||
the <literal>AspectJ Build Options</literal> tab | |||||
of the <literal>Options</literal> dialog. | |||||
Once in incremental mode, you can force a full rebuild | |||||
by holding the shift key down when selecting the | |||||
build menu item or button. | |||||
</para> | |||||
--> | |||||
<para> | |||||
You may select | |||||
from different build configurations in the GUI | |||||
(see label 1 in the graphic below). | |||||
(If you get classpath or other errors, set up the | |||||
global build options as described above.) | |||||
</para> | |||||
<para> | |||||
<inlinemediaobject> | |||||
<imageobject> | |||||
<imagedata fileref="ajbrowser-building.gif"/> | |||||
</imageobject> | |||||
</inlinemediaobject> | |||||
</para> | |||||
</sect2> | |||||
</sect1> | |||||
<sect1 id="ajbrowser-navigating"> | |||||
<title>Navigating Program Structure</title> | |||||
<para> | |||||
Select nodes in the program structure by clicking them (see label 2). | |||||
If one node is related to one or more other nodes by an association the | |||||
name of the association will appear below that node and will be | |||||
displayed in italics. Links to other structure nodes appear in blue | |||||
below the association. If there is no corresponding source for the | |||||
link it will appear light-blue. | |||||
</para> | |||||
<para> | |||||
<inlinemediaobject> | |||||
<imageobject> | |||||
<imagedata fileref="ajbrowser-building.gif"/> | |||||
</imageobject> | |||||
</inlinemediaobject> | |||||
</para> | |||||
<sect2 id="example" xreflabel="example"> | |||||
<title>Example: Exploring the "Spacewar" sample code </title> | |||||
<para> | |||||
<itemizedlist> | |||||
<listitem> <para>Launch <literal>ajbrowser</literal></para> | |||||
</listitem> | |||||
<listitem> <para>Choose "File -> Open" or click the "Open Build | |||||
Configuration" button | |||||
(<inlinemediaobject> | |||||
<imageobject> | |||||
<imagedata fileref="openConfig.gif"/> | |||||
</imageobject> | |||||
</inlinemediaobject>) and select the configuration file for debugging | |||||
the spacewar example, in | |||||
<literal>examples/spacewar/debug.lst</literal>.</para> | |||||
</listitem> | |||||
<listitem> <para>Click the "Build" button (<inlinemediaobject> | |||||
<imageobject> | |||||
<imagedata fileref="build.gif"/> | |||||
</imageobject> | |||||
</inlinemediaobject>) to | |||||
compile. The left pane should fill with a spacewar declaration | |||||
tree. If there is a compiler error, the clickable error message | |||||
shows up as in label 4. | |||||
</para> | |||||
<para>Note: If you did not set up your classpath, the | |||||
compile will fail with a message that you need to install | |||||
aspectjrt.jar on your compile classpath. To do that, select "Tools | |||||
-> Options" or click the "Options" button | |||||
(<inlinemediaobject> | |||||
<imageobject> | |||||
<imagedata fileref="browseroptions.gif"/> | |||||
</imageobject> | |||||
</inlinemediaobject>). Click the <literal>Build Options</literal> tab | |||||
to view the Build Paths pane. Edit the classpath entry to use your | |||||
install location. For example, if you ran from the base Aspectj | |||||
directory, the classpath need only include | |||||
<literal>lib/aspectjrt.jar</literal> (though the browser may populate | |||||
the classpath with the bootclasspath and classpath initially.) | |||||
Be sure to use the | |||||
<literal>lib/aspectjrt.jar</literal> that came with the browser. | |||||
</para> | |||||
<para> | |||||
<inlinemediaobject> | |||||
<imageobject> | |||||
<imagedata fileref="ajbrowser-options.gif"/> | |||||
</imageobject> | |||||
</inlinemediaobject> | |||||
</para> | |||||
</listitem> | |||||
<listitem> <para>Different structure views: The structure tree at the | |||||
left can display different orderings and granularity for structure: | |||||
<itemizedlist> | |||||
<listitem><para>The package hierarchy view shows the traditional hierarchy | |||||
of package, class, and members.</para></listitem> | |||||
<listitem><para>The inheritance view shows the hierarchy from topmost | |||||
parent classes through subclasses to members.</para></listitem> | |||||
<listitem><para>The crosscutting view shows the aspect members | |||||
and the code they affect.</para></listitem> | |||||
<listitem><para>Additional buttons in the pane can be used to change the | |||||
granularity and filter out items.</para> | |||||
</listitem> | |||||
</itemizedlist> | |||||
</para> | |||||
<para>Whenever you select an item in the tree view, the | |||||
source pane scrolls to that item. If you select a leaf item | |||||
representing another program element, then the tree | |||||
selection will go to the corresponding node. (See below for | |||||
how to use two panes to maintain your place.) | |||||
</para> | |||||
</listitem> | |||||
<listitem> | |||||
<para>When working with aspects, it helps to be able to navigate | |||||
between different program elements: | |||||
</para> | |||||
<itemizedlist> | |||||
<listitem><para>When looking at a method, find the advice that | |||||
affects it. </para></listitem> | |||||
<listitem><para>When looking at a pointcut, find the advice that | |||||
uses it. </para></listitem> | |||||
<listitem><para>When looking at advice, find what it advises - | |||||
e.g., method calls or executions, initializers, etc. | |||||
</para></listitem> | |||||
<listitem><para>When looking at a type, find any aspects that | |||||
declare members or supertypes of the type, or | |||||
vice-versa. | |||||
</para></listitem> | |||||
</itemizedlist> | |||||
<para>You can view the advice on a particular method using the | |||||
default, hierarchical view. Navigate to the tree item for | |||||
<literal>spacewar.Registry.register(SpaceObject)</literal> | |||||
in the <literal>debug.lst</literal> config file. Now, in | |||||
the lower, file view, you can see and navigate to the advice | |||||
using the subtree whose parent is the <literal>method | |||||
affected by</literal> relation. | |||||
</para> | |||||
<para>You can also use crosscutting view to see the | |||||
advice using a pointcut or the methods affected by advice. | |||||
For example, to see what advice uses a particular pointcut, | |||||
navigate to the tree item for the pointcut | |||||
<literal>spacewar.Debug.allConstructorsCut()</literal> in | |||||
the <literal>debug.lst</literal> config file. You can see | |||||
and navigate to the advice that uses the pointcut using the | |||||
<literal>pointcut used by</literal> relation. | |||||
</para> | |||||
<para>As an example of seeing the methods affected by advice, | |||||
while still in the same view, select the first | |||||
<literal>before</literal> advice in | |||||
<literal>spacewar.Debug</literal>. It has relation | |||||
sub-trees for both <literal>uses pointcut</literal> and | |||||
<literal>affects constructions</literal>. The | |||||
<literal>affects</literal> relations will list different | |||||
kinds of join points - constructor or method calls, etc. | |||||
</para> | |||||
<para>Note that the AspectJ browser can only display | |||||
static structure (whether hierarchical or crosscutting). | |||||
That means that dynamicly-determined pointcuts (like | |||||
<literal>cflow(pointcut)</literal>) | |||||
will not be shown as picking out static points in | |||||
source code. Displayable pointcuts roughly correspond | |||||
to those that can be used in a | |||||
<literal>declare error</literal> statement. | |||||
</para> | |||||
</listitem> | |||||
</itemizedlist> | |||||
</para> | |||||
</sect2> | |||||
</sect1> | |||||
<sect1 id="ajbrowser-running"> | |||||
<title>Running Programs</title> | |||||
<para> | |||||
The browser supports a limited form of running compiled programs. | |||||
To run programs that have been built, click the run button | |||||
or select one of the run menu items in the project menu. | |||||
You can run in the same VM or spawn a new process; | |||||
the latter is generally better for GUI programs. | |||||
</para> | |||||
<para>Both require that any classpath you set be specified | |||||
using platform-specific paths and path separators (the | |||||
compiler might be more tolerant). | |||||
Output and error streams will be | |||||
merged into the streams of the browser (using separate | |||||
threads, so it may take a few seconds for the pipe | |||||
threads to gain control.) Errors should | |||||
be detected and displayed in a dialog. | |||||
</para> | |||||
<para> | |||||
The GUI does not support killing a running program, | |||||
so if your program might hang, | |||||
be sure to save your files since you may need to | |||||
kill the browser itself to kill its child processes. | |||||
</para> | |||||
</sect1> | |||||
<sect1 id="ajbrowser-problems"> | |||||
<title>Isolating problems running the AspectJ browser</title> | |||||
<para> | |||||
If you have problems with the browser not solved by the documentation, | |||||
please try to see if you have the same problems when running ajc | |||||
directly on the command line. | |||||
</para> | |||||
<itemizedlist> | |||||
<listitem><para> | |||||
If the problem occurs on the command line also, then the problem | |||||
is not in the browser. | |||||
(It may be in the compiler; please send bug reports.) | |||||
</para></listitem> | |||||
<listitem><para> | |||||
If the problem does not occur on the command line, then it may | |||||
lie in the parameters you are supplying in the build options. | |||||
</para></listitem> | |||||
<listitem><para> | |||||
If the build options look correct and the problem only occurs | |||||
when building from the browser, then please submit a bug report. | |||||
</para></listitem> | |||||
</itemizedlist> | |||||
<sect2 id="ajbrowser-knownProblems"> | |||||
<title>Known issues with the AspectJ browser</title> | |||||
<para> | |||||
For the most up-to-date information on known problems, | |||||
see the | |||||
<ulink url="http://bugs.eclipse.org/bugs">bug database</ulink> | |||||
for unresolved | |||||
<ulink url="http://bugs.eclipse.org/bugs/buglist.cgi?&product=AspectJ&component=Compiler&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED"> | |||||
compiler bugs | |||||
</ulink> or | |||||
<ulink url="http://bugs.eclipse.org/bugs/buglist.cgi?&product=AspectJ&component=IDE&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED"> | |||||
IDE bugs | |||||
</ulink>. | |||||
</para> | |||||
<para> | |||||
<itemizedlist> | |||||
<listitem><para> | |||||
Memory and forking: Users email most about the browser task running | |||||
out of memory. | |||||
This is not a problem with the browser; some compiles take a lot of | |||||
memory, often more than similar compiles using javac. | |||||
The browser does not support forking, so the only solution is to | |||||
edit the java command line or script that launches the browser | |||||
to add memory. | |||||
</para></listitem> | |||||
<listitem><para> | |||||
Editing build configuration files: this is not currently supported. | |||||
</para></listitem> | |||||
<listitem><para> | |||||
The structure model is incomplete after incremental compiles. | |||||
To get a complete structure model requires a full build. | |||||
</para></listitem> | |||||
<listitem><para> | |||||
If you change the output directory, you must do a | |||||
full build. | |||||
</para></listitem> | |||||
</itemizedlist> | |||||
</para> | |||||
</sect2> | |||||
<sect2 id="ajbrowser-limitations"> | |||||
<title>Limitations</title> | |||||
<para> | |||||
<itemizedlist> | |||||
<listitem><para> | |||||
The AJBrowser expects the package and directory structure to match. If they do not | |||||
it will be unable to browse to the corresponding file. | |||||
</para></listitem> | |||||
<listitem><para> | |||||
The "Run" feature launches applications in the same VM. As a result, if a Swing application | |||||
is disposed the AJBrowser will be disposed as well. | |||||
</para></listitem> | |||||
</itemizedlist> | |||||
</para> | |||||
</sect2> | |||||
<sect2 id="ajbrowser-feedback"> | |||||
<title>AspectJ Browser questions and bugs</title> | |||||
<para> | |||||
You can send email to | |||||
<ulink url="mailto:aspectj-users@dev.eclipse.org"> | |||||
aspectj-users@dev.eclipse.org</ulink>. | |||||
(Do join the list to participate!) | |||||
We also welcome any bug reports, patches, and feature requests; | |||||
you can submit them to the bug database at | |||||
<ulink url="http://bugs.eclipse.org/bugs"> | |||||
http://bugs.eclipse.org/bugs</ulink> | |||||
using the AspectJ product and IDE component. | |||||
</para> | |||||
</sect2> | |||||
</sect1> | |||||
</chapter> | |||||
<!-- Local variables: --> | |||||
<!-- fill-column: 79 --> | |||||
<!-- sgml-local-ecat-files: devguide.ced --> | |||||
<!-- sgml-parent-document:("devguide.sgml" "book" "refentry") --> | |||||
<!-- End: --> | |||||
<para> | <para> | ||||
To run the project select "Run Project" from the AspectJ toolbar, or | To run the project select "Run Project" from the AspectJ toolbar, or | ||||
click <ctrl>F12 while the editor pane is active. Note that the | click <ctrl>F12 while the editor pane is active. Note that the | ||||
"AspectJ Runtime" library must be added to your project in order to | |||||
run. If the library is not added you will see a "java.lang.NoClassDefFoundError: org/aspectj/lang/Signature" error. The library is created automatically for you from the runtime | |||||
"AspectJ Runtime" library must be added to your project in order to | |||||
run. If the library is not added you will see a | |||||
"java.lang.NoClassDefFoundError: org/aspectj/lang/Signature" error. | |||||
The library is created automatically for you from the runtime | |||||
in "jbuilderdir/lib/ext". You can also create a new library | in "jbuilderdir/lib/ext". You can also create a new library | ||||
to use the runtime from a different location. If you have not added the | |||||
to use the runtime from a different location. If you have not added the | |||||
library to the "Required Libraries" of your project it will be added | library to the "Required Libraries" of your project it will be added | ||||
automatically when you restart JBuilder. | automatically when you restart JBuilder. | ||||
</para> | </para> | ||||
<para> | <para> | ||||
JBuilder7 users please note: when you set up a run/debug configuration | |||||
you must select the "Build Target" (at the bottom of the | |||||
"Runtime Properties" dialog) to be "<None>". This will ensure | |||||
that the Java compiler is not invoked on your AspectJ sources | |||||
JBuilder7 users please note: when you set up a run/debug configuration | |||||
you must select the "Build Target" (at the bottom of the | |||||
"Runtime Properties" dialog) to be "<None>". This will ensure | |||||
that the Java compiler is not invoked on your AspectJ sources | |||||
before running or debugging the project. | before running or debugging the project. | ||||
</para> | </para> | ||||
</refsect1> | </refsect1> | ||||
<imagedata fileref="jbuilder-structureNavigation.gif" /> | <imagedata fileref="jbuilder-structureNavigation.gif" /> | ||||
</imageobject> | </imageobject> | ||||
<para> | <para> | ||||
Navigation of program structure is provided by the <xref linkend="ajbrowser">AspectJ Browser</xref>, so apart from a JBuilder | |||||
Navigation of program structure is provided by the AspectJ Browser, so apart from a JBuilder | |||||
look and feel, the extra navigation AspectJ allows work as described | look and feel, the extra navigation AspectJ allows work as described | ||||
there. In particular, you can use views with labels 1, 2 and 4 of the | there. In particular, you can use views with labels 1, 2 and 4 of the | ||||
second screenshot to navigate structure using the blue links, and you | second screenshot to navigate structure using the blue links, and you | ||||
<title>Manipulating Build Configurations</title> | <title>Manipulating Build Configurations</title> | ||||
<para> | <para> | ||||
Build configurations can be manipulated adding, removing, and | Build configurations can be manipulated adding, removing, and | ||||
editing build configuration files. The <xref linkend="ajbrowser">AspectJ Browser</xref> is used to select the | |||||
editing build configuration files. The AspectJ Browser is used to select the | |||||
current build configuration. Configurations are represented by | current build configuration. Configurations are represented by | ||||
".lst" files which are described in the <xref linkend="ajc">ajc</xref> documentation. | ".lst" files which are described in the <xref linkend="ajc">ajc</xref> documentation. | ||||
</para> | </para> |
<!ENTITY ajc SYSTEM "ajc.xml"> | <!ENTITY ajc SYSTEM "ajc.xml"> | ||||
<!ENTITY ajdoc SYSTEM "ajdoc.xml"> | <!ENTITY ajdoc SYSTEM "ajdoc.xml"> | ||||
<!ENTITY antsupport SYSTEM "antsupport.xml"> | <!ENTITY antsupport SYSTEM "antsupport.xml"> | ||||
<!ENTITY ajbrowser SYSTEM "ajbrowser.xml"> | |||||
<!ENTITY compatibility SYSTEM "compatibility.xml"> | <!ENTITY compatibility SYSTEM "compatibility.xml"> | ||||
<!ENTITY ltw SYSTEM "ltw.xml"> | <!ENTITY ltw SYSTEM "ltw.xml"> | ||||
<!ENTITY tools-intro SYSTEM "tools-intro.xml"> | <!ENTITY tools-intro SYSTEM "tools-intro.xml"> | ||||
</authorgroup> | </authorgroup> | ||||
<legalnotice> | <legalnotice> | ||||
<para>Copyright (c) 1998-2001 Xerox Corporation, | |||||
<para>Copyright (c) 1998-2001 Xerox Corporation, | |||||
2002 Palo Alto Research Center, Incorporated, | 2002 Palo Alto Research Center, Incorporated, | ||||
2003-2005 Contributors. | |||||
2003-2005 Contributors. | |||||
All rights reserved. | All rights reserved. | ||||
</para> | </para> | ||||
</legalnotice> | </legalnotice> | ||||
<abstract> | <abstract> | ||||
<para> | <para> | ||||
This guide describes how to build and deploy AspectJ programs | This guide describes how to build and deploy AspectJ programs | ||||
using the AspectJ tools and facilities. See also | |||||
using the AspectJ tools and facilities. See also | |||||
<ulink url="../progguide/index.html">The | <ulink url="../progguide/index.html">The | ||||
AspectJ Programming Guide</ulink>, | |||||
AspectJ Programming Guide</ulink>, | |||||
the documentation available with the AspectJ support available for | the documentation available with the AspectJ support available for | ||||
various integrated development environments (e.g., | |||||
<ulink url="http://eclipse.org/ajdt">Eclipse AJDT</ulink>), | |||||
and the most-recent documentation available from | |||||
various integrated development environments (e.g., | |||||
<ulink url="http://eclipse.org/ajdt">Eclipse AJDT</ulink>), | |||||
and the most-recent documentation available from | |||||
the AspectJ project page, at | the AspectJ project page, at | ||||
<ulink url="http://eclipse.org/aspectj"> | <ulink url="http://eclipse.org/aspectj"> | ||||
http://eclipse.org/aspectj</ulink>. | http://eclipse.org/aspectj</ulink>. | ||||
<chapter id="command-line-tools" xreflabel="AspectJ command-line tools"> | <chapter id="command-line-tools" xreflabel="AspectJ command-line tools"> | ||||
<title>AspectJ command-line tools</title> | <title>AspectJ command-line tools</title> | ||||
<sect1 id="ajc-ref-top"> | <sect1 id="ajc-ref-top"> | ||||
<title><literal>ajc</literal>, the AspectJ compiler/weaver</title> | <title><literal>ajc</literal>, the AspectJ compiler/weaver</title> | ||||
&ajc; | |||||
&ajc; | |||||
</sect1> | </sect1> | ||||
<sect1 id="ajdoc-ref-top"> | <sect1 id="ajdoc-ref-top"> | ||||
<title><literal>ajdoc</literal>, the AspectJ documentation tool</title> | <title><literal>ajdoc</literal>, the AspectJ documentation tool</title> | ||||
<para><literal>ajdoc</literal> produces JavaDoc-style documentation | <para><literal>ajdoc</literal> produces JavaDoc-style documentation | ||||
including crosscutting information.</para> | including crosscutting information.</para> | ||||
&ajdoc; | |||||
&ajdoc; | |||||
</sect1> | </sect1> | ||||
<sect1 id="aj-ref-top"> | <sect1 id="aj-ref-top"> | ||||
<title><literal>aj</literal>, the AspectJ load-time weaving script</title> | <title><literal>aj</literal>, the AspectJ load-time weaving script</title> | ||||
<para><literal>aj</literal> launches programs, | <para><literal>aj</literal> launches programs, | ||||
configuring basic load-time weaving.</para> | configuring basic load-time weaving.</para> | ||||
&aj; | |||||
&aj; | |||||
</sect1> | </sect1> | ||||
</chapter> | </chapter> | ||||
&ajbrowser; | |||||
&antsupport; | &antsupport; | ||||
<w; | <w; | ||||
&compatibility; | &compatibility; | ||||
</book> | </book> | ||||
<chapter id="tools-intro" | |||||
<chapter id="tools-intro" | |||||
xreflabel="Introduction to the AspectJ tools"> | xreflabel="Introduction to the AspectJ tools"> | ||||
<title>Introduction to the AspectJ tools</title> | <title>Introduction to the AspectJ tools</title> | ||||
<sect1 | |||||
<sect1 | |||||
id="eclipse-aspectj" | id="eclipse-aspectj" | ||||
xreflabel="The Eclipse AspectJ implementation"> | xreflabel="The Eclipse AspectJ implementation"> | ||||
<title>The Eclipse AspectJ implementation</title> | <title>The Eclipse AspectJ implementation</title> | ||||
<para>The <ulink url="../progguide/index.html">AspectJ Programming Guide</ulink> | <para>The <ulink url="../progguide/index.html">AspectJ Programming Guide</ulink> | ||||
describes the AspectJ language. This guide describes the AspectJ | describes the AspectJ language. This guide describes the AspectJ | ||||
tools produced by the AspectJ | tools produced by the AspectJ | ||||
team on | |||||
team on | |||||
<ulink url="http://eclipse.org/aspectj">http://eclipse.org/aspectj</ulink>. | <ulink url="http://eclipse.org/aspectj">http://eclipse.org/aspectj</ulink>. | ||||
The AspectJ tools include | The AspectJ tools include | ||||
- ajc, the compiler/weaver; | - ajc, the compiler/weaver; | ||||
classes. | classes. | ||||
</para> | </para> | ||||
<para> | <para> | ||||
Since AspectJ 1.1, the tools have implemented the AspectJ language | |||||
Since AspectJ 1.1, the tools have implemented the AspectJ language | |||||
using bytecode weaving, which combines aspects and classes to produce | using bytecode weaving, which combines aspects and classes to produce | ||||
.class files that run in a Java VM. There are other ways to implement the | .class files that run in a Java VM. There are other ways to implement the | ||||
language (e.g., compiler preprocessor, VM support); the AspectJ team | language (e.g., compiler preprocessor, VM support); the AspectJ team | ||||
has always tried to distinguish the language and the implementation | has always tried to distinguish the language and the implementation | ||||
so other groups could build alternative implementations of AspectJ. | so other groups could build alternative implementations of AspectJ. | ||||
To that end, | To that end, | ||||
<ulink url="../progguide/implementation.html">The AspectJ Programming Guide, | <ulink url="../progguide/implementation.html">The AspectJ Programming Guide, | ||||
Implementation Notes</ulink> describes how the Java bytecode form affects | Implementation Notes</ulink> describes how the Java bytecode form affects | ||||
language semantics. VM- or source-based implementations may be free | language semantics. VM- or source-based implementations may be free | ||||
of these limits or impose limits of their own, but most should be | of these limits or impose limits of their own, but most should be | ||||
fairly close to what's possible in Java bytecode. | fairly close to what's possible in Java bytecode. | ||||
</para> | </para> | ||||
<para> | |||||
<para> | |||||
Please be careful not to confuse any description of | Please be careful not to confuse any description of | ||||
weaving or of this implementation of the AspectJ language with | weaving or of this implementation of the AspectJ language with | ||||
the AspectJ language semantics. | the AspectJ language semantics. | ||||
If you do, you might find yourself writing code that doesn't work as | If you do, you might find yourself writing code that doesn't work as | ||||
expected when you compile or run it on other systems. | |||||
expected when you compile or run it on other systems. | |||||
More importantly, if you | More importantly, if you | ||||
think about aspects in terms of weaving or of inserting or merging | think about aspects in terms of weaving or of inserting or merging | ||||
code, then you can lose many of the design benefits of thinking | code, then you can lose many of the design benefits of thinking | ||||
about an aspect as a single crosscutting module. | |||||
about an aspect as a single crosscutting module. | |||||
When the text below introduces an implementation detail, it will warn if | When the text below introduces an implementation detail, it will warn if | ||||
users make mistakes by applying it in lieu of the language semantics. | users make mistakes by applying it in lieu of the language semantics. | ||||
</para> | </para> | ||||
</sect1> | </sect1> | ||||
<!-- graphic for bytecode weaving --> | <!-- graphic for bytecode weaving --> | ||||
<sect1 | |||||
<sect1 | |||||
id="bytecode-concepts" | id="bytecode-concepts" | ||||
xreflabel="Bytecode weaving, incremental compilation, and memory usage"> | xreflabel="Bytecode weaving, incremental compilation, and memory usage"> | ||||
<title>Bytecode weaving, incremental compilation, and memory usage</title> | <title>Bytecode weaving, incremental compilation, and memory usage</title> | ||||
<para>Bytecode weaving takes classes and aspects in .class form | <para>Bytecode weaving takes classes and aspects in .class form | ||||
and weaves them together to produce binary-compatible .class files that | |||||
and weaves them together to produce binary-compatible .class files that | |||||
run in any Java VM and implement the AspectJ semantics. | run in any Java VM and implement the AspectJ semantics. | ||||
This process supports not only the compiler but also IDE's. | This process supports not only the compiler but also IDE's. | ||||
The compiler, given an aspect in source form, produces a binary | The compiler, given an aspect in source form, produces a binary | ||||
aspect and runs the weaver. IDE's can get information about | aspect and runs the weaver. IDE's can get information about | ||||
crosscutting in the program by subscribing to information | |||||
crosscutting in the program by subscribing to information | |||||
produced by weaver as a side-effect of weaving. | produced by weaver as a side-effect of weaving. | ||||
</para> | </para> | ||||
<para>Incremental compilation involves recompiling only what is necessary | <para>Incremental compilation involves recompiling only what is necessary | ||||
Incremental weaving supports this by weaving on a per-class basis. | Incremental weaving supports this by weaving on a per-class basis. | ||||
(Some implementations of AOP (including AspectJ 1.0) make use | (Some implementations of AOP (including AspectJ 1.0) make use | ||||
of whole-program analysis that can't be done in incremental mode.) | of whole-program analysis that can't be done in incremental mode.) | ||||
Weaving per-class means that if the source for a pure Java class | |||||
Weaving per-class means that if the source for a pure Java class | |||||
is updated, only that class needs to be produced. However, if | is updated, only that class needs to be produced. However, if | ||||
some crosscutting specification may have been updated, then all | some crosscutting specification may have been updated, then all | ||||
code potentially affected by it may need to be woven. The AspectJ | code potentially affected by it may need to be woven. The AspectJ | ||||
(While it may seem like more memory, the proper comparison | (While it may seem like more memory, the proper comparison | ||||
would with with a Java program that had the same crosscutting, | would with with a Java program that had the same crosscutting, | ||||
with changes made to each code segment. That would likely require | with changes made to each code segment. That would likely require | ||||
more memory and more time to recompile than the corresponding | |||||
more memory and more time to recompile than the corresponding | |||||
AspectJ program.) | AspectJ program.) | ||||
</para> | </para> | ||||
<sect2 | |||||
<sect2 | |||||
id="classpathInpathAndAspectpath" | id="classpathInpathAndAspectpath" | ||||
xreflabel="Classpath, inpath, and aspectpath"> | xreflabel="Classpath, inpath, and aspectpath"> | ||||
<title>Classpath, inpath, and aspectpath</title> | <title>Classpath, inpath, and aspectpath</title> | ||||
<para>AspectJ introduces two new paths for the binary input to the | <para>AspectJ introduces two new paths for the binary input to the | ||||
weaver which you'll find referenced in <xref linkend="ajc-ref"/>, | weaver which you'll find referenced in <xref linkend="ajc-ref"/>, | ||||
<xref linkend="ajbrowser"/>, | |||||
<xref linkend="antTasks"/>, | <xref linkend="antTasks"/>, | ||||
and <xref linkend="ltw"/>. | and <xref linkend="ltw"/>. | ||||
</para> | </para> | ||||
</para> | </para> | ||||
<para> | <para> | ||||
In AspectJ tools, the <literal>aspectpath</literal> is where to find binary | In AspectJ tools, the <literal>aspectpath</literal> is where to find binary | ||||
aspects. Like the classpath, it can include archives (.jar and .zip files) | |||||
and directories containing .class files in a package layout (since | |||||
aspects. Like the classpath, it can include archives (.jar and .zip files) | |||||
and directories containing .class files in a package layout (since | |||||
binary aspects are in .class files). These aspects affect other | binary aspects are in .class files). These aspects affect other | ||||
classes in exactly the same way as source-level aspects, but are themselves | classes in exactly the same way as source-level aspects, but are themselves | ||||
not affected. When deploying programs, the original aspects must be included | |||||
not affected. When deploying programs, the original aspects must be included | |||||
on the runtime classpath. | on the runtime classpath. | ||||
</para> | </para> | ||||
<para> | <para> | ||||
In AspectJ tools, the <literal>inpath</literal> is where to find binary | In AspectJ tools, the <literal>inpath</literal> is where to find binary | ||||
input - aspects and classes that weave and may be woven. | |||||
Like the classpath, it can include archives and class directories. | |||||
input - aspects and classes that weave and may be woven. | |||||
Like the classpath, it can include archives and class directories. | |||||
Like the aspectpath, it can include aspects that affect other classes | Like the aspectpath, it can include aspects that affect other classes | ||||
and aspects. | and aspects. | ||||
However, unlike the aspectpath, an aspect on the inpath may itself be | However, unlike the aspectpath, an aspect on the inpath may itself be | ||||
affected by aspects, as if the source were all compiled together. | affected by aspects, as if the source were all compiled together. | ||||
When deploying aspects that were put on the inpath, only the woven output | |||||
When deploying aspects that were put on the inpath, only the woven output | |||||
should be on the runtime classpath. | should be on the runtime classpath. | ||||
</para> | </para> | ||||
<para> | <para> | ||||
Although types in the inpath and the aspectpath need to be resolved by | Although types in the inpath and the aspectpath need to be resolved by | ||||
the AspectJ tools, you usually do not need to place them on the classpath | the AspectJ tools, you usually do not need to place them on the classpath | ||||
because this is done automatically by the compiler/weaver. But when using | |||||
because this is done automatically by the compiler/weaver. But when using | |||||
the <literal>WeavingURLClassLoader</literal>, your code must explicitly add the aspects | the <literal>WeavingURLClassLoader</literal>, your code must explicitly add the aspects | ||||
to the classpath so they can be resolved (as you'll see in the sample | to the classpath so they can be resolved (as you'll see in the sample | ||||
code and the <literal>aj.bat</literal> script). | code and the <literal>aj.bat</literal> script). | ||||
weaving with binary aspects, users forget to deploy the aspect itself | weaving with binary aspects, users forget to deploy the aspect itself | ||||
along with any classes it requires. A more subtle mistake is putting a | along with any classes it requires. A more subtle mistake is putting a | ||||
binary aspect (BA) on the inpath instead of the aspectpath. In this case | binary aspect (BA) on the inpath instead of the aspectpath. In this case | ||||
the aspect BA might be affected by an aspect, even itself; this can | |||||
cause the program to fail, e.g., when an aspect uses exclusion to | |||||
the aspect BA might be affected by an aspect, even itself; this can | |||||
cause the program to fail, e.g., when an aspect uses exclusion to | |||||
avoid infinite recursion but fails to exclude advice in aspect BA. | avoid infinite recursion but fails to exclude advice in aspect BA. | ||||
</para> | </para> | ||||
<para>The latter is one of many ways that mistakes in the build process | <para>The latter is one of many ways that mistakes in the build process | ||||
can affect aspects that are written poorly. Aspects should never | can affect aspects that are written poorly. Aspects should never | ||||
rely on the boundaries of the build specification to narrow the | rely on the boundaries of the build specification to narrow the | ||||
scope of their crosscutting, since the build can be changed | |||||
scope of their crosscutting, since the build can be changed | |||||
without notice to the aspect developer. Careful users might even | without notice to the aspect developer. Careful users might even | ||||
avoid relying on the implementation scope, to ensure their | avoid relying on the implementation scope, to ensure their | ||||
AspectJ code will run on other implementations. | AspectJ code will run on other implementations. | ||||
</para> | </para> | ||||
</sect2> | </sect2> | ||||
</sect1> | </sect1> | ||||
</chapter> | |||||
</chapter> |
Please refer to the [AspectJ Development Environment Guide](https://www.eclipse.org/aspectj/doc/next/devguide/printable.html) | Please refer to the [AspectJ Development Environment Guide](https://www.eclipse.org/aspectj/doc/next/devguide/printable.html) | ||||
for more details about on-board AspectJ tools, such as _ajc_ (compiler), _ajdoc_ (aspect-enriched Javadoc), _aj_ | for more details about on-board AspectJ tools, such as _ajc_ (compiler), _ajdoc_ (aspect-enriched Javadoc), _aj_ | ||||
(load-time weaving helper), AspectJ Browser (simple visualisation tool for cross-cutting aspect structure) as well as | |||||
basic information about load-time weaving configuration and the built-in Ant task for AspectJ. | |||||
(load-time weaving helper) as well as basic information about load-time weaving configuration and the built-in Ant task | |||||
for AspectJ. | |||||
## IDE support | ## IDE support | ||||
feel free to download the **AspectJ installer**. It is and executable JAR installer. It requires Java and possibly admin | feel free to download the **AspectJ installer**. It is and executable JAR installer. It requires Java and possibly admin | ||||
rights, if e.g. under Windows you want to install AspectJ to _C:/Program Files/AspectJ_. You execute it from a command | rights, if e.g. under Windows you want to install AspectJ to _C:/Program Files/AspectJ_. You execute it from a command | ||||
prompt via `java -jar installer-<version>.jar` and select your installation options. Then you add `<ASPECTJ_HOME>/bin` | prompt via `java -jar installer-<version>.jar` and select your installation options. Then you add `<ASPECTJ_HOME>/bin` | ||||
to your path and are good to go. You can now call tools like the Aspectj compiler `ajc`, the AspectJ documentation | |||||
generator `ajdoc` (similar to Javadoc) or the AspectJ Browser `ajbrowser` from the command line. | |||||
to your path and are good to go. You can now call tools like the Aspectj compiler `ajc` or the AspectJ documentation | |||||
generator `ajdoc` (similar to Javadoc) from the command line. | |||||
You can find older installer versions until 1.9.6 on the [AspectJ website](https://www.eclipse.org/aspectj/downloads.php), | You can find older installer versions until 1.9.6 on the [AspectJ website](https://www.eclipse.org/aspectj/downloads.php), | ||||
more recent ones are attached to AspectJ [GitHub releases](https://github.com/eclipse/org.aspectj/releases) as | more recent ones are attached to AspectJ [GitHub releases](https://github.com/eclipse/org.aspectj/releases) as |
<title>AspectJ modules</title> | <title>AspectJ modules</title> | ||||
<STYLE TYPE="text/css"> | <STYLE TYPE="text/css"> | ||||
<!-- | <!-- | ||||
/* FOR THE SDA PAGE */ | /* FOR THE SDA PAGE */ | ||||
/* | /* | ||||
BODY {margin-top: 15px; margin-left: 15px; margin-right: 15px;} | BODY {margin-top: 15px; margin-left: 15px; margin-right: 15px;} | ||||
*/ | */ | ||||
A:hover { | A:hover { | ||||
color:red | color:red | ||||
} | } | ||||
INPUT {font:12px "Courier New", sans-serif;} | INPUT {font:12px "Courier New", sans-serif;} | ||||
H2 { | H2 { | ||||
font:18px/18px Verdana, Arial, Helvetica, sans-serif; | |||||
color:black; | |||||
font-weight:bold; | |||||
font:18px/18px Verdana, Arial, Helvetica, sans-serif; | |||||
color:black; | |||||
font-weight:bold; | |||||
margin-left: 10px; | margin-left: 10px; | ||||
line-height:110%; | |||||
line-height:110%; | |||||
} | } | ||||
H3 { | H3 { | ||||
font:18px/18px Verdana, Arial, Helvetica, sans-serif; | |||||
color:black; | |||||
font-weight:bold; | |||||
font:18px/18px Verdana, Arial, Helvetica, sans-serif; | |||||
color:black; | |||||
font-weight:bold; | |||||
margin-left: 10px; | margin-left: 10px; | ||||
line-height:110%; | |||||
line-height:110%; | |||||
} | } | ||||
H4 { | H4 { | ||||
font:15px/16px Verdana, Arial, Helvetica, sans-serif; | |||||
color:black; | |||||
font-weight:bold; | |||||
font:15px/16px Verdana, Arial, Helvetica, sans-serif; | |||||
color:black; | |||||
font-weight:bold; | |||||
margin-left: 10px; | margin-left: 10px; | ||||
line-height:140%; | line-height:140%; | ||||
} | } | ||||
P { | P { | ||||
font:13px/13px Verdana, Arial, Helvetica, sans-serif; | |||||
font:13px/13px Verdana, Arial, Helvetica, sans-serif; | |||||
margin-right: 10px; | margin-right: 10px; | ||||
margin-left: 10px; | margin-left: 10px; | ||||
line-height:130%; | |||||
line-height:130%; | |||||
} | } | ||||
.paragraph { | .paragraph { | ||||
font:13px/13px Verdana, Arial, Helvetica, sans-serif; | |||||
font:13px/13px Verdana, Arial, Helvetica, sans-serif; | |||||
margin-right: 10px; | margin-right: 10px; | ||||
margin-left: 10px; | margin-left: 10px; | ||||
line-height:130%; | |||||
line-height:130%; | |||||
} | } | ||||
.smallParagraph { | .smallParagraph { | ||||
font:11px/11px Verdana, Arial, Helvetica, sans-serif; | |||||
font:11px/11px Verdana, Arial, Helvetica, sans-serif; | |||||
margin-right: 10px; | margin-right: 10px; | ||||
margin-left: 10px; | margin-left: 10px; | ||||
line-height:130%; | |||||
line-height:130%; | |||||
} | } | ||||
LI { | LI { | ||||
font:13px/13px Verdana, Arial, Helvetica, sans-serif; | font:13px/13px Verdana, Arial, Helvetica, sans-serif; | ||||
text-align:justify; | |||||
text-align:justify; | |||||
margin-right: 10px; | margin-right: 10px; | ||||
margin-left: 15px; | margin-left: 15px; | ||||
line-height:120%; | |||||
line-height:120%; | |||||
} | } | ||||
/* | /* | ||||
UL { | UL { | ||||
font:13px/13px Verdana, Arial, Helvetica, sans-serif; | font:13px/13px Verdana, Arial, Helvetica, sans-serif; | ||||
text-align:justify; | |||||
text-align:justify; | |||||
margin-right: 10px; | margin-right: 10px; | ||||
margin-left: 15px; | margin-left: 15px; | ||||
line-height:120%; | |||||
line-height:120%; | |||||
}*/ | }*/ | ||||
DL { | DL { | ||||
font:13px/13px Verdana, Arial, Helvetica, sans-serif; | font:13px/13px Verdana, Arial, Helvetica, sans-serif; | ||||
text-align:justify; | |||||
text-align:justify; | |||||
margin-right: 10px; | margin-right: 10px; | ||||
margin-left: 15px; | margin-left: 15px; | ||||
line-height:120%; | |||||
line-height:120%; | |||||
} | } | ||||
B { font:13px/13px Verdana, Arial, Helvetica, sans-serif; | |||||
font-weight:bold; | |||||
B { font:13px/13px Verdana, Arial, Helvetica, sans-serif; | |||||
font-weight:bold; | |||||
line-height:140%; | line-height:140%; | ||||
} | } | ||||
.footer { | .footer { | ||||
font:10px/10px Verdana, Arial, Helvetica, sans-serif; | |||||
color:#888888; | |||||
font:10px/10px Verdana, Arial, Helvetica, sans-serif; | |||||
color:#888888; | |||||
text-align:left | text-align:left | ||||
} | } | ||||
.figureTitle { | .figureTitle { | ||||
font:13px/13px Verdana, Arial, Helvetica, sans-serif; | |||||
text-align:justify; | |||||
font:13px/13px Verdana, Arial, Helvetica, sans-serif; | |||||
text-align:justify; | |||||
text-align:center | text-align:center | ||||
} | } | ||||
.copyrightNotice { | .copyrightNotice { | ||||
font:10px/10px Verdana, Arial, Helvetica, sans-serif; | |||||
color:#999999; | |||||
font:10px/10px Verdana, Arial, Helvetica, sans-serif; | |||||
color:#999999; | |||||
line-height:110%; | line-height:110%; | ||||
} | } | ||||
.smallHeading { | .smallHeading { | ||||
font:13px/13px Verdana, Arial, Helvetica, sans-serif; | |||||
font:13px/13px Verdana, Arial, Helvetica, sans-serif; | |||||
font-weight:bold; | font-weight:bold; | ||||
line-height:110%; | line-height:110%; | ||||
} | } | ||||
.tinyHeading { | .tinyHeading { | ||||
font:11px/11px Verdana, Arial, Helvetica, sans-serif; | |||||
font:11px/11px Verdana, Arial, Helvetica, sans-serif; | |||||
font-weight:bold; | font-weight:bold; | ||||
line-height:120%; | line-height:120%; | ||||
} | } | ||||
.newsText { | .newsText { | ||||
font:11px/11px Verdana, Arial, Helvetica, sans-serif; | |||||
font:11px/11px Verdana, Arial, Helvetica, sans-serif; | |||||
line-height:130%; | line-height:130%; | ||||
} | } | ||||
.smallParagraph { | .smallParagraph { | ||||
font:11px/11px Verdana, Arial, Helvetica, sans-serif; | |||||
font:11px/11px Verdana, Arial, Helvetica, sans-serif; | |||||
line-height:130%; | line-height:130%; | ||||
} | } | ||||
.fancyHeading { | .fancyHeading { | ||||
font:20px/20px Chantilly, Arial, Helvetica, sans-serif; | |||||
font:20px/20px Chantilly, Arial, Helvetica, sans-serif; | |||||
margin-right: 10px; | margin-right: 10px; | ||||
color:#6f7a92; | color:#6f7a92; | ||||
margin-left: 10px; | margin-left: 10px; | ||||
line-height:130%; | line-height:130%; | ||||
} | } | ||||
--> | --> | ||||
</STYLE> | </STYLE> | ||||
</head> | </head> | ||||
<h3 align="center">AspectJ Modules</h3> | <h3 align="center">AspectJ Modules</h3> | ||||
<p>There are a number of different structures [Parnas]: "the module structure, | |||||
the uses structure, the runtime structure, .." This document overviews module structure and summarizes what is hidden by each. | |||||
For detailed documentation refer to the individual module sources and docs | |||||
<p>There are a number of different structures [Parnas]: "the module structure, | |||||
the uses structure, the runtime structure, .." This document overviews module structure and summarizes what is hidden by each. | |||||
For detailed documentation refer to the individual module sources and docs | |||||
available via CVS. </p> | available via CVS. </p> | ||||
<h4 align="center">Core Modules</h4> | <h4 align="center">Core Modules</h4> | ||||
<p><b>CVS Location: </b>dev.eclipse.org:/cvsroot/technology/org.aspectj/modules</p> | <p><b>CVS Location: </b>dev.eclipse.org:/cvsroot/technology/org.aspectj/modules</p> | ||||
<p> | <p> | ||||
To set up for building, one need only check out the module directories within the | |||||
To set up for building, one need only check out the module directories within the | |||||
<code>modules/</code> directory. In Eclipse, check out each module into the | <code>modules/</code> directory. In Eclipse, check out each module into the | ||||
the workspace as a project. | the workspace as a project. | ||||
(Note: module dependencies may change at any time, | (Note: module dependencies may change at any time, | ||||
so this documentation might be out of date. | so this documentation might be out of date. | ||||
The Eclipse .classpath files specify the module dependencies, | |||||
The Eclipse .classpath files specify the module dependencies, | |||||
even when using Ant to build outside of Eclipse.) | even when using Ant to build outside of Eclipse.) | ||||
<p> | <p> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left">ajbrowser</td> | <p class="smallParagraph" align="left">ajbrowser</td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left">ajde, asm, bridge, util, taskdefs | |||||
<p class="smallParagraph" align="left">ajde, asm, bridge, util, taskdefs | |||||
(pseudo, for build system) </td> | (pseudo, for build system) </td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left"> | <p class="smallParagraph" align="left"> | ||||
This module contains the ajbrowser application. It depends on the ajde module | |||||
for access to the aspectj compiler, and also for the swing user interface | |||||
This retired module used to contain the ajbrowser application. It depends on the ajde module | |||||
for access to the aspectj compiler, and also for the swing user interface | |||||
components that ajde provides.</td> | components that ajde provides.</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left">ajde</td> | <p class="smallParagraph" align="left">ajde</td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left">asm, bridge, | |||||
<p class="smallParagraph" align="left">asm, bridge, | |||||
org.aspectj.ajdt.core, org.eclipse.jdt.core, util</td> | org.aspectj.ajdt.core, org.eclipse.jdt.core, util</td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left"> | <p class="smallParagraph" align="left"> | ||||
Hides the details of accessing the aspectj compiler | |||||
and interpreting compilation results (error messages, structure | |||||
model, etc.) from other applications (typically IDEs) that need | |||||
Hides the details of accessing the aspectj compiler | |||||
and interpreting compilation results (error messages, structure | |||||
model, etc.) from other applications (typically IDEs) that need | |||||
to invoke it programmatically. | to invoke it programmatically. | ||||
Changing any public interface in ajde can break all the IDE | |||||
Changing any public interface in ajde can break all the IDE | |||||
integration projects and should be done with care.<br> | integration projects and should be done with care.<br> | ||||
<br> | <br> | ||||
It also contains a library of common swing user interface | |||||
components that can be used by any swing based IDE. Ajbrowser | |||||
and the non-eclipse IDE integration projects use this library | |||||
It also contains a library of common swing user interface | |||||
components that can be used by any swing based IDE. Ajbrowser | |||||
and the non-eclipse IDE integration projects use this library | |||||
(except for the emacs support).</td> | (except for the emacs support).</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<p class="smallParagraph" align="left">bridge</td> | <p class="smallParagraph" align="left">bridge</td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left"> | <p class="smallParagraph" align="left"> | ||||
Contains the Abstract Structure Model, which represents the result of | |||||
an aspectj compilation. Clients of ajde are returned an instance of the | |||||
Contains the Abstract Structure Model, which represents the result of | |||||
an aspectj compilation. Clients of ajde are returned an instance of the | |||||
structure model which allows them to navigate and interpret the static structure of an aspectj program.</td> | structure model which allows them to navigate and interpret the static structure of an aspectj program.</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<p class="smallParagraph" align="left">util</td> | <p class="smallParagraph" align="left">util</td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left"> | <p class="smallParagraph" align="left"> | ||||
Contains an interface and implementation of classes realted to | |||||
compiler messages including: source locations, handling, and | |||||
formatting. Intended to minimize dependencies between | |||||
Contains an interface and implementation of classes realted to | |||||
compiler messages including: source locations, handling, and | |||||
formatting. Intended to minimize dependencies between | |||||
testing, the compiler, and ajde.</td> | testing, the compiler, and ajde.</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left">org.aspectj.ajdt.core</td> | <p class="smallParagraph" align="left">org.aspectj.ajdt.core</td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left">asm, bridge, org.eclipse.jdt.core, | |||||
<p class="smallParagraph" align="left">asm, bridge, org.eclipse.jdt.core, | |||||
runtime, testing-util, util, weaver</td> | runtime, testing-util, util, weaver</td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left"> | <p class="smallParagraph" align="left"> | ||||
Front-end of the AspectJ compiler and extension of Eclipse's JDT compiler. | |||||
Extends the JDT compiler's parsing and name resolution to | |||||
understand AspectJ declarations. Also extends incremental | |||||
Front-end of the AspectJ compiler and extension of Eclipse's JDT compiler. | |||||
Extends the JDT compiler's parsing and name resolution to | |||||
understand AspectJ declarations. Also extends incremental | |||||
behavior with understanding of AspectJ dependancies.</td> | behavior with understanding of AspectJ dependancies.</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<p class="smallParagraph" align="left"> </td> | <p class="smallParagraph" align="left"> </td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left"> | <p class="smallParagraph" align="left"> | ||||
Small runtime library required for building and running AspectJ | |||||
Small runtime library required for building and running AspectJ | |||||
programs.</td> | programs.</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left">taskdefs</td> | <p class="smallParagraph" align="left">taskdefs</td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left">bridge, org.aspectj.ajdt.core, | |||||
<p class="smallParagraph" align="left">bridge, org.aspectj.ajdt.core, | |||||
util</td> | util</td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left"> | <p class="smallParagraph" align="left"> | ||||
<p class="smallParagraph" align="left"> </td> | <p class="smallParagraph" align="left"> </td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left"> | <p class="smallParagraph" align="left"> | ||||
Common utility classes including data type, file, and stream | |||||
Common utility classes including data type, file, and stream | |||||
manipulation.</td> | manipulation.</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left">weaver</td> | <p class="smallParagraph" align="left">weaver</td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left">asm, bridge, runtime, testing-util, | |||||
<p class="smallParagraph" align="left">asm, bridge, runtime, testing-util, | |||||
util</td> | util</td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left"> | <p class="smallParagraph" align="left"> | ||||
Back-end of the AspectJ compiler, built on top of the BCEL | |||||
bytecode toolkit. All advice planning and weaving is done | |||||
here. Takes an aspect bytecode format and other Java | |||||
Back-end of the AspectJ compiler, built on top of the BCEL | |||||
bytecode toolkit. All advice planning and weaving is done | |||||
here. Takes an aspect bytecode format and other Java | |||||
classfiles as input. </td> | classfiles as input. </td> | ||||
</tr> | </tr> | ||||
<!-- | <!-- | ||||
<p class="smallParagraph" align="left">build</td> | <p class="smallParagraph" align="left">build</td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left"> | <p class="smallParagraph" align="left"> | ||||
Ant files, scripts, and taskdefs required for building the | |||||
Ant files, scripts, and taskdefs required for building the | |||||
AspectJ distribution. Also contains the GUI installer.</td> | AspectJ distribution. Also contains the GUI installer.</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<p class="smallParagraph" align="left">testing-util</td> | <p class="smallParagraph" align="left">testing-util</td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left"> | <p class="smallParagraph" align="left"> | ||||
Common testing utility classes used by the unit test suites in | |||||
Common testing utility classes used by the unit test suites in | |||||
the core modules.</td> | the core modules.</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<p class="smallParagraph" align="left">tests</td> | <p class="smallParagraph" align="left">tests</td> | ||||
<td bgColor="#eeeeee"> | <td bgColor="#eeeeee"> | ||||
<p class="smallParagraph" align="left"> | <p class="smallParagraph" align="left"> | ||||
AspectJ test suite, including all language tests, regression | |||||
AspectJ test suite, including all language tests, regression | |||||
tests, and test system sources.</td> | tests, and test system sources.</td> | ||||
</tr> | </tr> | ||||
<!-- | <!-- | ||||
</body> | </body> | ||||
</html> | |||||
</html> |
<UL> | <UL> | ||||
<li>the <a href="bin"><CODE><aspectj install dir>/bin</CODE></a> | <li>the <a href="bin"><CODE><aspectj install dir>/bin</CODE></a> | ||||
directory has scripts for | |||||
directory has scripts for | |||||
<ul> | <ul> | ||||
<li><CODE>ajc</CODE>: the compiler for the AspectJ language</li> | <li><CODE>ajc</CODE>: the compiler for the AspectJ language</li> | ||||
<!-- XXX removed references to ajdoc and ajdb --> | |||||
<li><CODE>ajbrowser</CODE>: a graphical editor for | |||||
compiling programs with <CODE>ajc</CODE> | |||||
and navigating the crosscutting structure of those programs</li> | |||||
</ul> | |||||
<li>the directory <a href="lib"><CODE><aspectj install dir>/lib</CODE></a> | <li>the directory <a href="lib"><CODE><aspectj install dir>/lib</CODE></a> | ||||
has the AspectJ binaries, | has the AspectJ binaries, | ||||
<ul> | <ul> | ||||
<li><CODE><a href="lib/aspectjtools.jar">aspectjtools.jar</a></CODE>: libraries for | |||||
<li><CODE><a href="lib/aspectjtools.jar">aspectjtools.jar</a></CODE>: libraries for | |||||
<code>ajc</code>, <code>ajbrowser</code>, and the Ant tasks</li> | <code>ajc</code>, <code>ajbrowser</code>, and the Ant tasks</li> | ||||
<li><CODE>aspectjrt.jar</CODE>: runtime library for AspectJ programs</li> | <li><CODE>aspectjrt.jar</CODE>: runtime library for AspectJ programs</li> | ||||
<h3>2 Install Procedure</h3> | <h3>2 Install Procedure</h3> | ||||
<p>The AspectJ tools <code>ajc</code> and <code>ajbrowser</code> are | |||||
Java programs that can be run indirectly from the scripts or | |||||
directly from <code>aspectjtools.jar</code>. | |||||
<p>The AspectJ tool <code>ajc</code> is a | |||||
Java program that can be run indirectly from the scripts or | |||||
directly from <code>aspectjtools.jar</code>. | |||||
The <code>aspectjrt.jar</code> needs to be on the classpath | The <code>aspectjrt.jar</code> needs to be on the classpath | ||||
when compiling or running programs compiled | when compiling or running programs compiled | ||||
by <code>ajc</code>. This procedure shows ways to do that. | by <code>ajc</code>. This procedure shows ways to do that. | ||||
<p>After finishing automatic installation, we recommend that the | <p>After finishing automatic installation, we recommend that the | ||||
following steps to complete your installation:</p> | following steps to complete your installation:</p> | ||||
<p><b>2.1 Add <CODE><aspectj install dir>/lib/aspectjrt.jar</CODE> | |||||
<p><b>2.1 Add <CODE><aspectj install dir>/lib/aspectjrt.jar</CODE> | |||||
to your class path</b></p> | to your class path</b></p> | ||||
<blockquote> | <blockquote> | ||||
<p>This small .jar file contains classes required to compile programs | |||||
<p>This small .jar file contains classes required to compile programs | |||||
with the ajc compiler, and to run programs compiled with the ajc | with the ajc compiler, and to run programs compiled with the ajc | ||||
compiler. You must have these classes somewhere on your class path | compiler. You must have these classes somewhere on your class path | ||||
when running programs compiled with ajc. For detailed instructions | when running programs compiled with ajc. For detailed instructions | ||||
<p>If you did not use the automatic installation process or the | <p>If you did not use the automatic installation process or the | ||||
default launch scripts do not work on your system, you may wish to | default launch scripts do not work on your system, you may wish to | ||||
create short launch scripts to start ajc easily. </p> | |||||
<p>You can also run the <code>aspectjtools.jar</code> directly | |||||
using java's -jar option: | |||||
<blockquote> | |||||
<CODE>C:\jdk1.3\bin\java.exe -jar D:\aspectj\lib\aspectjtools.jar %*</CODE> | |||||
</blockquote> | |||||
<p>With no arguments or only argument list (.lst) files, this will launch | |||||
<code>ajbrowser</code>, the GUI structure browser; otherwise, it will | |||||
run <code>ajc</code>, the AspectJ compiler. This means that | |||||
if your browser is set up to run jar files, clicking a link | |||||
to <a href="lib/aspectjtools.jar">lib/aspectjtools.jar</a> will | |||||
launch <code>ajbrowser</code>. | |||||
create short launch scripts to start ajc easily.</p> | |||||
<p> You can also create scripts like those created by the installer. | <p> You can also create scripts like those created by the installer. | ||||
These scripts use full paths that are system dependent so you will | These scripts use full paths that are system dependent so you will |
</td> | </td> | ||||
<td>This is a guide to | <td>This is a guide to | ||||
<a href="devguide/ajc-ref.html">ajc</a>, the command-line compiler; | <a href="devguide/ajc-ref.html">ajc</a>, the command-line compiler; | ||||
<a href="devguide/ajbrowser.html">ajbrowser</a>, the stand-alone | |||||
GUI for compiling and viewing crosscutting structure; | |||||
and the <a href="devguide/antTasks.html">Ant tasks</a> | and the <a href="devguide/antTasks.html">Ant tasks</a> | ||||
for building AspectJ programs. | for building AspectJ programs. | ||||
</td> | </td> | ||||
see the <a href="progguide/examples.html">Examples </a> section | see the <a href="progguide/examples.html">Examples </a> section | ||||
in the <a href="progguide/index.html">Programming Guide</a>. | in the <a href="progguide/index.html">Programming Guide</a>. | ||||
View and navigate the crosscutting structure using | View and navigate the crosscutting structure using | ||||
<a href="http://eclipse.org/ajdt">AJDT</a>; if you can't use Eclipse, try | |||||
the <code>ajbrowser</code> structure viewer, as described in | |||||
the <a href="devguide/ajbrowser.html">AspectJ Browser</a> section of | |||||
the <a href="devguide/index.html">Development Environment Guide</a>. | |||||
<a href="http://eclipse.org/ajdt">AJDT (AspectJ Development Tools) | |||||
in Eclipse IDE</a>. IntelliJ IDEA also offers AspectJ and Spring AOP | |||||
support. | |||||
<p/> | <p/> | ||||
To start using AspectJ with your own code, | To start using AspectJ with your own code, | ||||
modify the example aspects to apply to your classes. | modify the example aspects to apply to your classes. |
a compiler (<literal>ajc</literal>), | a compiler (<literal>ajc</literal>), | ||||
a debugger (<literal>ajdb</literal>), | a debugger (<literal>ajdb</literal>), | ||||
a documentation generator (<literal>ajdoc</literal>), | a documentation generator (<literal>ajdoc</literal>), | ||||
a program structure browser (<literal>ajbrowser</literal>), | |||||
and integration with | and integration with | ||||
Eclipse, Sun-ONE/Netbeans, GNU Emacs/XEmacs, | Eclipse, Sun-ONE/Netbeans, GNU Emacs/XEmacs, | ||||
JBuilder, and Ant. | JBuilder, and Ant. | ||||
modularizing crosscutting concerns while still having immediate | modularizing crosscutting concerns while still having immediate | ||||
access to what aspects affect a class. | access to what aspects affect a class. | ||||
</para> | </para> | ||||
<para>For example, the | |||||
<ulink url="devguide/index.html"> | |||||
Development Environment Guide</ulink> | |||||
<ulink url="devguide/ajbrowser.html"> | |||||
ajbrowser section</ulink>. | |||||
shows that you can list or navigate | |||||
between method and advice affecting that method and between a type | |||||
and declarations in an aspect on that type. (The IDE support may | |||||
have more features than <literal>ajbrowser</literal>, depending | |||||
on the IDE. | |||||
<para> | |||||
See <xref linkend="q:integrateWithDevTools"/> for more | See <xref linkend="q:integrateWithDevTools"/> for more | ||||
information on which Java development environments are | information on which Java development environments are | ||||
supported.) | supported.) | ||||
weaver, asm, org.eclipse.jdt.core, org.aspectj.ajdt.core, | weaver, asm, org.eclipse.jdt.core, org.aspectj.ajdt.core, | ||||
and runtime. | and runtime. | ||||
</para></listitem> | </para></listitem> | ||||
<listitem><para>For ajbrowser: the compiler modules, plus | |||||
ajbrowser, ajdoc, taskdefs, and ajde. | |||||
</para></listitem> | |||||
<listitem><para>For the AspectJ distribution, the ajbrowser modules, | <listitem><para>For the AspectJ distribution, the ajbrowser modules, | ||||
plus aspectj5rt and org.aspectj.lib. | plus aspectj5rt and org.aspectj.lib. | ||||
</para></listitem> | </para></listitem> | ||||
<listitem><para>For the test harness (or to run the release build | <listitem><para>For the test harness (or to run the release build | ||||
scripts and tests): the ajbrowser modules, plus | |||||
testing, testing-client, and testing-drivers. | |||||
scripts and tests): testing, testing-client, and testing-drivers. | |||||
</para></listitem> | </para></listitem> | ||||
<listitem><para>To run the test suite: the test harness modules, plus | <listitem><para>To run the test suite: the test harness modules, plus | ||||
tests. | tests. | ||||
</ulink>). | </ulink>). | ||||
</para> | </para> | ||||
<para> | <para> | ||||
Bug reports on ajbrowser should have version | |||||
information for both Java and AspectJ, and | |||||
(most importantly) clear steps for reproducing the bug. | |||||
You may submit ajbrowser bugs against the IDE component of AspectJ | |||||
via the web form | |||||
<ulink url="http://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ"> | |||||
http://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ | |||||
</ulink>. | |||||
</para> | |||||
<para> | |||||
One of the benefits of open-source is that you can | One of the benefits of open-source is that you can | ||||
find and fix the bug for yourself; when you submit | find and fix the bug for yourself; when you submit | ||||
the fix back to us, we can validate the fix for you | the fix back to us, we can validate the fix for you |
<module>org.aspectj.matcher</module> | <module>org.aspectj.matcher</module> | ||||
<module>asm</module> | <module>asm</module> | ||||
<module>testing-client</module> | <module>testing-client</module> | ||||
<module>ajbrowser</module> | |||||
<module>runtime</module> | <module>runtime</module> | ||||
<module>bcel-builder</module> | <module>bcel-builder</module> | ||||
<module>weaver</module> | <module>weaver</module> |
suite.addTest(WeaverModuleTests.suite()); | suite.addTest(WeaverModuleTests.suite()); | ||||
suite.addTest(TaskdefsModuleTests.suite()); | suite.addTest(TaskdefsModuleTests.suite()); | ||||
suite.addTest(MatcherModuleTests.suite()); | suite.addTest(MatcherModuleTests.suite()); | ||||
// suite.addTest(AjbrowserModuleTests.suite()); // There are none so far... | |||||
// suite.addTest(LibModuleTests.suite()); // anyone using this? | // suite.addTest(LibModuleTests.suite()); // anyone using this? | ||||
suite.addTest(AjdtCoreModuleTests.suite()); | suite.addTest(AjdtCoreModuleTests.suite()); | ||||
<!-- ========================================================================== --> | <!-- ========================================================================== --> | ||||
<target name="init" depends="init.product" | <target name="init" depends="init.product" | ||||
description="caller must define jdk.tools.jar and product.dir or run from product.dir"> | description="caller must define jdk.tools.jar and product.dir or run from product.dir"> | ||||
<echo message="init ant-examples.xml"/> | |||||
<echo message="init ant-examples.xml"/> | |||||
<!-- directory produced during test install --> | <!-- directory produced during test install --> | ||||
<property name="ajx.base.dir" | <property name="ajx.base.dir" | ||||
location="${productTest.output.dir}/ajx-output"/> | location="${productTest.output.dir}/ajx-output"/> | ||||
<mkdir dir="${noclass.dir}"/> | <mkdir dir="${noclass.dir}"/> | ||||
<delete dir="${noclass.dir}"/> | <delete dir="${noclass.dir}"/> | ||||
<mkdir dir="${noclass.dir}"/> | <mkdir dir="${noclass.dir}"/> | ||||
<javac srcdir="." | |||||
includes="${noclass}.java" | |||||
<javac srcdir="." | |||||
includes="${noclass}.java" | |||||
destdir="${noclass.dir}" | destdir="${noclass.dir}" | ||||
failonerror="true"/> | failonerror="true"/> | ||||
<delete file="${noclass}.java"/> | <delete file="${noclass}.java"/> | ||||
<echo message=" todo check file: ${noclass}.java"/> | <echo message=" todo check file: ${noclass}.java"/> | ||||
<java classname="${noclass}" | <java classname="${noclass}" | ||||
failonerror="true" | |||||
failonerror="true" | |||||
classpath="${noclass.dir}"/> | classpath="${noclass.dir}"/> | ||||
</target> | </target> | ||||
<target name="Ajx" depends="init.taskdefs" | <target name="Ajx" depends="init.taskdefs" | ||||
description="for {example}, compile {list}, doc {list}, and run {class}"> | description="for {example}, compile {list}, doc {list}, and run {class}"> | ||||
<echo message="##### START Ajx example=${example} list=${list} class=${class}" /> | <echo message="##### START Ajx example=${example} list=${list} class=${class}" /> | ||||
<property name="exdir" | |||||
<property name="exdir" | |||||
value="${ajx.base.dir}/${example}"/> | value="${ajx.base.dir}/${example}"/> | ||||
<property name="expect.exdir" value="${ajx.expect.dir}/${example}"/> | <property name="expect.exdir" value="${ajx.expect.dir}/${example}"/> | ||||
<mkdir dir="${exdir}/classes"/> | <mkdir dir="${exdir}/classes"/> | ||||
<mkdir dir="${exdir}/docs"/> | <mkdir dir="${exdir}/docs"/> | ||||
<echo message="##################### Ajx ajc ${list}"/> | <echo message="##################### Ajx ajc ${list}"/> | ||||
<ajc | |||||
<ajc | |||||
destdir="${exdir}/classes" | destdir="${exdir}/classes" | ||||
argfile="${list}" | |||||
argfile="${list}" | |||||
failonerror="false" > | failonerror="false" > | ||||
<classpath> | <classpath> | ||||
<pathelement location="${product.rt.jar}" /> | <pathelement location="${product.rt.jar}" /> | ||||
</ajc> | </ajc> | ||||
<!-- copying resources, etc. as javac does todo weak --> | <!-- copying resources, etc. as javac does todo weak --> | ||||
<copy todir="${exdir}/classes"> | <copy todir="${exdir}/classes"> | ||||
<fileset dir="${srcDir}" | |||||
<fileset dir="${srcDir}" | |||||
includes="**/*.properties,**/*.gif,**/*.jpg,**/*.props" /> | includes="**/*.properties,**/*.gif,**/*.jpg,**/*.props" /> | ||||
</copy> | </copy> | ||||
verbose="yes" | verbose="yes" | ||||
sourcepath="${product.examples.dir}" | sourcepath="${product.examples.dir}" | ||||
destdir="${exdir}/docs" | destdir="${exdir}/docs" | ||||
argfile="${list}" | |||||
argfile="${list}" | |||||
classpath="${product.rt.jar}${PS}${jdk.tools.jar}" | classpath="${product.rt.jar}${PS}${jdk.tools.jar}" | ||||
failonerror="false" > | failonerror="false" > | ||||
<!-- internalclasspath | |||||
internalclasspath="${taskdef.classpath}" | |||||
<!-- internalclasspath | |||||
internalclasspath="${taskdef.classpath}" | |||||
is required now - but still not producing docs | is required now - but still not producing docs | ||||
<classpath> | <classpath> | ||||
<pathelement location="${product.rt.jar}" /> | <pathelement location="${product.rt.jar}" /> | ||||
<echo message="##################### Ajx run ${class} START - output in ${exdir}/output/out.txt"/> | <echo message="##################### Ajx run ${class} START - output in ${exdir}/output/out.txt"/> | ||||
<java classname="${class}" | <java classname="${class}" | ||||
output="${exdir}/output/out.txt" | output="${exdir}/output/out.txt" | ||||
fork="yes" | |||||
fork="yes" | |||||
failonerror="false" > | failonerror="false" > | ||||
<!-- fork because ajc does a System.exit --> | <!-- fork because ajc does a System.exit --> | ||||
<classpath> | <classpath> | ||||
<param name="class" value="${noclass}"/> | <param name="class" value="${noclass}"/> | ||||
<param name="srcDir" value="${tools.src.dir}"/> | <param name="srcDir" value="${tools.src.dir}"/> | ||||
</antcall> | </antcall> | ||||
<antcall target="Ajx"> | |||||
<param name="list" value="${tools.src.dir}/ajbrowser.lst"/> | |||||
<param name="example" value="source-tools-ajbrowser"/> | |||||
<param name="class" value="${noclass}"/> | |||||
<param name="srcDir" value="${tools.src.dir}"/> | |||||
</antcall> | |||||
<antcall target="Ajx"> | <antcall target="Ajx"> | ||||
<param name="list" value="${tools.src.dir}/ajdoc.lst"/> | <param name="list" value="${tools.src.dir}/ajdoc.lst"/> | ||||
<param name="example" value="source-tools-ajdoc"/> | <param name="example" value="source-tools-ajdoc"/> | ||||
<param name="class" value="telecom.TimingSimulation"/> | <param name="class" value="telecom.TimingSimulation"/> | ||||
<param name="srcDir" value="."/> | <param name="srcDir" value="."/> | ||||
</antcall> | </antcall> | ||||
<!-- timeserver not in product - todo check | |||||
<!-- timeserver not in product - todo check | |||||
<antcall target="Ajx"> | <antcall target="Ajx"> | ||||
<param name="list" value="timeserver/abort.lst"/> | <param name="list" value="timeserver/abort.lst"/> | ||||
<param name="example" value="timeserver-abort"/> | <param name="example" value="timeserver-abort"/> |
</path> | </path> | ||||
<path id="tools.roots"> | <path id="tools.roots"> | ||||
<pathelement path="${aspectj.src}/ajbrowser/src"/> | |||||
<pathelement path="${aspectj.src}/ajde/src"/> | <pathelement path="${aspectj.src}/ajde/src"/> | ||||
<pathelement path="${aspectj.src}/asm/src"/> | <pathelement path="${aspectj.src}/asm/src"/> | ||||
<pathelement path="${aspectj.src}/bridge/src"/> | <pathelement path="${aspectj.src}/bridge/src"/> |
<!-- This only runs from ../../test-product.xml b/c it uses comparefiles w/o defining it --> | <!-- This only runs from ../../test-product.xml b/c it uses comparefiles w/o defining it --> | ||||
<project name="product-test" default="test" basedir="."> | <project name="product-test" default="test" basedir="."> | ||||
&aspectj_initProduct; | |||||
&aspectj_initProduct; | |||||
<!-- ========================================================================== --> | <!-- ========================================================================== --> | ||||
<!-- Init --> | <!-- Init --> | ||||
<!-- ========================================================================== --> | <!-- ========================================================================== --> | ||||
<target name="init" depends="init.product,productTest.expect.dir" | <target name="init" depends="init.product,productTest.expect.dir" | ||||
description="init values - launch from install dir or set product.dir variable"> | description="init values - launch from install dir or set product.dir variable"> | ||||
<echo message="init product-test.xml"/> | |||||
<echo message="init product-test.xml"/> | |||||
<property name="productTest.classes.dir" | <property name="productTest.classes.dir" | ||||
location="${productTest.output.dir}/classes"/> | location="${productTest.output.dir}/classes"/> | ||||
<property name="script.expect.dir" | <property name="script.expect.dir" | ||||
<!-- ========================================================================== --> | <!-- ========================================================================== --> | ||||
<!-- Run product tests --> | <!-- Run product tests --> | ||||
<!-- ========================================================================== --> | <!-- ========================================================================== --> | ||||
<target name="test" | |||||
<target name="test" | |||||
depends="test.examples.buildscript,test.script.telecom,test.tools.sources" | depends="test.examples.buildscript,test.script.telecom,test.tools.sources" | ||||
description="run available tests"/> | description="run available tests"/> | ||||
<target name="test.script.telecom" | |||||
<target name="test.script.telecom" | |||||
depends="init,productTest.dir,product.dir, | depends="init,productTest.dir,product.dir, | ||||
productTest.expect.bat.dir,productTest.output.dir" | productTest.expect.bat.dir,productTest.output.dir" | ||||
description="ajc/ajdoc/java/ajdb telecom example using bat scripts"> | description="ajc/ajdoc/java/ajdb telecom example using bat scripts"> | ||||
</exec> | </exec> | ||||
<comparefiles lhsFile="${ajdb.out}" | <comparefiles lhsFile="${ajdb.out}" | ||||
rhsFile="${expect.ajdb.out}"/> | rhsFile="${expect.ajdb.out}"/> | ||||
</target> | |||||
</target> | |||||
<!-- todo: also depends on jdk.tools.jar --> | <!-- todo: also depends on jdk.tools.jar --> | ||||
<!-- todo: ignore as duplicating examples/build.xml --> | <!-- todo: ignore as duplicating examples/build.xml --> | ||||
<target name="test.examples.antscript" | |||||
<target name="test.examples.antscript" | |||||
depends="init,productTest.dir,product.dir, | depends="init,productTest.dir,product.dir, | ||||
product.taskdefs.jar,product.rt.jar, | product.taskdefs.jar,product.rt.jar, | ||||
product.tools.jar" | product.tools.jar" | ||||
<ant antfile="${productTest.dir}/ant-example.xml" | <ant antfile="${productTest.dir}/ant-example.xml" | ||||
dir="${product.examples.dir}" | dir="${product.examples.dir}" | ||||
output="${productTest.output.dir}/ant-example.ant.txt"> | output="${productTest.output.dir}/ant-example.ant.txt"> | ||||
<property name="PS" | |||||
<property name="PS" | |||||
value="${path.separator}"/> | value="${path.separator}"/> | ||||
<property name="product.dir" | |||||
<property name="product.dir" | |||||
value="${product.dir}"/> | value="${product.dir}"/> | ||||
<property name="jdk.tools.jar" | |||||
<property name="jdk.tools.jar" | |||||
location="${jdk.tools.jar}"/> | location="${jdk.tools.jar}"/> | ||||
<property name="jdk.dir" | |||||
<property name="jdk.dir" | |||||
location="${jdk.dir}"/> | location="${jdk.dir}"/> | ||||
</ant> | </ant> | ||||
</target> | </target> | ||||
<target name="test.examples.buildscript" | |||||
<target name="test.examples.buildscript" | |||||
depends="init,product.dir, | depends="init,product.dir, | ||||
product.taskdefs.jar,product.rt.jar, | product.taskdefs.jar,product.rt.jar, | ||||
product.tools.jar" | product.tools.jar" | ||||
<param name="example.target" value="nonGui" /> | <param name="example.target" value="nonGui" /> | ||||
</antcall> | </antcall> | ||||
<!-- OutOfMemory if including all | |||||
<!-- OutOfMemory if including all | |||||
<antcall target="antcall.test.examples.buildscript.norun"> | <antcall target="antcall.test.examples.buildscript.norun"> | ||||
<param name="example.target" value="all" /> | <param name="example.target" value="all" /> | ||||
</antcall> | </antcall> | ||||
--> | --> | ||||
</target> | </target> | ||||
<target name="antcall.test.examples.buildscript.norun" | |||||
<target name="antcall.test.examples.buildscript.norun" | |||||
depends="init,product.dir, | depends="init,product.dir, | ||||
product.taskdefs.jar,product.rt.jar, | product.taskdefs.jar,product.rt.jar, | ||||
product.tools.jar" | product.tools.jar" | ||||
target="${example.target}" | target="${example.target}" | ||||
dir="${product.examples.dir}" | dir="${product.examples.dir}" | ||||
output="${productTest.output.dir}/example-build.${example.target}.txt" > | output="${productTest.output.dir}/example-build.${example.target}.txt" > | ||||
<property name="JAVA_HOME" | |||||
location="${jdk.dir}"/> | |||||
<property name="norun" | |||||
location="skipRunning"/> | |||||
<property name="JAVA_HOME" | |||||
location="${jdk.dir}"/> | |||||
<property name="norun" | |||||
location="skipRunning"/> | |||||
</ant> | </ant> | ||||
</target> | </target> | ||||
<target name="antcall.test.examples.buildscript" | |||||
<target name="antcall.test.examples.buildscript" | |||||
depends="init,product.dir, | depends="init,product.dir, | ||||
product.taskdefs.jar,product.rt.jar, | product.taskdefs.jar,product.rt.jar, | ||||
product.tools.jar" | product.tools.jar" | ||||
target="${example.target}" | target="${example.target}" | ||||
dir="${product.examples.dir}" | dir="${product.examples.dir}" | ||||
output="${productTest.output.dir}/example-build.${example.target}.txt" > | output="${productTest.output.dir}/example-build.${example.target}.txt" > | ||||
<property name="JAVA_HOME" | |||||
location="${jdk.dir}"/> | |||||
<property name="JAVA_HOME" | |||||
location="${jdk.dir}"/> | |||||
</ant> | </ant> | ||||
</target> | </target> | ||||
<!-- see also more recent devenv/dev/bin/aj/testToolsSrc.sh --> | <!-- see also more recent devenv/dev/bin/aj/testToolsSrc.sh --> | ||||
<target name="test.tools.sources" | |||||
<target name="test.tools.sources" | |||||
depends="init,product.tools.jar,product.src.dir" | depends="init,product.tools.jar,product.src.dir" | ||||
description="test source dist using ajc, ajdoc (todo remove - see ant-example)"> | description="test source dist using ajc, ajdoc (todo remove - see ant-example)"> | ||||
<property name="tools.source.out" | |||||
<property name="tools.source.out" | |||||
location="${productTest.output.dir}/source-tools"/> | location="${productTest.output.dir}/source-tools"/> | ||||
<property name="test.source.classes.dir" | <property name="test.source.classes.dir" | ||||
location="${productTest.output.dir}/source-tools"/> | location="${productTest.output.dir}/source-tools"/> | ||||
<antcall target="build.source.call"> | <antcall target="build.source.call"> | ||||
<param name="target.name" value="ajde" /> | <param name="target.name" value="ajde" /> | ||||
</antcall> | </antcall> | ||||
<antcall target="build.source.call"> | |||||
<param name="target.name" value="ajbrowser" /> | |||||
</antcall> | |||||
<antcall target="build.source.call"> | <antcall target="build.source.call"> | ||||
<param name="target.name" value="ajdoc" /> | <param name="target.name" value="ajdoc" /> | ||||
</antcall> | </antcall> | ||||
</target> | </target> | ||||
</project> | </project> | ||||