summaryrefslogtreecommitdiffstats
path: root/ajde/src
diff options
context:
space:
mode:
authoraclement <aclement>2007-01-15 09:37:23 +0000
committeraclement <aclement>2007-01-15 09:37:23 +0000
commit8559a350a486171c332791c8364d857a074531e0 (patch)
tree9fea02d68204d89bb16c1abb162b02338abfc9d7 /ajde/src
parentfb86dd4ca2edac7e1eb639cfde1d4b2a4f450457 (diff)
downloadaspectj-8559a350a486171c332791c8364d857a074531e0.tar.gz
aspectj-8559a350a486171c332791c8364d857a074531e0.zip
148190#35
Diffstat (limited to 'ajde/src')
-rw-r--r--ajde/src/org/aspectj/ajde/IRuntimeProperties.java30
-rw-r--r--ajde/src/org/aspectj/ajde/IUIBuildMessageHandler.java27
-rw-r--r--ajde/src/org/aspectj/ajde/IconRegistry.java158
-rw-r--r--ajde/src/org/aspectj/ajde/IdeUIAdapter.java23
-rw-r--r--ajde/src/org/aspectj/ajde/internal/BuildConfigListener.java37
-rw-r--r--ajde/src/org/aspectj/ajde/internal/BuildConfigManager.java99
-rw-r--r--ajde/src/org/aspectj/ajde/ui/javaoptions/JavaBuildOptions.java168
-rw-r--r--ajde/src/org/aspectj/ajde/ui/javaoptions/JavaCompilerWarningsOptionsPanel.java140
-rw-r--r--ajde/src/org/aspectj/ajde/ui/javaoptions/JavaComplianceOptionsPanel.java143
-rw-r--r--ajde/src/org/aspectj/ajde/ui/javaoptions/JavaDebugOptionsPanel.java148
-rw-r--r--ajde/src/org/aspectj/ajde/ui/javaoptions/JavaOtherOptionsPanel.java120
11 files changed, 1093 insertions, 0 deletions
diff --git a/ajde/src/org/aspectj/ajde/IRuntimeProperties.java b/ajde/src/org/aspectj/ajde/IRuntimeProperties.java
new file mode 100644
index 000000000..9970c597e
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/IRuntimeProperties.java
@@ -0,0 +1,30 @@
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.ajde;
+
+/**
+ * Interface to enable users to specify which class to run
+ */
+public interface IRuntimeProperties {
+
+ /**
+ * @return class which contains the main method and should
+ * be used to run the application
+ */
+ public String getClassToExecute();
+
+ /**
+ * @return args which should be used as part of the execution
+ * of the application
+ */
+ public String getExecutionArgs();
+
+}
diff --git a/ajde/src/org/aspectj/ajde/IUIBuildMessageHandler.java b/ajde/src/org/aspectj/ajde/IUIBuildMessageHandler.java
new file mode 100644
index 000000000..7e9678d22
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/IUIBuildMessageHandler.java
@@ -0,0 +1,27 @@
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.ajde;
+
+import org.aspectj.ajde.core.IBuildMessageHandler;
+
+/**
+ * Extension to the IBuildMessageHandler to be used if only one BuildMessageHandler
+ * is going to be used for all projects/build configuration files. Provides a method
+ * for resetting the state of the BuildMessageHandler between compiles
+ */
+public interface IUIBuildMessageHandler extends IBuildMessageHandler {
+
+ /**
+ * Reset the state of the message handler
+ */
+ public void reset();
+
+}
diff --git a/ajde/src/org/aspectj/ajde/IconRegistry.java b/ajde/src/org/aspectj/ajde/IconRegistry.java
new file mode 100644
index 000000000..4cdec89f2
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/IconRegistry.java
@@ -0,0 +1,158 @@
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+import javax.swing.*;
+
+import org.aspectj.ajde.ui.*;
+import org.aspectj.asm.*;
+import org.aspectj.asm.IProgramElement;
+
+/**
+ * Default icons. Override behavior for custom icons.
+ *
+ * @author Mik Kersten
+ */
+public class IconRegistry extends AbstractIconRegistry {
+
+ //public static IconRegistry INSTANCE = null;
+ protected String RESOURCE_PATH = "org/aspectj/ajde/resources/";
+
+ private final Icon START_AJDE = makeIcon("actions/startAjde.gif");
+ private final Icon STOP_AJDE = makeIcon("actions/stopAjde.gif");
+ private final Icon BUILD = makeIcon("actions/build.gif");
+ private final Icon DEBUG = makeIcon("actions/debug.gif");
+ private final Icon EXECUTE = makeIcon("actions/execute.gif");
+ private final Icon AJBROWSER = makeIcon("structure/advice.gif");
+ private final Icon AJBROWSER_ENABLED = makeIcon("actions/browserEnabled.gif");
+ private final Icon AJBROWSER_DISABLED = makeIcon("actions/browserDisabled.gif");
+ private final Icon STRUCTURE_VIEW = makeIcon("actions/structureView.gif");
+
+ private final Icon HIDE_ASSOCIATIONS = makeIcon("actions/hideAssociations.gif");
+ private final Icon HIDE_NON_AJ = makeIcon("actions/hideNonAJ.gif");
+ private final Icon GRANULARITY = makeIcon("actions/granularity.gif");
+ private final Icon AJDE_SMALL = makeIcon("actions/ajdeSmall.gif");
+
+ private final Icon ERROR = makeIcon("structure/error.gif");
+ private final Icon WARNING = makeIcon("structure/warning.gif");
+ private final Icon INFO = makeIcon("structure/info.gif");
+
+ private final Icon POPUP = makeIcon("actions/popup.gif");
+ private final Icon FILTER = makeIcon("actions/filter.gif");
+ private final Icon RELATIONS = makeIcon("actions/relations.gif");
+ private final Icon ORDER = makeIcon("actions/order.gif");
+
+ private final Icon ZOOM_STRUCTURE_TO_FILE_MODE = makeIcon("actions/zoomStructureToFileMode.gif");
+ private final Icon ZOOM_STRUCTURE_TO_GLOBAL_MODE = makeIcon("actions/zoomStructureToGlobalMode.gif");
+ private final Icon SPLIT_STRUCTURE_VIEW = makeIcon("actions/splitStructureView.gif");
+ private final Icon MERGE_STRUCTURE_VIEW = makeIcon("actions/mergeStructureView.gif");
+
+ private final Icon BACK = makeIcon("actions/back.gif");
+ private final Icon FORWARD = makeIcon("actions/forward.gif");
+ private final Icon SEARCH = makeIcon("actions/search.gif");
+ private final Icon OPEN_CONFIG = makeIcon("actions/openConfig.gif");
+ private final Icon CLOSE_CONFIG = makeIcon("actions/closeConfig.gif");
+ private final Icon SAVE = makeIcon("actions/save.gif");
+ private final Icon SAVE_ALL = makeIcon("actions/saveAll.gif");
+ private final Icon BROWSER_OPTIONS = makeIcon("actions/browseroptions.gif");
+
+ private final Icon ACCESSIBILITY_PUBLIC = makeIcon("structure/accessibility-public.gif");
+ private final Icon ACCESSIBILITY_PACKAGE = makeIcon("structure/accessibility-package.gif");
+ private final Icon ACCESSIBILITY_PROTECTED = makeIcon("structure/accessibility-protected.gif");
+ private final Icon ACCESSIBILITY_PRIVATE = makeIcon("structure/accessibility-private.gif");
+ private final Icon ACCESSIBILITY_PRIVILEGED = makeIcon("structure/accessibility-privileged.gif");
+
+ public Icon getAjdeSmallIcon() { return AJDE_SMALL; }
+ public Icon getHideAssociationsIcon() { return HIDE_ASSOCIATIONS; }
+ public Icon getHideNonAJIcon() { return HIDE_NON_AJ; }
+ public Icon getGranularityIcon() { return GRANULARITY; }
+ public Icon getErrorIcon() { return ERROR; }
+ public Icon getWarningIcon() { return WARNING; }
+ public Icon getInfoIcon() { return INFO; }
+ public Icon getAJBrowserIcon() { return AJBROWSER; }
+ public Icon getAJBrowserEnabledIcon() { return AJBROWSER_ENABLED; }
+ public Icon getAJBrowserDisabledIcon() { return AJBROWSER_DISABLED; }
+ public Icon getPopupIcon() { return POPUP; }
+ public Icon getFilterIcon() { return FILTER; }
+ public Icon getOrderIcon() { return ORDER; }
+ public Icon getRelationsIcon() { return RELATIONS; }
+ public Icon getStartAjdeIcon() { return START_AJDE; }
+ public Icon getStopAjdeIcon() { return STOP_AJDE; }
+ public Icon getBackIcon() { return BACK; }
+ public Icon getForwardIcon() { return FORWARD; }
+ public Icon getSearchIcon() { return SEARCH; }
+ public Icon getBuildIcon() { return BUILD; }
+ public Icon getDebugIcon() { return DEBUG; }
+ public Icon getExecuteIcon() { return EXECUTE; }
+ public Icon getOpenConfigIcon() { return OPEN_CONFIG; }
+ public Icon getCloseConfigIcon() { return CLOSE_CONFIG; }
+ public Icon getOpenIcon() { return OPEN_CONFIG; }
+ public Icon getSaveIcon() { return SAVE; }
+ public Icon getSaveAllIcon() { return SAVE_ALL; }
+ public Icon getBrowserOptionsIcon() { return BROWSER_OPTIONS; }
+ public Icon getZoomStructureToFileModeIcon() { return ZOOM_STRUCTURE_TO_FILE_MODE; }
+ public Icon getZoomStructureToGlobalModeIcon() { return ZOOM_STRUCTURE_TO_GLOBAL_MODE; }
+ public Icon getSplitStructureViewIcon() { return SPLIT_STRUCTURE_VIEW; }
+ public Icon getMergeStructureViewIcon() { return MERGE_STRUCTURE_VIEW; }
+ public Icon getStructureViewIcon() { return STRUCTURE_VIEW; }
+
+ public Icon getAssociationSwingIcon(IRelationship.Kind relation) {
+ return convertToSwingIcon(getIcon(relation));
+ }
+
+ public AbstractIcon getStructureIcon(IProgramElement.Kind kind, IProgramElement.Accessibility accessibility) {
+ return getIcon(kind);
+ }
+
+ public Icon getStructureSwingIcon(IProgramElement.Kind kind, IProgramElement.Accessibility accessibility) {
+ return convertToSwingIcon(getStructureIcon(kind, accessibility));
+ }
+
+ public Icon getStructureSwingIcon(IProgramElement.Kind kind) {
+ return convertToSwingIcon(getIcon(kind));
+ }
+
+ public Icon getAccessibilitySwingIcon(IProgramElement.Accessibility accessibility) {
+ if (accessibility == IProgramElement.Accessibility.PUBLIC) {
+ return ACCESSIBILITY_PUBLIC;
+ } else if (accessibility == IProgramElement.Accessibility.PACKAGE) {
+ return ACCESSIBILITY_PACKAGE;
+ } else if (accessibility == IProgramElement.Accessibility.PROTECTED) {
+ return ACCESSIBILITY_PROTECTED;
+ } else if (accessibility == IProgramElement.Accessibility.PRIVATE) {
+ return ACCESSIBILITY_PRIVATE;
+ } else if (accessibility == IProgramElement.Accessibility.PRIVILEGED) {
+ return ACCESSIBILITY_PRIVILEGED;
+ } else {
+ return null;
+ }
+ }
+
+ public Icon convertToSwingIcon(AbstractIcon iconAdapter) {
+ if (iconAdapter != null) {
+ return (Icon)iconAdapter.getIconResource();
+ } else {
+ return null;
+ }
+ }
+
+ protected AbstractIcon createIcon(String path) {
+ return new AbstractIcon(new ImageIcon(ClassLoader.getSystemResource(path)));
+ }
+
+ protected Icon makeIcon(String iconPath) {
+ return new ImageIcon(ClassLoader.getSystemResource(RESOURCE_PATH + iconPath));
+ }
+}
diff --git a/ajde/src/org/aspectj/ajde/IdeUIAdapter.java b/ajde/src/org/aspectj/ajde/IdeUIAdapter.java
new file mode 100644
index 000000000..9c526fb0d
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/IdeUIAdapter.java
@@ -0,0 +1,23 @@
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde;
+
+/**
+ * @author Mik Kersten
+ */
+public interface IdeUIAdapter {
+
+ public void displayStatusInformation(String message);
+}
diff --git a/ajde/src/org/aspectj/ajde/internal/BuildConfigListener.java b/ajde/src/org/aspectj/ajde/internal/BuildConfigListener.java
new file mode 100644
index 000000000..30d3f1e35
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/internal/BuildConfigListener.java
@@ -0,0 +1,37 @@
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+
+package org.aspectj.ajde.internal;
+
+import java.util.EventListener;
+import java.util.List;
+
+/**
+ * @author Mik Kersten
+ */
+public interface BuildConfigListener extends EventListener {
+
+ /**
+ * Called when the current configuration has changed.
+ *
+ * @param configFilePath the path to the new current configuration file
+ */
+ public void currConfigChanged(String configFilePath);
+
+ /**
+ * Called when items are added to or deleted from the configurations list.
+ */
+ public void configsListUpdated(List configsList);
+}
diff --git a/ajde/src/org/aspectj/ajde/internal/BuildConfigManager.java b/ajde/src/org/aspectj/ajde/internal/BuildConfigManager.java
new file mode 100644
index 000000000..f049357c5
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/internal/BuildConfigManager.java
@@ -0,0 +1,99 @@
+/* *******************************************************************
+ * Copyright (c) 1999-2001 Xerox Corporation,
+ * 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xerox/PARC initial implementation
+ * ******************************************************************/
+
+
+package org.aspectj.ajde.internal;
+
+import java.util.List;
+
+import org.aspectj.ajde.ui.BuildConfigModel;
+
+/**
+ * @author Mik Kersten
+ */
+public interface BuildConfigManager {
+
+ public static final String CONFIG_FILE_SUFFIX = ".lst";
+
+ public static final String DEFAULT_CONFIG_LABEL = "<all project files>";
+
+ /**
+ * Returns the currently active build configuration file. The current active
+ * build configuration file that is set in this class is used for building and
+ * for updating the structure model.
+ *
+ * @return full path to the file
+ */
+ public String getActiveConfigFile();
+
+ /**
+ * Sets the currently active build configuration file.
+ *
+ * @param full path to the file
+ */
+ public void setActiveConfigFile(String currConfigFilePath);
+
+ /**
+ * Add a listner that will be notified of build configuration change events
+ */
+ public void addListener(BuildConfigListener configurationListener);
+
+ /**
+ * Remove a configuration listener.
+ */
+ public void removeListener(BuildConfigListener configurationListener);
+
+ /**
+ * Build a model for the corresponding configuration file.
+ *
+ * @param full path to the file
+ */
+ public BuildConfigModel buildModel(String configFilePath);
+
+ /**
+ * Save the given configuration model to the file that it was generated from.
+ */
+ public void writeModel(BuildConfigModel model);
+
+ /**
+ * Write a list of source files into a configuration file. File paths will be
+ * written relative to the path of the configuration file.
+ */
+ public void writePaths(String configFilePath, List paths);
+
+ /**
+ * Add files to a configuration.
+ *
+ * @param configFilePath full path to the configuration file
+ * @param files list of full paths to the files to be added
+ */
+ public void addFilesToConfig(String configFilePath, List files);
+
+ /**
+ * Remove files from a configuration.
+ *
+ * @param configFilePath full path to the configuration file
+ * @param files list of full paths to the files to be removed
+ */
+ public void removeFilesFromConfig(String configFilePath, List files);
+
+
+ /**
+ * @return list (of Strings) of all build configuration files
+ * found so far
+ */
+ public List /*String*/ getAllBuildConfigFiles();
+
+}
+
+
diff --git a/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaBuildOptions.java b/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaBuildOptions.java
new file mode 100644
index 000000000..313ad0d1a
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaBuildOptions.java
@@ -0,0 +1,168 @@
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.ajde.ui.javaoptions;
+
+import java.util.Map;
+
+import org.aspectj.ajde.core.JavaOptions;
+
+/**
+ * Class which handles the setting of the java options and the
+ * java options map required by ICompilerConfiguration#getJavaOptionsMap()
+ */
+public class JavaBuildOptions {
+
+ private Map javaBuildOptions;
+
+ public JavaBuildOptions() {
+ javaBuildOptions = JavaOptions.getDefaultJavaOptions();
+ }
+
+ public Map getJavaBuildOptionsMap() {
+ return javaBuildOptions;
+ }
+
+ public void setOption(String javaOption, String value) {
+ javaBuildOptions.put(javaOption,value);
+ }
+
+ // ----------------- compliance settings ---------------
+
+ // compliance
+ public void setComplianceLevel(String level) {
+ if (JavaOptions.isValidJvmVersion(level)) {
+ javaBuildOptions.put(JavaOptions.COMPLIANCE_LEVEL,level);
+ }
+ }
+ // source
+ public void setSourceCompatibilityLevel(String level) {
+ if (JavaOptions.isValidJvmVersion(level)) {
+ javaBuildOptions.put(JavaOptions.SOURCE_COMPATIBILITY_LEVEL,level);
+ }
+ }
+ // target
+ public void setTargetLevel(String level) {
+ if (JavaOptions.isValidJvmVersion(level)) {
+ javaBuildOptions.put(JavaOptions.TARGET_COMPATIBILITY_LEVEL,level);
+ }
+ }
+
+ // ---------------- compiler warning options ------------------
+
+ // warn method with constructor name
+ public void setWarnMethodWithConstructorName(String option) {
+ if (JavaOptions.isIgnoreOrWarning(option)) {
+ javaBuildOptions.put(
+ JavaOptions.WARN_METHOD_WITH_CONSTRUCTOR_NAME,option);
+ }
+ }
+ // warn overriding package default method
+ public void setWarnOverridingPackageDefaultMethod(String option) {
+ if (JavaOptions.isIgnoreOrWarning(option)) {
+ javaBuildOptions.put(
+ JavaOptions.WARN_OVERRIDING_PACKAGE_DEFAULT_METHOD,option);
+ }
+ }
+ // warn deprecation
+ public void setWarnDeprecation(String option) {
+ if (JavaOptions.isIgnoreOrWarning(option)) {
+ javaBuildOptions.put(
+ JavaOptions.WARN_DEPRECATION,option);
+ }
+ }
+ // warn hidden catch blocks
+ public void setWarnHiddenCatchBlocks(String option) {
+ if (JavaOptions.isIgnoreOrWarning(option)) {
+ javaBuildOptions.put(
+ JavaOptions.WARN_HIDDEN_CATCH_BLOCKS,option);
+ }
+ }
+ // warn unused locals
+ public void setWarnUnusedLocals(String option) {
+ if (JavaOptions.isIgnoreOrWarning(option)) {
+ javaBuildOptions.put(
+ JavaOptions.WARN_UNUSED_LOCALS,option);
+ }
+ }
+ // warn unused parameters
+ public void setWarnUnusedParameters(String option) {
+ if (JavaOptions.isIgnoreOrWarning(option)) {
+ javaBuildOptions.put(
+ JavaOptions.WARN_UNUSED_PARAMETER,option);
+ }
+ }
+ // warn unused imports
+ public void setWarnUnusedImports(String option) {
+ if (JavaOptions.isIgnoreOrWarning(option)) {
+ javaBuildOptions.put(
+ JavaOptions.WARN_UNUSED_IMPORTS,option);
+ }
+ }
+ // warn synthetic access
+ public void setWarnSyntheticAccess(String option) {
+ if (JavaOptions.isIgnoreOrWarning(option)) {
+ javaBuildOptions.put(
+ JavaOptions.WARN_SYNTHETIC_ACCESS,option);
+ }
+ }
+ // warn assert identifier
+ public void setWarnAssertIdentifier(String option) {
+ if (JavaOptions.isIgnoreOrWarning(option)) {
+ javaBuildOptions.put(
+ JavaOptions.WARN_ASSERT_IDENITIFIER,option);
+ }
+ }
+ // warn non nls
+ public void setWarnNonNLS(String option) {
+ if (JavaOptions.isIgnoreOrWarning(option)) {
+ javaBuildOptions.put(
+ JavaOptions.WARN_NON_NLS,option);
+ }
+ }
+
+ // --------------- debug options --------------------
+
+ // debug source
+ public void setDebugSource(String option) {
+ if (JavaOptions.isGenerateOrNot(option)) {
+ javaBuildOptions.put(
+ JavaOptions.DEBUG_SOURCE,option);
+ }
+ }
+ // debug lines
+ public void setDebugLines(String option) {
+ if (JavaOptions.isGenerateOrNot(option)) {
+ javaBuildOptions.put(
+ JavaOptions.DEBUG_LINES,option);
+ }
+ }
+ // debug vars
+ public void setDebugVariables(String option) {
+ if (JavaOptions.isGenerateOrNot(option)) {
+ javaBuildOptions.put(
+ JavaOptions.DEBUG_VARS,option);
+ }
+ }
+ // preserve all locals
+ public void setPreserveAllLocals(String value) {
+ if (JavaOptions.isValidPreserveAllLocalsOption(value)) {
+ javaBuildOptions.put(JavaOptions.PRESERVE_ALL_LOCALS,value);
+ }
+ }
+
+ // ----------- other settings
+ // character encoding
+ public void setCharacterEncoding(String value) {
+ javaBuildOptions.put(JavaOptions.CHARACTER_ENCODING, value);
+ }
+
+
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaCompilerWarningsOptionsPanel.java b/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaCompilerWarningsOptionsPanel.java
new file mode 100644
index 000000000..f34ace5df
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaCompilerWarningsOptionsPanel.java
@@ -0,0 +1,140 @@
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.ajde.ui.javaoptions;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.Border;
+import javax.swing.border.TitledBorder;
+
+import org.aspectj.ajde.core.JavaOptions;
+import org.aspectj.ajde.ui.swing.OptionsPanel;
+
+/**
+ * An options panel which displays the java compiler warning options.
+ * Users should add this to the Ajde.getOptionsFrame()
+ */
+public class JavaCompilerWarningsOptionsPanel extends OptionsPanel {
+
+ private final String[] ignoreOrWarning = new String[] {JavaOptions.IGNORE,JavaOptions.WARNING};
+ private static final long serialVersionUID = 4491319302490183151L;
+
+ private JPanel parentPanel;
+
+ private Border warningsEtchedBorder;
+ private TitledBorder warningsTitleBorder;
+ private Border warningsCompoundBorder;
+ private JPanel warningsPanel;
+ private Box warningsBox = Box.createVerticalBox();
+
+ private JavaBuildOptions javaBuildOptions;
+
+ private Map/*String --> JComboBox*/ warningComboBoxes = new HashMap();
+
+ public JavaCompilerWarningsOptionsPanel(JavaBuildOptions javaBuildOptions) {
+ this.javaBuildOptions = javaBuildOptions;
+ try {
+ jbInit();
+ this.setName("Java Compiler Warning Options");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void loadOptions() throws IOException {
+ createWarningContents();
+ }
+
+ public void saveOptions() throws IOException {
+ Set s = warningComboBoxes.entrySet();
+ for (Iterator iterator = s.iterator(); iterator.hasNext();) {
+ Map.Entry entry = (Entry) iterator.next();
+ String javaOption = (String) entry.getKey();
+ JComboBox combo = (JComboBox)entry.getValue();
+ String value = (String) combo.getSelectedItem();
+ javaBuildOptions.setOption(javaOption, value);
+ }
+ }
+
+ private void jbInit() throws Exception {
+ this.setLayout(new BorderLayout());
+ createBorders();
+ addBordersToPanel();
+ this.add(parentPanel,BorderLayout.NORTH);
+ }
+
+
+ private void createWarningContents() {
+ createWarningsEntry("Method with a constructor name",JavaOptions.WARN_METHOD_WITH_CONSTRUCTOR_NAME);
+ createWarningsEntry("Method overriden but not package visible",JavaOptions.WARN_OVERRIDING_PACKAGE_DEFAULT_METHOD);
+ createWarningsEntry("Deprecated API's",JavaOptions.WARN_DEPRECATION);
+ createWarningsEntry("Hidden catch block",JavaOptions.WARN_HIDDEN_CATCH_BLOCKS);
+ createWarningsEntry("Unused local or private member",JavaOptions.WARN_UNUSED_LOCALS);
+ createWarningsEntry("Parameter is never read",JavaOptions.WARN_UNUSED_PARAMETER);
+ createWarningsEntry("Unused import",JavaOptions.WARN_UNUSED_IMPORTS);
+ createWarningsEntry("Synthetic access",JavaOptions.WARN_SYNTHETIC_ACCESS);
+ createWarningsEntry("Assert identifier",JavaOptions.WARN_ASSERT_IDENITIFIER);
+ createWarningsEntry("Non-externalized strings",JavaOptions.WARN_NON_NLS);
+ warningsPanel.add(warningsBox,null);
+ }
+
+ private void createWarningsEntry(String labelText, String javaOptionToSet) {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BorderLayout());
+
+ JLabel label = new JLabel();
+ label.setFont(new java.awt.Font("Dialog", 0, 11));
+ label.setText(labelText);
+ panel.add(label,BorderLayout.WEST);
+
+ JComboBox warnings = new JComboBox(ignoreOrWarning);
+ String value = (String) javaBuildOptions.getJavaBuildOptionsMap().get(javaOptionToSet);
+ if (value.equals(JavaOptions.IGNORE)) {
+ warnings.setSelectedIndex(0);
+ } else {
+ warnings.setSelectedIndex(1);
+ }
+ panel.add(warnings,BorderLayout.EAST);
+ warningsBox.add(panel,null);
+ warningComboBoxes.put(javaOptionToSet,warnings);
+ }
+
+ private void createBorders() {
+ warningsEtchedBorder = BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158));
+ warningsTitleBorder = new TitledBorder(warningsEtchedBorder, "Warning Options");
+ warningsCompoundBorder = BorderFactory.createCompoundBorder(warningsTitleBorder,
+ BorderFactory.createEmptyBorder(5, 5, 5, 5));
+ warningsTitleBorder.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ }
+
+ private void addBordersToPanel() {
+ parentPanel = new JPanel();
+ parentPanel.setLayout(new BorderLayout());
+
+ warningsPanel = new JPanel();
+ warningsPanel.setBorder(warningsCompoundBorder);
+ parentPanel.add(warningsPanel,BorderLayout.CENTER);
+ }
+
+
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaComplianceOptionsPanel.java b/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaComplianceOptionsPanel.java
new file mode 100644
index 000000000..09eabe901
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaComplianceOptionsPanel.java
@@ -0,0 +1,143 @@
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.ajde.ui.javaoptions;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.Border;
+import javax.swing.border.TitledBorder;
+
+import org.aspectj.ajde.core.JavaOptions;
+import org.aspectj.ajde.ui.swing.OptionsPanel;
+
+/**
+ * An options panel which displays the java compiler compliance options.
+ * Users should add this to the Ajde.getOptionsFrame()
+ */
+public class JavaComplianceOptionsPanel extends OptionsPanel {
+
+ private final String[] complianceLevels = new String[] {JavaOptions.VERSION_13, JavaOptions.VERSION_14, JavaOptions.VERSION_15, JavaOptions.VERSION_16};
+
+ private static final long serialVersionUID = 4491319302490183151L;
+
+ private JPanel parentPanel;
+
+ private Border complianceEtchedBorder;
+ private TitledBorder complianceTitleBorder;
+ private Border complianceCompoundBorder;
+ private JPanel compliancePanel;
+ private Box complianceBox = Box.createVerticalBox();
+
+ private JavaBuildOptions javaBuildOptions;
+
+ private Map/*String --> JComboBox*/ complianceComboBoxes = new HashMap();
+
+ public JavaComplianceOptionsPanel(JavaBuildOptions javaBuildOptions) {
+ this.javaBuildOptions = javaBuildOptions;
+ try {
+ jbInit();
+ this.setName("Java Compliance Options");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void loadOptions() throws IOException {
+ createComplianceContents();
+ }
+
+ public void saveOptions() throws IOException {
+ Set s = complianceComboBoxes.entrySet();
+ for (Iterator iterator = s.iterator(); iterator.hasNext();) {
+ Map.Entry entry = (Entry) iterator.next();
+ String javaOption = (String) entry.getKey();
+ JComboBox combo = (JComboBox)entry.getValue();
+ String value = (String) combo.getSelectedItem();
+ javaBuildOptions.setOption(javaOption, value);
+ }
+ }
+
+ private void jbInit() throws Exception {
+ this.setLayout(new BorderLayout());
+ createBorders();
+ addBordersToPanel();
+ this.add(parentPanel,BorderLayout.NORTH);
+ }
+
+
+ private void createComplianceContents() {
+ createComplianceEntry("AjCompiler compliance level: ",JavaOptions.COMPLIANCE_LEVEL);
+ createComplianceEntry("Source compatibility: ",JavaOptions.SOURCE_COMPATIBILITY_LEVEL);
+ createComplianceEntry("Generated class file compatibility: ",JavaOptions.TARGET_COMPATIBILITY_LEVEL);
+ compliancePanel.add(complianceBox);
+ }
+
+ private void createComplianceEntry(String labelText, String javaOptionToSet) {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BorderLayout());
+
+ JLabel label = new JLabel();
+ label.setFont(new java.awt.Font("Dialog", 0, 11));
+ label.setText(labelText);
+ panel.add(label,BorderLayout.WEST);
+
+ JComboBox levels = new JComboBox(complianceLevels);
+ String value = (String) javaBuildOptions.getJavaBuildOptionsMap().get(javaOptionToSet);
+ if (value == null) {
+ // default to 1.5
+ levels.setSelectedIndex(2);
+ } else if (value.equals(JavaOptions.VERSION_13)) {
+ levels.setSelectedIndex(0);
+ } else if (value.equals(JavaOptions.VERSION_14)){
+ levels.setSelectedIndex(1);
+ } else if (value.equals(JavaOptions.VERSION_15)){
+ levels.setSelectedIndex(2);
+ } else if (value.equals(JavaOptions.VERSION_16)){
+ levels.setSelectedIndex(3);
+ }
+ panel.add(levels,BorderLayout.EAST);
+ complianceBox.add(panel,null);
+ complianceComboBoxes.put(javaOptionToSet,levels);
+ }
+
+
+ private void createBorders() {
+ complianceEtchedBorder = BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158));
+ complianceTitleBorder = new TitledBorder(complianceEtchedBorder, "Compliance Options");
+ complianceCompoundBorder = BorderFactory.createCompoundBorder(complianceTitleBorder,
+ BorderFactory.createEmptyBorder(5, 5, 5, 5));
+ complianceTitleBorder.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ }
+
+ private void addBordersToPanel() {
+ parentPanel = new JPanel();
+ parentPanel.setLayout(new BorderLayout());
+
+ compliancePanel = new JPanel();
+ compliancePanel.setBorder(complianceCompoundBorder);
+
+ parentPanel.add(compliancePanel,BorderLayout.CENTER);
+ }
+
+
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaDebugOptionsPanel.java b/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaDebugOptionsPanel.java
new file mode 100644
index 000000000..7d19d6a08
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaDebugOptionsPanel.java
@@ -0,0 +1,148 @@
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.ajde.ui.javaoptions;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.Border;
+import javax.swing.border.TitledBorder;
+
+import org.aspectj.ajde.core.JavaOptions;
+import org.aspectj.ajde.ui.swing.OptionsPanel;
+
+/**
+ * An options panel which displays the java compiler debug options.
+ * Users should add this to the Ajde.getOptionsFrame()
+ */
+public class JavaDebugOptionsPanel extends OptionsPanel {
+
+ private final String[] debugOptions = new String[] {JavaOptions.GENERATE,JavaOptions.DO_NOT_GENERATE};
+ private final String[] preserveOptions = new String[] {JavaOptions.PRESERVE,JavaOptions.OPTIMIZE};
+
+ private static final long serialVersionUID = 4491319302490183151L;
+
+ private JPanel parentPanel;
+
+ private Border debugEtchedBorder;
+ private TitledBorder debugTitleBorder;
+ private Border debugCompoundBorder;
+ private JPanel debugPanel;
+ private Box debugBox = Box.createVerticalBox();
+
+ private JavaBuildOptions javaBuildOptions;
+
+ private Map/*String --> JComboBox*/ debugComboBoxes = new HashMap();
+
+ public JavaDebugOptionsPanel(JavaBuildOptions javaBuildOptions) {
+ this.javaBuildOptions = javaBuildOptions;
+ try {
+ jbInit();
+ this.setName("Java Debug Options");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void loadOptions() throws IOException {
+ createDebugContents();
+ }
+
+ public void saveOptions() throws IOException {
+ Set s = debugComboBoxes.entrySet();
+ for (Iterator iterator = s.iterator(); iterator.hasNext();) {
+ Map.Entry entry = (Entry) iterator.next();
+ String javaOption = (String) entry.getKey();
+ JComboBox combo = (JComboBox)entry.getValue();
+ String value = (String) combo.getSelectedItem();
+ javaBuildOptions.setOption(javaOption, value);
+ }
+ }
+
+ private void jbInit() throws Exception {
+ this.setLayout(new BorderLayout());
+ createBorders();
+ addBordersToPanel();
+ this.add(parentPanel,BorderLayout.NORTH);
+ }
+
+ private void createDebugContents() {
+ createDebugEntry("Add line number attributes to generated class files",JavaOptions.DEBUG_LINES);
+ createDebugEntry("Add source file name to generated class file",JavaOptions.DEBUG_SOURCE);
+ createDebugEntry("Add variable attributes to generated class files",JavaOptions.DEBUG_VARS);
+ createDebugEntry("Preserve unused (never read) local variables",JavaOptions.PRESERVE_ALL_LOCALS);
+ debugPanel.add(debugBox);
+ }
+
+ private void createDebugEntry(String labelText, String javaOptionToSet) {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BorderLayout());
+
+ JLabel label = new JLabel();
+ label.setFont(new java.awt.Font("Dialog", 0, 11));
+ label.setText(labelText);
+ panel.add(label,BorderLayout.WEST);
+
+ JComboBox debug = null;
+ if (javaOptionToSet.equals(JavaOptions.PRESERVE_ALL_LOCALS)) {
+ debug = new JComboBox(preserveOptions);
+ String value = (String) javaBuildOptions.getJavaBuildOptionsMap().get(javaOptionToSet);
+ if (value.equals(JavaOptions.PRESERVE)) {
+ debug.setSelectedIndex(0);
+ } else {
+ debug.setSelectedIndex(1);
+ }
+ } else {
+ debug = new JComboBox(debugOptions);
+ String value = (String) javaBuildOptions.getJavaBuildOptionsMap().get(javaOptionToSet);
+ if (value.equals(JavaOptions.GENERATE)) {
+ debug.setSelectedIndex(0);
+ } else {
+ debug.setSelectedIndex(1);
+ }
+ }
+ panel.add(debug,BorderLayout.EAST);
+ debugBox.add(panel,null);
+ debugComboBoxes.put(javaOptionToSet,debug);
+ }
+
+
+ private void createBorders() {
+ debugEtchedBorder = BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158));
+ debugTitleBorder = new TitledBorder(debugEtchedBorder, "Debug Options");
+ debugCompoundBorder = BorderFactory.createCompoundBorder(debugTitleBorder,
+ BorderFactory.createEmptyBorder(5, 5, 5, 5));
+ debugTitleBorder.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ }
+
+ private void addBordersToPanel() {
+ parentPanel = new JPanel();
+ parentPanel.setLayout(new BorderLayout());
+
+ debugPanel = new JPanel();
+ debugPanel.setBorder(debugCompoundBorder);
+
+ parentPanel.add(debugPanel,BorderLayout.CENTER);
+ }
+
+
+}
diff --git a/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaOtherOptionsPanel.java b/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaOtherOptionsPanel.java
new file mode 100644
index 000000000..5ffaf13c3
--- /dev/null
+++ b/ajde/src/org/aspectj/ajde/ui/javaoptions/JavaOtherOptionsPanel.java
@@ -0,0 +1,120 @@
+/********************************************************************
+ * Copyright (c) 2007 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version (bug 148190)
+ *******************************************************************/
+package org.aspectj.ajde.ui.javaoptions;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.io.IOException;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.Border;
+import javax.swing.border.TitledBorder;
+
+import org.aspectj.ajde.core.JavaOptions;
+import org.aspectj.ajde.ui.swing.OptionsPanel;
+
+/**
+ * An options panel which displays the character encoding java
+ * compiler option. Users should add this to the Ajde.getOptionsFrame()
+ */
+public class JavaOtherOptionsPanel extends OptionsPanel {
+
+ private static final long serialVersionUID = 4491319302490183151L;
+
+ private JPanel parentPanel;
+
+ private Border otherEtchedBorder;
+ private TitledBorder otherTitleBorder;
+ private Border otherCompoundBorder;
+ private JPanel otherPanel;
+ private Box otherBox = Box.createVerticalBox();
+
+ private JavaBuildOptions javaBuildOptions;
+
+ private JTextField characterEncoding;
+
+ public JavaOtherOptionsPanel(JavaBuildOptions javaBuildOptions) {
+ this.javaBuildOptions = javaBuildOptions;
+ try {
+ jbInit();
+ this.setName("Java Other Build Options");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void loadOptions() throws IOException {
+ createOtherContents();
+ }
+
+ public void saveOptions() throws IOException {
+ String text = characterEncoding.getText();
+ if (text != null ) {
+ javaBuildOptions.setCharacterEncoding(text);
+ }
+ }
+
+ private void jbInit() throws Exception {
+ this.setLayout(new BorderLayout());
+ createBorders();
+ addBordersToPanel();
+ this.add(parentPanel,BorderLayout.NORTH);
+ }
+
+ private void createOtherContents() {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BorderLayout());
+
+ JLabel label = new JLabel();
+ label.setFont(new java.awt.Font("Dialog", 0, 11));
+ label.setText("Character encoding (will default to platform encoding)");
+ panel.add(label,BorderLayout.WEST);
+
+ characterEncoding = new JTextField();
+ characterEncoding.setFont(new java.awt.Font("SansSerif", 0, 11));
+ characterEncoding.setMinimumSize(new Dimension(100, 21));
+ characterEncoding.setPreferredSize(new Dimension(150, 21));
+ panel.add(characterEncoding,BorderLayout.EAST);
+
+ String option = (String) javaBuildOptions.getJavaBuildOptionsMap().get(
+ JavaOptions.CHARACTER_ENCODING);
+ if (option != null) {
+ characterEncoding.setText(option);
+ }
+
+ otherBox.add(panel,null);
+ otherPanel.add(otherBox);
+ }
+
+ private void createBorders() {
+ otherEtchedBorder = BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158));
+ otherTitleBorder = new TitledBorder(otherEtchedBorder, "Other Options");
+ otherCompoundBorder = BorderFactory.createCompoundBorder(otherTitleBorder,
+ BorderFactory.createEmptyBorder(5, 5, 5, 5));
+ otherTitleBorder.setTitleFont(new java.awt.Font("Dialog", 0, 11));
+ }
+
+ private void addBordersToPanel() {
+ parentPanel = new JPanel();
+ parentPanel.setLayout(new BorderLayout());
+
+ otherPanel = new JPanel();
+ otherPanel.setBorder(otherCompoundBorder);
+ parentPanel.add(otherPanel,BorderLayout.CENTER);
+ }
+
+
+}