/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2010 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.intellij.lang.ant.config.explorer;
+package com.intellij.execution.impl;
+import com.intellij.execution.BeforeRunTask;
+import com.intellij.execution.ExecutionBundle;
import com.intellij.execution.RunManager;
import com.intellij.execution.RunManagerEx;
import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.execution.configurations.ConfigurationType;
import com.intellij.execution.configurations.RunConfiguration;
-import com.intellij.execution.impl.RunManagerImpl;
-import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl;
-import com.intellij.lang.ant.AntBundle;
-import com.intellij.lang.ant.config.AntBuildFile;
-import com.intellij.lang.ant.config.AntBuildTarget;
-import com.intellij.lang.ant.config.impl.AntBeforeRunTask;
-import com.intellij.lang.ant.config.impl.AntBeforeRunTaskProvider;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.util.Key;
import com.intellij.ui.TreeSpeedSearch;
import com.intellij.ui.TreeToolTipHandler;
import com.intellij.ui.treeStructure.Tree;
import java.util.Enumeration;
import java.util.Set;
-public final class ExecuteOnRunDialog extends DialogWrapper {
+
+public abstract class BaseExecuteBeforeRunDialog<T extends BeforeRunTask> extends DialogWrapper {
private final Project myProject;
- private final AntBuildTarget myTarget;
- private final AntBuildFile myFile;
private DefaultMutableTreeNode myRoot;
- public ExecuteOnRunDialog(final Project project, final AntBuildTarget target, final AntBuildFile file) {
+ public BaseExecuteBeforeRunDialog(final Project project) {
super(project, true);
myProject = project;
- myTarget = target;
- myFile = file;
- setTitle(AntBundle.message("execute.target.before.run.debug.dialog.title"));
- init();
}
+ @Override
+ protected void init() {
+ super.init();
+ setTitle(ExecutionBundle.message("execute.before.run.debug.dialog.title", getTargetDisplayString()));
+ }
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new BorderLayout());
final RunManagerEx runManager = RunManagerEx.getInstanceEx(myProject);
for (ConfigurationFactory factory : type.getConfigurationFactories()) {
final RunnerAndConfigurationSettingsImpl settings = ((RunManagerImpl)runManager).getConfigurationTemplate(factory);
- final AntBeforeRunTask task = runManager.getBeforeRunTask(settings.getConfiguration(), AntBeforeRunTaskProvider.ID);
- if (task != null && task.isRunningTarget(myTarget)) {
- return true;
- }
+ if (isConfigurationAssigned(settings.getConfiguration())) return true;
}
return false;
}
+
private boolean isConfigurationAssigned(RunConfiguration configuration) {
- final AntBeforeRunTask task = RunManagerEx.getInstanceEx(myProject).getBeforeRunTask(configuration, AntBeforeRunTaskProvider.ID);
- return task != null && task.isRunningTarget(myTarget);
+ final T task = RunManagerEx.getInstanceEx(myProject).getBeforeRunTask(configuration, getTaskID());
+ return task != null && isRunning(task);
}
protected void doOKAction() {
final DefaultMutableTreeNode node = (DefaultMutableTreeNode)nodes.nextElement();
final Descriptor descriptor = (Descriptor)node.getUserObject();
final boolean isChecked = descriptor.isChecked();
- final String targetName;
- final String antfileUrl;
- if (isChecked) {
- final VirtualFile vFile = myTarget.getModel().getBuildFile().getVirtualFile();
- targetName = vFile != null? myTarget.getName() : null;
- antfileUrl = vFile != null? vFile.getUrl() : null;
- }
- else {
- targetName = null;
- antfileUrl = null;
- }
+
if (descriptor instanceof ConfigurationTypeDescriptor) {
- final ConfigurationTypeDescriptor configurationTypeDescriptor = (ConfigurationTypeDescriptor)descriptor;
- for (ConfigurationFactory factory : configurationTypeDescriptor.getConfigurationType().getConfigurationFactories()) {
- final RunnerAndConfigurationSettingsImpl settings = runManager.getConfigurationTemplate(factory);
- final AntBeforeRunTask task = runManager.getBeforeRunTask(settings.getConfiguration(), AntBeforeRunTaskProvider.ID);
- if (task != null && (isChecked || task.isRunningTarget(myTarget))) {
- task.setEnabled(isChecked);
- task.setAntFileUrl(antfileUrl);
- task.setTargetName(targetName);
- }
+ ConfigurationTypeDescriptor typeDesc = (ConfigurationTypeDescriptor)descriptor;
+ for (ConfigurationFactory factory : typeDesc.getConfigurationType().getConfigurationFactories()) {
+ RunnerAndConfigurationSettingsImpl settings = runManager.getConfigurationTemplate(factory);
+ update(settings.getConfiguration(), isChecked, runManager);
}
}
else if (descriptor instanceof ConfigurationDescriptor) {
- final ConfigurationDescriptor configurationDescriptor = (ConfigurationDescriptor)descriptor;
- final AntBeforeRunTask task = runManager.getBeforeRunTask(configurationDescriptor.getConfiguration(), AntBeforeRunTaskProvider.ID);
- if (task != null && (isChecked || task.isRunningTarget(myTarget))) {
- task.setEnabled(isChecked);
- task.setAntFileUrl(antfileUrl);
- task.setTargetName(targetName);
- }
+ ConfigurationDescriptor configDesc = (ConfigurationDescriptor)descriptor;
+ update(configDesc.getConfiguration(), isChecked, runManager);
}
}
close(OK_EXIT_CODE);
}
+ protected abstract String getTargetDisplayString();
+
+ protected abstract Key<T> getTaskID();
+
+ protected abstract boolean isRunning(T task);
+
+ private void update(RunConfiguration config, boolean enabled, RunManagerImpl runManager) {
+ T task = runManager.getBeforeRunTask(config, getTaskID());
+ if (task == null) return;
+
+ if (enabled) {
+ task.setEnabled(true);
+ update(task);
+ }
+ else {
+ if (isRunning(task)) {
+ task.setEnabled(false);
+ clear(task);
+ }
+ // do not change the task otherwise
+ }
+ }
+
+ protected abstract void update(T task);
+
+ protected abstract void clear(T task);
+
private static class Descriptor {
private boolean myChecked;
}
}
-}
+}
\ No newline at end of file
configuration.action.chooser.title=Choose configuration type to run
env.vars.checkbox.title=&Include parent environment variables
-before.launch.compile.step=Make
\ No newline at end of file
+before.launch.compile.step=Make
+execute.before.run.debug.dialog.title=Execute {0} Before Run/Debug
--- /dev/null
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.lang.ant.config.explorer;
+
+import com.intellij.execution.impl.BaseExecuteBeforeRunDialog;
+import com.intellij.lang.ant.AntBundle;
+import com.intellij.lang.ant.config.AntBuildTarget;
+import com.intellij.lang.ant.config.impl.AntBeforeRunTask;
+import com.intellij.lang.ant.config.impl.AntBeforeRunTaskProvider;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Key;
+import com.intellij.openapi.vfs.VirtualFile;
+
+public final class AntExecuteBeforeRunDialog extends BaseExecuteBeforeRunDialog<AntBeforeRunTask> {
+ private final AntBuildTarget myTarget;
+
+ public AntExecuteBeforeRunDialog(final Project project, final AntBuildTarget target) {
+ super(project);
+ myTarget = target;
+ init();
+ }
+
+ @Override
+ protected String getTargetDisplayString() {
+ return AntBundle.message("ant.target");
+ }
+
+ @Override
+ protected Key<AntBeforeRunTask> getTaskID() {
+ return AntBeforeRunTaskProvider.ID;
+ }
+
+ @Override
+ protected boolean isRunning(AntBeforeRunTask task) {
+ return task.isRunningTarget(myTarget);
+ }
+
+ @Override
+ protected void update(AntBeforeRunTask task) {
+ VirtualFile f = myTarget.getModel().getBuildFile().getVirtualFile();
+ task.setAntFileUrl(f != null ? f.getUrl() : null);
+ task.setTargetName(f != null ? myTarget.getName() : null);
+ }
+
+ @Override
+ protected void clear(AntBeforeRunTask task) {
+ task.setAntFileUrl(null);
+ task.setTargetName(null);
+ }
+}
executeOnGroup.add(new ExecuteOnEventAction(target, ExecuteBeforeCompilationEvent.getInstance()));
executeOnGroup.add(new ExecuteOnEventAction(target, ExecuteAfterCompilationEvent.getInstance()));
executeOnGroup.addSeparator();
- executeOnGroup.add(new ExecuteBeforeRunAction(target, getCurrentBuildFile()));
+ executeOnGroup.add(new ExecuteBeforeRunAction(target));
group.add(executeOnGroup);
group.add(new AssignShortcutAction(target.getActionId()));
}
private final class ExecuteBeforeRunAction extends AnAction {
private final AntBuildTarget myTarget;
- private final AntBuildFile myBuildFile;
- public ExecuteBeforeRunAction(final AntBuildTarget target, final AntBuildFile buildFile) {
+ public ExecuteBeforeRunAction(final AntBuildTarget target) {
super(AntBundle.message("executes.before.run.debug.acton.name"));
myTarget = target;
- myBuildFile = buildFile;
}
public void actionPerformed(AnActionEvent e) {
- final ExecuteOnRunDialog dialog = new ExecuteOnRunDialog(myProject, myTarget, myBuildFile);
+ final AntExecuteBeforeRunDialog dialog = new AntExecuteBeforeRunDialog(myProject, myTarget);
dialog.show();
myBuilder.refresh();
}
public void update(AnActionEvent e) {
- e.getPresentation().setEnabled(myBuildFile.exists());
+ e.getPresentation().setEnabled(myTarget.getModel().getBuildFile().exists());
}
}
}
};
private static final ColumnInfo<TargetFilter, String> NAME_COLUMN = new ColumnInfo<TargetFilter, String>(
- AntBundle.message("edit.ant.properties.target.column.name")) {
+ AntBundle.message("ant.target")) {
public String valueOf(TargetFilter targetFilter) {
return targetFilter.getTargetName();
}
--- /dev/null
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.maven.tasks.actions;
+
+import com.intellij.execution.impl.BaseExecuteBeforeRunDialog;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Key;
+import org.jetbrains.idea.maven.project.MavenProject;
+import org.jetbrains.idea.maven.tasks.MavenBeforeRunTask;
+import org.jetbrains.idea.maven.tasks.MavenBeforeRunTasksProvider;
+import org.jetbrains.idea.maven.tasks.TasksBundle;
+
+public class MavenExecuteBeforeRunDialog extends BaseExecuteBeforeRunDialog<MavenBeforeRunTask> {
+ private final MavenProject myMavenProject;
+ private final String myGoal;
+
+ public MavenExecuteBeforeRunDialog(Project project, MavenProject mavenProject, String goal) {
+ super(project);
+ myMavenProject = mavenProject;
+ myGoal = goal;
+ init();
+ }
+
+ @Override
+ protected String getTargetDisplayString() {
+ return TasksBundle.message("maven.tasks.goal");
+ }
+
+ @Override
+ protected Key<MavenBeforeRunTask> getTaskID() {
+ return MavenBeforeRunTasksProvider.TASK_ID;
+ }
+
+ @Override
+ protected boolean isRunning(MavenBeforeRunTask task) {
+ return task.isFor(myMavenProject, myGoal);
+ }
+
+ @Override
+ protected void update(MavenBeforeRunTask task) {
+ task.setProjectPath(myMavenProject.getPath());
+ task.setGoal(myGoal);
+ }
+
+ @Override
+ protected void clear(MavenBeforeRunTask task) {
+ task.setProjectPath(null);
+ task.setGoal(null);
+ }
+}
+++ /dev/null
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.idea.maven.tasks.actions;
-
-import com.intellij.execution.RunManagerEx;
-import com.intellij.execution.configurations.ConfigurationFactory;
-import com.intellij.execution.configurations.ConfigurationType;
-import com.intellij.execution.configurations.RunConfiguration;
-import com.intellij.execution.impl.RunManagerImpl;
-import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.ui.treeStructure.Tree;
-import com.intellij.util.StringSetSpinAllocator;
-import com.intellij.util.ui.UIUtil;
-import com.intellij.util.ui.tree.TreeUtil;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.idea.maven.project.MavenProject;
-import org.jetbrains.idea.maven.tasks.MavenBeforeRunTask;
-import org.jetbrains.idea.maven.tasks.MavenBeforeRunTasksProvider;
-import org.jetbrains.idea.maven.tasks.MavenTasksManager;
-import org.jetbrains.idea.maven.tasks.TasksBundle;
-
-import javax.swing.*;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreeCellRenderer;
-import javax.swing.tree.TreeNode;
-import javax.swing.tree.TreePath;
-import java.awt.*;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Set;
-
-public class SelectBeforeRunTaskDialog extends DialogWrapper {
- private final RunManagerEx myRunManager;
- private final MavenTasksManager myTasksManager;
-
- private final MavenProject myMavenProject;
- private final String myGoal;
-
- private DefaultMutableTreeNode myRoot;
-
- public SelectBeforeRunTaskDialog(Project project, MavenProject mavenProject, String goal) {
- super(project, true);
- myRunManager = RunManagerEx.getInstanceEx(project);
- myTasksManager = MavenTasksManager.getInstance(project);
- myMavenProject = mavenProject;
- myGoal = goal;
-
- setTitle(TasksBundle.message("maven.tasks.before.run.action"));
- init();
- }
-
- protected JComponent createCenterPanel() {
- JPanel panel = new JPanel(new BorderLayout());
-
- myRoot = buildNodes();
- final Tree tree = new Tree(myRoot);
-
- final MyTreeCellRenderer cellRenderer = new MyTreeCellRenderer();
-
- tree.setCellRenderer(cellRenderer);
- tree.setRootVisible(false);
- tree.setShowsRootHandles(true);
- tree.setLineStyleAngled();
-// TreeToolTipHandler.install(tree);
- TreeUtil.installActions(tree);
-// new TreeSpeedSearch(tree);
-
- tree.addMouseListener(new MouseAdapter() {
- public void mousePressed(MouseEvent e) {
- int row = tree.getRowForLocation(e.getX(), e.getY());
- if (row >= 0) {
- Rectangle rowBounds = tree.getRowBounds(row);
- cellRenderer.setBounds(rowBounds);
- Rectangle checkBounds = cellRenderer.myCheckbox.getBounds();
-
- checkBounds.setLocation(rowBounds.getLocation());
- if (checkBounds.contains(e.getPoint())) {
- toggleNode(tree, (DefaultMutableTreeNode)tree.getPathForRow(row).getLastPathComponent());
- e.consume();
- tree.setSelectionRow(row);
- }
- }
- }
- });
-
- tree.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_SPACE) {
- TreePath treePath = tree.getLeadSelectionPath();
- DefaultMutableTreeNode node = (DefaultMutableTreeNode)treePath.getLastPathComponent();
- toggleNode(tree, node);
- e.consume();
- }
- }
- });
-
- expandChecked(tree);
-
- JScrollPane scrollPane = new JScrollPane(tree);
- scrollPane.setPreferredSize(new Dimension(400, 400));
- panel.add(scrollPane, BorderLayout.CENTER);
- return panel;
- }
-
- private static void expandChecked(Tree tree) {
- TreeNode root = (TreeNode)tree.getModel().getRoot();
- Enumeration factories = root.children();
- ArrayList<TreeNode[]> toExpand = new ArrayList<TreeNode[]>();
- while (factories.hasMoreElements()) {
- DefaultMutableTreeNode factoryNode = (DefaultMutableTreeNode)factories.nextElement();
- Enumeration configurations = factoryNode.children();
- while (configurations.hasMoreElements()) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode)configurations.nextElement();
- ConfigurationDescriptor config = (ConfigurationDescriptor)node.getUserObject();
- if (config.isChecked()) {
- toExpand.add(factoryNode.getPath());
- break;
- }
- }
- }
- for (TreeNode[] treeNodes : toExpand) {
- tree.expandPath(new TreePath(treeNodes));
- }
- }
-
- private static void toggleNode(JTree tree, DefaultMutableTreeNode node) {
- Descriptor descriptor = (Descriptor)node.getUserObject();
- descriptor.setChecked(!descriptor.isChecked());
- tree.repaint();
- }
-
- private DefaultMutableTreeNode buildNodes() {
- DefaultMutableTreeNode root = new DefaultMutableTreeNode(new Descriptor());
- ConfigurationType[] configurationFactories = myRunManager.getConfigurationFactories();
-
- for (final ConfigurationType type : configurationFactories) {
- final Icon icon = type.getIcon();
- DefaultMutableTreeNode typeNode =
- new DefaultMutableTreeNode(new ConfigurationTypeDescriptor(type, icon, isAssigned(type, null)));
- root.add(typeNode);
- final Set<String> addedNames = StringSetSpinAllocator.alloc();
- try {
- RunConfiguration[] configurations = myRunManager.getConfigurations(type);
- for (final RunConfiguration configuration : configurations) {
- final String configurationName = configuration.getName();
- if (addedNames.contains(configurationName)) {
- // add only the first configuration if more than one has the same name
- continue;
- }
- addedNames.add(configurationName);
- typeNode.add(new DefaultMutableTreeNode(
- new ConfigurationDescriptor(type, configuration, configurationName, isAssigned(type, configuration))));
- }
- }
- finally {
- StringSetSpinAllocator.dispose(addedNames);
- }
- }
-
- return root;
- }
-
- private boolean isAssigned(ConfigurationType type, RunConfiguration configuration) {
- if (configuration == null) {
- for (ConfigurationFactory each : type.getConfigurationFactories()) {
- RunnerAndConfigurationSettingsImpl settings = ((RunManagerImpl)myRunManager).getConfigurationTemplate(each);
- if (doIsAssigned(settings.getConfiguration())) return true;
- }
- return false;
- }
-
- return doIsAssigned(configuration);
- }
-
- private boolean doIsAssigned(RunConfiguration configuration) {
- MavenBeforeRunTask task = myRunManager.getBeforeRunTask(configuration, MavenBeforeRunTasksProvider.TASK_ID);
- return task != null && task.isEnabled() && task.isFor(myMavenProject, myGoal);
- }
-
- private void assign(ConfigurationType type, RunConfiguration configuration) {
- if (configuration == null) {
- for (ConfigurationFactory each : type.getConfigurationFactories()) {
- RunnerAndConfigurationSettingsImpl settings = ((RunManagerImpl)myRunManager).getConfigurationTemplate(each);
- doAssign(settings.getConfiguration());
- }
- } else {
- doAssign(configuration);
- }
- myTasksManager.fireTasksChanged();
- }
-
- private void doAssign(RunConfiguration configuration) {
- MavenBeforeRunTask task = myRunManager.getBeforeRunTask(configuration, MavenBeforeRunTasksProvider.TASK_ID);
- if (task != null) {
- task.setProjectPath(myMavenProject.getPath());
- task.setGoal(myGoal);
- task.setEnabled(true);
- }
- }
-
- private void clearAll() {
- for (MavenBeforeRunTask each : myRunManager.getBeforeRunTasks(MavenBeforeRunTasksProvider.TASK_ID, false)) {
- each.setEnabled(false);
- }
- myTasksManager.fireTasksChanged();
- }
-
- protected void doOKAction() {
- clearAll();
-
- Enumeration nodes = myRoot.depthFirstEnumeration();
- while (nodes.hasMoreElements()) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode)nodes.nextElement();
- Descriptor descriptor = (Descriptor)node.getUserObject();
- if (!descriptor.isChecked()) continue;
- if (descriptor instanceof DescriptorBase) {
- DescriptorBase descriptorBase = (DescriptorBase)descriptor;
- assign(descriptorBase.getConfigurationType(), descriptorBase.getConfiguration());
- }
- }
-
- close(OK_EXIT_CODE);
- }
-
- private static class Descriptor {
- private boolean myChecked;
-
- public final boolean isChecked() {
- return myChecked;
- }
-
- public final void setChecked(boolean checked) {
- myChecked = checked;
- }
- }
-
- private static abstract class DescriptorBase extends Descriptor {
- private final ConfigurationType myConfigurationType;
- private final RunConfiguration myConfiguration;
-
- public DescriptorBase(ConfigurationType type, RunConfiguration configuration, boolean isChecked) {
- myConfigurationType = type;
- myConfiguration = configuration;
- setChecked(isChecked);
- }
-
- public ConfigurationType getConfigurationType() {
- return myConfigurationType;
- }
-
- @Nullable
- public abstract String getName();
-
- public RunConfiguration getConfiguration() {
- return myConfiguration;
- }
- }
-
- private static final class ConfigurationTypeDescriptor extends DescriptorBase {
- private final Icon myIcon;
-
- public ConfigurationTypeDescriptor(ConfigurationType type, Icon icon, boolean isChecked) {
- super(type, null, isChecked);
- myIcon = icon;
- }
-
- public Icon getIcon() {
- return myIcon;
- }
-
- @Nullable
- public String getName() {
- return null;
- }
- }
-
- private static final class ConfigurationDescriptor extends DescriptorBase {
- private final String myName;
-
- public ConfigurationDescriptor(ConfigurationType type, RunConfiguration configuration, String name, boolean isChecked) {
- super(type, configuration, isChecked);
- myName = name;
- }
-
- public String getName() {
- return myName;
- }
- }
-
- private static final class MyTreeCellRenderer extends JPanel implements TreeCellRenderer {
- private final JLabel myLabel;
- public final JCheckBox myCheckbox;
-
- public MyTreeCellRenderer() {
- super(new BorderLayout());
- myCheckbox = new JCheckBox();
- myLabel = new JLabel();
- add(myCheckbox, BorderLayout.WEST);
- add(myLabel, BorderLayout.CENTER);
- }
-
- public Component getTreeCellRendererComponent(JTree tree,
- Object value,
- boolean selected,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
- Descriptor descriptor = (Descriptor)node.getUserObject();
-
- myCheckbox.setSelected(descriptor.isChecked());
-
- myCheckbox.setBackground(UIUtil.getTreeTextBackground());
- setBackground(selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground());
- Color foreground = selected ? UIUtil.getTreeSelectionForeground() : UIUtil.getTreeTextForeground();
- setForeground(foreground);
- myCheckbox.setForeground(foreground);
- myLabel.setForeground(foreground);
- myCheckbox.setEnabled(true);
-
- if (descriptor instanceof ConfigurationTypeDescriptor) {
- ConfigurationTypeDescriptor configurationTypeDescriptor = (ConfigurationTypeDescriptor)descriptor;
- myLabel.setFont(tree.getFont());
- myLabel.setText(configurationTypeDescriptor.getConfigurationType().getDisplayName());
- myLabel.setIcon(configurationTypeDescriptor.getIcon());
- }
- else if (descriptor instanceof ConfigurationDescriptor) {
- ConfigurationDescriptor configurationTypeDescriptor = (ConfigurationDescriptor)descriptor;
- myLabel.setFont(tree.getFont());
- myLabel.setText(configurationTypeDescriptor.getName());
- myLabel.setIcon(null);
-
- if (((ConfigurationTypeDescriptor)((DefaultMutableTreeNode)node.getParent()).getUserObject()).isChecked()) {
- Color foregrnd = tree.getForeground();
- Color backgrnd = tree.getBackground();
- if (foregrnd == null) foregrnd = Color.black;
- if (backgrnd == null) backgrnd = Color.white;
-
- int red = (foregrnd.getRed() + backgrnd.getRed()) / 2;
- int green = (foregrnd.getGreen() + backgrnd.getGreen()) / 2;
- int blue = (foregrnd.getBlue() + backgrnd.getBlue()) / 2;
- Color halftone = new Color(red, green, blue);
- setForeground(halftone);
- myCheckbox.setForeground(halftone);
- myLabel.setForeground(halftone);
- myCheckbox.setEnabled(false);
- }
- }
-
- return this;
- }
- }
-}
import org.jetbrains.idea.maven.project.MavenProject;
import org.jetbrains.idea.maven.tasks.MavenBeforeRunTask;
import org.jetbrains.idea.maven.tasks.MavenBeforeRunTasksProvider;
+import org.jetbrains.idea.maven.tasks.MavenTasksManager;
import org.jetbrains.idea.maven.utils.MavenDataKeys;
import org.jetbrains.idea.maven.utils.actions.MavenToggleAction;
import org.jetbrains.idea.maven.utils.actions.MavenActionUtil;
@Override
public void setSelected(final AnActionEvent e, boolean state) {
Pair<MavenProject, String> desc = getTaskDesc(e);
- new SelectBeforeRunTaskDialog(MavenActionUtil.getProject(e), desc.first, desc.second).show();
+ new MavenExecuteBeforeRunDialog(MavenActionUtil.getProject(e), desc.first, desc.second).show();
+ MavenTasksManager.getInstance(MavenActionUtil.getProject(e)).fireTasksChanged();
}
protected Pair<MavenProject, String> getTaskDesc(AnActionEvent e) {
+maven.tasks.goal=Maven Goal
+
maven.tasks.before.run.empty=Run Maven Goal
maven.tasks.before.run=Run Maven Goal ''{0}''
-maven.tasks.before.run.action=Execute Goal Before Run/Debug
maven.tasks.goal.before.compile=Before Make
maven.tasks.goal.after.compile=After Make
maven.tasks.goal.before.run=Before Run
ant.role.ant.target=Ant target
ant.role.ant.property=Ant property
ant.role.ant.task=Ant task
+ant.target=Target
cannot.add.build.files.from.excluded.directories.error.message=Cannot add build files from excluded directories\n{0}
cannot.add.build.file.dialog.title=Cannot Add Build File
build.file.properties.action.name=Properties
edit.ant.properties.name.column.name=Name
edit.ant.properties.value.column.name=Value
edit.ant.properties.tab.display.name=Properties
-edit.ant.properties.target.column.name=Target
edit.ant.properties.description.column.name=Description
edit.ant.properties.filters.tab.display.name=Filters
edit.ant.properties.execution.tab.display.name=Execution