summaryrefslogtreecommitdiffstats
path: root/ajde
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-09-01 17:09:49 +0000
committeracolyer <acolyer>2005-09-01 17:09:49 +0000
commitd8442e7f2a1af534dddc827134d970e9812c881b (patch)
tree34703e3016e32501556b7b7f8e9be69c9285570f /ajde
parent6629e48dbff05751879a24c27623a3c923189a79 (diff)
downloadaspectj-d8442e7f2a1af534dddc827134d970e9812c881b.tar.gz
aspectj-d8442e7f2a1af534dddc827134d970e9812c881b.zip
fix for pr102479, allow clients to provide a custom message handler / holder to be used in place of the default if so desired.
Diffstat (limited to 'ajde')
-rw-r--r--ajde/src/org/aspectj/ajde/Ajde.java15
-rw-r--r--ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java16
2 files changed, 22 insertions, 9 deletions
diff --git a/ajde/src/org/aspectj/ajde/Ajde.java b/ajde/src/org/aspectj/ajde/Ajde.java
index fd08eeccc..06a382e1d 100644
--- a/ajde/src/org/aspectj/ajde/Ajde.java
+++ b/ajde/src/org/aspectj/ajde/Ajde.java
@@ -21,6 +21,7 @@ import org.aspectj.ajde.ui.StructureSearchManager;
import org.aspectj.ajde.ui.StructureViewManager;
import org.aspectj.ajde.ui.StructureViewNodeFactory;
import org.aspectj.asm.AsmManager;
+import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.Version;
import org.aspectj.util.LangUtil;
import org.aspectj.util.Reflection;
@@ -53,6 +54,7 @@ public class Ajde {
private IdeUIAdapter ideUIAdapter;
private ErrorHandler errorHandler;
private PrintStream logPrintStream = null;
+ private IMessageHandler messageHandler = null; // allow provision of custom handler
/**
* This class can only be constructured by itself (as a singleton) or by sub-classes.
@@ -114,6 +116,19 @@ public class Ajde {
public void setConfigurationManager(BuildConfigManager configurationManager) {
this.configurationManager = configurationManager;
}
+
+ /**
+ * Call this method with a custom IMessageHandler to override the default message
+ * handling.
+ * @param aHandler
+ */
+ public void setMessageHandler(IMessageHandler aHandler) {
+ this.messageHandler = aHandler;
+ }
+
+ public IMessageHandler getMessageHandler() {
+ return messageHandler;
+ }
public BuildManager getBuildManager() {
return buildManager;
diff --git a/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java b/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
index 13dc99cf0..504f2b927 100644
--- a/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
+++ b/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
@@ -45,7 +45,7 @@ public class CompilerAdapter {
// private Map optionsMap;
private AjBuildManager buildManager = null;
- private MessageHandlerAdapter messageHandler = null;
+ private IMessageHandler messageHandler = null;
private BuildNotifierAdapter currNotifier = null;
private boolean initialized = false;
private boolean structureDirty = true;
@@ -99,7 +99,6 @@ public class CompilerAdapter {
buildConfig.setGenerateModelMode(buildModel);
currNotifier = new BuildNotifierAdapter(progressMonitor, buildManager);
buildManager.setProgressListener(currNotifier);
- messageHandler.setBuildNotifierAdapter(currNotifier);
String rtInfo = buildManager.checkRtJar(buildConfig); // !!! will get called twice
if (rtInfo != null) {
@@ -600,7 +599,11 @@ public class CompilerAdapter {
private void init() {
if (!initialized) { // XXX plug into AJDE initialization
// Ajde.getDefault().setErrorHandler(new DebugErrorHandler());
- this.messageHandler = new MessageHandlerAdapter();
+ if (Ajde.getDefault().getMessageHandler() != null) {
+ this.messageHandler = Ajde.getDefault().getMessageHandler();
+ } else {
+ this.messageHandler = new MessageHandlerAdapter();
+ }
buildManager = new AjBuildManager(messageHandler);
// XXX need to remove the properties file each time!
initialized = true;
@@ -609,8 +612,7 @@ public class CompilerAdapter {
class MessageHandlerAdapter extends MessageHandler {
private TaskListManager taskListManager;
- private BuildNotifierAdapter buildNotifierAdapter;
-
+
public MessageHandlerAdapter() {
this.taskListManager = Ajde.getDefault().getTaskListManager();
}
@@ -625,10 +627,6 @@ public class CompilerAdapter {
taskListManager.addSourcelineTask(message);
return super.handleMessage(message); // also store...
}
- // --------------- adje methods
- public void setBuildNotifierAdapter(BuildNotifierAdapter buildNotifierAdapter) {
- this.buildNotifierAdapter = buildNotifierAdapter;
- }
}
public void setState(AjState buildState) {