mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Minor maven action optimization: check MavenDataKeys.MAVEN_GOALS firstly
This commit is contained in:
+3
-3
@@ -38,12 +38,12 @@ public class RunBuildAction extends MavenAction {
|
||||
}
|
||||
|
||||
private static boolean checkOrPerform(DataContext context, boolean perform) {
|
||||
final MavenProject project = MavenActionUtil.getMavenProject(context);
|
||||
if (project == null) return false;
|
||||
|
||||
final List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(context);
|
||||
if (goals == null || goals.isEmpty()) return false;
|
||||
|
||||
final MavenProject project = MavenActionUtil.getMavenProject(context);
|
||||
if (project == null) return false;
|
||||
|
||||
if (!perform) return true;
|
||||
|
||||
final MavenRunnerParameters params = new MavenRunnerParameters(true,
|
||||
|
||||
+3
-3
@@ -50,14 +50,14 @@ public class AssignShortcutAction extends MavenAction {
|
||||
|
||||
@Nullable
|
||||
private static String getGoalActionId(DataContext context) {
|
||||
MavenProject project = MavenActionUtil.getMavenProject(context);
|
||||
if (project == null) return null;
|
||||
|
||||
final List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(context);
|
||||
if (goals == null || goals.size() != 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MavenProject project = MavenActionUtil.getMavenProject(context);
|
||||
if (project == null) return null;
|
||||
|
||||
String goal = goals.get(0);
|
||||
|
||||
return getShortcutsManager(context).getActionId(project.getPath(), goal);
|
||||
|
||||
+3
-2
@@ -58,11 +58,12 @@ public class ToggleBeforeRunTaskAction extends MavenToggleAction {
|
||||
|
||||
@Nullable
|
||||
protected static Pair<MavenProject, String> getTaskDesc(DataContext context) {
|
||||
List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(context);
|
||||
if (goals == null || goals.size() != 1) return null;
|
||||
|
||||
MavenProject mavenProject = MavenActionUtil.getMavenProject(context);
|
||||
if (mavenProject == null) return null;
|
||||
|
||||
List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(context);
|
||||
if (goals == null || goals.size() != 1) return null;
|
||||
|
||||
return Pair.create(mavenProject, goals.get(0));
|
||||
}
|
||||
|
||||
+3
-3
@@ -53,12 +53,12 @@ public abstract class ToggleCompilerTasksAction extends MavenToggleAction {
|
||||
}
|
||||
|
||||
protected static List<MavenCompilerTask> getTasks(DataContext context) {
|
||||
MavenProject project = MavenActionUtil.getMavenProject(context);
|
||||
if (project == null) return Collections.emptyList();
|
||||
|
||||
final List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(context);
|
||||
if (goals == null || goals.isEmpty()) return Collections.emptyList();
|
||||
|
||||
MavenProject project = MavenActionUtil.getMavenProject(context);
|
||||
if (project == null) return Collections.emptyList();
|
||||
|
||||
List<MavenCompilerTask> result = new ArrayList<MavenCompilerTask>();
|
||||
for (String each : goals) {
|
||||
result.add(new MavenCompilerTask(project.getPath(), each));
|
||||
|
||||
Reference in New Issue
Block a user