diff --git a/kantra b/kantra new file mode 100755 index 0000000..2f8d352 Binary files /dev/null and b/kantra differ diff --git a/src/main/java/org/jboss/tools/intellij/windup/cli/KantraCliParamBuilder.java b/src/main/java/org/jboss/tools/intellij/windup/cli/KantraCliParamBuilder.java index c88ad78..a9a37b7 100644 --- a/src/main/java/org/jboss/tools/intellij/windup/cli/KantraCliParamBuilder.java +++ b/src/main/java/org/jboss/tools/intellij/windup/cli/KantraCliParamBuilder.java @@ -32,9 +32,10 @@ public static List buildParams(WindupConfiguration config) { target = Lists.newArrayList(); target.add("eap7"); } - params.add("--target"); + // params.add("--target"); for (String aTarget : target) { + params.add("--target"); params.add(aTarget); } // params.add(String.join(",", target)); diff --git a/src/main/java/org/jboss/tools/intellij/windup/cli/WindupCliProcessHandler.java b/src/main/java/org/jboss/tools/intellij/windup/cli/WindupCliProcessHandler.java index 1c4a301..64975ac 100644 --- a/src/main/java/org/jboss/tools/intellij/windup/cli/WindupCliProcessHandler.java +++ b/src/main/java/org/jboss/tools/intellij/windup/cli/WindupCliProcessHandler.java @@ -8,14 +8,14 @@ import com.intellij.execution.process.OSProcessHandler; import com.intellij.execution.ui.ConsoleViewContentType; import com.intellij.openapi.progress.ProgressIndicator; -import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.util.Key; import com.intellij.openapi.vfs.CharsetToolkit; import org.jboss.tools.intellij.windup.explorer.actions.RunConfigurationAction; import org.jetbrains.annotations.NotNull; - +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.nio.charset.Charset; -import java.util.Arrays; + import static org.jboss.tools.intellij.windup.cli.ProgressMonitor.PROGRESS; @@ -74,7 +74,8 @@ else if (text.contains("rules parsed")) { progressIndicator.setFraction(0.10); } else if (text.contains("rule response received")) { - progressIndicator.setText("Running Analysis..."); + int progress = calculateWorkDonePercentage(text); + progressIndicator.setText("Running Analysis (" + progress + "%)"); progressIndicator.setFraction(0.25); } else if (text.contains("running dependency analysis")) { @@ -91,6 +92,12 @@ else if (text.contains("Static report created.")) { progressMonitor.handleMessage(msg); progressIndicator.setFraction(1); } + else if (text.contains("Error")) { + System.out.println(text + "---------------------------------------: detected "); + ProgressMonitor.ProgressMessage msg = new ProgressMonitor.ProgressMessage("complete", "", 20, ""); + progressMonitor.handleMessage(msg); + progressIndicator.setFraction(1); + } else if (text.contains(PROGRESS)) { JsonObject json = ProgressMonitor.parseProgressMessage(text); if (json != null) { @@ -119,4 +126,26 @@ else if (text.contains(PROGRESS)) { public Charset getCharset() { return CharsetToolkit.UTF8_CHARSET; } + + public static int calculateWorkDonePercentage(String log) { + // Regex pattern to extract the relevant numbers from the log string + String pattern = "failed=(\\d+) matched=(\\d+) total=(\\d+) unmatched=(\\d+)"; + Pattern r = Pattern.compile(pattern); + Matcher m = r.matcher(log); + + if (m.find()) { + // Parse numbers from the log string + int failed = Integer.parseInt(m.group(1)); + int matched = Integer.parseInt(m.group(2)); + int total = Integer.parseInt(m.group(3)); + int unmatched = Integer.parseInt(m.group(4)); + + // Calculate the work done percentage + double workDone = (double) (failed + matched + unmatched) / total; + return (int) Math.round(workDone * 100); + } else { + // If the pattern does not match, return an error code or throw an exception + return -1; // Or you could throw an exception + } + } } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 457209f..602858f 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,11 +1,11 @@ org.jboss.tools.intellij.mtr - Migration Toolkit for Runtimes (MTR) by Red Hat + Migration Toolkit for Applications (MTA) by Red Hat Red-Hat Overview -

The Migration Toolkit for Runtimes (MTR) plugin for IntelliJ Platform-based IDEs.

+

The Migration Toolkit for Applications (MTA) plugin for IntelliJ Platform-based IDEs.

Provides tooling to accelerate application migration by marking migration issues in the source code, provides guidance to fix the issues, and offers automatic code replacement when possible.

Read more about MTR here.

]]>
@@ -19,7 +19,7 @@ com.intellij.modules.platform -