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:
+2
-1
@@ -420,7 +420,7 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
|
||||
(elements2 != null) ? elements2.getReferenceElements() : PsiElement.EMPTY_ARRAY
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private boolean compareClasses(final PsiClass clazz, final PsiClass clazz2) {
|
||||
final PsiClass saveClazz = this.myClazz;
|
||||
final MatchContext.MatchedElementsListener oldListener = myMatchingVisitor.getMatchContext().getMatchedElementsListener();
|
||||
@@ -838,6 +838,7 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
|
||||
String text2;
|
||||
if (el2 instanceof PsiClass) {
|
||||
text2 = ((PsiClass)el2).getQualifiedName();
|
||||
if (text2 == null) text2 = el2.getText();
|
||||
} else {
|
||||
text2 = el2.getText();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.jps.model.java.impl;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
@@ -30,11 +31,11 @@ import java.util.Set;
|
||||
* @author nik
|
||||
*/
|
||||
public class JavaSdkUtil {
|
||||
public static List<File> getJdkClassesRoots(File home, boolean isJre) {
|
||||
@NotNull
|
||||
public static List<File> getJdkClassesRoots(@NotNull File home, boolean isJre) {
|
||||
FileFilter jarFileFilter = new FileFilter() {
|
||||
@Override
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
public boolean accept(File f) {
|
||||
public boolean accept(@NotNull File f) {
|
||||
return !f.isDirectory() && f.getName().endsWith(".jar");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -25,7 +25,6 @@ import com.intellij.execution.configurations.SimpleJavaParameters;
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
@@ -61,16 +60,10 @@ public class JdkUtil {
|
||||
VirtualFile homeDirectory = jdk.getHomeDirectory();
|
||||
if (homeDirectory == null) return null;
|
||||
|
||||
VirtualFile rtJar = homeDirectory.findFileByRelativePath("jre/lib/rt.jar");
|
||||
if (rtJar == null) {
|
||||
rtJar = homeDirectory.findFileByRelativePath("lib/rt.jar");
|
||||
}
|
||||
if (rtJar == null) {
|
||||
rtJar = homeDirectory.findFileByRelativePath("jre/lib/vm.jar"); // for IBM jdk
|
||||
}
|
||||
if (rtJar == null) {
|
||||
rtJar = homeDirectory.findFileByRelativePath("../Classes/classes.jar"); // for mac
|
||||
}
|
||||
VirtualFile rtJar = homeDirectory.findFileByRelativePath("jre/lib/rt.jar"); // JDK
|
||||
if (rtJar == null) rtJar = homeDirectory.findFileByRelativePath("lib/rt.jar"); // JRE
|
||||
if (rtJar == null) rtJar = homeDirectory.findFileByRelativePath("jre/lib/vm.jar"); // IBM JDK
|
||||
if (rtJar == null) rtJar = homeDirectory.findFileByRelativePath("../Classes/classes.jar"); // Apple JDK
|
||||
|
||||
if (rtJar == null) {
|
||||
String versionString = jdk.getVersionString();
|
||||
@@ -107,17 +100,16 @@ public class JdkUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean checkForJdk(final File homePath) {
|
||||
public static boolean checkForJdk(@NotNull File homePath) {
|
||||
File binPath = new File(homePath.getAbsolutePath() + File.separator + "bin");
|
||||
if (!binPath.exists()) return false;
|
||||
|
||||
FileFilter fileFilter = new FileFilter() {
|
||||
@Override
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
public boolean accept(File f) {
|
||||
public boolean accept(@NotNull File f) {
|
||||
if (f.isDirectory()) return false;
|
||||
return Comparing.strEqual(FileUtil.getNameWithoutExtension(f), "javac") ||
|
||||
Comparing.strEqual(FileUtil.getNameWithoutExtension(f), "javah");
|
||||
String name = FileUtil.getNameWithoutExtension(f);
|
||||
return "javac".equals(name) || "javah".equals(name);
|
||||
}
|
||||
};
|
||||
File[] children = binPath.listFiles(fileFilter);
|
||||
@@ -126,16 +118,15 @@ public class JdkUtil {
|
||||
checkForRuntime(homePath.getAbsolutePath());
|
||||
}
|
||||
|
||||
public static boolean checkForJre(String homePath) {
|
||||
public static boolean checkForJre(@NotNull String homePath) {
|
||||
homePath = new File(FileUtil.toSystemDependentName(homePath)).getAbsolutePath();
|
||||
File binPath = new File(homePath + File.separator + "bin");
|
||||
if (!binPath.exists()) return false;
|
||||
|
||||
FileFilter fileFilter = new FileFilter() {
|
||||
@Override
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
public boolean accept(File f) {
|
||||
return !f.isDirectory() && Comparing.strEqual(FileUtil.getNameWithoutExtension(f), "java");
|
||||
public boolean accept(@NotNull File f) {
|
||||
return !f.isDirectory() && "java".equals(FileUtil.getNameWithoutExtension(f));
|
||||
}
|
||||
};
|
||||
File[] children = binPath.listFiles(fileFilter);
|
||||
@@ -144,12 +135,12 @@ public class JdkUtil {
|
||||
checkForRuntime(homePath);
|
||||
}
|
||||
|
||||
public static boolean checkForRuntime(final String homePath) {
|
||||
return new File(new File(new File(homePath, "jre"), "lib"), "rt.jar").exists() ||
|
||||
new File(new File(homePath, "lib"), "rt.jar").exists() ||
|
||||
new File(new File(new File(homePath, ".."), "Classes"), "classes.jar").exists() || // Apple JDK
|
||||
new File(new File(new File(homePath, "jre"), "lib"), "vm.jar").exists() || // IBM JDK
|
||||
new File(homePath, "classes").isDirectory(); // custom build
|
||||
public static boolean checkForRuntime(@NotNull String homePath) {
|
||||
return new File(homePath, "jre/lib/rt.jar").exists() || // JDK
|
||||
new File(homePath, "lib/rt.jar").exists() || // JRE
|
||||
new File(homePath, "../Classes/classes.jar").exists() || // Apple JDK
|
||||
new File(homePath, "jre/lib/vm.jar").exists() || // IBM JDK
|
||||
new File(homePath, "classes").isDirectory(); // custom build
|
||||
}
|
||||
|
||||
public static GeneralCommandLine setupJVMCommandLine(final String exePath,
|
||||
@@ -258,7 +249,7 @@ public class JdkUtil {
|
||||
|
||||
commandLine.addParameters(javaParameters.getProgramParametersList().getList());
|
||||
|
||||
commandLine.setWorkDirectory(javaParameters.getWorkingDirectory());
|
||||
commandLine.withWorkDirectory(javaParameters.getWorkingDirectory());
|
||||
|
||||
return commandLine;
|
||||
}
|
||||
@@ -275,24 +266,24 @@ public class JdkUtil {
|
||||
}
|
||||
|
||||
private static void appendEncoding(SimpleJavaParameters javaParameters, GeneralCommandLine commandLine, ParametersList parametersList) {
|
||||
// Value of -Dfile.encoding and charset of GeneralCommandLine should be in sync in order process's input and output be correctly handled.
|
||||
// Value of file.encoding and charset of GeneralCommandLine should be in sync in order process's input and output be correctly handled.
|
||||
String encoding = parametersList.getPropertyValue("file.encoding");
|
||||
if (encoding == null) {
|
||||
Charset charset = javaParameters.getCharset();
|
||||
if (charset == null) charset = EncodingManager.getInstance().getDefaultCharset();
|
||||
if (charset == null) charset = CharsetToolkit.getDefaultSystemCharset();
|
||||
commandLine.addParameter("-Dfile.encoding=" + charset.name());
|
||||
commandLine.setCharset(charset);
|
||||
if (charset != null) {
|
||||
commandLine.addParameter("-Dfile.encoding=" + charset.name());
|
||||
commandLine.withCharset(charset);
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
Charset charset = Charset.forName(encoding);
|
||||
commandLine.setCharset(charset);
|
||||
}
|
||||
catch (UnsupportedCharsetException ignore) {
|
||||
}
|
||||
catch (IllegalCharsetNameException ignore) {
|
||||
commandLine.withCharset(charset);
|
||||
}
|
||||
catch (UnsupportedCharsetException ignore) { }
|
||||
catch (IllegalCharsetNameException ignore) { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-16
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.intellij.openapi.roots.ui.configuration.projectRoot;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
@@ -36,14 +35,15 @@ import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.util.ArrayUtilRt;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.EventDispatcher;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
* Date: 05-Jun-2006
|
||||
* @author anna
|
||||
* @since 05-Jun-2006
|
||||
*/
|
||||
public class ProjectSdksModel implements SdkModel {
|
||||
private static final Logger LOG = Logger.getInstance("com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel");
|
||||
@@ -116,7 +116,7 @@ public class ProjectSdksModel implements SdkModel {
|
||||
return myProjectSdks;
|
||||
}
|
||||
|
||||
public boolean isModified(){
|
||||
public boolean isModified() {
|
||||
return myModified;
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ public class ProjectSdksModel implements SdkModel {
|
||||
final SdkAdditionalData sdkAdditionalData = currItem.getSdkAdditionalData();
|
||||
if (sdkAdditionalData instanceof ValidatableSdkAdditionalData) {
|
||||
try {
|
||||
((ValidatableSdkAdditionalData) sdkAdditionalData).checkValid(this);
|
||||
((ValidatableSdkAdditionalData)sdkAdditionalData).checkValid(this);
|
||||
}
|
||||
catch (ConfigurationException e) {
|
||||
if (rootConfigurable != null) {
|
||||
@@ -249,14 +249,12 @@ public class ProjectSdksModel implements SdkModel {
|
||||
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()) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
doAdd(parent, type, updateTree);
|
||||
}
|
||||
};
|
||||
final AnAction addAction = new DumbAwareAction(type.getPresentableName(), null, type.getIconForAddAction()) {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
doAdd(parent, type, updateTree);
|
||||
}
|
||||
};
|
||||
group.add(addAction);
|
||||
}
|
||||
}
|
||||
@@ -290,8 +288,8 @@ public class ProjectSdksModel implements SdkModel {
|
||||
if (!sdkType.setupSdkPaths(newJdk, this)) return;
|
||||
|
||||
if (newJdk.getVersionString() == null) {
|
||||
Messages.showMessageDialog(ProjectBundle.message("sdk.java.corrupt.error", home),
|
||||
ProjectBundle.message("sdk.java.corrupt.title"), Messages.getErrorIcon());
|
||||
String message = ProjectBundle.message("sdk.java.corrupt.error", home);
|
||||
Messages.showMessageDialog(message, ProjectBundle.message("sdk.java.corrupt.title"), Messages.getErrorIcon());
|
||||
}
|
||||
|
||||
doAdd(newJdk, callback);
|
||||
|
||||
@@ -49,7 +49,7 @@ import java.util.List;
|
||||
|
||||
public class OpenFileAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
final Project project = e.getProject();
|
||||
final boolean showFiles = project != null || PlatformProjectOpenProcessor.getInstanceIfItExists() != null;
|
||||
final FileChooserDescriptor descriptor = showFiles ? new ProjectOrFileChooserDescriptor() : new ProjectOnlyFileChooserDescriptor();
|
||||
@@ -141,7 +141,7 @@ public class OpenFileAction extends AnAction implements DumbAware {
|
||||
}
|
||||
}
|
||||
|
||||
// vanilla OpenProjectFileChooserDescriptor only accepts project files; this on is overridden to accept any files
|
||||
// vanilla OpenProjectFileChooserDescriptor only accepts project files; this one is overridden to accept any files
|
||||
private static class ProjectOrFileChooserDescriptor extends OpenProjectFileChooserDescriptor {
|
||||
private final FileChooserDescriptor myStandardDescriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
|
||||
|
||||
@@ -157,7 +157,7 @@ public class OpenFileAction extends AnAction implements DumbAware {
|
||||
|
||||
@Override
|
||||
public boolean isFileSelectable(VirtualFile file) {
|
||||
return file.isDirectory() ? super.isFileSelectable(file) : myStandardDescriptor.isFileSelectable(file);
|
||||
return file.isDirectory() ? super.isFileSelectable(file) : myStandardDescriptor.isFileSelectable(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -142,7 +142,7 @@ public abstract class XDebuggerEditorBase {
|
||||
|
||||
public abstract JComponent getComponent();
|
||||
|
||||
protected abstract void setEditorText(XExpression text);
|
||||
protected abstract void doSetText(XExpression text);
|
||||
|
||||
public void setExpression(@Nullable XExpression text) {
|
||||
if (text == null) {
|
||||
@@ -174,7 +174,7 @@ public abstract class XDebuggerEditorBase {
|
||||
myChooseFactory.setDisabledIcon(IconLoader.getDisabledIcon(icon));
|
||||
}
|
||||
|
||||
setEditorText(text);
|
||||
doSetText(text);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ public class XDebuggerExpressionComboBox extends XDebuggerEditorBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setEditorText(XExpression text) {
|
||||
protected void doSetText(XExpression text) {
|
||||
if (myComboBox.getItemCount() > 0) {
|
||||
myComboBox.setSelectedIndex(0);
|
||||
}
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ public class XDebuggerMultilineEditor extends XDebuggerEditorBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setEditorText(XExpression text) {
|
||||
protected void doSetText(XExpression text) {
|
||||
myExpression = text;
|
||||
Language language = text.getLanguage();
|
||||
FileType fileType = language != null ? language.getAssociatedFileType() : getEditorsProvider().getFileType();
|
||||
|
||||
+13
-3
@@ -118,9 +118,6 @@ public class GradleResourceCompilerConfigurationGenerator {
|
||||
continue;
|
||||
}
|
||||
|
||||
final CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module);
|
||||
assert compilerModuleExtension != null;
|
||||
|
||||
GradleModuleResourceConfiguration resourceConfig = new GradleModuleResourceConfiguration();
|
||||
resourceConfig.id = new ModuleVersion(externalProject.getGroup(), externalProject.getName(), externalProject.getVersion());
|
||||
resourceConfig.directory = FileUtil.toSystemIndependentName(externalProject.getProjectDir().getPath());
|
||||
@@ -131,6 +128,19 @@ public class GradleResourceCompilerConfigurationGenerator {
|
||||
final ExternalSourceSet testSourcesSet = externalProject.getSourceSets().get("test");
|
||||
addResources(resourceConfig.testResources, testSourcesSet, ExternalSystemSourceType.TEST_RESOURCE);
|
||||
|
||||
final CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module);
|
||||
if(compilerModuleExtension != null && compilerModuleExtension.isCompilerOutputPathInherited()) {
|
||||
String outputPath = VfsUtilCore.urlToPath(compilerModuleExtension.getCompilerOutputUrl());
|
||||
for (ResourceRootConfiguration resource : resourceConfig.resources) {
|
||||
resource.targetPath = outputPath;
|
||||
}
|
||||
|
||||
String testOutputPath = VfsUtilCore.urlToPath(compilerModuleExtension.getCompilerOutputUrlForTests());
|
||||
for (ResourceRootConfiguration resource : resourceConfig.testResources) {
|
||||
resource.targetPath = testOutputPath;
|
||||
}
|
||||
}
|
||||
|
||||
projectConfig.moduleConfigurations.put(module.getName(), resourceConfig);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.execution;
|
||||
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.ApplicationEx;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
@@ -27,9 +26,9 @@ import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceTyp
|
||||
import com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager;
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemConstants;
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.CompilerModuleExtension;
|
||||
import com.intellij.openapi.roots.ModuleRootModel;
|
||||
import com.intellij.openapi.roots.OrderEnumerationHandler;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
@@ -54,6 +53,8 @@ public class GradleOrderEnumeratorHandler extends OrderEnumerationHandler {
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull Module module) {
|
||||
CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module);
|
||||
if (compilerModuleExtension != null && compilerModuleExtension.isCompilerOutputPathInherited()) return false;
|
||||
return ExternalSystemApiUtil.isExternalSystemAwareModule(GradleConstants.SYSTEM_ID, module);
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ public class ArrayTableCellEditor extends AbstractCellEditor implements TableCel
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setEditorText(XExpression text) {
|
||||
protected void doSetText(XExpression text) {
|
||||
myEditorTextField.setText(text.getExpression());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user