This is an automated email from the ASF dual-hosted git repository. mbien pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push: new 5a46d6d4c6 globally enable maven stacktrace processing. new a959587808 Merge pull request #5116 from mbien/global-stacktrace-parsing 5a46d6d4c6 is described below commit 5a46d6d4c685677f5d877eae165fdb8fb5064d4e Author: Michael Bien <mbie...@gmail.com> AuthorDate: Thu Dec 15 23:48:05 2022 +0100 globally enable maven stacktrace processing. --- .../output/DefaultOutputProcessorFactory.java | 4 +- .../output/ExecPluginOutputListenerProvider.java | 51 +++----------------- ...der.java => JavaStacktraceOutputProcessor.java} | 55 +++++++++++----------- 3 files changed, 35 insertions(+), 75 deletions(-) diff --git a/java/maven/src/org/netbeans/modules/maven/output/DefaultOutputProcessorFactory.java b/java/maven/src/org/netbeans/modules/maven/output/DefaultOutputProcessorFactory.java index 18f923c53b..7f57110442 100644 --- a/java/maven/src/org/netbeans/modules/maven/output/DefaultOutputProcessorFactory.java +++ b/java/maven/src/org/netbeans/modules/maven/output/DefaultOutputProcessorFactory.java @@ -33,13 +33,13 @@ import org.openide.util.lookup.ServiceProvider; public class DefaultOutputProcessorFactory implements ContextOutputProcessorFactory { @Override public Set<OutputProcessor> createProcessorsSet(Project project) { - Set<OutputProcessor> toReturn = new HashSet<OutputProcessor>(); + Set<OutputProcessor> toReturn = new HashSet<>(); if (project != null) { toReturn.add(new JavadocOutputProcessor()); toReturn.add(new TestOutputListenerProvider()); toReturn.add(new SiteOutputProcessor(project)); NbMavenProjectImpl nbprj = project.getLookup().lookup(NbMavenProjectImpl.class); - toReturn.add(new ExecPluginOutputListenerProvider(nbprj)); + toReturn.add(new JavaStacktraceOutputProcessor(nbprj)); toReturn.add(new DependencyAnalyzeOutputProcessor(nbprj)); } return toReturn; diff --git a/java/maven/src/org/netbeans/modules/maven/output/ExecPluginOutputListenerProvider.java b/java/maven/src/org/netbeans/modules/maven/output/ExecPluginOutputListenerProvider.java index 2da6103946..fa90801d70 100644 --- a/java/maven/src/org/netbeans/modules/maven/output/ExecPluginOutputListenerProvider.java +++ b/java/maven/src/org/netbeans/modules/maven/output/ExecPluginOutputListenerProvider.java @@ -19,64 +19,25 @@ package org.netbeans.modules.maven.output; import org.netbeans.modules.maven.NbMavenProjectImpl; -import org.netbeans.modules.maven.api.output.OutputProcessor; -import org.netbeans.modules.maven.api.output.OutputUtils; -import org.netbeans.modules.maven.api.output.OutputVisitor; -import org.netbeans.api.java.classpath.ClassPath; -import org.netbeans.api.project.Project; -import org.netbeans.modules.maven.api.classpath.ProjectSourcesClassPathProvider; -import org.netbeans.spi.java.classpath.support.ClassPathSupport; -import org.openide.windows.OutputListener; - - /** * exec plugin output processing, just handle stacktraces. * @author Milos Kleint + * + * @deprecated use JavaStacktraceOutputListenerProvider instead */ -public class ExecPluginOutputListenerProvider implements OutputProcessor { - +public class ExecPluginOutputListenerProvider extends JavaStacktraceOutputProcessor { + private static final String[] EXECGOALS = new String[] { "mojo-execute#exec:exec", //NOI18N "mojo-execute#exec:java", //NOI18N "mojo-execute#javafx:run" //NOI18N }; - private final NbMavenProjectImpl project; - + /** Creates a new instance of ExecPluginOutputListenerProvider */ public ExecPluginOutputListenerProvider(NbMavenProjectImpl proj) { - project = proj; - } - - @Override - public void processLine(String line, OutputVisitor visitor) { - OutputVisitor.Context context = visitor.getContext(); - Project prj = project; - if (context != null && context.getCurrentProject() != null) { - prj = context.getCurrentProject(); - } - OutputListener list = OutputUtils.matchStackTraceLine(line, prj); - if (list != null) { - visitor.setOutputListener(list); - } + super(proj, EXECGOALS); } - @Override - public String[] getRegisteredOutputSequences() { - return EXECGOALS; - } - - @Override - public void sequenceStart(String sequenceId, OutputVisitor visitor) { - } - - @Override - public void sequenceEnd(String sequenceId, OutputVisitor visitor) { - } - - @Override - public void sequenceFail(String sequenceId, OutputVisitor visitor) { - } - } diff --git a/java/maven/src/org/netbeans/modules/maven/output/ExecPluginOutputListenerProvider.java b/java/maven/src/org/netbeans/modules/maven/output/JavaStacktraceOutputProcessor.java similarity index 71% copy from java/maven/src/org/netbeans/modules/maven/output/ExecPluginOutputListenerProvider.java copy to java/maven/src/org/netbeans/modules/maven/output/JavaStacktraceOutputProcessor.java index 2da6103946..56ef8a34b1 100644 --- a/java/maven/src/org/netbeans/modules/maven/output/ExecPluginOutputListenerProvider.java +++ b/java/maven/src/org/netbeans/modules/maven/output/JavaStacktraceOutputProcessor.java @@ -22,33 +22,35 @@ import org.netbeans.modules.maven.NbMavenProjectImpl; import org.netbeans.modules.maven.api.output.OutputProcessor; import org.netbeans.modules.maven.api.output.OutputUtils; import org.netbeans.modules.maven.api.output.OutputVisitor; -import org.netbeans.api.java.classpath.ClassPath; import org.netbeans.api.project.Project; -import org.netbeans.modules.maven.api.classpath.ProjectSourcesClassPathProvider; -import org.netbeans.spi.java.classpath.support.ClassPathSupport; import org.openide.windows.OutputListener; - - /** - * exec plugin output processing, just handle stacktraces. - * @author Milos Kleint + * Provides links for stack traces in the output window. + * + * @author mbien */ -public class ExecPluginOutputListenerProvider implements OutputProcessor { - - private static final String[] EXECGOALS = new String[] { - "mojo-execute#exec:exec", //NOI18N - "mojo-execute#exec:java", //NOI18N - "mojo-execute#javafx:run" //NOI18N - }; +public class JavaStacktraceOutputProcessor implements OutputProcessor { + + private final String[] goals; private final NbMavenProjectImpl project; - - /** Creates a new instance of ExecPluginOutputListenerProvider */ - public ExecPluginOutputListenerProvider(NbMavenProjectImpl proj) { - project = proj; + + /** + * Creates a JavaStacktraceOutputProcessor with global scope (goal: "session-execute"). + */ + public JavaStacktraceOutputProcessor(NbMavenProjectImpl project) { + this(project, new String[] { "session-execute" }); + } + + /** + * Creates a JavaStacktraceOutputProcessor which is only active during the given goals. + */ + public JavaStacktraceOutputProcessor(NbMavenProjectImpl project, String[] goals) { + this.project = project; + this.goals = goals; } - + @Override public void processLine(String line, OutputVisitor visitor) { OutputVisitor.Context context = visitor.getContext(); @@ -64,19 +66,16 @@ public class ExecPluginOutputListenerProvider implements OutputProcessor { @Override public String[] getRegisteredOutputSequences() { - return EXECGOALS; + return goals; } @Override - public void sequenceStart(String sequenceId, OutputVisitor visitor) { - } + public void sequenceStart(String sequenceId, OutputVisitor visitor) {} @Override - public void sequenceEnd(String sequenceId, OutputVisitor visitor) { - } - + public void sequenceEnd(String sequenceId, OutputVisitor visitor) {} + @Override - public void sequenceFail(String sequenceId, OutputVisitor visitor) { - } - + public void sequenceFail(String sequenceId, OutputVisitor visitor) {} + } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists