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;
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.
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;
// 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;
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) {
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;
class MessageHandlerAdapter extends MessageHandler {
private TaskListManager taskListManager;
- private BuildNotifierAdapter buildNotifierAdapter;
-
+
public MessageHandlerAdapter() {
this.taskListManager = Ajde.getDefault().getTaskListManager();
}
taskListManager.addSourcelineTask(message);
return super.handleMessage(message); // also store...
}
- // --------------- adje methods
- public void setBuildNotifierAdapter(BuildNotifierAdapter buildNotifierAdapter) {
- this.buildNotifierAdapter = buildNotifierAdapter;
- }
}
public void setState(AjState buildState) {