diff --git a/platform/icons/src/general/externalToolsSmall.png b/platform/icons/src/general/externalToolsSmall.png new file mode 100644 index 000000000000..0d55a24e139e Binary files /dev/null and b/platform/icons/src/general/externalToolsSmall.png differ diff --git a/platform/lang-impl/src/com/intellij/tools/ToolBeforeRunTaskProvider.java b/platform/lang-impl/src/com/intellij/tools/ToolBeforeRunTaskProvider.java index e9efaa98c421..4ee286a92e16 100644 --- a/platform/lang-impl/src/com/intellij/tools/ToolBeforeRunTaskProvider.java +++ b/platform/lang-impl/src/com/intellij/tools/ToolBeforeRunTaskProvider.java @@ -1,105 +1,108 @@ -/* - * Copyright 2000-2012 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.tools; - -import com.intellij.execution.BeforeRunTaskProvider; -import com.intellij.execution.configurations.RunConfiguration; -import com.intellij.execution.runners.ExecutionEnvironment; -import com.intellij.openapi.actionSystem.DataContext; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.util.Key; -import com.intellij.openapi.util.text.StringUtil; - -public class ToolBeforeRunTaskProvider extends BeforeRunTaskProvider { - static final Key ID = Key.create("ToolBeforeRunTask"); - private static final Logger LOG = Logger.getInstance("#" + ToolBeforeRunTaskProvider.class.getName()); - - - @Override - public Key getId() { - return ID; - } - - @Override - public String getName() { - return ToolsBundle.message("tools.before.run.provider.name"); - } - - @Override - public String getDescription(ToolBeforeRunTask task) { - final String actionId = task.getToolActionId(); - if (actionId == null) { - LOG.error("Null id"); - return ToolsBundle.message("tools.unknown.external.tool"); - } - Tool tool = task.findCorrespondingTool(); - if (tool == null) { - return ToolsBundle.message("tools.unknown.external.tool"); - } - String groupName = tool.getGroup(); - return ToolsBundle - .message("tools.before.run.description", StringUtil.isEmpty(groupName) ? tool.getName() : groupName + "/" + tool.getName()); - } - - /* - @Override //todo[lene] - public Icon getIcon() { - return ICON; - }*/ - - @Override - public boolean isConfigurable() { - return true; - } - - @Override - public ToolBeforeRunTask createTask(RunConfiguration runConfiguration) { - return new ToolBeforeRunTask(); - } - - @Override - public boolean configureTask(RunConfiguration runConfiguration, ToolBeforeRunTask task) { - final ToolSelectDialog dialog = new ToolSelectDialog(runConfiguration.getProject(), task); - dialog.show(); - if (!dialog.isOK()) { - return false; - } - boolean isModified = dialog.isModified(); - Tool selectedTool = dialog.getSelectedTool(); - LOG.assertTrue(selectedTool != null); - String selectedToolId = selectedTool.getActionId(); - String oldToolId = task.getToolActionId(); - if (oldToolId != null && oldToolId.equals(selectedToolId)) { - return isModified; - } - task.setToolActionId(selectedToolId); - return true; - } - - @Override - public boolean canExecuteTask(RunConfiguration configuration, ToolBeforeRunTask task) { - return task.isExecutable(); - } - - @Override - public boolean executeTask(DataContext context, RunConfiguration configuration, ExecutionEnvironment env, ToolBeforeRunTask task) { - if (!task.isExecutable()) { - return false; - } - task.execute(context); - return true; - } -} +/* + * Copyright 2000-2012 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.tools; + +import com.intellij.execution.BeforeRunTaskProvider; +import com.intellij.execution.configurations.RunConfiguration; +import com.intellij.execution.runners.ExecutionEnvironment; +import com.intellij.icons.AllIcons; +import com.intellij.openapi.actionSystem.DataContext; +import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.util.Key; +import com.intellij.openapi.util.text.StringUtil; + +import javax.swing.*; + +public class ToolBeforeRunTaskProvider extends BeforeRunTaskProvider { + private static final Icon ICON = AllIcons.General.ExternalToolsSmall; + static final Key ID = Key.create("ToolBeforeRunTask"); + private static final Logger LOG = Logger.getInstance("#" + ToolBeforeRunTaskProvider.class.getName()); + + + @Override + public Key getId() { + return ID; + } + + @Override + public String getName() { + return ToolsBundle.message("tools.before.run.provider.name"); + } + + @Override + public String getDescription(ToolBeforeRunTask task) { + final String actionId = task.getToolActionId(); + if (actionId == null) { + LOG.error("Null id"); + return ToolsBundle.message("tools.unknown.external.tool"); + } + Tool tool = task.findCorrespondingTool(); + if (tool == null) { + return ToolsBundle.message("tools.unknown.external.tool"); + } + String groupName = tool.getGroup(); + return ToolsBundle + .message("tools.before.run.description", StringUtil.isEmpty(groupName) ? tool.getName() : groupName + "/" + tool.getName()); + } + + @Override + public Icon getIcon() { + return ICON; + } + + @Override + public boolean isConfigurable() { + return true; + } + + @Override + public ToolBeforeRunTask createTask(RunConfiguration runConfiguration) { + return new ToolBeforeRunTask(); + } + + @Override + public boolean configureTask(RunConfiguration runConfiguration, ToolBeforeRunTask task) { + final ToolSelectDialog dialog = new ToolSelectDialog(runConfiguration.getProject(), task); + dialog.show(); + if (!dialog.isOK()) { + return false; + } + boolean isModified = dialog.isModified(); + Tool selectedTool = dialog.getSelectedTool(); + LOG.assertTrue(selectedTool != null); + String selectedToolId = selectedTool.getActionId(); + String oldToolId = task.getToolActionId(); + if (oldToolId != null && oldToolId.equals(selectedToolId)) { + return isModified; + } + task.setToolActionId(selectedToolId); + return true; + } + + @Override + public boolean canExecuteTask(RunConfiguration configuration, ToolBeforeRunTask task) { + return task.isExecutable(); + } + + @Override + public boolean executeTask(DataContext context, RunConfiguration configuration, ExecutionEnvironment env, ToolBeforeRunTask task) { + if (!task.isExecutable()) { + return false; + } + task.execute(context); + return true; + } +} diff --git a/platform/util/src/com/intellij/icons/AllIcons.java b/platform/util/src/com/intellij/icons/AllIcons.java index 8989ea826894..cfcf8d021365 100644 --- a/platform/util/src/com/intellij/icons/AllIcons.java +++ b/platform/util/src/com/intellij/icons/AllIcons.java @@ -349,6 +349,7 @@ public class AllIcons { public static final Icon ExpandAll = IconLoader.getIcon("/general/expandAll.png"); // 11x16 public static final Icon ExpandAllHover = IconLoader.getIcon("/general/expandAllHover.png"); // 11x16 public static final Icon ExternalTools = IconLoader.getIcon("/general/externalTools.png"); // 32x32 + public static final Icon ExternalToolsSmall = IconLoader.getIcon("/general/externalToolsSmall.png"); // 16x16 public static final Icon Floating = IconLoader.getIcon("/general/floating.png"); // 14x14 public static final Icon Gear = IconLoader.getIcon("/general/gear.png"); // 21x16 public static final Icon GearHover = IconLoader.getIcon("/general/gearHover.png"); // 21x16