diff --git a/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/ResultDisplayHandler.java b/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/ResultDisplayHandler.java --- a/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/ResultDisplayHandler.java +++ b/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/ResultDisplayHandler.java @@ -307,6 +307,10 @@ displayInDispatchThread(prepareMethod("displayMsgSessionFinished", String.class), msg); //NOI18N + // #186277: declaration of the ResultWindow as a top component with the + // special results for activation of it instead of usual Output window. + // See also org.apache.tools.ant.module.run.TargetExecutor.run(). + System.setProperty("SPECIAL_RESULTS_TOPCOMPONENT_ID", ResultWindow.ID); } /** */ private Map methodsMap = new HashMap(); diff --git a/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/ResultWindow.java b/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/ResultWindow.java --- a/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/ResultWindow.java +++ b/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/ResultWindow.java @@ -73,7 +73,7 @@ final class ResultWindow extends TopComponent { /** unique ID of TopComponent (singleton) */ - private static final String ID = "gsf-testrunner-results"; //NOI18N + static final String ID = "gsf-testrunner-results"; //NOI18N /** * instance/singleton of this class * diff --git a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/TargetExecutor.java b/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/TargetExecutor.java --- a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/TargetExecutor.java +++ b/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/TargetExecutor.java @@ -41,6 +41,7 @@ package org.apache.tools.ant.module.run; +import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.io.File; import java.io.IOException; @@ -90,6 +91,8 @@ import org.openide.windows.IOSelect; import org.openide.windows.InputOutput; import org.openide.windows.OutputWriter; +import org.openide.windows.TopComponent; +import org.openide.windows.WindowManager; import org.w3c.dom.Element; /** Executes an Ant Target asynchronously in the IDE. @@ -482,6 +485,40 @@ if (!displayed.getAndSet(true)) { io.select(); } + + // #186277 + EventQueue.invokeLater(new Runnable() { + + /** + * Activates a top component with the special results if + * the system property "SPECIAL_RESULTS_TOPCOMPONENT_ID" + * defines identifier of that component, otherwise does + * nothing, and then "clears" the property for future + * use. + */ + @Override + public void run() { + String SPECIAL_RESULTS_TOPCOMPONENT_ID_PROP = + "SPECIAL_RESULTS_TOPCOMPONENT_ID"; + String UNKNOWN_TOPCOMPONENT_ID = + "***Unknown***"; + String id = System.getProperty( + SPECIAL_RESULTS_TOPCOMPONENT_ID_PROP, + UNKNOWN_TOPCOMPONENT_ID); + if(UNKNOWN_TOPCOMPONENT_ID.equals(id)) { + return; // do nothing + } + TopComponent specialResults = + WindowManager.getDefault().findTopComponent(id); + if(specialResults != null) { + specialResults.requestActive(); + } + // "Clear" the property for future use + System.setProperty( + SPECIAL_RESULTS_TOPCOMPONENT_ID_PROP, + UNKNOWN_TOPCOMPONENT_ID); + } + }); } };