/plugins/maven/src/main/java/org/jetbrains/idea/maven/tasks/actions/MavenExecuteBeforeRunDialog.java

https://bitbucket.org/nbargnesi/idea · Java · 63 lines · 40 code · 8 blank · 15 comment · 0 complexity · 7e4b28c4421e8453e2b051935f88af48 MD5 · raw file

  1. /*
  2. * Copyright 2000-2009 JetBrains s.r.o.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.jetbrains.idea.maven.tasks.actions;
  17. import com.intellij.execution.impl.BaseExecuteBeforeRunDialog;
  18. import com.intellij.openapi.project.Project;
  19. import com.intellij.openapi.util.Key;
  20. import org.jetbrains.idea.maven.project.MavenProject;
  21. import org.jetbrains.idea.maven.tasks.MavenBeforeRunTask;
  22. import org.jetbrains.idea.maven.tasks.MavenBeforeRunTasksProvider;
  23. import org.jetbrains.idea.maven.tasks.TasksBundle;
  24. public class MavenExecuteBeforeRunDialog extends BaseExecuteBeforeRunDialog<MavenBeforeRunTask> {
  25. private final MavenProject myMavenProject;
  26. private final String myGoal;
  27. public MavenExecuteBeforeRunDialog(Project project, MavenProject mavenProject, String goal) {
  28. super(project);
  29. myMavenProject = mavenProject;
  30. myGoal = goal;
  31. init();
  32. }
  33. @Override
  34. protected String getTargetDisplayString() {
  35. return TasksBundle.message("maven.tasks.goal");
  36. }
  37. @Override
  38. protected Key<MavenBeforeRunTask> getTaskID() {
  39. return MavenBeforeRunTasksProvider.ID;
  40. }
  41. @Override
  42. protected boolean isRunning(MavenBeforeRunTask task) {
  43. return task.isFor(myMavenProject, myGoal);
  44. }
  45. @Override
  46. protected void update(MavenBeforeRunTask task) {
  47. task.setProjectPath(myMavenProject.getPath());
  48. task.setGoal(myGoal);
  49. }
  50. @Override
  51. protected void clear(MavenBeforeRunTask task) {
  52. task.setProjectPath(null);
  53. task.setGoal(null);
  54. }
  55. }