From ace67be72dce66665f5a65e8e68e5fb6e3009356 Mon Sep 17 00:00:00 2001 From: "kirill.safonov" Date: Fri, 9 Mar 2012 16:00:32 +0400 Subject: [PATCH 1/3] IDEA-81546 'New...' button near SDK combo at Dependencies tab should open file chooser to select Flex SDK home --- .../roots/ui/configuration/JdkComboBox.java | 34 +++++++++++++------ .../projectRoot/ProjectSdksModel.java | 9 +++++ 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JdkComboBox.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JdkComboBox.java index a6d238a8688e..aae24ea21e63 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JdkComboBox.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JdkComboBox.java @@ -17,10 +17,11 @@ package com.intellij.openapi.roots.ui.configuration; import com.intellij.ide.DataManager; import com.intellij.ide.util.projectWizard.ProjectJdkListRenderer; -import com.intellij.openapi.actionSystem.DefaultActionGroup; +import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectBundle; import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.projectRoots.SdkType; import com.intellij.openapi.roots.ui.configuration.projectRoot.JdkListConfigurable; import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; import com.intellij.openapi.ui.ComboBoxWithWidePopup; @@ -48,15 +49,20 @@ import java.util.List; public class JdkComboBox extends ComboBoxWithWidePopup { @Nullable - private Condition myFilter; - + private final Condition myFilter; + @Nullable + private final Condition myCreationFilter; + public JdkComboBox(@NotNull final ProjectSdksModel jdkModel) { - this(jdkModel, null); + this(jdkModel, null, null); } - public JdkComboBox(@NotNull final ProjectSdksModel jdkModel, @Nullable Condition filter) { + public JdkComboBox(@NotNull final ProjectSdksModel jdkModel, + @Nullable Condition filter, + @Nullable Condition creationFilter) { super(new JdkComboBoxModel(jdkModel, filter)); myFilter = filter; + myCreationFilter = creationFilter; setRenderer(new ProjectJdkListRenderer(getRenderer()) { @Override public void doCustomize(JList list, Object value, int index, boolean selected, boolean hasFocus) { @@ -137,12 +143,18 @@ public class JdkComboBox extends ComboBoxWithWidePopup { } } } - }); - JBPopupFactory.getInstance() - .createActionGroupPopup(actionGroupTitle, group, - DataManager.getInstance().getDataContext(JdkComboBox.this), JBPopupFactory.ActionSelectionAid.MNEMONICS, - false) - .showUnderneathOf(setUpButton); + }, myCreationFilter); + final DataContext dataContext = DataManager.getInstance().getDataContext(JdkComboBox.this); + if (group.getChildrenCount() > 1) { + JBPopupFactory.getInstance() + .createActionGroupPopup(actionGroupTitle, group, dataContext, JBPopupFactory.ActionSelectionAid.MNEMONICS, false) + .showUnderneathOf(setUpButton); + } + else { + final AnActionEvent event = + new AnActionEvent(null, dataContext, ActionPlaces.UNKNOWN, new Presentation(""), ActionManager.getInstance(), 0); + group.getChildren(event)[0].actionPerformed(event); + } } }); } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModel.java b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModel.java index eef29826d38a..bfd33af9a830 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModel.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModel.java @@ -32,6 +32,7 @@ import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.ui.MasterDetailsComponent; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Comparing; +import com.intellij.openapi.util.Condition; import com.intellij.util.ArrayUtil; import com.intellij.util.Consumer; import com.intellij.util.EventDispatcher; @@ -214,8 +215,16 @@ public class ProjectSdksModel implements SdkModel { } public void createAddActions(DefaultActionGroup group, final JComponent parent, final Consumer updateTree) { + createAddActions(group, parent, updateTree, null); + } + + public void createAddActions(DefaultActionGroup group, + final JComponent parent, + final Consumer updateTree, + @Nullable Condition filter) { final SdkType[] types = SdkType.getAllTypes(); for (final SdkType type : types) { + if (filter != null && !filter.value(type)) continue; final AnAction addAction = new DumbAwareAction(type.getPresentableName(), null, type.getIconForAddAction()) { From 712fb2efde8af3465c5cab893dff4c596f9ef1b1 Mon Sep 17 00:00:00 2001 From: Serega Vasiliev Date: Fri, 9 Mar 2012 13:19:53 +0100 Subject: [PATCH 2/3] Hibernate 4: library type, new file templates, download --- .../download/impl/FileSetVersionsFetcherBase.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/util/download/impl/FileSetVersionsFetcherBase.java b/platform/lang-impl/src/com/intellij/util/download/impl/FileSetVersionsFetcherBase.java index 6ed7a278cb3b..cef0acf2dba3 100644 --- a/platform/lang-impl/src/com/intellij/util/download/impl/FileSetVersionsFetcherBase.java +++ b/platform/lang-impl/src/com/intellij/util/download/impl/FileSetVersionsFetcherBase.java @@ -70,9 +70,17 @@ public abstract class FileSetVersionsFetcherBase Date: Fri, 9 Mar 2012 16:41:57 +0400 Subject: [PATCH 3/3] IDEA-66226: Pay respect to [CDATA] inside tags (InjectionValueStyleInspection # checkValue ) --- .../psi/impl/source/xml/XmlTagValueImpl.java | 14 ++++++++++++++ .../src/com/intellij/psi/xml/XmlTagValue.java | 2 ++ 2 files changed, 16 insertions(+) diff --git a/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java b/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java index e03bdfdf5a8a..f68e7e48bb9f 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java +++ b/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java @@ -19,6 +19,7 @@ import com.intellij.lang.ASTNode; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.psi.PsiElement; import com.intellij.psi.XmlElementFactory; import com.intellij.psi.xml.*; import com.intellij.util.IncorrectOperationException; @@ -123,4 +124,17 @@ public class XmlTagValueImpl implements XmlTagValue{ LOG.error(e); } } + + @Override + public boolean hasCDATA() { + for (XmlText xmlText : myTextElements) { + PsiElement[] children = xmlText.getChildren(); + for (PsiElement child : children) { + if (child.getNode().getElementType() == XmlElementType.XML_CDATA) { + return true; + } + } + } + return false; + } } diff --git a/xml/openapi/src/com/intellij/psi/xml/XmlTagValue.java b/xml/openapi/src/com/intellij/psi/xml/XmlTagValue.java index 9e922e58f907..aedef5bbb975 100644 --- a/xml/openapi/src/com/intellij/psi/xml/XmlTagValue.java +++ b/xml/openapi/src/com/intellij/psi/xml/XmlTagValue.java @@ -36,4 +36,6 @@ public interface XmlTagValue { String getTrimmedText(); void setText(String value); + + boolean hasCDATA(); }