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:
@@ -129,4 +129,8 @@ public class RendererConfiguration implements Cloneable, JDOMExternalizable {
|
||||
public int getRendererCount() {
|
||||
return myRepresentationNodes.size();
|
||||
}
|
||||
|
||||
public boolean contains(NodeRenderer renderer) {
|
||||
return myRepresentationNodes.contains(renderer);
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -86,6 +86,7 @@ public class CustomFieldInplaceEditor extends XDebuggerTreeInplaceEditor {
|
||||
|
||||
Renderer lastRenderer = descriptor.getLastRenderer();
|
||||
if (lastRenderer instanceof CompoundNodeRenderer &&
|
||||
NodeRendererSettings.getInstance().getCustomRenderers().contains((NodeRenderer)lastRenderer) &&
|
||||
!(((CompoundNodeRenderer)lastRenderer).getChildrenRenderer() instanceof ExpressionChildrenRenderer)) {
|
||||
((CompoundNodeRenderer)lastRenderer).setChildrenRenderer(enumerationChildrenRenderer);
|
||||
}
|
||||
|
||||
+3
-1
@@ -22,6 +22,7 @@ import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContext;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImports;
|
||||
import com.intellij.debugger.impl.descriptors.data.UserExpressionData;
|
||||
import com.intellij.debugger.settings.NodeRendererSettings;
|
||||
import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
|
||||
import com.intellij.debugger.ui.tree.*;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
@@ -149,7 +150,8 @@ public final class EnumerationChildrenRenderer extends TypeRenderer implements C
|
||||
@Nullable
|
||||
public static EnumerationChildrenRenderer getCurrent(ValueDescriptorImpl valueDescriptor) {
|
||||
Renderer renderer = valueDescriptor.getLastRenderer();
|
||||
if (renderer instanceof CompoundNodeRenderer) {
|
||||
if (renderer instanceof CompoundNodeRenderer &&
|
||||
NodeRendererSettings.getInstance().getCustomRenderers().contains((NodeRenderer)renderer)) {
|
||||
ChildrenRenderer childrenRenderer = ((CompoundNodeRenderer)renderer).getChildrenRenderer();
|
||||
if (childrenRenderer instanceof EnumerationChildrenRenderer) {
|
||||
return (EnumerationChildrenRenderer)childrenRenderer;
|
||||
|
||||
+3
-2
@@ -1252,7 +1252,8 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
}
|
||||
|
||||
PsiExpression[] expressions = expression.getArgumentList().getExpressions();
|
||||
PsiElement method = methodExpression.resolve();
|
||||
JavaResolveResult result = methodExpression.advancedResolve(false);
|
||||
PsiElement method = result.getElement();
|
||||
PsiParameter[] parameters = method instanceof PsiMethod ? ((PsiMethod)method).getParameterList().getParameters() : null;
|
||||
boolean isEqualsCall = expressions.length == 1 && method instanceof PsiMethod &&
|
||||
"equals".equals(((PsiMethod)method).getName()) && parameters.length == 1 &&
|
||||
@@ -1263,7 +1264,7 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
PsiExpression paramExpr = expressions[i];
|
||||
paramExpr.accept(this);
|
||||
if (parameters != null && i < parameters.length) {
|
||||
generateBoxingUnboxingInstructionFor(paramExpr, parameters[i].getType());
|
||||
generateBoxingUnboxingInstructionFor(paramExpr, result.getSubstitutor().substitute(parameters[i].getType()));
|
||||
}
|
||||
if (i == 0 && isEqualsCall) {
|
||||
// stack: .., qualifier, arg1
|
||||
|
||||
@@ -43,6 +43,7 @@ public class JavaLineIndentProvider extends JavaLikeLangLineIndentProvider {
|
||||
SYNTAX_MAP.put(JavaTokenType.LBRACE, BlockOpeningBrace);
|
||||
SYNTAX_MAP.put(JavaTokenType.RBRACE, BlockClosingBrace);
|
||||
SYNTAX_MAP.put(JavaTokenType.LBRACKET, ArrayOpeningBracket);
|
||||
SYNTAX_MAP.put(JavaTokenType.RBRACKET, ArrayClosingBracket);
|
||||
SYNTAX_MAP.put(JavaTokenType.RPARENTH, RightParenthesis);
|
||||
SYNTAX_MAP.put(JavaTokenType.LPARENTH, LeftParenthesis);
|
||||
SYNTAX_MAP.put(JavaTokenType.COLON, Colon);
|
||||
|
||||
@@ -20,5 +20,11 @@ class Test {
|
||||
return Optional.ofNullable(<warning descr="Passing 'null' argument to 'Optional'">null</warning>);
|
||||
}
|
||||
|
||||
long field;
|
||||
|
||||
Optional<Long> getName4() {
|
||||
return Optional.ofNullable(<warning descr="Passing a non-null argument to 'Optional'">field</warning>);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,9 @@
|
||||
<item name="java.lang.Iterable Iterator<T> iterator()">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
</item>
|
||||
<item name='java.lang.Iterable java.util.Iterator<T> iterator()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name="java.lang.Readable int read(java.nio.CharBuffer) 0">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
</item>
|
||||
|
||||
+4
@@ -45,6 +45,7 @@ public abstract class JavaLikeLangLineIndentProvider implements LineIndentProvid
|
||||
BlockOpeningBrace,
|
||||
BlockClosingBrace,
|
||||
ArrayOpeningBracket,
|
||||
ArrayClosingBracket,
|
||||
RightParenthesis,
|
||||
LeftParenthesis,
|
||||
Colon,
|
||||
@@ -199,6 +200,9 @@ public abstract class JavaLikeLangLineIndentProvider implements LineIndentProvid
|
||||
else if (position.isAt(BlockClosingBrace)) {
|
||||
position.beforeParentheses(BlockOpeningBrace, BlockClosingBrace);
|
||||
}
|
||||
else if (position.isAt(ArrayClosingBracket)) {
|
||||
position.beforeParentheses(ArrayOpeningBracket, ArrayClosingBracket);
|
||||
}
|
||||
else if (position.isAtAnyOf(Semicolon,
|
||||
BlockOpeningBrace,
|
||||
BlockComment,
|
||||
|
||||
@@ -76,11 +76,11 @@ public final class ColorLineMarkerProvider implements LineMarkerProvider {
|
||||
public void navigate(MouseEvent e, PsiElement elt) {
|
||||
if (!elt.isWritable()) return;
|
||||
|
||||
final Editor editor = PsiUtilBase.findEditor(element);
|
||||
final Editor editor = PsiUtilBase.findEditor(elt);
|
||||
assert editor != null;
|
||||
final Color c = ColorChooser.chooseColor(editor.getComponent(), "Choose Color", color, true);
|
||||
if (c != null) {
|
||||
WriteAction.run(() -> colorProvider.setColorTo(element, c));
|
||||
WriteAction.run(() -> colorProvider.setColorTo(elt, c));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class MockModule extends MockComponentManager implements Module {
|
||||
private final Project myProject;
|
||||
private String myName = "MockModule";
|
||||
|
||||
public MockModule(@NotNull Disposable parentDisposable) {
|
||||
this(null, parentDisposable);
|
||||
@@ -114,7 +115,12 @@ public class MockModule extends MockComponentManager implements Module {
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return "MockModule";
|
||||
return myName;
|
||||
}
|
||||
|
||||
public MockModule setName(String name) {
|
||||
myName = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+41
-2
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.dgm;
|
||||
|
||||
import com.intellij.lang.properties.IProperty;
|
||||
import com.intellij.lang.properties.psi.PropertiesFile;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Couple;
|
||||
import com.intellij.psi.*;
|
||||
@@ -26,13 +28,15 @@ import com.intellij.psi.util.CachedValuesManager;
|
||||
import com.intellij.psi.util.PsiModificationTracker;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames.DEFAULT_INSTANCE_EXTENSIONS;
|
||||
import static org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames.DEFAULT_STATIC_EXTENSIONS;
|
||||
|
||||
/**
|
||||
* Provides members from extension classes referenced in {@code META-INF/services/org.codehaus.groovy.runtime.ExtensionModule}.
|
||||
*/
|
||||
@@ -72,7 +76,7 @@ public class DGMMemberContributor extends NonCodeMembersContributor {
|
||||
List<GdkMethodHolder> gdkMethods = ContainerUtil.newArrayList();
|
||||
|
||||
JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
|
||||
Couple<List<String>> extensions = GroovyExtensionProvider.getInstance(project).collectExtensions(resolveScope);
|
||||
Couple<List<String>> extensions = collectExtensions(project, resolveScope);
|
||||
for (String category : extensions.getFirst()) {
|
||||
PsiClass clazz = facade.findClass(category, resolveScope);
|
||||
if (clazz != null) {
|
||||
@@ -87,4 +91,39 @@ public class DGMMemberContributor extends NonCodeMembersContributor {
|
||||
}
|
||||
return gdkMethods;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Couple<List<String>> collectExtensions(@NotNull Project project, @NotNull GlobalSearchScope resolveScope) {
|
||||
List<String> instanceClasses = ContainerUtil.newArrayList(DEFAULT_INSTANCE_EXTENSIONS);
|
||||
List<String> staticClasses = ContainerUtil.newArrayList(DEFAULT_STATIC_EXTENSIONS);
|
||||
doCollectExtensions(project, resolveScope, instanceClasses, staticClasses);
|
||||
return Couple.of(instanceClasses, staticClasses);
|
||||
}
|
||||
|
||||
private static void doCollectExtensions(@NotNull Project project,
|
||||
@NotNull GlobalSearchScope resolveScope,
|
||||
List<String> instanceClasses,
|
||||
List<String> staticClasses) {
|
||||
PsiPackage aPackage = JavaPsiFacade.getInstance(project).findPackage("META-INF.services");
|
||||
if (aPackage == null) return;
|
||||
|
||||
for (PsiDirectory directory : aPackage.getDirectories(resolveScope)) {
|
||||
PsiFile file = directory.findFile(DGMUtil.ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE);
|
||||
if (file instanceof PropertiesFile) {
|
||||
IProperty inst = ((PropertiesFile)file).findPropertyByKey("extensionClasses");
|
||||
IProperty stat = ((PropertiesFile)file).findPropertyByKey("staticExtensionClasses");
|
||||
|
||||
if (inst != null) collectClasses(inst, instanceClasses);
|
||||
if (stat != null) collectClasses(stat, staticClasses);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void collectClasses(IProperty pr, List<String> classes) {
|
||||
String value = pr.getUnescapedValue();
|
||||
if (value == null) return;
|
||||
value = value.trim();
|
||||
String[] qnames = value.split("\\s*,\\s*");
|
||||
ContainerUtil.addAll(classes, qnames);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +25,13 @@ import com.intellij.psi.PsiFile;
|
||||
* @author Max Medvedev
|
||||
*/
|
||||
public class DGMUtil {
|
||||
public static final String ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE = "org.codehaus.groovy.runtime.ExtensionModule";
|
||||
public static final String[] KEYS = new String[]{"moduleName", "moduleVersion", "extensionClasses", "staticExtensionClasses",};
|
||||
|
||||
public static boolean isInDGMFile(PsiElement e) {
|
||||
PsiFile file = e.getContainingFile();
|
||||
return file instanceof PropertiesFile &&
|
||||
Comparing.equal(file.getName(), GroovyExtensionProvider.ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE,
|
||||
Comparing.equal(file.getName(), ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE,
|
||||
SystemInfo.isFileSystemCaseSensitive);
|
||||
}
|
||||
}
|
||||
|
||||
-91
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.dgm;
|
||||
|
||||
import com.intellij.lang.properties.IProperty;
|
||||
import com.intellij.lang.properties.psi.PropertiesFile;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Couple;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiPackage;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames.DEFAULT_INSTANCE_EXTENSIONS;
|
||||
import static org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames.DEFAULT_STATIC_EXTENSIONS;
|
||||
|
||||
/**
|
||||
* @author Max Medvedev
|
||||
*/
|
||||
public class GroovyExtensionProvider {
|
||||
@NonNls public static final String ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE = "org.codehaus.groovy.runtime.ExtensionModule";
|
||||
private final Project myProject;
|
||||
|
||||
public GroovyExtensionProvider(Project project) {
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
public static GroovyExtensionProvider getInstance(Project project) {
|
||||
return ServiceManager.getService(project, GroovyExtensionProvider.class);
|
||||
}
|
||||
|
||||
public Couple<List<String>> collectExtensions(@NotNull GlobalSearchScope resolveScope) {
|
||||
List<String> instanceClasses = ContainerUtil.newArrayList(DEFAULT_INSTANCE_EXTENSIONS);
|
||||
List<String> staticClasses = ContainerUtil.newArrayList(DEFAULT_STATIC_EXTENSIONS);
|
||||
doCollectExtensions(resolveScope, instanceClasses, staticClasses);
|
||||
return Couple.of(instanceClasses, staticClasses);
|
||||
}
|
||||
|
||||
private void doCollectExtensions(@NotNull GlobalSearchScope resolveScope, List<String> instanceClasses, List<String> staticClasses) {
|
||||
PsiPackage aPackage = JavaPsiFacade.getInstance(myProject).findPackage("META-INF.services");
|
||||
if (aPackage == null) return;
|
||||
|
||||
for (PsiDirectory directory : aPackage.getDirectories(resolveScope)) {
|
||||
PsiFile file = directory.findFile(ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE);
|
||||
if (file instanceof PropertiesFile) {
|
||||
IProperty inst = ((PropertiesFile)file).findPropertyByKey("extensionClasses");
|
||||
IProperty stat = ((PropertiesFile)file).findPropertyByKey("staticExtensionClasses");
|
||||
|
||||
if (inst != null) collectClasses(inst, instanceClasses);
|
||||
if (stat != null) collectClasses(stat, staticClasses);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void collectClasses(IProperty pr, List<String> classes) {
|
||||
String value = pr.getUnescapedValue();
|
||||
if (value == null) return;
|
||||
value = value.trim();
|
||||
String[] qnames = value.split("\\s*,\\s*");
|
||||
ContainerUtil.addAll(classes, qnames);
|
||||
}
|
||||
|
||||
public static class GroovyExtensionVetoSPI implements Condition<String> {
|
||||
|
||||
@Override
|
||||
public boolean value(String s) {
|
||||
return ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE.equals(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.dgm;
|
||||
|
||||
import com.intellij.openapi.util.Condition;
|
||||
|
||||
public class GroovyExtensionVetoSPI implements Condition<String> {
|
||||
|
||||
@Override
|
||||
public boolean value(String s) {
|
||||
return DGMUtil.ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE.equals(s);
|
||||
}
|
||||
}
|
||||
-2
@@ -66,7 +66,6 @@ import org.jetbrains.plugins.groovy.configSlurper.ConfigSlurperMapContentProvide
|
||||
import org.jetbrains.plugins.groovy.configSlurper.GroovyMapValueTypeEnhancer;
|
||||
import org.jetbrains.plugins.groovy.dgm.DGMImplicitPropertyUsageProvider;
|
||||
import org.jetbrains.plugins.groovy.dgm.DGMMemberContributor;
|
||||
import org.jetbrains.plugins.groovy.dgm.GroovyExtensionProvider;
|
||||
import org.jetbrains.plugins.groovy.dsl.DslActivationStatus;
|
||||
import org.jetbrains.plugins.groovy.dsl.GroovyDslAnnotator;
|
||||
import org.jetbrains.plugins.groovy.dsl.GroovyDslFileIndex;
|
||||
@@ -359,7 +358,6 @@ public class GroovyCoreEnvironment {
|
||||
project.registerService(GroovyPsiManager.class, GroovyPsiManager.class);
|
||||
project.registerService(GroovyCodeStyleManager.class, CoreGroovyCodeStyleManager.class);
|
||||
project.registerService(GroovyCodeStyleSettingsFacade.class, CoreGroovyCodeStyleSettingsFacade.class);
|
||||
project.registerService(GroovyExtensionProvider.class, GroovyExtensionProvider.class);
|
||||
projectEnvironment.addProjectExtension(PsiShortNamesCache.EP_NAME, new GroovyShortNamesCache(project));
|
||||
projectEnvironment.addProjectExtension(PsiElementFinder.EP_NAME, new GroovyClassFinder(project));
|
||||
TextEditorHighlightingPassRegistrar registrar = TextEditorHighlightingPassRegistrar.getInstance(project);
|
||||
|
||||
@@ -576,7 +576,7 @@
|
||||
<projectService serviceImplementation="org.jetbrains.plugins.groovy.compiler.GreclipseIdeaCompilerSettings"/>
|
||||
<buildProcess.parametersProvider implementation="org.jetbrains.plugins.groovy.compiler.GrBuildProcessParametersProvider"/>
|
||||
|
||||
<vetoSPICondition implementation="org.jetbrains.plugins.groovy.dgm.GroovyExtensionProvider$GroovyExtensionVetoSPI"/>
|
||||
<vetoSPICondition implementation="org.jetbrains.plugins.groovy.dgm.GroovyExtensionVetoSPI"/>
|
||||
|
||||
<stubElementTypeHolder class="org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes"/>
|
||||
<!--Stubs index-->
|
||||
@@ -626,9 +626,6 @@
|
||||
<projectService serviceInterface="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyCodeStyleSettingsFacade"
|
||||
serviceImplementation="org.jetbrains.plugins.groovy.codeStyle.GroovyCodeStyleSettingsFacadeImpl"/>
|
||||
|
||||
<projectService
|
||||
serviceImplementation="org.jetbrains.plugins.groovy.dgm.GroovyExtensionProvider"/>
|
||||
|
||||
<problemFileHighlightFilter implementation="org.jetbrains.plugins.groovy.GroovyProblemFileHighlightFilter"/>
|
||||
|
||||
<renameInputValidator implementation="org.jetbrains.plugins.groovy.GroovyRenameInputValidator"/>
|
||||
|
||||
@@ -29,7 +29,7 @@ public class DGMFileTypeFactory extends FileTypeFactory {
|
||||
|
||||
@Override
|
||||
public void createFileTypes(@NotNull FileTypeConsumer consumer) {
|
||||
ExactFileNameMatcher matcher = new ExactFileNameMatcher(GroovyExtensionProvider.ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE,
|
||||
ExactFileNameMatcher matcher = new ExactFileNameMatcher(DGMUtil.ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE,
|
||||
!SystemInfo.isFileSystemCaseSensitive);
|
||||
consumer.consume(PropertiesFileType.INSTANCE, matcher);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user