mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
@@ -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<Sdk> myFilter;
|
||||
|
||||
private final Condition<Sdk> myFilter;
|
||||
@Nullable
|
||||
private final Condition<SdkType> myCreationFilter;
|
||||
|
||||
public JdkComboBox(@NotNull final ProjectSdksModel jdkModel) {
|
||||
this(jdkModel, null);
|
||||
this(jdkModel, null, null);
|
||||
}
|
||||
|
||||
public JdkComboBox(@NotNull final ProjectSdksModel jdkModel, @Nullable Condition<Sdk> filter) {
|
||||
public JdkComboBox(@NotNull final ProjectSdksModel jdkModel,
|
||||
@Nullable Condition<Sdk> filter,
|
||||
@Nullable Condition<SdkType> 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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+9
@@ -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<Sdk> updateTree) {
|
||||
createAddActions(group, parent, updateTree, null);
|
||||
}
|
||||
|
||||
public void createAddActions(DefaultActionGroup group,
|
||||
final JComponent parent,
|
||||
final Consumer<Sdk> updateTree,
|
||||
@Nullable Condition<SdkType> 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()) {
|
||||
|
||||
+10
-2
@@ -70,9 +70,17 @@ public abstract class FileSetVersionsFetcherBase<F extends DownloadableFileSetDe
|
||||
for (ArtifactItem item : items) {
|
||||
String url = item.getUrl();
|
||||
final String prefix = version.getUrlPrefix();
|
||||
if (!url.startsWith("http://") && prefix != null) {
|
||||
url = prefix + url;
|
||||
if (url == null) {
|
||||
if (prefix != null) {
|
||||
url = prefix + item.getName();
|
||||
}
|
||||
} else {
|
||||
if (!url.startsWith("http://") && prefix != null) {
|
||||
url = prefix + url;
|
||||
}
|
||||
}
|
||||
assert url != null;
|
||||
|
||||
files.add(DownloadableFileService.getInstance().createFileDescription(url, item.getName()));
|
||||
}
|
||||
result.add(createVersion(version, files));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,4 +36,6 @@ public interface XmlTagValue {
|
||||
String getTrimmedText();
|
||||
|
||||
void setText(String value);
|
||||
|
||||
boolean hasCDATA();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user