mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.debugger.settings;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -204,7 +205,7 @@ public class CaptureConfigurable implements SearchableConfigurable {
|
||||
public static final int INSERT_KEY_EXPR = 6;
|
||||
|
||||
static final String[] COLUMN_NAMES =
|
||||
new String[]{"", "Class name", "Method name", "Key expression", "Insert class name", "Insert method name", "Insert key expression"};
|
||||
new String[]{"", "Capture class name", "Capture method name", "Capture key expression", "Insert class name", "Insert method name", "Insert key expression"};
|
||||
List<CapturePoint> myCapturePoints = DebuggerSettings.getInstance().cloneCapturePoints();
|
||||
|
||||
public String getColumnName(int column) {
|
||||
@@ -319,7 +320,7 @@ public class CaptureConfigurable implements SearchableConfigurable {
|
||||
@Nls
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return "Capture";
|
||||
return DebuggerBundle.message("async.stacktraces.configurable.display.name");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -137,7 +137,7 @@ public class JsonOriginalPsiWalker implements JsonLikePsiWalker {
|
||||
final JsonObject object = PsiTreeUtil.getParentOfType(element, JsonObject.class);
|
||||
if (object != null) {
|
||||
return object.getPropertyList().stream()
|
||||
.filter(p -> StringUtil.isQuotedString(p.getName()))
|
||||
.filter(p -> p.getNameElement() instanceof JsonStringLiteral)
|
||||
.map(p -> StringUtil.unquoteString(p.getName())).collect(Collectors.toSet());
|
||||
}
|
||||
return Collections.emptySet();
|
||||
|
||||
+5
-3
@@ -17,6 +17,7 @@ package com.intellij.openapi.externalSystem.service.project;
|
||||
|
||||
import com.intellij.openapi.externalSystem.model.project.*;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleGrouperKt;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.module.ModuleUtilCore;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -87,16 +88,17 @@ public class IdeModelsProviderImpl implements IdeModelsProvider {
|
||||
protected String[] suggestModuleNameCandidates(@NotNull ModuleData module) {
|
||||
String prefix = module.getGroup();
|
||||
File modulePath = new File(module.getLinkedExternalProjectPath());
|
||||
if(modulePath.isFile()) {
|
||||
if (modulePath.isFile()) {
|
||||
modulePath = modulePath.getParentFile();
|
||||
}
|
||||
if (modulePath.getParentFile() != null) {
|
||||
prefix = modulePath.getParentFile().getName();
|
||||
}
|
||||
char delimiter = ModuleGrouperKt.isQualifiedModuleNamesEnabled() ? '.' : '_';
|
||||
return new String[]{
|
||||
module.getInternalName(),
|
||||
prefix + '-' + module.getInternalName(),
|
||||
prefix + '-' + module.getInternalName() + "~1"};
|
||||
prefix + delimiter + module.getInternalName(),
|
||||
prefix + delimiter + module.getInternalName() + "~1"};
|
||||
}
|
||||
|
||||
private static boolean isApplicableIdeModule(@NotNull ModuleData moduleData, @NotNull Module ideModule) {
|
||||
|
||||
+62
-12
@@ -17,31 +17,78 @@ package com.intellij.openapi.updateSettings.impl;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.application.ApplicationInfo;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.ui.components.JBTextField;
|
||||
import com.intellij.util.JdomKt;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Collections;
|
||||
|
||||
public class ShowUpdateInfoDialogAction extends AnAction {
|
||||
private boolean myShowBigData = false;
|
||||
|
||||
public ShowUpdateInfoDialogAction() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = ObjectUtils.notNull(e.getProject());
|
||||
JComponent component = ObjectUtils.notNull((JComponent)e.getData(PlatformDataKeys.CONTEXT_COMPONENT));
|
||||
String title = "Updates.xml <channel> Text";
|
||||
JBList list = new JBList("Manual Text", "Default Text (short)", "Default Text (long)");
|
||||
JBPopupFactory.getInstance().createListPopupBuilder(list)
|
||||
.setTitle(title)
|
||||
.setFilteringEnabled(o -> (String)o)
|
||||
.setItemChoosenCallback(() -> {
|
||||
int index = list.getSelectedIndex();
|
||||
showDialog(index == 0 ? getUserText(project, component, title) : getXML(index == 2));
|
||||
})
|
||||
.createPopup()
|
||||
.showCenteredInCurrentWindow(project);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String getUserText(@NotNull Project project, @NotNull JComponent component, @NotNull String title) {
|
||||
JBTextField field = new JBTextField();
|
||||
field.setVisible(false);
|
||||
component.getRootPane().add(field);
|
||||
try {
|
||||
myShowBigData = ! myShowBigData;
|
||||
UpdateChannel channel = new UpdateChannel(JdomKt.loadElement(getXML(myShowBigData)));
|
||||
BuildInfo newBuild = channel.getBuilds().get(0);
|
||||
PatchInfo patchInfo = new PatchInfo(
|
||||
JdomKt.loadElement("<patch from=\"" + ApplicationInfo.getInstance().getBuild().asString() + "\" size=\"from 733 to 800\"/>"));
|
||||
new UpdateInfoDialog(channel, newBuild, patchInfo, true, UpdateSettings.getInstance().canUseSecureConnection(),
|
||||
Collections.emptyList(), Collections.emptyList()).show();
|
||||
Messages.showTextAreaDialog(field, title, null);
|
||||
}
|
||||
catch (Exception ignored) {
|
||||
ignored.printStackTrace();
|
||||
finally {
|
||||
component.getRootPane().remove(field);
|
||||
}
|
||||
return field.getText();
|
||||
}
|
||||
|
||||
protected void showDialog(@Nullable String text) {
|
||||
String trim = StringUtil.trim(text);
|
||||
if (StringUtil.isEmpty(trim)) return;
|
||||
|
||||
Element element;
|
||||
try {
|
||||
element = JdomKt.loadElement(trim);
|
||||
if (!"channel".equals(element.getName())) return;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Logger.getInstance(ShowUpdateInfoDialogAction.class).error(ex);
|
||||
return;
|
||||
}
|
||||
UpdateChannel channel = new UpdateChannel(element);
|
||||
BuildInfo newBuild = ContainerUtil.getFirstItem(channel.getBuilds());
|
||||
PatchInfo patch = ContainerUtil.getFirstItem(newBuild.getPatches());
|
||||
new UpdateInfoDialog(channel, newBuild, patch, true, UpdateSettings.getInstance().canUseSecureConnection(),
|
||||
Collections.emptyList(), Collections.emptyList()).show();
|
||||
}
|
||||
|
||||
|
||||
@@ -118,10 +165,13 @@ public class ShowUpdateInfoDialogAction extends AnAction {
|
||||
" <patch from=\"145.1617\" size=\"from 42 to 58\"/>\n" +
|
||||
" </build>\n" +
|
||||
" </channel>\n";
|
||||
|
||||
private static String getXML(boolean bigData) {
|
||||
StringBuilder sb = new StringBuilder(CHANNEL_XML_START);
|
||||
int count = bigData ? 4 : 1;
|
||||
for (int i = 0; i < count; i++) { sb.append(PARAGRAPH); }
|
||||
for (int i = 0; i < count; i++) {
|
||||
sb.append(PARAGRAPH);
|
||||
}
|
||||
sb.append(CHANNEL_XML_END);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
+2
-10
@@ -25,6 +25,7 @@ import com.intellij.openapi.components.impl.ComponentManagerImpl;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
|
||||
import com.intellij.openapi.fileEditor.impl.NonProjectFileWritingAccessExtension;
|
||||
import com.intellij.openapi.fileEditor.impl.NonProjectFileWritingAccessProvider;
|
||||
import com.intellij.openapi.module.EmptyModuleType;
|
||||
@@ -52,7 +53,6 @@ import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
public class NonProjectFileAccessTest extends HeavyFileEditorManagerTestCase {
|
||||
private final Set<VirtualFile> myOpenedFiles = new THashSet<>();
|
||||
private final Set<VirtualFile> myCreatedFiles = new THashSet<>();
|
||||
|
||||
@Override
|
||||
@@ -68,7 +68,7 @@ public class NonProjectFileAccessTest extends HeavyFileEditorManagerTestCase {
|
||||
protected void tearDown() throws Exception {
|
||||
try {
|
||||
NonProjectFileWritingAccessProvider.setCustomUnlocker(null);
|
||||
closeOpenFiles();
|
||||
FileEditorManagerEx.getInstanceEx(getProject()).closeAllFiles();
|
||||
ApplicationManager.getApplication().runWriteAction(() -> {
|
||||
for (VirtualFile each : myCreatedFiles) {
|
||||
try {
|
||||
@@ -86,13 +86,6 @@ public class NonProjectFileAccessTest extends HeavyFileEditorManagerTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
private void closeOpenFiles() {
|
||||
FileEditorManager editorManager = FileEditorManager.getInstance(getProject());
|
||||
for (VirtualFile file : myOpenedFiles) {
|
||||
editorManager.closeFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
public void testBasicAccessCheck() throws Exception {
|
||||
VirtualFile projectFile = createProjectFile();
|
||||
typeAndCheck(projectFile, true);
|
||||
@@ -396,7 +389,6 @@ public class NonProjectFileAccessTest extends HeavyFileEditorManagerTestCase {
|
||||
}
|
||||
|
||||
private Editor getEditor(VirtualFile file) {
|
||||
myOpenedFiles.add(file);
|
||||
Editor editor = FileEditorManager.getInstance(getProject()).openTextEditor(new OpenFileDescriptor(getProject(), file, 0), false);
|
||||
EditorTestUtil.waitForLoading(editor);
|
||||
return editor;
|
||||
|
||||
+9
-20
@@ -34,10 +34,7 @@ import com.intellij.openapi.externalSystem.service.notification.NotificationData
|
||||
import com.intellij.openapi.externalSystem.service.notification.NotificationSource;
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
|
||||
import com.intellij.openapi.externalSystem.util.Order;
|
||||
import com.intellij.openapi.module.EmptyModuleType;
|
||||
import com.intellij.openapi.module.JavaModuleType;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.module.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.DependencyScope;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
@@ -175,21 +172,18 @@ public class BaseGradleProjectResolverExtension implements GradleProjectResolver
|
||||
|
||||
ExternalProject externalProject = resolverCtx.getExtraProject(gradleModule, ExternalProject.class);
|
||||
if (resolverCtx.isResolveModulePerSourceSet() && externalProject != null) {
|
||||
String gradlePath = gradleModule.getGradleProject().getPath();
|
||||
final boolean isRootModule = StringUtil.isEmpty(gradlePath) || ":".equals(gradlePath);
|
||||
final String[] moduleGroup;
|
||||
if (isRootModule) {
|
||||
moduleGroup = new String[]{mainModuleData.getInternalName()};
|
||||
String[] moduleGroup = null;
|
||||
if (!ModuleGrouperKt.isQualifiedModuleNamesEnabled()) {
|
||||
String gradlePath = gradleModule.getGradleProject().getPath();
|
||||
final boolean isRootModule = StringUtil.isEmpty(gradlePath) || ":".equals(gradlePath);
|
||||
moduleGroup = isRootModule ? new String[]{mainModuleData.getInternalName()} : ArrayUtil.remove(gradlePath.split(":"), 0);
|
||||
mainModuleData.setIdeModuleGroup(isRootModule ? null : moduleGroup);
|
||||
}
|
||||
else {
|
||||
moduleGroup = ArrayUtil.remove(gradlePath.split(":"), 0);
|
||||
}
|
||||
mainModuleData.setIdeModuleGroup(isRootModule ? null : moduleGroup);
|
||||
|
||||
for (ExternalSourceSet sourceSet : externalProject.getSourceSets().values()) {
|
||||
final String moduleId = getModuleId(resolverCtx, gradleModule, sourceSet);
|
||||
final String moduleExternalName = gradleModule.getName() + ":" + sourceSet.getName();
|
||||
final String moduleInternalName = getInternalModuleName(gradleModule, sourceSet.getName());
|
||||
final String moduleInternalName = getInternalModuleName(gradleModule, externalProject, sourceSet.getName());
|
||||
|
||||
GradleSourceSetData sourceSetData = new GradleSourceSetData(
|
||||
moduleId, moduleExternalName, moduleInternalName, mainModuleFileDirectoryPath, mainModuleConfigPath);
|
||||
@@ -218,7 +212,7 @@ public class BaseGradleProjectResolverExtension implements GradleProjectResolver
|
||||
}
|
||||
else {
|
||||
if ("test".equals(sourceSet.getName())) {
|
||||
sourceSetData.setProductionModuleId(getInternalModuleName(gradleModule, "main"));
|
||||
sourceSetData.setProductionModuleId(getInternalModuleName(gradleModule, externalProject, "main"));
|
||||
final Set<File> testsArtifacts = externalProject.getArtifactsByConfiguration().get("tests");
|
||||
if (testsArtifacts != null) {
|
||||
artifacts.addAll(testsArtifacts);
|
||||
@@ -260,11 +254,6 @@ public class BaseGradleProjectResolverExtension implements GradleProjectResolver
|
||||
return mainModuleNode;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String getInternalModuleName(@NotNull IdeaModule gradleModule, @NotNull String sourceSetName) {
|
||||
return PathUtilRt.suggestFileName(gradleModule.getName() + "_" + sourceSetName, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populateModuleExtraModels(@NotNull IdeaModule gradleModule, @NotNull DataNode<ModuleData> ideModule) {
|
||||
final BuildScriptClasspathModel buildScriptClasspathModel = resolverCtx.getExtraProject(gradleModule, BuildScriptClasspathModel.class);
|
||||
|
||||
+10
-8
@@ -29,6 +29,7 @@ import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotifica
|
||||
import com.intellij.openapi.externalSystem.service.project.ExternalSystemProjectResolver;
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemDebugEnvironment;
|
||||
import com.intellij.openapi.module.ModuleGrouperKt;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.roots.DependencyScope;
|
||||
import com.intellij.openapi.util.Factory;
|
||||
@@ -866,15 +867,16 @@ public class GradleProjectResolver implements ExternalSystemProjectResolver<Grad
|
||||
if (paths.contains(moduleNode.getData().getLinkedExternalProjectPath())) continue;
|
||||
|
||||
resultProjectDataNode.addChild(moduleNode);
|
||||
if (!ModuleGrouperKt.isQualifiedModuleNamesEnabled()) {
|
||||
// adjust ide module group
|
||||
final ModuleData moduleData = moduleNode.getData();
|
||||
if (moduleData.getIdeModuleGroup() != null) {
|
||||
String[] moduleGroup = ArrayUtil.prepend(resultProjectDataNode.getData().getInternalName(), moduleData.getIdeModuleGroup());
|
||||
moduleData.setIdeModuleGroup(moduleGroup);
|
||||
|
||||
// adjust ide module group
|
||||
final ModuleData moduleData = moduleNode.getData();
|
||||
if (moduleData.getIdeModuleGroup() != null) {
|
||||
String[] moduleGroup = ArrayUtil.prepend(resultProjectDataNode.getData().getInternalName(), moduleData.getIdeModuleGroup());
|
||||
moduleData.setIdeModuleGroup(moduleGroup);
|
||||
|
||||
for (DataNode<GradleSourceSetData> sourceSetNode : ExternalSystemApiUtil.getChildren(moduleNode, GradleSourceSetData.KEY)) {
|
||||
sourceSetNode.getData().setIdeModuleGroup(moduleGroup);
|
||||
for (DataNode<GradleSourceSetData> sourceSetNode : ExternalSystemApiUtil.getChildren(moduleNode, GradleSourceSetData.KEY)) {
|
||||
sourceSetNode.getData().setIdeModuleGroup(moduleGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+33
@@ -25,11 +25,13 @@ import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemConstants;
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemDebugEnvironment;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleGrouperKt;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.roots.DependencyScope;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.PathUtilRt;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.gradle.api.artifacts.Dependency;
|
||||
import org.gradle.tooling.model.GradleProject;
|
||||
@@ -100,6 +102,7 @@ public class GradleProjectResolverUtil {
|
||||
|
||||
ExternalProject externalProject = resolverCtx.getExtraProject(gradleModule, ExternalProject.class);
|
||||
if (externalProject != null) {
|
||||
moduleData.setInternalName(getInternalModuleName(gradleModule, externalProject));
|
||||
moduleData.setGroup(externalProject.getGroup());
|
||||
moduleData.setVersion(externalProject.getVersion());
|
||||
moduleData.setDescription(externalProject.getDescription());
|
||||
@@ -111,6 +114,36 @@ public class GradleProjectResolverUtil {
|
||||
return projectDataNode.createChild(ProjectKeys.MODULE, moduleData);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static String getInternalModuleName(@NotNull IdeaModule gradleModule, @NotNull ExternalProject externalProject) {
|
||||
return getInternalModuleName(gradleModule, externalProject, null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static String getInternalModuleName(@NotNull IdeaModule gradleModule,
|
||||
@NotNull ExternalProject externalProject,
|
||||
@Nullable String sourceSetName) {
|
||||
String delimiter;
|
||||
StringBuilder moduleName = new StringBuilder();
|
||||
if (ModuleGrouperKt.isQualifiedModuleNamesEnabled()) {
|
||||
delimiter = ".";
|
||||
if (StringUtil.isNotEmpty(externalProject.getGroup())) {
|
||||
moduleName.append(externalProject.getGroup()).append(delimiter);
|
||||
}
|
||||
moduleName.append(externalProject.getName());
|
||||
}
|
||||
else {
|
||||
delimiter = "_";
|
||||
moduleName.append(gradleModule.getName());
|
||||
}
|
||||
if (sourceSetName != null) {
|
||||
assert !sourceSetName.isEmpty();
|
||||
moduleName.append(delimiter);
|
||||
moduleName.append(sourceSetName);
|
||||
}
|
||||
return PathUtilRt.suggestFileName(moduleName.toString(), true, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getModuleConfigPath(@NotNull ProjectResolverContext resolverCtx,
|
||||
@NotNull IdeaModule gradleModule,
|
||||
|
||||
@@ -256,6 +256,7 @@ label.threads.view.configurable.show.stack.frames.for.synthetic.methods=Show sta
|
||||
label.threads.view.configurable.show.thread.groups=Show thread &groups
|
||||
threads.view.configurable.display.name=Customize Threads View
|
||||
user.renderers.configurable.display.name=Java Type Renderers
|
||||
async.stacktraces.configurable.display.name=Async Stacktraces
|
||||
label.user.renderers.configurable.renderer.name=Renderer name:
|
||||
text.user.renderers.configurable.no.renderers=No renderers
|
||||
button.copy=Copy
|
||||
|
||||
Reference in New Issue
Block a user