From 22a9be346b8e8a38a632d4db9dde43b6871008e2 Mon Sep 17 00:00:00 2001 From: Gregory Shrago Date: Wed, 18 Nov 2009 20:31:59 +0300 Subject: [PATCH] WI-629 Help userto download JDBC drivers --- platform/icons/src/actions/apache.png | Bin 578 -> 1358 bytes platform/icons/src/actions/ibm.png | Bin 0 -> 165 bytes platform/icons/src/actions/microsoft.png | Bin 0 -> 594 bytes platform/icons/src/actions/mysql.png | Bin 0 -> 333 bytes platform/icons/src/actions/postgresql.png | Bin 0 -> 1426 bytes platform/icons/src/actions/sqlite.png | Bin 0 -> 301 bytes platform/icons/src/actions/sun.png | Bin 0 -> 1340 bytes .../ui/classpath/SimpleClasspathPanel.java | 126 ++++++++++-------- .../src/com/intellij/ide/BrowserUtil.java | 2 +- .../ui/ReorderableListController.java | 3 +- 10 files changed, 72 insertions(+), 59 deletions(-) create mode 100644 platform/icons/src/actions/ibm.png create mode 100644 platform/icons/src/actions/microsoft.png create mode 100644 platform/icons/src/actions/mysql.png create mode 100644 platform/icons/src/actions/postgresql.png create mode 100644 platform/icons/src/actions/sqlite.png create mode 100644 platform/icons/src/actions/sun.png diff --git a/platform/icons/src/actions/apache.png b/platform/icons/src/actions/apache.png index 0f5343249330925fd2bcb2884d2aa5c953bc0179..4a9774dbd452133cb9db458c406a1da560f72480 100644 GIT binary patch literal 1358 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NSs56Z83KGlT!G?Bx`yg3e#)$YdaR)uY}v|e6)tSKk<6L(_4W3w4dxsh+_^df z*rtWCO-yB5lg_@Wgl)MG*MS_)GZh@i%J{D5TA!|M?P%f6-^pHbhNtk=Tbk$xpdc9?NDuSB-mSnQ+^&{78oXW5?`A4rR~X ztDeWDJk2O=m76}1WyU=A=^b3FI@veQXI-?IW%gp$`RipTZe{M>&)mM3rF|cB*KY3i zT^ya8*{3%096H9*ev-BAfo#XC(8lK_laDM8I=3_A-u{^GC0lz|ZCbs0^^tkoZ#V9^ zHgm_5j;Sx3raqsx?8VdtuNJI&y?)2r?Q7q!Ie6>*jJsEw9$x5vc4y6r6DO|Te|Y2J zqqj$ne7b%0)4i+TZa)5YO>_%)r2R7=#&*=dVZs3W}GwMwA5SrVe*~el`i~_6=&Th-S4Mbo6@f+kWU%U4AXY1nk z3ZIX@VzhUhwslwWAMWdI-t&xm_q7~2xOM^i=5MlY90zLAD delta 564 zcmV-40?Yl*3c>`C8Gix*005AYXf^-<00wkYPE!B?00000Zl(v300009a7bBm000XU z000XU0RWnu7ytkP;z>k7RCt_YymfvCGwUl(4lPkZ7gk{b210;|o$>SY^A}#+UGX5K z{ndh1Ki<6|pg};vM@ok4+xp)t&-}QMasRnX&5NlEet!9YOMe3+0|UdSdsjauPrG)E zbHSgl7L58@?C*7?uCvWg6SlFzVgmyM1D}#MPj(o;1e*bi$2!IrQ-AZ{zpwc_VCIvK zseiuz#9{*kT${P$X3I_fXFq2!v%h1wlh3GO#B%C ziSK_tMF#uoe}4yd{xSY`=*P#}=1;e;VzGgNf#L6;->+t^{#Ca3&JUICObVO-El*^N z3Hp7E$K(Uw=29LJZ3YGg7Gw>~EUXL+46oPkkk44<_=fE>OUmru^MA4zdYm~TQ?uaD zukS2uoJ@xH~s51Op`%YUt0%Nh84tAFsvz1vXyfDFW1(>a~_bpPJc z`Nzi3!lvI6-ro-U3d z7XHa89&%}LFCG~< zPt-k-&9I5B#8;ze$qt5_+8S{Rsyqo&hKCy7yikc&*7@5b^+BE?ELJOK9pn4?KzkTG MUHx3vIVCg!0P?9cpa1{> literal 0 HcmV?d00001 diff --git a/platform/icons/src/actions/microsoft.png b/platform/icons/src/actions/microsoft.png new file mode 100644 index 0000000000000000000000000000000000000000..23743b32240a474b5edef82839d97b0682ce508a GIT binary patch literal 594 zcmV-Y0Px#1ZP1_K>z@;j|==^1poj5AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUz&`Cr=R5(wKlHV&sVHn5XGncO2`U93iNQ%-@N-k%bva$IwQ5-*8)}oaeYn%PR&e_>H@9{m3hI3=5bKdjxKF{a-exJ98 zA%s*7+5O=U9m61I7$!%@$cSVaD?a>nU%C9eT+3)BsUEhM7`KYMEZMwGQ-?&~vH82S z$e<t=)Vzcn>)rFlg7ydm4UtA gx2zdTWmF0I1Y7IZA{j-32mk;807*qoM6N<$g2H43P5=M^ literal 0 HcmV?d00001 diff --git a/platform/icons/src/actions/mysql.png b/platform/icons/src/actions/mysql.png new file mode 100644 index 0000000000000000000000000000000000000000..8842c1c10e6531c003f90fa38e9a9d8fa378601a GIT binary patch literal 333 zcmV-T0kZyyP)u<)!O~K!Y;A;C2v%Yx!9s|IkVZHQK?{p3 zEK*opVR41cxO0$@i`pZ-v1#7>e`&QbbJB@*7Go}D!#$t8IyaFr5-I+idQ~-Epus**X z)tQxSl3IiZP&bS8DlRJOuNCMpBoDwKLoyP}a1##I1B~|??Av8gQEx771OoK{+y@qS zMvGt;oC>E?mIvSu-oz~G+KEpZbeg+)0~B=HmA&xf+S780D%z|E)C`V$kuMvMd<|d` f+oO}80cCS9S16pmI&dI^00000NkvXXu0mjf9J_!q literal 0 HcmV?d00001 diff --git a/platform/icons/src/actions/postgresql.png b/platform/icons/src/actions/postgresql.png new file mode 100644 index 0000000000000000000000000000000000000000..fe381c90780e1399cbbfe34c1edf760e424b3e46 GIT binary patch literal 1426 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NSs56Z83KGlT!G@Qne}>!9r{Uq`sv;JsX($%F9XP!sGm03FtOPTrP(aK%_ynEIH|`dxz8xI%P6JWIHkuhrPm;(&oHImFst_gq6*RteF;3J0rGsUTnjhxW>f^t&6!9-6)5$ntFmmhL#ZeE;zkI}fkeb$sQ%<7@XG-LUV} z`lA=O967P|$f=!2PHj7JamUFE2hZO;bm8XF%ePNmxpD5=t;=`rU%Kq{N(xb2QS||eD&_>>vvDye+0(kC?F#Qz83#s1m+Wlk|4j}|05eP1b=5& z1qLB!fk$L90|Vb-5N14{zaj-FC|=?kQ4*Y=R#Ki=l*$m0n3-3i=jR%tP-d)Wy4Q8_ zNuZK9o-U3d8o|jw{?}*S-}3*z`ZvG-@sY+4|JS$u@3gw3rFoGlX4Su?e_pNpFKIR9 z%h#>m6-SQpsJy-WbIEH-qn;x!PO&pZR9tY02ew;}&M8Ko&=y~onIiaL$~8U_ z4}%FF+a7ACi^<+f0pa$6WL<$`tZ=P(LN%>i>BX>6&H-qvqR8IPkyi z|J{wgd1-H?{yOk^FtDgq7i@}XlrU)gzwePwp9YiTp<{6xOu1!xa}^jFq*Q9w9$mTR Q8Yszmy85}Sb4q9e0N)XmJ^%m! literal 0 HcmV?d00001 diff --git a/platform/icons/src/actions/sqlite.png b/platform/icons/src/actions/sqlite.png new file mode 100644 index 0000000000000000000000000000000000000000..0960f1047f402992c0a82fc3c6970dcd139bf57f GIT binary patch literal 301 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCijSl0AZa85pY67#JE_7#My5g&JNkFq9fFFuY1&V6d9Oz#v{QXIG#NP-3;G zi(`m||J=zN1sfE2TpyeDJdh9(>q~s8!Iv=ckfTgv?u9vrj?PecA=_&B|8s2%pP=$1 zzPy49pIUSeSbSr+=l@Z}?%E!`iDK(dOYOaX%X^O0mSZVLd?Vv4%kx%9MHK#A=NaLn zU>~(H{+O6fr2ib1f(akI-fQJ}ADC^Lm=-?y!F0yX46mmKq0U$89M^6&xZrlrrgc4w tq*5%0ZmY?J;tBe~jhlSD)Lo=5$+flr4mp$3oC9<=gQu&X%Q~loCIA6EYasvt literal 0 HcmV?d00001 diff --git a/platform/icons/src/actions/sun.png b/platform/icons/src/actions/sun.png new file mode 100644 index 0000000000000000000000000000000000000000..3c4d21ef7bc567a625c6d7bbb513044547930cb9 GIT binary patch literal 1340 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NSs56Z83KGlT!G?dVOeHjc~((Hc5!8PNmWj1bxv7rZh1h|;yriyW zX)f?_m#*ErcJI-nXRn^UdiURR|SSBXMsm#F#`kNVGw3Kp1&dmC@5ay8c`CQpH@juaF&zQ}o&D!@^WToBIi^39% z-~K$RC0oXFMEjAP{tO=Z$QJJhf2K^E^St;|$qx2)V$<>-22c3?q|dP actions = new ArrayList(); - actions.add(new ChooseAndAddAction(index++, "Jar...", Icons.JAR_ICON) { - @NotNull - protected List doChoose() { - final ChooseJarDialog dialog = new ChooseJarDialog(SimpleClasspathPanel.this, getVirtualFiles(), myDisposable); - dialog.doChoose(); - return dialog.getChosenElements(); - } - }); - actions.add(new ChooseAndAddAction(index++, "Library...", Icons.LIBRARY_ICON) { - - @NotNull - protected List doChoose() { - final Set existingFiles = getVirtualFiles(); - final ChooseLibrariesDialog dialog = new ChooseLibrariesDialog(ProjectManager.getInstance().getDefaultProject(), "Choose Existing Libraries") { - @Override - protected boolean acceptsElement(final Object element) { - if (!(element instanceof Library)) return true; - final Library library = (Library)element; - return !existingFiles.containsAll(Arrays.asList(library.getFiles(OrderRootType.CLASSES))); - } - - @Override - protected JComponent createCenterPanel() { - final JPanel panel = new JPanel(new BorderLayout()); - panel.add(super.createCenterPanel(), BorderLayout.CENTER); - final MultiLineLabel label = new MultiLineLabel("Please note that project-level and module-level libraries will not be\n\n" + - " added as a whole but will be converted to jars and folders instead."); - label.setIcon(Messages.getWarningIcon()); - label.setIcon(Messages.getWarningIcon()); - panel.add(label, BorderLayout.SOUTH); - return panel; - } - - }; - dialog.show(); - final List libraries = dialog.getSelectedLibraries(); - final ArrayList result = new ArrayList(); - for (Library o : libraries) { - result.addAll(ensureApplicationLevel(o, existingFiles, myDisposable)); - } - return result; - } - }); - myPopupActions = actions.toArray(new PopupAction[actions.size()]); + myPopupActions = createPopupActions(); myIcons = new Icon[myPopupActions.length]; for (int idx = 0; idx < myPopupActions.length; idx++) { @@ -280,9 +239,11 @@ public class SimpleClasspathPanel extends JPanel { } } + protected abstract PopupAction[] createPopupActions(); + public void actionPerformed(final AnActionEvent e) { initPopupActions(); - final JBPopup popup = JBPopupFactory.getInstance().createWizardStep(new BaseListPopupStep(null, myPopupActions, myIcons) { + final JBPopup popup = JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep(null, myPopupActions, myIcons) { public boolean isMnemonicsNavigationEnabled() { return true; } @@ -297,7 +258,7 @@ public class SimpleClasspathPanel extends JPanel { selectedValue.execute(); } }, ModalityState.stateForComponent(e.getInputEvent().getComponent())); - return PopupStep.FINAL_CHOICE; + return FINAL_CHOICE; } @NotNull @@ -307,10 +268,61 @@ public class SimpleClasspathPanel extends JPanel { }); popup.showUnderneathOf(e.getInputEvent().getComponent()); } + } - public Object fun(final AnActionEvent s) { - actionPerformed(s); - return null; + private class AddAction extends PopupActionGroupAction { + + public AddAction() { + super(ProjectBundle.message("module.add.action"), null, IconLoader.getIcon("/general/add.png")); + } + + protected PopupAction[] createPopupActions() { + int index = 1; + final List actions = new ArrayList(); + actions.add(new ChooseAndAddAction(index++, "Jar...", Icons.JAR_ICON) { + @NotNull + protected List doChoose() { + final ChooseJarDialog dialog = new ChooseJarDialog(SimpleClasspathPanel.this, getVirtualFiles(), myDisposable); + dialog.doChoose(); + return dialog.getChosenElements(); + } + }); + actions.add(new ChooseAndAddAction(index++, "Library...", Icons.LIBRARY_ICON) { + + @NotNull + protected List doChoose() { + final Set existingFiles = getVirtualFiles(); + final ChooseLibrariesDialog dialog = new ChooseLibrariesDialog(ProjectManager.getInstance().getDefaultProject(), "Choose Existing Libraries") { + @Override + protected boolean acceptsElement(final Object element) { + if (!(element instanceof Library)) return true; + final Library library = (Library)element; + return !existingFiles.containsAll(Arrays.asList(library.getFiles(OrderRootType.CLASSES))); + } + + @Override + protected JComponent createCenterPanel() { + final JPanel panel = new JPanel(new BorderLayout()); + panel.add(super.createCenterPanel(), BorderLayout.CENTER); + final MultiLineLabel label = new MultiLineLabel("Please note that project-level and module-level libraries will not be\n\n" + + " added as a whole but will be converted to jars and folders instead."); + label.setIcon(Messages.getWarningIcon()); + label.setIcon(Messages.getWarningIcon()); + panel.add(label, BorderLayout.SOUTH); + return panel; + } + + }; + dialog.show(); + final List libraries = dialog.getSelectedLibraries(); + final ArrayList result = new ArrayList(); + for (Library o : libraries) { + result.addAll(ensureApplicationLevel(o, existingFiles, myDisposable)); + } + return result; + } + }); + return actions.toArray(new PopupAction[actions.size()]); } } diff --git a/platform/platform-api/src/com/intellij/ide/BrowserUtil.java b/platform/platform-api/src/com/intellij/ide/BrowserUtil.java index e8f7b4ba09ad..9b384ebc9b1d 100644 --- a/platform/platform-api/src/com/intellij/ide/BrowserUtil.java +++ b/platform/platform-api/src/com/intellij/ide/BrowserUtil.java @@ -205,7 +205,7 @@ public class BrowserUtil { @NotNull public static String escapeUrl(@NotNull @NonNls String url) { if (SystemInfo.isWindows) { - return "\"" + url + "\""; + return url.indexOf(' ') > 0? "\"" + url + "\"" : url; } else { return url.replaceAll(" ", "%20"); diff --git a/platform/platform-api/src/com/intellij/ui/ReorderableListController.java b/platform/platform-api/src/com/intellij/ui/ReorderableListController.java index 72f40f3d79ed..cd31cbff9236 100644 --- a/platform/platform-api/src/com/intellij/ui/ReorderableListController.java +++ b/platform/platform-api/src/com/intellij/ui/ReorderableListController.java @@ -16,6 +16,7 @@ package com.intellij.ui; import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Factory; import com.intellij.openapi.util.IconLoader; @@ -154,7 +155,7 @@ public abstract class ReorderableListController { myShowText = showText; } - protected static class BaseAction extends AnAction { + protected static class BaseAction extends DumbAwareAction { private final ActionBehaviour myBehaviour; private final CustomActionDescription myCustomActionDescription;