From 027859737c8de9d8a559e28ba3f187d9e5fad2a7 Mon Sep 17 00:00:00 2001 From: Shaverdova Elena Date: Tue, 10 Jul 2012 17:01:22 +0400 Subject: [PATCH] Icon for External tools before run provider --- .../icons/src/general/externalToolsSmall.png | Bin 0 -> 1466 bytes .../tools/ToolBeforeRunTaskProvider.java | 213 +++++++++--------- .../util/src/com/intellij/icons/AllIcons.java | 1 + 3 files changed, 109 insertions(+), 105 deletions(-) create mode 100644 platform/icons/src/general/externalToolsSmall.png diff --git a/platform/icons/src/general/externalToolsSmall.png b/platform/icons/src/general/externalToolsSmall.png new file mode 100644 index 0000000000000000000000000000000000000000..0d55a24e139e7a8f20220081805713f74e8ac76b GIT binary patch literal 1466 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n3Xa^B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`Z0PLl1t}~V&G(I?qp_Q zVq|Ur)9aF-T$-DjR|3o#*~q_s{;39TgM$*)es`LZCp=s9$7jNadN!s8!Mm&qXDe^6 zC+)|NcglxfeSPhy$FSSwu%4BK$I`|d=6t%P?YkLPaIUj7S8jdy`1pJt|G0f= zJH9+n^Vq?9vSz}wZiBNLaSWN~JiL=CKL6xCy!ZNf$#pUN4;6g=vsG-t+pPwsMw1rp za`57KAr!o#yKIxg(|^mCs~PS2_o4IQ#naPy_~q^-{iuGf)coqa`s&14ja^?QW<)05 zDN(Q&Im)VkzcyjV*B6|J=k7K?Fw6XkVROrQ^_{a`JDR@F(CC=Paw*PXdIjUtFO3yq zXIOd4KV=*%j@ZN?b+e{Zq$f998I0`e`wv1h(~dw27H{B_HR|3C5W{+Dg3_9t+A@1^FG zhYjv9q?}dY30m_|;Jefk$rO$g1``%W@H!kL5sEHY6D{`7uSY1PVa+t+miM(^92OVPzkrM;Y+DLbG!DFke3caBcH%)M&}z> z&L0$5w{xMz!%5M8+#VYhJ&Z31cq&x0Tclm!VOVN3U;TXi?zy|mfi)KbLh*2~7b1(;RmI literal 0 HcmV?d00001 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