Snapshot idea/141.498 from git://git.jetbrains.org/idea/community.git
Change-Id: I28ca54917a6c4129a2044732dde5cf18cc3bd5d0
diff --git a/.idea/libraries/Slf4j.xml b/.idea/libraries/Slf4j.xml
new file mode 100644
index 0000000..84df8aa
--- /dev/null
+++ b/.idea/libraries/Slf4j.xml
@@ -0,0 +1,10 @@
+<component name="libraryTable">
+ <library name="Slf4j">
+ <CLASSES>
+ <root url="jar://$PROJECT_DIR$/lib/slf4j-api-1.7.10.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib/slf4j-log4j12-1.7.10.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+</component>
\ No newline at end of file
diff --git a/bin/scripts/unix/idea.sh b/bin/scripts/unix/idea.sh
index 0a2df34..a2abafa 100755
--- a/bin/scripts/unix/idea.sh
+++ b/bin/scripts/unix/idea.sh
@@ -43,11 +43,26 @@
OS_TYPE=`"$UNAME" -s`
# ---------------------------------------------------------------------
+# Ensure IDE_HOME points to the directory where the IDE is installed.
+# ---------------------------------------------------------------------
+SCRIPT_LOCATION=$0
+if [ -x "$READLINK" ]; then
+ while [ -L "$SCRIPT_LOCATION" ]; do
+ SCRIPT_LOCATION=`"$READLINK" -e "$SCRIPT_LOCATION"`
+ done
+fi
+
+IDE_HOME=`dirname "$SCRIPT_LOCATION"`/..
+IDE_BIN_HOME=`dirname "$SCRIPT_LOCATION"`
+
+# ---------------------------------------------------------------------
# Locate a JDK installation directory which will be used to run the IDE.
-# Try (in order): @@product_uc@@_JDK, JDK_HOME, JAVA_HOME, "java" in PATH.
+# Try (in order): @@product_uc@@_JDK, ../jre, JDK_HOME, JAVA_HOME, "java" in PATH.
# ---------------------------------------------------------------------
if [ -n "$@@product_uc@@_JDK" -a -x "$@@product_uc@@_JDK/bin/java" ]; then
JDK="$@@product_uc@@_JDK"
+elif [ -x "$IDE_HOME/jre/bin/java" ] && "$IDE_HOME/jre/bin/java" -version > /dev/null 2>&1 ; then
+ JDK="$IDE_HOME/jre"
elif [ -n "$JDK_HOME" -a -x "$JDK_HOME/bin/java" ]; then
JDK="$JDK_HOME"
elif [ -n "$JAVA_HOME" -a -x "$JAVA_HOME/bin/java" ]; then
@@ -109,19 +124,6 @@
fi
# ---------------------------------------------------------------------
-# Ensure IDE_HOME points to the directory where the IDE is installed.
-# ---------------------------------------------------------------------
-SCRIPT_LOCATION=$0
-if [ -x "$READLINK" ]; then
- while [ -L "$SCRIPT_LOCATION" ]; do
- SCRIPT_LOCATION=`"$READLINK" -e "$SCRIPT_LOCATION"`
- done
-fi
-
-IDE_HOME=`dirname "$SCRIPT_LOCATION"`/..
-IDE_BIN_HOME=`dirname "$SCRIPT_LOCATION"`
-
-# ---------------------------------------------------------------------
# Collect JVM options and properties.
# ---------------------------------------------------------------------
if [ -n "$@@product_uc@@_PROPERTIES" ]; then
diff --git a/build/lib/jps/antlayout.jar b/build/lib/jps/antlayout.jar
index eaa7f61..47dae3c 100644
--- a/build/lib/jps/antlayout.jar
+++ b/build/lib/jps/antlayout.jar
Binary files differ
diff --git a/build/lib/jps/groovy-jps-plugin.jar b/build/lib/jps/groovy-jps-plugin.jar
index 45f4867..a4c8f68 100644
--- a/build/lib/jps/groovy-jps-plugin.jar
+++ b/build/lib/jps/groovy-jps-plugin.jar
Binary files differ
diff --git a/build/lib/jps/groovy_rt.jar b/build/lib/jps/groovy_rt.jar
index 661e9e5..f74f0a8 100644
--- a/build/lib/jps/groovy_rt.jar
+++ b/build/lib/jps/groovy_rt.jar
Binary files differ
diff --git a/build/lib/jps/jps-builders.jar b/build/lib/jps/jps-builders.jar
index 1e19cd7..6a79213 100644
--- a/build/lib/jps/jps-builders.jar
+++ b/build/lib/jps/jps-builders.jar
Binary files differ
diff --git a/build/lib/jps/jps-model.jar b/build/lib/jps/jps-model.jar
index e11c540..3d4fc26 100644
--- a/build/lib/jps/jps-model.jar
+++ b/build/lib/jps/jps-model.jar
Binary files differ
diff --git a/build/lib/jps/ui-designer-jps-plugin.jar b/build/lib/jps/ui-designer-jps-plugin.jar
index d94b168..43351b5 100644
--- a/build/lib/jps/ui-designer-jps-plugin.jar
+++ b/build/lib/jps/ui-designer-jps-plugin.jar
Binary files differ
diff --git a/build/lib/jps/util.jar b/build/lib/jps/util.jar
index 0a909c4..18195e6 100644
--- a/build/lib/jps/util.jar
+++ b/build/lib/jps/util.jar
Binary files differ
diff --git a/build/scripts/layouts.gant b/build/scripts/layouts.gant
index 7d3db45..6587f8e 100644
--- a/build/scripts/layouts.gant
+++ b/build/scripts/layouts.gant
@@ -475,10 +475,11 @@
//layout of groovy jars must be consistent with GroovyBuilder.getGroovyRtRoot method
jar("groovy-jps-plugin.jar") {
module("groovy-jps-plugin")
- module("groovy-rt-constants")
}
jar("groovy_rt.jar") {
module("groovy_rt")
+ }
+ jar("groovy-rt-constants.jar") {
module("groovy-rt-constants")
}
dir("standardDsls") {
diff --git a/build/scripts/libLicenses.gant b/build/scripts/libLicenses.gant
index 4578e00..730ab4c 100644
--- a/build/scripts/libLicenses.gant
+++ b/build/scripts/libLicenses.gant
@@ -221,7 +221,7 @@
libraryLicense(name: "Gradle", version: "1.12", license: "Apache 2.0", url: "http://gradle.org/", licenseUrl: "http://gradle.org/license")
libraryLicense(name: "gradle-tooling-api-2.0.jar", version: "2.0", license: "Apache 2.0", url: "http://gradle.org/", licenseUrl: "http://gradle.org/license")
libraryLicense(name: "GradleJnaPosix", version: "1.0.3", license: "LGPL 2.1", url: "http://www.jruby.org/", licenseUrl: "http://www.gnu.org/licenses/lgpl-2.1.txt")
-libraryLicense(name: "Slf4j", version: "1.7.2", license: "MIT License", url: "http://slf4j.org/", licenseUrl: "http://slf4j.org/license.html")
+libraryLicense(name: "Slf4j", version: "1.7.10", license: "MIT License", url: "http://slf4j.org/", licenseUrl: "http://slf4j.org/license.html")
libraryLicense(name: "GradleGuava", version: "14.0.1", license: "Apache 2.0", url: "http://code.google.com/p/guava-libraries/", licenseUrl: "http://apache.org/licenses/LICENSE-2.0")
libraryLicense(name: "Jsr305", version: "1.3.9", license: "New BSD", url: "http://code.google.com/p/jsr-305/", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause")
libraryLicense(name: "markdownj", attachedTo: "tasks-core", version: "", license: "BSD", url: "http://markdownj.org/", licenseUrl: "http://www.opensource.org/licenses/bsd-license.php")
diff --git a/build/scripts/utils.gant b/build/scripts/utils.gant
index 12a2a52..f4de6c4 100644
--- a/build/scripts/utils.gant
+++ b/build/scripts/utils.gant
@@ -383,11 +383,11 @@
}
new File("$path/bin/idea.properties").text = effectiveProperties.toString()
- String ideaVmOptions = "$mem64 -XX:+UseCompressedOops".split(" ").join("\n")
+ String ideaVmOptions = "$mem64 -XX:+UseCompressedOops"
if (isEap() && !args.mac_no_yjp) {
ideaVmOptions += " ${yjpOptions(args.system_selector)}"
}
- new File("$path/bin/${executable}.vmoptions").text = ideaVmOptions
+ new File("$path/bin/${executable}.vmoptions").text = ideaVmOptions.split(" ").join("\n")
String classPath = classPathLibs.collect {"\$APP_PACKAGE/Contents/lib/${it}" }.join(":")
diff --git a/community-resources/src/idea/IdeaApplicationInfo.xml b/community-resources/src/idea/IdeaApplicationInfo.xml
index 4cd1cde..087754a 100644
--- a/community-resources/src/idea/IdeaApplicationInfo.xml
+++ b/community-resources/src/idea/IdeaApplicationInfo.xml
@@ -1,5 +1,5 @@
<component>
- <version codename="Community Edition" major="14" minor="1.1" eap="false"/>
+ <version codename="Community Edition" major="14" minor="1.2" eap="true"/>
<company name="JetBrains s.r.o." url="https://www.jetbrains.com/?fromIDE"/>
<build number="__BUILD_NUMBER__" date="__BUILD_DATE__"/>
<install-over minbuild="129.1" maxbuild="139.9999" version="14"/>
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactManagerImpl.java b/java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactManagerImpl.java
index 837360f..1cd4478 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactManagerImpl.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactManagerImpl.java
@@ -246,7 +246,7 @@
private InvalidArtifact createInvalidArtifact(ArtifactState state, String errorMessage) {
final InvalidArtifact artifact = new InvalidArtifact(state, errorMessage);
ProjectLoadingErrorsNotifier.getInstance(myProject).registerError(new ArtifactLoadingErrorDescription(myProject, artifact));
- UnknownFeaturesCollector.getInstance(myProject).registerUnknownFeature("com.intellij.packaging.artifacts.ArtifactType", state.getArtifactType());
+ UnknownFeaturesCollector.getInstance(myProject).registerUnknownFeature("com.intellij.packaging.artifacts.ArtifactType", state.getArtifactType(), "Artifact");
return artifact;
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java b/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java
index aabdc0f..a9982cd 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -24,6 +24,7 @@
import com.intellij.debugger.requests.ClassPrepareRequestor;
import com.intellij.execution.filters.LineNumbersMapping;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ThreeState;
import com.intellij.xdebugger.frame.XStackFrame;
@@ -59,62 +60,55 @@
private Cache<Location, SourcePosition> mySourcePositionCache = new Cache<Location, SourcePosition>();
+ private interface Processor<T> {
+ T process(PositionManager positionManager) throws NoDataException;
+ }
+
+ private <T> T iterate(Processor<T> processor, T defaultValue) {
+ for (PositionManager positionManager : myPositionManagers) {
+ try {
+ return processor.process(positionManager);
+ }
+ catch (NoDataException ignored) {}
+ catch (VMDisconnectedException e) {throw e;}
+ catch (InternalException ignored) {}
+ catch (ProcessCanceledException ignored) {}
+ catch (Exception e) {LOG.error(e);}
+ catch (AssertionError e) {LOG.error(e);}
+ }
+ return defaultValue;
+ }
+
@Override
- public SourcePosition getSourcePosition(Location location) {
+ public SourcePosition getSourcePosition(final Location location) {
if (location == null) return null;
SourcePosition res = mySourcePositionCache.get(location);
if (res != null) return res;
- for (PositionManager positionManager : myPositionManagers) {
- try {
- res = positionManager.getSourcePosition(location);
+ return iterate(new Processor<SourcePosition>() {
+ @Override
+ public SourcePosition process(PositionManager positionManager) throws NoDataException {
+ SourcePosition res = positionManager.getSourcePosition(location);
mySourcePositionCache.put(location, res);
return res;
}
- catch (NoDataException ignored) {
- }
- catch (VMDisconnectedException e) {
- throw e;
- }
- catch (InternalException ignored) {
- }
- catch (Exception e) {
- LOG.error(e);
- }
- catch (AssertionError e) {
- LOG.error(e);
- }
- }
- return null;
+ }, null);
}
@Override
@NotNull
- public List<ReferenceType> getAllClasses(@NotNull SourcePosition classPosition) {
- for (PositionManager positionManager : myPositionManagers) {
- try {
+ public List<ReferenceType> getAllClasses(@NotNull final SourcePosition classPosition) {
+ return iterate(new Processor<List<ReferenceType>>() {
+ @Override
+ public List<ReferenceType> process(PositionManager positionManager) throws NoDataException {
return positionManager.getAllClasses(classPosition);
}
- catch (NoDataException ignored) {
- }
- catch (VMDisconnectedException e) {
- throw e;
- }
- catch (InternalException ignored) {
- }
- catch (Exception e) {
- LOG.error(e);
- }
- catch (AssertionError e) {
- LOG.error(e);
- }
- }
- return Collections.emptyList();
+ }, Collections.<ReferenceType>emptyList());
}
@Override
@NotNull
- public List<Location> locationsOfLine(@NotNull ReferenceType type, @NotNull SourcePosition position) {
+ public List<Location> locationsOfLine(@NotNull final ReferenceType type, @NotNull SourcePosition position) {
VirtualFile file = position.getFile().getVirtualFile();
if (file != null) {
LineNumbersMapping mapping = file.getUserData(LineNumbersMapping.LINE_NUMBERS_MAPPING_KEY);
@@ -126,54 +120,31 @@
}
}
- for (PositionManager positionManager : myPositionManagers) {
- try {
- return positionManager.locationsOfLine(type, position);
+ final SourcePosition finalPosition = position;
+ return iterate(new Processor<List<Location>>() {
+ @Override
+ public List<Location> process(PositionManager positionManager) throws NoDataException {
+ return positionManager.locationsOfLine(type, finalPosition);
}
- catch (NoDataException ignored) {
- }
- catch (VMDisconnectedException e) {
- throw e;
- }
- catch (InternalException ignored) {
- }
- catch (Exception e) {
- LOG.error(e);
- }
- catch (AssertionError e) {
- LOG.error(e);
- }
- }
- return Collections.emptyList();
+ }, Collections.<Location>emptyList());
}
@Override
- public ClassPrepareRequest createPrepareRequest(@NotNull ClassPrepareRequestor requestor, @NotNull SourcePosition position) {
- for (PositionManager positionManager : myPositionManagers) {
- try {
+ public ClassPrepareRequest createPrepareRequest(@NotNull final ClassPrepareRequestor requestor, @NotNull final SourcePosition position) {
+ return iterate(new Processor<ClassPrepareRequest>() {
+ @Override
+ public ClassPrepareRequest process(PositionManager positionManager) throws NoDataException {
return positionManager.createPrepareRequest(requestor, position);
}
- catch (NoDataException ignored) {
- }
- catch (VMDisconnectedException e) {
- throw e;
- }
- catch (Exception e) {
- LOG.error(e);
- }
- catch (AssertionError e) {
- LOG.error(e);
- }
- }
-
- return null;
+ }, null);
}
@NotNull
@Override
- public List<ClassPrepareRequest> createPrepareRequests(@NotNull ClassPrepareRequestor requestor, @NotNull SourcePosition position) {
- for (PositionManager positionManager : myPositionManagers) {
- try {
+ public List<ClassPrepareRequest> createPrepareRequests(@NotNull final ClassPrepareRequestor requestor, @NotNull final SourcePosition position) {
+ return iterate(new Processor<List<ClassPrepareRequest>>() {
+ @Override
+ public List<ClassPrepareRequest> process(PositionManager positionManager) throws NoDataException {
if (positionManager instanceof MultiRequestPositionManager) {
return ((MultiRequestPositionManager)positionManager).createPrepareRequests(requestor, position);
}
@@ -185,20 +156,7 @@
return Collections.singletonList(prepareRequest);
}
}
- catch (NoDataException ignored) {
- }
- catch (VMDisconnectedException e) {
- throw e;
- }
- catch (Exception e) {
- LOG.error(e);
- }
- catch (AssertionError e) {
- LOG.error(e);
- }
- }
-
- return Collections.emptyList();
+ }, Collections.<ClassPrepareRequest>emptyList());
}
@Nullable
diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/InvokeThread.java b/java/debugger/impl/src/com/intellij/debugger/impl/InvokeThread.java
index 2d83c11..8c98f4f 100644
--- a/java/debugger/impl/src/com/intellij/debugger/impl/InvokeThread.java
+++ b/java/debugger/impl/src/com/intellij/debugger/impl/InvokeThread.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -17,6 +17,7 @@
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.sun.jdi.VMDisconnectedException;
@@ -157,6 +158,7 @@
catch (EventQueueClosedException ignored) {
break;
}
+ catch (ProcessCanceledException ignored) {}
catch (RuntimeException e) {
if(e.getCause() instanceof InterruptedException) {
break;
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java
index 25bc97b..9f903a8 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -638,27 +638,28 @@
}
final EventRequestManager eventRequestManager = requestManager.getVMRequestManager();
+ if (eventRequestManager != null) {
+ new FilterSetter<BreakpointRequest>() {
+ @Override
+ protected void addFilter(@NotNull final BreakpointRequest request, final ThreadReference thread) {
+ request.addThreadFilter(thread);
+ }
+ }.applyFilter(eventRequestManager.breakpointRequests(), newFilterThread);
- new FilterSetter<BreakpointRequest>() {
- @Override
- protected void addFilter(@NotNull final BreakpointRequest request, final ThreadReference thread) {
- request.addThreadFilter(thread);
- }
- }.applyFilter(eventRequestManager.breakpointRequests(), newFilterThread);
+ new FilterSetter<MethodEntryRequest>() {
+ @Override
+ protected void addFilter(@NotNull final MethodEntryRequest request, final ThreadReference thread) {
+ request.addThreadFilter(thread);
+ }
+ }.applyFilter(eventRequestManager.methodEntryRequests(), newFilterThread);
- new FilterSetter<MethodEntryRequest>() {
- @Override
- protected void addFilter(@NotNull final MethodEntryRequest request, final ThreadReference thread) {
- request.addThreadFilter(thread);
- }
- }.applyFilter(eventRequestManager.methodEntryRequests(), newFilterThread);
-
- new FilterSetter<MethodExitRequest>() {
- @Override
- protected void addFilter(@NotNull final MethodExitRequest request, final ThreadReference thread) {
- request.addThreadFilter(thread);
- }
- }.applyFilter(eventRequestManager.methodExitRequests(), newFilterThread);
+ new FilterSetter<MethodExitRequest>() {
+ @Override
+ protected void addFilter(@NotNull final MethodExitRequest request, final ThreadReference thread) {
+ request.addThreadFilter(thread);
+ }
+ }.applyFilter(eventRequestManager.methodExitRequests(), newFilterThread);
+ }
}
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ArgumentValueDescriptorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ArgumentValueDescriptorImpl.java
index 2e3653a..5455179 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ArgumentValueDescriptorImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ArgumentValueDescriptorImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -161,9 +161,15 @@
}
public void visitSynchronizedStatement(PsiSynchronizedStatement statement) {
- appendName("<monitor>");
- myCurrentSlotIndex++;
- super.visitSynchronizedStatement(statement);
+ myIndexStack.push(myCurrentSlotIndex);
+ try {
+ appendName("<monitor>");
+ myCurrentSlotIndex++;
+ super.visitSynchronizedStatement(statement);
+ }
+ finally {
+ myCurrentSlotIndex = myIndexStack.pop();
+ }
}
private void appendName(String varName) {
diff --git a/java/debugger/openapi/src/com/intellij/debugger/SourcePosition.java b/java/debugger/openapi/src/com/intellij/debugger/SourcePosition.java
index d10b656..965452b 100644
--- a/java/debugger/openapi/src/com/intellij/debugger/SourcePosition.java
+++ b/java/debugger/openapi/src/com/intellij/debugger/SourcePosition.java
@@ -21,6 +21,7 @@
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
+import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Computable;
@@ -172,6 +173,7 @@
document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file.getOriginalFile());
}
}
+ catch (ProcessCanceledException ignored) {}
catch (Throwable e) {
LOG.error(e);
}
diff --git a/java/execution/impl/src/com/intellij/execution/junit/JUnitUtil.java b/java/execution/impl/src/com/intellij/execution/junit/JUnitUtil.java
index 055fcf2..193c8d2 100644
--- a/java/execution/impl/src/com/intellij/execution/junit/JUnitUtil.java
+++ b/java/execution/impl/src/com/intellij/execution/junit/JUnitUtil.java
@@ -28,6 +28,7 @@
import com.intellij.psi.search.searches.ClassInheritorsSearch;
import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.util.PsiClassUtil;
+import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.Processor;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -56,7 +57,8 @@
private static final Collection<String> CONFIGURATIONS_ANNOTATION_NAME = Collections.unmodifiableList(
Arrays.asList(DATA_POINT, AFTER_ANNOTATION_NAME, BEFORE_ANNOTATION_NAME, AFTER_CLASS_ANNOTATION_NAME, BEFORE_CLASS_ANNOTATION_NAME));
- public static final String PARAMETERIZED_CLASS_NAME = "org.junit.runners.Parameterized";
+ @NonNls public static final String PARAMETERIZED_CLASS_NAME = "org.junit.runners.Parameterized";
+ @NonNls public static final String SUITE_CLASS_NAME = "org.junit.runners.Suite";
public static boolean isSuiteMethod(@NotNull PsiMethod psiMethod) {
if (!psiMethod.hasModifierProperty(PsiModifier.PUBLIC)) return false;
@@ -104,6 +106,19 @@
public static boolean isTestClass(@NotNull PsiClass psiClass, boolean checkAbstract, boolean checkForTestCaseInheritance) {
if (psiClass.getQualifiedName() == null) return false;
+ final PsiClass topLevelClass = PsiTreeUtil.getTopmostParentOfType(psiClass, PsiClass.class);
+ if (topLevelClass != null) {
+ final PsiAnnotation annotation = AnnotationUtil.findAnnotationInHierarchy(topLevelClass, Collections.singleton(RUN_WITH));
+ if (annotation != null) {
+ final PsiAnnotationMemberValue attributeValue = annotation.findAttributeValue("value");
+ if (attributeValue instanceof PsiClassObjectAccessExpression) {
+ final String runnerName = ((PsiClassObjectAccessExpression)attributeValue).getOperand().getType().getCanonicalText();
+ if (!(PARAMETERIZED_CLASS_NAME.equals(runnerName) || SUITE_CLASS_NAME.equals(runnerName))) {
+ return true;
+ }
+ }
+ }
+ }
if (!PsiClassUtil.isRunnableClass(psiClass, true, checkAbstract)) return false;
if (checkForTestCaseInheritance && isTestCaseInheritor(psiClass)) return true;
final PsiModifierList modifierList = psiClass.getModifierList();
diff --git a/java/execution/impl/src/com/intellij/execution/junit2/SegmentedInputStream.java b/java/execution/impl/src/com/intellij/execution/junit2/SegmentedInputStream.java
index 7ebb739..adf24c4 100644
--- a/java/execution/impl/src/com/intellij/execution/junit2/SegmentedInputStream.java
+++ b/java/execution/impl/src/com/intellij/execution/junit2/SegmentedInputStream.java
@@ -94,6 +94,7 @@
while (nextRead != ' ' && nextRead != SegmentedStream.SPECIAL_SYMBOL) {
buffer.append((char)nextRead);
nextRead = readNext();
+ if (nextRead == -1) return new char[0];
}
return readNext(Integer.valueOf(buffer.toString()).intValue());
}
diff --git a/java/execution/impl/src/com/intellij/execution/util/JavaParametersUtil.java b/java/execution/impl/src/com/intellij/execution/util/JavaParametersUtil.java
index bec7729..eede2ed 100644
--- a/java/execution/impl/src/com/intellij/execution/util/JavaParametersUtil.java
+++ b/java/execution/impl/src/com/intellij/execution/util/JavaParametersUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -27,6 +27,7 @@
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdk;
+import com.intellij.openapi.projectRoots.JdkUtil;
import com.intellij.openapi.projectRoots.ProjectJdkTable;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.ex.PathUtilEx;
@@ -39,7 +40,6 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.io.File;
import java.util.List;
import java.util.Map;
@@ -90,7 +90,9 @@
}
final List<OrderEntry> entriesForFile = fileIndex.getOrderEntriesForFile(virtualFile);
for (OrderEntry entry : entriesForFile) {
- if (entry instanceof ExportableOrderEntry && ((ExportableOrderEntry)entry).getScope() == DependencyScope.TEST) return JavaParameters.JDK_AND_CLASSES_AND_TESTS;
+ if (entry instanceof ExportableOrderEntry && ((ExportableOrderEntry)entry).getScope() == DependencyScope.TEST) {
+ return JavaParameters.JDK_AND_CLASSES_AND_TESTS;
+ }
}
return JavaParameters.JDK_AND_CLASSES;
}
@@ -106,12 +108,17 @@
configureModule(module, parameters, classPathType, jreHome);
}
- public static void configureModule(Module module, JavaParameters parameters, @MagicConstant(valuesFromClass = JavaParameters.class) int classPathType, @Nullable String jreHome) throws CantRunException {
+ public static void configureModule(Module module,
+ JavaParameters parameters,
+ @MagicConstant(valuesFromClass = JavaParameters.class) int classPathType,
+ @Nullable String jreHome) throws CantRunException {
parameters.configureByModule(module, classPathType, createModuleJdk(module, jreHome));
}
- public static void configureProject(Project project, final JavaParameters parameters, @MagicConstant(valuesFromClass = JavaParameters.class) final int classPathType, @Nullable String jreHome)
- throws CantRunException {
+ public static void configureProject(Project project,
+ final JavaParameters parameters,
+ @MagicConstant(valuesFromClass = JavaParameters.class) final int classPathType,
+ @Nullable String jreHome) throws CantRunException {
parameters.configureByProject(project, classPathType, createProjectJdk(project, jreHome));
}
@@ -136,23 +143,29 @@
if (configuredJdk != null) {
return configuredJdk;
}
- final boolean isJdk = JavaSdk.checkForJdk(new File(jreHome));
- if (isJdk) {
- throw new CantRunException("Alternative JRE path needs to point to a JRE, not to a complete JDK installation");
+
+ if (JdkUtil.checkForJdk(jreHome)) {
+ throw new CantRunException(ExecutionBundle.message("jre.path.is.jdk.error.message"));
}
+ if (!JdkUtil.checkForJre(jreHome)) {
+ throw new CantRunException(ExecutionBundle.message("jre.path.is.not.valid.jre.home.error.message", jreHome));
+ }
+
final Sdk jdk = JavaSdk.getInstance().createJdk("", jreHome);
if (jdk == null) throw CantRunException.noJdkConfigured();
return jdk;
}
- public static void checkAlternativeJRE(CommonJavaRunConfigurationParameters configuration) throws RuntimeConfigurationWarning {
+ public static void checkAlternativeJRE(@NotNull CommonJavaRunConfigurationParameters configuration) throws RuntimeConfigurationWarning {
if (configuration.isAlternativeJrePathEnabled()) {
- String alternativeJrePath = configuration.getAlternativeJrePath();
- if (StringUtil.isEmpty(alternativeJrePath) ||
- ProjectJdkTable.getInstance().findJdk(alternativeJrePath) == null && !JavaSdk.checkForJre(alternativeJrePath)) {
- throw new RuntimeConfigurationWarning(
- ExecutionBundle.message("jre.path.is.not.valid.jre.home.error.mesage", alternativeJrePath));
- }
+ checkAlternativeJRE(configuration.getAlternativeJrePath());
+ }
+ }
+
+ public static void checkAlternativeJRE(@Nullable String jrePath) throws RuntimeConfigurationWarning {
+ if (StringUtil.isEmpty(jrePath) ||
+ ProjectJdkTable.getInstance().findJdk(jrePath) == null && !JavaSdk.checkForJre(jrePath)) {
+ throw new RuntimeConfigurationWarning(ExecutionBundle.message("jre.path.is.not.valid.jre.home.error.message", jrePath));
}
}
}
diff --git a/java/idea-ui/src/com/intellij/ide/actions/ImportModuleAction.java b/java/idea-ui/src/com/intellij/ide/actions/ImportModuleAction.java
index 76e3567..c992d54 100644
--- a/java/idea-ui/src/com/intellij/ide/actions/ImportModuleAction.java
+++ b/java/idea-ui/src/com/intellij/ide/actions/ImportModuleAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -45,6 +45,8 @@
import java.util.Collections;
import java.util.List;
+import static com.intellij.util.ArrayUtil.toObjectArray;
+
/**
* @author Dmitry Avdeev
* Date: 10/31/12
@@ -55,21 +57,31 @@
@Override
public void actionPerformed(AnActionEvent e) {
- final Project project = getEventProject(e);
- doImport(project);
+ doImport(getEventProject(e));
}
- public static List<Module> doImport(Project project) {
+ @Override
+ public void update(AnActionEvent e) {
+ Presentation presentation = e.getPresentation();
+ presentation.setEnabled(getEventProject(e) != null);
+ }
+
+ @Override
+ public boolean isDumbAware() {
+ return true;
+ }
+
+ public static List<Module> doImport(@Nullable Project project) {
AddModuleWizard wizard = selectFileAndCreateWizard(project, null);
- if (wizard == null) {
+
+ if (wizard == null || wizard.getStepCount() > 0 && !wizard.showAndGet()) {
return Collections.emptyList();
}
- if (wizard.getStepCount() > 0 && !wizard.showAndGet()) return Collections.emptyList();
return createFromWizard(project, wizard);
}
- public static List<Module> createFromWizard(Project project, AbstractProjectWizard wizard) {
+ public static List<Module> createFromWizard(@Nullable Project project, AbstractProjectWizard wizard) {
if (project == null && wizard.getStepCount() > 0) {
Project newProject = NewProjectUtil.createFromWizard(wizard, null);
return newProject == null ? Collections.<Module>emptyList() : Arrays.asList(ModuleManager.getInstance(newProject).getModules());
@@ -82,6 +94,7 @@
return Collections.singletonList(module);
}
else {
+ assert project != null;
return projectBuilder.commit(project);
}
}
@@ -93,23 +106,21 @@
}
@Nullable
- public static AddModuleWizard selectFileAndCreateWizard(final Project project, Component dialogParent) {
+ public static AddModuleWizard selectFileAndCreateWizard(@Nullable Project project, @Nullable Component dialogParent) {
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
descriptor.setHideIgnored(false);
descriptor.setTitle("Select File or Directory to Import");
- ProjectImportProvider[] providers = ProjectImportProvider.PROJECT_IMPORT_PROVIDER.getExtensions();
- String description = getFileChooserDescription(project);
+ List<ProjectImportProvider> providers = getProviders(project);
+ String description = getFileChooserDescription(providers);
descriptor.setDescription(description);
-
- return selectFileAndCreateWizard(project, dialogParent, descriptor, providers);
+ return selectFileAndCreateWizard(project, dialogParent, descriptor, toObjectArray(providers, ProjectImportProvider.class));
}
@Nullable
- public static AddModuleWizard selectFileAndCreateWizard(final Project project,
+ public static AddModuleWizard selectFileAndCreateWizard(@Nullable Project project,
@Nullable Component dialogParent,
@NotNull FileChooserDescriptor descriptor,
- ProjectImportProvider[] providers)
- {
+ ProjectImportProvider[] providers) {
FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, project, dialogParent);
VirtualFile toSelect = null;
String lastLocation = PropertiesComponent.getInstance().getValue(LAST_IMPORTED_LOCATION);
@@ -126,18 +137,17 @@
return createImportWizard(project, dialogParent, file, providers);
}
- public static String getFileChooserDescription(final Project project) {
- ProjectImportProvider[] providers = ProjectImportProvider.PROJECT_IMPORT_PROVIDER.getExtensions();
- List<ProjectImportProvider> list = ContainerUtil.filter(providers, new Condition<ProjectImportProvider>() {
- @Override
- public boolean value(ProjectImportProvider provider) {
- return project != null || provider.canCreateNewProject();
- }
- });
+ /** @deprecated to be removed in IDEA 16 */
+ @SuppressWarnings("unused")
+ public static String getFileChooserDescription(@Nullable final Project project) {
+ return getFileChooserDescription(getProviders(project));
+ }
+
+ private static String getFileChooserDescription(List<ProjectImportProvider> providers) {
StringBuilder builder = new StringBuilder("<html>Select ");
boolean first = true;
- if (list.size() > 0) {
- for (ProjectImportProvider provider : list) {
+ if (providers.size() > 0) {
+ for (ProjectImportProvider provider : providers) {
String sample = provider.getFileSample();
if (sample != null) {
if (!first) {
@@ -154,8 +164,19 @@
return builder.toString();
}
+ @NotNull
+ public static List<ProjectImportProvider> getProviders(@Nullable final Project project) {
+ ProjectImportProvider[] providers = ProjectImportProvider.PROJECT_IMPORT_PROVIDER.getExtensions();
+ return ContainerUtil.filter(providers, new Condition<ProjectImportProvider>() {
+ @Override
+ public boolean value(ProjectImportProvider provider) {
+ return project == null ? provider.canCreateNewProject() : provider.canImportModule();
+ }
+ });
+ }
+
@Nullable
- public static AddModuleWizard createImportWizard(final Project project,
+ public static AddModuleWizard createImportWizard(@Nullable final Project project,
@Nullable Component dialogParent,
final VirtualFile file,
ProjectImportProvider... providers) {
@@ -180,18 +201,8 @@
ProjectImportProvider[] availableProviders = available.toArray(new ProjectImportProvider[available.size()]);
- return dialogParent == null ? new AddModuleWizard(project, path, availableProviders) : new AddModuleWizard(project, dialogParent, path, availableProviders);
- }
-
-
- @Override
- public void update(AnActionEvent e) {
- Presentation presentation = e.getPresentation();
- presentation.setEnabled(getEventProject(e) != null);
- }
-
- @Override
- public boolean isDumbAware() {
- return true;
+ return dialogParent == null
+ ? new AddModuleWizard(project, path, availableProviders)
+ : new AddModuleWizard(project, dialogParent, path, availableProviders);
}
}
diff --git a/java/idea-ui/src/com/intellij/ide/util/projectWizard/SdkSettingsStep.java b/java/idea-ui/src/com/intellij/ide/util/projectWizard/SdkSettingsStep.java
index b497b14..314ca60 100644
--- a/java/idea-ui/src/com/intellij/ide/util/projectWizard/SdkSettingsStep.java
+++ b/java/idea-ui/src/com/intellij/ide/util/projectWizard/SdkSettingsStep.java
@@ -81,33 +81,12 @@
if (jdk != null) {
component.setValue(selectedJdkProperty, jdk.getName());
}
- OnSdkSelected(jdk);
+ onSdkSelected(jdk);
}
});
- if (project != null) {
- Sdk sdk = ProjectRootManager.getInstance(project).getProjectSdk();
- if (sdk != null && moduleBuilder.isSuitableSdkType(sdk.getSdkType())) {
- // use project SDK
- return;
- }
- }
- else {
- // set default project SDK
- Project defaultProject = ProjectManager.getInstance().getDefaultProject();
- Sdk sdk = ProjectRootManager.getInstance(defaultProject).getProjectSdk();
- if (sdk != null && sdkFilter.value(sdk.getSdkType())) {
- myJdkComboBox.setSelectedJdk(sdk);
- }
- }
-
- String value = component.getValue(selectedJdkProperty);
- if (value != null) {
- Sdk jdk = ProjectJdkTable.getInstance().findJdk(value);
- if (jdk != null) {
- myJdkComboBox.setSelectedJdk(jdk);
- }
- }
+ Sdk sdk = getPreselectedSdk(project, component.getValue(selectedJdkProperty), sdkFilter);
+ myJdkComboBox.setSelectedJdk(sdk);
JButton button = new JButton("Ne\u001Bw...");
myJdkComboBox.setSetupButton(button, project, myModel,
@@ -119,7 +98,32 @@
myJdkPanel.add(myJdkComboBox.getSetUpButton(), BorderLayout.EAST);
}
- protected void OnSdkSelected(Sdk sdk) {}
+ private Sdk getPreselectedSdk(Project project, String lastUsedSdk, Condition<SdkTypeId> sdkFilter) {
+ if (project != null) {
+ Sdk sdk = ProjectRootManager.getInstance(project).getProjectSdk();
+ if (sdk != null && myModuleBuilder.isSuitableSdkType(sdk.getSdkType())) {
+ // use project SDK
+ //noinspection unchecked
+ myJdkComboBox.insertItemAt(new JdkComboBox.ProjectJdkComboBoxItem(), 0);
+ return null;
+ }
+ }
+ if (lastUsedSdk != null) {
+ Sdk sdk = ProjectJdkTable.getInstance().findJdk(lastUsedSdk);
+ if (sdk != null && myModuleBuilder.isSuitableSdkType(sdk.getSdkType())) {
+ return sdk;
+ }
+ }
+ // set default project SDK
+ Project defaultProject = ProjectManager.getInstance().getDefaultProject();
+ Sdk selected = ProjectRootManager.getInstance(defaultProject).getProjectSdk();
+ if (selected != null && sdkFilter.value(selected.getSdkType())) {
+ return selected;
+ }
+ return null;
+ }
+
+ protected void onSdkSelected(Sdk sdk) {}
public boolean isEmpty() {
return myJdkPanel.getComponentCount() == 0;
@@ -130,10 +134,6 @@
return (project == null ? "Project" : "Module") + " \u001BSDK:";
}
- public JdkComboBox getJdkComboBox() {
- return myJdkComboBox;
- }
-
@Override
public JComponent getComponent() {
return myJdkPanel;
@@ -147,16 +147,13 @@
myWizardContext.setProjectJdk(jdk);
}
else {
- Sdk sdk = ProjectRootManager.getInstance(project).getProjectSdk();
- if (sdk == null || !myModuleBuilder.isSuitableSdkType(sdk.getSdkType())) {
- myModuleBuilder.setModuleJdk(myJdkComboBox.getSelectedJdk());
- } // else, inherit project jdk
+ myModuleBuilder.setModuleJdk(myJdkComboBox.getSelectedJdk());
}
}
@Override
public boolean validate() throws ConfigurationException {
- if (myJdkComboBox.getSelectedJdk() == null) {
+ if (myJdkComboBox.getSelectedJdk() == null && !myJdkComboBox.isProjectJdkSelected()) {
if (Messages.showDialog(getNoSdkMessage(),
IdeBundle.message("title.no.jdk.specified"),
new String[]{CommonBundle.getYesButtonText(), CommonBundle.getNoButtonText()}, 1, Messages.getWarningIcon()) != Messages.YES) {
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/BuildElementsEditor.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/BuildElementsEditor.java
index a36acc6..93fbf8d 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/BuildElementsEditor.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/BuildElementsEditor.java
@@ -70,27 +70,17 @@
group.add(myInheritCompilerOutput);
group.add(myPerModuleCompilerOutput);
- final ActionListener listener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- enableCompilerSettings(!myInheritCompilerOutput.isSelected());
- }
- };
-
- myInheritCompilerOutput.addActionListener(listener);
- myPerModuleCompilerOutput.addActionListener(listener);
-
myOutputPathPanel = createOutputPathPanel(ProjectBundle.message("module.paths.output.title"), new CommitPathRunnable() {
@Override
public void saveUrl(String url) {
- if (getCompilerExtension().isCompilerOutputPathInherited()) return; //do not override settings if any
+ if (myInheritCompilerOutput.isSelected()) return; //do not override settings if any
getCompilerExtension().setCompilerOutputPath(url);
}
});
myTestsOutputPathPanel = createOutputPathPanel(ProjectBundle.message("module.paths.test.output.title"), new CommitPathRunnable() {
@Override
public void saveUrl(String url) {
- if (getCompilerExtension().isCompilerOutputPathInherited()) return; //do not override settings if any
+ if (myInheritCompilerOutput.isSelected()) return; //do not override settings if any
getCompilerExtension().setCompilerOutputPathForTests(url);
}
});
@@ -129,15 +119,26 @@
outputPathsPanel.add(myCbExcludeOutput, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(6, 16, 0, 0), 0, 0));
+ final boolean outputPathInherited = getCompilerExtension().isCompilerOutputPathInherited();
+ myInheritCompilerOutput.setSelected(outputPathInherited);
+ myPerModuleCompilerOutput.setSelected(!outputPathInherited);
+
// fill with data
updateOutputPathPresentation();
//compiler settings
- final boolean outputPathInherited = getCompilerExtension().isCompilerOutputPathInherited();
- myInheritCompilerOutput.setSelected(outputPathInherited);
- myPerModuleCompilerOutput.setSelected(!outputPathInherited);
enableCompilerSettings(!outputPathInherited);
+ final ActionListener listener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ enableCompilerSettings(!myInheritCompilerOutput.isSelected());
+ }
+ };
+
+ myInheritCompilerOutput.addActionListener(listener);
+ myPerModuleCompilerOutput.addActionListener(listener);
+
final JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(IdeBorderFactory.createTitledBorder(ProjectBundle.message("project.roots.output.compiler.title"),
true));
@@ -218,6 +219,14 @@
}
};
+ final ActionListener listener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ commitRunnable.run();
+ }
+ };
+ myPerModuleCompilerOutput.addActionListener(listener);
+
textField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
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 43344ae..41899d6 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
@@ -213,10 +213,14 @@
@Nullable
public Sdk getSelectedJdk() {
- final JdkComboBoxItem selectedItem = (JdkComboBoxItem)super.getSelectedItem();
+ final JdkComboBoxItem selectedItem = getSelectedItem();
return selectedItem != null? selectedItem.getJdk() : null;
}
+ public boolean isProjectJdkSelected() {
+ return getSelectedItem() instanceof ProjectJdkComboBoxItem;
+ }
+
public void setSelectedJdk(Sdk jdk) {
final int index = indexOf(jdk);
if (index >= 0) {
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModuleJdkConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModuleJdkConfigurable.java
index 66931e4..4a3a3c2 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModuleJdkConfigurable.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModuleJdkConfigurable.java
@@ -44,7 +44,6 @@
*/
public abstract class ModuleJdkConfigurable implements Disposable {
private JdkComboBox myCbModuleJdk;
- private Sdk mySelectedModuleJdk = null;
private JPanel myJdkPanel;
private ClasspathEditor myModuleEditor;
private final ProjectSdksModel myJdksModel;
@@ -78,18 +77,6 @@
init();
}
- /**
- * @return null if JDK should be inherited
- */
- @Nullable
- public Sdk getSelectedModuleJdk() {
- return myJdksModel.findSdk(mySelectedModuleJdk);
- }
-
- public boolean isInheritJdk() {
- return myCbModuleJdk.getSelectedItem()instanceof JdkComboBox.ProjectJdkComboBoxItem;
- }
-
public JComponent createComponent() {
return myJdkPanel;
}
@@ -171,9 +158,9 @@
myFreeze = true;
final String jdkName = getRootModel().getSdkName();
if (jdkName != null && !getRootModel().isSdkInherited()) {
- mySelectedModuleJdk = myJdksModel.findSdk(jdkName);
- if (mySelectedModuleJdk != null) {
- myCbModuleJdk.setSelectedJdk(mySelectedModuleJdk);
+ Sdk selectedModuleJdk = myJdksModel.findSdk(jdkName);
+ if (selectedModuleJdk != null) {
+ myCbModuleJdk.setSelectedJdk(selectedModuleJdk);
} else {
myCbModuleJdk.setInvalidJdk(jdkName);
clearCaches();
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/JavadocOrderRootTypeUIFactory.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/JavadocOrderRootTypeUIFactory.java
index 7fcb3f0..16cd462 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/JavadocOrderRootTypeUIFactory.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/JavadocOrderRootTypeUIFactory.java
@@ -31,6 +31,7 @@
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.AnActionButton;
import com.intellij.ui.AnActionButtonUpdater;
+import com.intellij.ui.DumbAwareActionButton;
import com.intellij.ui.ToolbarDecorator;
import com.intellij.util.IconUtil;
@@ -66,7 +67,7 @@
@Override
protected void addToolbarButtons(ToolbarDecorator toolbarDecorator) {
- AnActionButton specifyUrlButton = new AnActionButton(ProjectBundle.message("sdk.paths.specify.url.button"), IconUtil.getAddLinkIcon()) {
+ AnActionButton specifyUrlButton = new DumbAwareActionButton(ProjectBundle.message("sdk.paths.specify.url.button"), IconUtil.getAddLinkIcon()) {
@Override
public void actionPerformed(AnActionEvent e) {
onSpecifyUrlButtonClicked();
diff --git a/java/idea-ui/src/com/intellij/projectImport/ProjectImportProvider.java b/java/idea-ui/src/com/intellij/projectImport/ProjectImportProvider.java
index 8f79e2b..cf9319d 100644
--- a/java/idea-ui/src/com/intellij/projectImport/ProjectImportProvider.java
+++ b/java/idea-ui/src/com/intellij/projectImport/ProjectImportProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -86,6 +86,10 @@
return true;
}
+ public boolean canImportModule() {
+ return true;
+ }
+
public void addSteps(StepSequence sequence, WizardContext context, String id) {
ModuleWizardStep[] steps = createSteps(context);
for (ModuleWizardStep step : steps) {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
index de9876b..f691f50 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
@@ -157,6 +157,10 @@
final HighlightInfo highlightInfo =
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(referenceParameterList).descriptionAndTooltip(description).create();
if (registerIntentions) {
+ if (typeParameterListOwner instanceof PsiClass) {
+ QuickFixAction.registerQuickFixAction(highlightInfo, QUICK_FIX_FACTORY.createChangeClassSignatureFromUsageFix((PsiClass)typeParameterListOwner, referenceParameterList));
+ }
+
PsiElement grandParent = referenceParameterList.getParent().getParent();
if (grandParent instanceof PsiTypeElement) {
PsiElement variable = grandParent.getParent();
@@ -164,9 +168,6 @@
if (targetParametersNum == 0) {
QuickFixAction.registerQuickFixAction(highlightInfo, QUICK_FIX_FACTORY.createRemoveTypeArgumentsFix(variable));
}
- if (typeParameterListOwner instanceof PsiClass) {
- QuickFixAction.registerQuickFixAction(highlightInfo, QUICK_FIX_FACTORY.createChangeClassSignatureFromUsageFix((PsiClass)typeParameterListOwner, referenceParameterList));
- }
registerVariableParameterizedTypeFixes(highlightInfo, (PsiVariable)variable, referenceParameterList, javaSdkVersion);
}
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java
index deacd92..92e639e 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java
@@ -88,6 +88,7 @@
PsiMethod superMethod = superMethodSignature.getMethod();
if (method.hasModifierProperty(PsiModifier.ABSTRACT) && !MethodSignatureUtil.isSuperMethod(superMethod, method)) continue;
if (!PsiUtil.isAccessible(containingFile.getProject(), superMethod, method, null)) continue;
+ if (!includeRealPositionInfo && MethodSignatureUtil.isSuperMethod(superMethod, method)) continue;
HighlightInfo info = isWeaker(method, modifierList, accessModifier, accessLevel, superMethod, includeRealPositionInfo);
if (info != null) return info;
}
@@ -1039,6 +1040,7 @@
boolean isInterface = aClass != null && aClass.isInterface();
boolean isExtension = method.hasModifierProperty(PsiModifier.DEFAULT);
boolean isStatic = method.hasModifierProperty(PsiModifier.STATIC);
+ boolean isPrivate = method.hasModifierProperty(PsiModifier.PRIVATE);
final List<IntentionAction> additionalFixes = new ArrayList<IntentionAction>();
String description = null;
@@ -1052,7 +1054,7 @@
}
}
else if (isInterface) {
- if (!isExtension && !isStatic) {
+ if (!isExtension && !isStatic && !isPrivate) {
description = JavaErrorMessages.message("interface.methods.cannot.have.body");
if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
additionalFixes.add(QUICK_FIX_FACTORY.createModifierListFix(method, PsiModifier.DEFAULT, true, false));
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
index ce564b3..73299fd 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
@@ -154,12 +154,16 @@
Set<String> incompatibles = incompatibleModifiersHash.get(modifier);
if (incompatibles == null) return null;
final boolean level8OrHigher = PsiUtil.isLanguageLevel8OrHigher(modifierList);
+ final boolean level9OrHigher = PsiUtil.isLanguageLevel9OrHigher(modifierList);
for (@PsiModifier.ModifierConstant String incompatible : incompatibles) {
if (level8OrHigher) {
if (modifier.equals(PsiModifier.STATIC) && incompatible.equals(PsiModifier.ABSTRACT)){
continue;
}
}
+ if (level9OrHigher && modifier.equals(PsiModifier.PRIVATE) && incompatible.equals(PsiModifier.PUBLIC)) {
+ continue;
+ }
if (modifier.equals(PsiModifier.STATIC) && incompatible.equals(PsiModifier.FINAL)) {
final PsiElement parent = modifierList.getParent();
if (parent instanceof PsiMethod) {
@@ -475,6 +479,7 @@
HighlightInfo highlightInfo = checkAssignability(lType, rType, initializer, new TextRange(start, end), 0);
if (highlightInfo != null) {
registerChangeVariableTypeFixes(variable, rType, variable.getInitializer(), highlightInfo);
+ registerChangeVariableTypeFixes(initializer, lType, null, highlightInfo);
}
return highlightInfo;
}
@@ -881,8 +886,15 @@
isAllowed = false;
}
- if (PsiModifier.PRIVATE.equals(modifier) || PsiModifier.PROTECTED.equals(modifier) || PsiModifier.TRANSIENT.equals(modifier) ||
- PsiModifier.STRICTFP.equals(modifier) || PsiModifier.SYNCHRONIZED.equals(modifier)) {
+ if (PsiModifier.PRIVATE.equals(modifier)) {
+ isAllowed &= modifierOwnerParent instanceof PsiClass &&
+ (!((PsiClass)modifierOwnerParent).isInterface() || PsiUtil.isLanguageLevel9OrHigher(modifierOwner));
+ }
+ else if (PsiModifier.STRICTFP.equals(modifier)) {
+ isAllowed &= modifierOwnerParent instanceof PsiClass && (!((PsiClass)modifierOwnerParent).isInterface() || PsiUtil.isLanguageLevel8OrHigher(modifierOwner));
+ }
+ else if (PsiModifier.PROTECTED.equals(modifier) || PsiModifier.TRANSIENT.equals(modifier) ||
+ PsiModifier.SYNCHRONIZED.equals(modifier)) {
isAllowed &= modifierOwnerParent instanceof PsiClass && !((PsiClass)modifierOwnerParent).isInterface();
}
@@ -2726,11 +2738,6 @@
QuickFixAction.registerQuickFixAction(highlightInfo, PriorityActionWrapper
.lowPriority(method, QUICK_FIX_FACTORY.createMethodReturnFix(method, parameter.getType(), true)));
}
- } else if (expr instanceof PsiReferenceExpression) {
- final PsiElement resolve = ((PsiReferenceExpression)expr).resolve();
- if (resolve instanceof PsiVariable) {
- registerChangeVariableTypeFixes((PsiVariable)resolve, parameter.getType(), null, highlightInfo);
- }
}
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ExtendsListFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ExtendsListFix.java
index ae5493c..e6a9031 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ExtendsListFix.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ExtendsListFix.java
@@ -172,6 +172,12 @@
}
list = (PsiReferenceList) element.getParent();
}
+
+ //nothing was changed
+ if (!add && !alreadyExtends) {
+ return list;
+ }
+
return (PsiReferenceList)JavaCodeStyleManager.getInstance(extendsList.getProject()).shortenClassReferences(list);
}
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
index a50eaee..c8cf8025 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
@@ -35,10 +35,7 @@
import com.intellij.psi.impl.source.resolve.DefaultParameterTypeInferencePolicy;
import com.intellij.psi.impl.source.resolve.graphInference.FunctionalInterfaceParameterizationUtil;
import com.intellij.psi.infos.MethodCandidateInfo;
-import com.intellij.psi.util.InheritanceUtil;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.psi.util.PsiTypesUtil;
-import com.intellij.psi.util.PsiUtil;
+import com.intellij.psi.util.*;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtilRt;
@@ -433,14 +430,15 @@
private final PsiMethod myMethod;
private final PsiAnonymousClass myAnonymClass;
- private final boolean myEqualInference;
+ private final PsiType myInferredType;
public ForbiddenRefsChecker(PsiMethod method,
PsiAnonymousClass aClass) {
myMethod = method;
myAnonymClass = aClass;
final PsiType inferredType = FunctionalInterfaceParameterizationUtil.getGroundTargetType(getInferredType(aClass));
- myEqualInference = !aClass.getBaseClassType().equals(inferredType);
+ final PsiClassType baseClassType = aClass.getBaseClassType();
+ myInferredType = !baseClassType.equals(inferredType) ? inferredType : null;
}
@Override
@@ -531,14 +529,31 @@
}
}
- if (myEqualInference) {
+ if (myInferredType != null) {
final PsiElement resolved = expression.resolve();
if (resolved instanceof PsiParameter && ((PsiParameter)resolved).getDeclarationScope() == myMethod) {
+ if (!(myInferredType instanceof PsiClassType)) {
+ myBodyContainsForbiddenRefs = true;
+ return;
+ }
final int parameterIndex = myMethod.getParameterList().getParameterIndex((PsiParameter)resolved);
for (PsiMethod superMethod : myMethod.findDeepestSuperMethods()) {
- if (PsiUtil.resolveClassInType(superMethod.getParameterList().getParameters()[parameterIndex].getType()) instanceof PsiTypeParameter) {
- myBodyContainsForbiddenRefs = true;
- return;
+ final PsiType paramType = superMethod.getParameterList().getParameters()[parameterIndex].getType();
+ final PsiClass superClass = superMethod.getContainingClass();
+ if (superClass != null) {
+ final PsiClassType.ClassResolveResult classResolveResult = ((PsiClassType)myInferredType).resolveGenerics();
+ final PsiClass classCandidate = classResolveResult.getElement();
+ if (classCandidate == null) {
+ myBodyContainsForbiddenRefs = true;
+ return;
+ }
+ final PsiSubstitutor inferredSubstitutor = TypeConversionUtil.getClassSubstitutor(superClass, classCandidate, classResolveResult.getSubstitutor());
+ final PsiSubstitutor substitutor = TypeConversionUtil.getSuperClassSubstitutor(superClass, myAnonymClass.getBaseClassType());
+ if (inferredSubstitutor != null &&
+ !Comparing.equal(inferredSubstitutor.substitute(paramType), substitutor.substitute(paramType))) {
+ myBodyContainsForbiddenRefs = true;
+ return;
+ }
}
}
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/ExplicitTypeCanBeDiamondInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/ExplicitTypeCanBeDiamondInspection.java
index b39171e..100cc97 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/ExplicitTypeCanBeDiamondInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/ExplicitTypeCanBeDiamondInspection.java
@@ -22,8 +22,9 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.impl.PsiDiamondTypeUtil;
-import com.intellij.psi.impl.source.tree.ChildRole;
+import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
@@ -97,7 +98,11 @@
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
final PsiElement element = descriptor.getPsiElement();
if (!FileModificationService.getInstance().preparePsiElementForWrite(element)) return;
- PsiDiamondTypeUtil.replaceExplicitWithDiamond(element);
+ final PsiNewExpression newExpression =
+ PsiTreeUtil.getParentOfType(PsiDiamondTypeUtil.replaceExplicitWithDiamond(element), PsiNewExpression.class);
+ if (newExpression != null) {
+ CodeStyleManager.getInstance(project).reformat(newExpression);
+ }
}
}
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
index 3403ed5..b4f38da 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
@@ -190,7 +190,7 @@
final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
final PsiBinaryExpression binary = (PsiBinaryExpression)elementFactory.createExpressionFromText("a != null", null);
binary.getLOperand().replace(qualifier);
- ContainerUtil.addIfNotNull(fixes, createAssertFix(binary));
+ ContainerUtil.addIfNotNull(fixes, createAssertFix(binary, expression));
}
addSurroundWithIfFix(qualifier, fixes, onTheFly);
@@ -206,7 +206,7 @@
}
}
- protected LocalQuickFix createAssertFix(PsiBinaryExpression binary) {
+ protected LocalQuickFix createAssertFix(PsiBinaryExpression binary, PsiExpression expression) {
return null;
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java
index 390b045..898c744 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java
@@ -262,13 +262,18 @@
MethodContract.ValueConstraint constraint = contract.arguments[i];
DfaConstValue expectedValue = constraint.getComparisonValue(factory);
if (expectedValue == null) continue;
-
+
+ boolean nullContract = expectedValue == constFactory.getNull();
boolean invertCondition = constraint.shouldUseNonEqComparison();
DfaValue condition = factory.getRelationFactory().createRelation(argValue, expectedValue, EQEQ, invertCondition);
if (condition == null) {
if (!(argValue instanceof DfaConstValue)) {
for (DfaMemoryState state : states) {
- falseStates.add(state.createCopy());
+ DfaMemoryState falseCopy = state.createCopy();
+ if (nullContract) {
+ (invertCondition ? falseCopy : state).markEphemeral();
+ }
+ falseStates.add(falseCopy);
}
continue;
}
@@ -277,7 +282,7 @@
LinkedHashSet<DfaMemoryState> nextStates = ContainerUtil.newLinkedHashSet();
for (DfaMemoryState state : states) {
- boolean unknownVsNull = expectedValue == constFactory.getNull() &&
+ boolean unknownVsNull = nullContract &&
argValue instanceof DfaVariableValue &&
((DfaMemoryStateImpl)state).getVariableState((DfaVariableValue)argValue).getNullability() == Nullness.UNKNOWN;
DfaMemoryState falseCopy = state.createCopy();
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/miscGenerics/RedundantTypeArgsInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/miscGenerics/RedundantTypeArgsInspection.java
index 6321ca3..35ac656 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/miscGenerics/RedundantTypeArgsInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/miscGenerics/RedundantTypeArgsInspection.java
@@ -129,7 +129,9 @@
final PsiCallExpression copy = (PsiCallExpression)expression.copy(); //see IDEADEV-8174
try {
- copy.getTypeArgumentList().delete();
+ final PsiMethodCallExpression expr = (PsiMethodCallExpression)
+ JavaPsiFacade.getInstance(copy.getProject()).getElementFactory().createExpressionFromText("foo()", null);
+ copy.getTypeArgumentList().replace(expr.getTypeArgumentList());
if (copy.resolveMethod() != element) return;
}
catch (IncorrectOperationException e) {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspectionBase.java
index 65933ea..efcb536 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspectionBase.java
@@ -27,9 +27,11 @@
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.Pass;
import com.intellij.openapi.util.WriteExternalException;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
import com.intellij.psi.util.*;
+import com.intellij.xml.util.XmlUtil;
import org.intellij.lang.annotations.Pattern;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
@@ -135,7 +137,15 @@
return new UncheckedWarningsVisitor(isOnTheFly, languageLevel){
@Override
- protected void registerProblem(@NotNull String message, @NotNull PsiElement psiElement, @NotNull LocalQuickFix[] quickFixes) {
+ protected void registerProblem(@NotNull String message,
+ @Nullable PsiElement callExpression,
+ @NotNull PsiElement psiElement,
+ @NotNull LocalQuickFix[] quickFixes) {
+ final String rawExpression = isMethodCalledOnRawType(callExpression);
+ if (rawExpression != null) {
+ final String referenceName = ((PsiMethodCallExpression)callExpression).getMethodExpression().getReferenceName();
+ message += ". Reason: '" + rawExpression + "' has raw type, so result of " + referenceName + " is erased";
+ }
holder.registerProblem(psiElement, message, quickFixes);
}
};
@@ -145,6 +155,21 @@
return null;
}
+ private static String isMethodCalledOnRawType(PsiElement expression) {
+ if (expression instanceof PsiMethodCallExpression) {
+ final PsiExpression qualifierExpression = ((PsiMethodCallExpression)expression).getMethodExpression().getQualifierExpression();
+ if (qualifierExpression != null) {
+ final PsiClass qualifierClass = PsiUtil.resolveClassInClassTypeOnly(qualifierExpression.getType());
+ if (qualifierClass != null) {
+ if (PsiUtil.isRawSubstitutor(qualifierClass, ((PsiMethodCallExpression)expression).resolveMethodGenerics().getSubstitutor())) {
+ return qualifierExpression.getText();
+ }
+ }
+ }
+ }
+ return null;
+ }
+
private abstract class UncheckedWarningsVisitor extends JavaElementVisitor {
private final boolean myOnTheFly;
@NotNull private final LanguageLevel myLanguageLevel;
@@ -156,7 +181,10 @@
myGenerifyFixes = onTheFly ? createFixes() : LocalQuickFix.EMPTY_ARRAY;
}
- protected abstract void registerProblem(@NotNull String message, @NotNull PsiElement psiElement, @NotNull LocalQuickFix[] quickFixes);
+ protected abstract void registerProblem(@NotNull String message,
+ PsiElement callExpression,
+ @NotNull PsiElement psiElement,
+ @NotNull LocalQuickFix[] quickFixes);
@Override
@@ -164,7 +192,7 @@
if (IGNORE_UNCHECKED_GENERICS_ARRAY_CREATION) return;
final JavaResolveResult result = expression.advancedResolve(false);
if (JavaGenericsUtil.isUncheckedWarning(expression, result, myLanguageLevel)) {
- registerProblem("Unchecked generics array creation for varargs parameter", expression, LocalQuickFix.EMPTY_ARRAY);
+ registerProblem("Unchecked generics array creation for varargs parameter", null, expression, LocalQuickFix.EMPTY_ARRAY);
}
}
@@ -174,7 +202,7 @@
if (IGNORE_UNCHECKED_GENERICS_ARRAY_CREATION) return;
final PsiJavaCodeReferenceElement classReference = expression.getClassOrAnonymousClassReference();
if (classReference != null && JavaGenericsUtil.isUncheckedWarning(classReference, expression.resolveMethodGenerics(), myLanguageLevel)) {
- registerProblem("Unchecked generics array creation for varargs parameter", classReference, LocalQuickFix.EMPTY_ARRAY);
+ registerProblem("Unchecked generics array creation for varargs parameter", expression, classReference, LocalQuickFix.EMPTY_ARRAY);
}
}
@@ -194,7 +222,7 @@
final String description =
JavaErrorMessages.message("generics.unchecked.cast", JavaHighlightUtil.formatType(exprType), JavaHighlightUtil
.formatType(castType));
- registerProblem(description, expression, myGenerifyFixes);
+ registerProblem(description, operand, expression, myGenerifyFixes);
}
}
@@ -206,7 +234,7 @@
final String description = getUncheckedCallDescription(result);
if (description != null) {
final PsiElement referenceNameElement = expression.getReferenceNameElement();
- registerProblem(description, referenceNameElement != null ? referenceNameElement : expression, myGenerifyFixes);
+ registerProblem(description, expression, referenceNameElement != null ? referenceNameElement : expression, myGenerifyFixes);
}
}
@@ -220,7 +248,7 @@
final PsiExpression element = callExpression instanceof PsiMethodCallExpression
? ((PsiMethodCallExpression)callExpression).getMethodExpression()
: callExpression;
- registerProblem(description, element, myGenerifyFixes);
+ registerProblem(description, null, element, myGenerifyFixes);
}
else {
if (IGNORE_UNCHECKED_ASSIGNMENT) return;
@@ -238,7 +266,7 @@
final PsiType parameterType = substitutor.substitute(parameter.getType());
final PsiType expressionType = expression.getType();
if (expressionType != null) {
- checkRawToGenericsAssignment(expression, parameterType, expressionType, true, myGenerifyFixes);
+ checkRawToGenericsAssignment(expression, expression, parameterType, expressionType, true, myGenerifyFixes);
}
}
}
@@ -254,7 +282,7 @@
PsiExpression initializer = variable.getInitializer();
if (initializer == null || initializer instanceof PsiArrayInitializerExpression) return;
final PsiType initializerType = initializer.getType();
- checkRawToGenericsAssignment(initializer, variable.getType(), initializerType, true,
+ checkRawToGenericsAssignment(initializer, initializer, variable.getType(), initializerType, true,
myOnTheFly ? getChangeVariableTypeFixes(variable, initializerType) : LocalQuickFix.EMPTY_ARRAY);
}
@@ -267,7 +295,7 @@
final PsiExpression iteratedValue = statement.getIteratedValue();
if (iteratedValue == null) return;
final PsiType itemType = JavaGenericsUtil.getCollectionItemType(iteratedValue);
- checkRawToGenericsAssignment(parameter, parameterType, itemType, true, myOnTheFly ? getChangeVariableTypeFixes(parameter, itemType) : LocalQuickFix.EMPTY_ARRAY);
+ checkRawToGenericsAssignment(parameter, iteratedValue, parameterType, itemType, true, myOnTheFly ? getChangeVariableTypeFixes(parameter, itemType) : LocalQuickFix.EMPTY_ARRAY);
}
@Override
@@ -288,7 +316,7 @@
leftVar = (PsiVariable)element;
}
}
- checkRawToGenericsAssignment(rExpr, lType, rType, true, myOnTheFly && leftVar != null ? getChangeVariableTypeFixes(leftVar, rType) : LocalQuickFix.EMPTY_ARRAY);
+ checkRawToGenericsAssignment(rExpr, rExpr, lType, rType, true, myOnTheFly && leftVar != null ? getChangeVariableTypeFixes(leftVar, rType) : LocalQuickFix.EMPTY_ARRAY);
}
@Override
@@ -320,14 +348,14 @@
}
if (fix != null) {
- registerProblem(description, expression, new LocalQuickFix[]{fix});
+ registerProblem(description, null, expression, new LocalQuickFix[]{fix});
}
}
}
}
private void checkRawToGenericsAssignment(@NotNull PsiElement parameter,
- PsiType parameterType,
+ PsiExpression expression, PsiType parameterType,
PsiType itemType,
boolean checkAssignability,
@NotNull LocalQuickFix[] quickFixes) {
@@ -337,7 +365,7 @@
String description = JavaErrorMessages.message("generics.unchecked.assignment",
JavaHighlightUtil.formatType(itemType),
JavaHighlightUtil.formatType(parameterType));
- registerProblem(description, parameter, quickFixes);
+ registerProblem(description, expression, parameter, quickFixes);
}
}
@@ -364,7 +392,7 @@
final PsiTypeElement returnTypeElement = method.getReturnTypeElement();
LOG.assertTrue(returnTypeElement != null);
- registerProblem(message, returnTypeElement, LocalQuickFix.EMPTY_ARRAY);
+ registerProblem(message, null, returnTypeElement, LocalQuickFix.EMPTY_ARRAY);
}
}
}
@@ -384,7 +412,7 @@
if (returnValue != null) {
final PsiType valueType = returnValue.getType();
if (valueType != null) {
- checkRawToGenericsAssignment(returnValue, returnType, valueType,
+ checkRawToGenericsAssignment(returnValue, returnValue, returnType, valueType,
false,
new LocalQuickFix[]{QuickFixFactory.getInstance().createMethodReturnFix(method, valueType, true)});
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java b/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java
index 270d6f9..d92ecff 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java
@@ -216,8 +216,6 @@
final boolean filterByScope, final boolean pkgContext) {
ProgressManager.checkCanceled();
- if (!context.isValid() || !psiClass.isValid()) return false;
-
if (JavaCompletionUtil.isInExcludedPackage(psiClass, false)) return false;
final String qualifiedName = psiClass.getQualifiedName();
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameCompletionContributor.java
index 90e550a..8c3d1cc 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameCompletionContributor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameCompletionContributor.java
@@ -39,6 +39,7 @@
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.Set;
@@ -121,12 +122,10 @@
AllClassesGetter.processJavaClasses(parameters, matcher, filterByScope, new Consumer<PsiClass>() {
@Override
public void consume(PsiClass psiClass) {
- processClass(psiClass, ContainerUtil.<PsiClass>newHashSet(), "");
+ processClass(psiClass, null, "");
}
- private void processClass(PsiClass psiClass, Set<PsiClass> visited, String prefix) {
- if (!visited.add(psiClass)) return;
-
+ private void processClass(PsiClass psiClass, @Nullable Set<PsiClass> visited, String prefix) {
boolean isInnerClass = StringUtil.isNotEmpty(prefix);
if (isInnerClass && isProcessedIndependently(psiClass)) {
return;
@@ -153,8 +152,15 @@
} else {
String name = psiClass.getName();
if (name != null) {
- for (PsiClass innerClass : psiClass.getInnerClasses()) {
- processClass(innerClass, visited, prefix + name + ".");
+ PsiClass[] innerClasses = psiClass.getInnerClasses();
+ if (innerClasses.length > 0) {
+ if (visited == null) visited = ContainerUtil.newHashSet();
+
+ for (PsiClass innerClass : innerClasses) {
+ if (visited.add(innerClass)) {
+ processClass(innerClass, visited, prefix + name + ".");
+ }
+ }
}
}
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java
index c542317..4a2077e 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java
@@ -75,20 +75,32 @@
public static final OffsetKey LPAREN_OFFSET = OffsetKey.create("lparen");
public static final OffsetKey RPAREN_OFFSET = OffsetKey.create("rparen");
public static final OffsetKey ARG_LIST_END_OFFSET = OffsetKey.create("argListEnd");
- static final NullableLazyKey<ExpectedTypeInfo[], CompletionLocation> EXPECTED_TYPES = NullableLazyKey.create("expectedTypes", new NullableFunction<CompletionLocation, ExpectedTypeInfo[]>() {
- @Override
- @Nullable
- public ExpectedTypeInfo[] fun(final CompletionLocation location) {
- if (PsiJavaPatterns.psiElement().beforeLeaf(PsiJavaPatterns.psiElement().withText("."))
- .accepts(location.getCompletionParameters().getPosition())) {
- return ExpectedTypeInfo.EMPTY_ARRAY;
- }
+ static final NullableLazyKey<ExpectedTypeInfo[], CompletionLocation> EXPECTED_TYPES = NullableLazyKey.create("expectedTypes",
+ new NullableFunction<CompletionLocation, ExpectedTypeInfo[]>() {
+ @Override
+ @Nullable
+ public ExpectedTypeInfo[] fun(
+ final CompletionLocation location) {
+ if (PsiJavaPatterns
+ .psiElement()
+ .beforeLeaf(
+ PsiJavaPatterns
+ .psiElement()
+ .withText("."))
+ .accepts(location
+ .getCompletionParameters()
+ .getPosition())) {
+ return ExpectedTypeInfo.EMPTY_ARRAY;
+ }
- return JavaSmartCompletionContributor.getExpectedTypes(location.getCompletionParameters());
- }
- });
+ return JavaSmartCompletionContributor
+ .getExpectedTypes(
+ location
+ .getCompletionParameters());
+ }
+ });
private static final ElementPattern<PsiElement> LEFT_PAREN = psiElement(JavaTokenType.LPARENTH).andOr(psiElement().withParent(
- PsiExpressionList.class), psiElement().afterLeaf(".", PsiKeyword.NEW));
+ PsiExpressionList.class), psiElement().afterLeaf(".", PsiKeyword.NEW));
public static final Key<Boolean> SUPER_METHOD_PARAMETERS = Key.create("SUPER_METHOD_PARAMETERS");
@@ -165,6 +177,10 @@
return new PsiImmediateClassType(CompletionUtil.getOriginalOrSelf(psiClass), originalize(substitutor));
}
+ @Override
+ public PsiType visitType(PsiType type) {
+ return type;
+ }
}.mapType(type);
if (result == null) {
throw new AssertionError("Null result for type " + type + " of class " + type.getClass());
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java
index a503de4..e96eb36 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java
@@ -156,7 +156,7 @@
final String erasedText = TypeConversionUtil.erasure(psiType).getCanonicalText();
String canonicalText = psiType.getCanonicalText();
if (canonicalText.contains("?extends") || canonicalText.contains("?super")) {
- LOG.error("Malformed canonical text: " + psiType + " of " + psiType.getClass() + "; " +
+ LOG.error("Malformed canonical text: " + canonicalText + "; presentable text: " + psiType + " of " + psiType.getClass() + "; " +
(psiType instanceof PsiClassReferenceType ? ((PsiClassReferenceType)psiType).getReference().getClass() : ""));
return null;
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeClassSignatureFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeClassSignatureFromUsageFix.java
index a7967aa..dec599e 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeClassSignatureFromUsageFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeClassSignatureFromUsageFix.java
@@ -103,8 +103,10 @@
}
}
- final PsiClassType type = (PsiClassType)typeElement.getType();
- result.put(new TypeParameterInfo(suggester.suggest(type), type), factory.createTypeCodeFragment(type.getClassName(), typeElement, true));
+ final PsiType type = typeElement.getType();
+ final String suggestedName = type instanceof PsiClassType ? suggester.suggest((PsiClassType)type) : suggester.suggestUnusedName("T");
+ result.put(new TypeParameterInfo(suggestedName, type),
+ factory.createTypeCodeFragment(suggestedName, typeElement, true));
}
return result;
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java
index ac2e35b..72b608b 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java
@@ -37,7 +37,9 @@
import com.intellij.psi.util.PropertyUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -120,12 +122,17 @@
private final String myDefaultFieldName;
private final PsiField myField;
private final PsiClass myClass;
- private final PsiType[] myExpectedTypes;
+ private final List<SmartTypePointer> myExpectedTypes;
- public FieldExpression(PsiField field, PsiClass aClass, PsiType[] expectedTypes) {
+ public FieldExpression(final PsiField field, PsiClass aClass, PsiType[] expectedTypes) {
myField = field;
myClass = aClass;
- myExpectedTypes = expectedTypes;
+ myExpectedTypes = ContainerUtil.map(expectedTypes, new Function<PsiType, SmartTypePointer>() {
+ @Override
+ public SmartTypePointer fun(PsiType type) {
+ return SmartTypePointerManager.getInstance(field.getProject()).createSmartTypePointer(type);
+ }
+ });
myDefaultFieldName = field.getName();
}
@@ -143,12 +150,11 @@
public LookupElement[] calculateLookupItems(ExpressionContext context) {
Set<LookupElement> set = new LinkedHashSet<LookupElement>();
set.add(JavaLookupElementBuilder.forField(myField).withTypeText(myField.getType().getPresentableText()));
- PsiField[] fields = myClass.getFields();
- for (PsiField otherField : fields) {
+ for (PsiField otherField : myClass.getFields()) {
if (!myDefaultFieldName.equals(otherField.getName())) {
PsiType otherType = otherField.getType();
- for (PsiType type : myExpectedTypes) {
- if (type.equals(otherType)) {
+ for (SmartTypePointer pointer : myExpectedTypes) {
+ if (otherType.equals(pointer.getType())) {
set.add(JavaLookupElementBuilder.forField(otherField).withTypeText(otherType.getPresentableText()));
}
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SurroundWithTryCatchFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SurroundWithTryCatchFix.java
index e10b616..b0264dc 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SurroundWithTryCatchFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SurroundWithTryCatchFix.java
@@ -28,6 +28,7 @@
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.refactoring.util.RefactoringChangeUtil;
+import com.intellij.refactoring.util.RefactoringUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
@@ -38,14 +39,16 @@
public class SurroundWithTryCatchFix implements IntentionAction {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.quickfix.SurroundWithTryCatchFix");
- private PsiStatement myStatement = null;
+ private PsiElement myStatement = null;
public SurroundWithTryCatchFix(@NotNull PsiElement element) {
- final PsiFunctionalExpression functionalExpression = PsiTreeUtil.getParentOfType(element, PsiFunctionalExpression.class, false);
- if (functionalExpression == null ||
- (functionalExpression instanceof PsiLambdaExpression && ((PsiLambdaExpression)functionalExpression).getBody() instanceof PsiCodeBlock)) {
+ final PsiFunctionalExpression functionalExpression = PsiTreeUtil.getParentOfType(element, PsiFunctionalExpression.class, false, PsiStatement.class);
+ if (functionalExpression == null) {
myStatement = PsiTreeUtil.getNonStrictParentOfType(element, PsiStatement.class);
}
+ else if (functionalExpression instanceof PsiLambdaExpression) {
+ myStatement = functionalExpression;
+ }
}
@Override
@@ -82,6 +85,20 @@
myStatement = forStatement;
}
}
+
+ if (myStatement instanceof PsiLambdaExpression) {
+ PsiElement body = ((PsiLambdaExpression)myStatement).getBody();
+ if (body instanceof PsiExpression) {
+ myStatement = RefactoringUtil.expandExpressionLambdaToCodeBlock(body);
+ }
+
+ body = ((PsiLambdaExpression)myStatement).getBody();
+ LOG.assertTrue(body instanceof PsiCodeBlock);
+ final PsiStatement[] statements = ((PsiCodeBlock)body).getStatements();
+ LOG.assertTrue(statements.length == 1);
+ myStatement = statements[0];
+ }
+
TextRange range = null;
try{
diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingMethodBodyFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingMethodBodyFixer.java
index ae5c042..ee01b1b 100644
--- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingMethodBodyFixer.java
+++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingMethodBodyFixer.java
@@ -67,8 +67,9 @@
static boolean shouldHaveBody(PsiMethod method) {
PsiClass containingClass = method.getContainingClass();
if (containingClass == null) return false;
- if (containingClass.isInterface() && !method.hasModifierProperty(DEFAULT)) return false;
- if (method.hasModifierProperty(ABSTRACT)) return false;
- return !method.hasModifierProperty(NATIVE);
+ if (method.hasModifierProperty(PRIVATE)) return true;
+ if (method.hasModifierProperty(ABSTRACT) || method.hasModifierProperty(NATIVE)) return false;
+ if (containingClass.isInterface() && !method.hasModifierProperty(DEFAULT) && !method.hasModifierProperty(STATIC)) return false;
+ return true;
}
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaElementSignatureProvider.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaElementSignatureProvider.java
index 54a47f5..2f1ac0c 100644
--- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaElementSignatureProvider.java
+++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaElementSignatureProvider.java
@@ -147,6 +147,9 @@
if (!(parent instanceof PsiClass) && !(parent instanceof PsiMethod) && !(parent instanceof PsiField)) {
return null;
}
+ if (!element.equals(((PsiDocCommentOwner)parent).getDocComment())) {
+ return null;
+ }
String parentSignature = getSignature(parent);
if (parentSignature == null) return null;
buffer.append(parentSignature);
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateGetterSetterHandlerBase.java b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateGetterSetterHandlerBase.java
index 0de29d1..791ea0c 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateGetterSetterHandlerBase.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateGetterSetterHandlerBase.java
@@ -75,6 +75,11 @@
}
@Override
+ protected String getHelpId() {
+ return "Getter and Setter Templates Dialog";
+ }
+
+ @Override
protected ClassMember[] chooseOriginalMembers(PsiClass aClass, Project project, Editor editor) {
final ClassMember[] allMembers = getAllOriginalMembers(aClass);
if (allMembers == null) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/defaultGetter.vm b/java/java-impl/src/com/intellij/codeInsight/generation/defaultGetter.vm
index 7482fcf..a2b82d1 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/defaultGetter.vm
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/defaultGetter.vm
@@ -4,7 +4,7 @@
#end
$field.type ##
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
-#if ($field.boolean)
+#if ($field.boolean && $field.primitive)
#if ($StringUtil.startsWithIgnoreCase($name, 'is'))
#set($name = $StringUtil.decapitalize($name))
#else
diff --git a/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocExternalFilter.java b/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocExternalFilter.java
index 16dfdc7..07338fc 100644
--- a/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocExternalFilter.java
+++ b/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocExternalFilter.java
@@ -17,6 +17,7 @@
import com.intellij.codeInsight.documentation.AbstractExternalFilter;
import com.intellij.codeInsight.documentation.DocumentationManager;
+import com.intellij.codeInsight.documentation.DocumentationManagerProtocol;
import com.intellij.codeInsight.documentation.PlatformDocumentationUtil;
import com.intellij.ide.BrowserUtil;
import com.intellij.lang.java.JavaDocumentationProvider;
@@ -89,12 +90,10 @@
return
(JavaPsiFacade.getInstance(myProject).findClass(classRef, GlobalSearchScope.allScope(myProject)) != null)
- ? DocumentationManager.PSI_ELEMENT_PROTOCOL + elementRef
+ ? DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL + elementRef
: DOC_ELEMENT_PROTOCOL + doAnnihilate(nakedRoot + href);
}
- },
-
- myIMGConvertor
+ }
};
public JavaDocExternalFilter(Project project) {
diff --git a/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java b/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java
index d7ec792..de132b8 100644
--- a/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java
@@ -26,6 +26,7 @@
import com.intellij.psi.PsiBinaryExpression;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.tree.IElementType;
+import com.intellij.refactoring.util.RefactoringUtil;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@@ -59,8 +60,8 @@
}
@Override
- protected AddAssertStatementFix createAssertFix(PsiBinaryExpression binary) {
- return new AddAssertStatementFix(binary);
+ protected AddAssertStatementFix createAssertFix(PsiBinaryExpression binary, PsiExpression expression) {
+ return RefactoringUtil.getParentStatement(expression, false) == null ? null : new AddAssertStatementFix(binary);
}
private class OptionsPanel extends JPanel {
diff --git a/java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java b/java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java
index 8baf408..7ed4530 100644
--- a/java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java
+++ b/java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java
@@ -767,7 +767,7 @@
@Override
public boolean hasDocumentationFor(PsiElement element, PsiElement originalElement) {
- return CompositeDocumentationProvider.hasUrlsFor(this, element, originalElement);
+ return CompositeDocumentationProvider.hasBrowsableUrlsFor(this, element, originalElement);
}
@Override
diff --git a/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodSignatureSuggester.java b/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodSignatureSuggester.java
index 4f26f32..5d2fa67 100644
--- a/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodSignatureSuggester.java
+++ b/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodSignatureSuggester.java
@@ -33,6 +33,7 @@
import com.intellij.psi.codeStyle.SuggestedNameInfo;
import com.intellij.psi.codeStyle.VariableKind;
import com.intellij.psi.search.LocalSearchScope;
+import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.refactoring.introduceParameter.Util;
@@ -149,11 +150,11 @@
if (duplicates != null && !duplicates.isEmpty()) {
restoreRenamedParams(copies);
- inlineSameArguments(method, copies, variables, duplicates);
if (!myMethodCall.isValid()) {
return null;
}
myMethodCall = (PsiMethodCallExpression)myMethodCall.copy();
+ inlineSameArguments(method, copies, variables, duplicates);
for (PsiExpression expression : copies) {
myMethodCall.getArgumentList().add(expression);
}
@@ -188,6 +189,24 @@
inlineArgumentsInMethodBody(toInline);
removeRedundantParametersFromMethodSignature(toInline);
}
+
+ removeUnusedStongParams(strongParamsCound);
+ }
+
+ private void removeUnusedStongParams(int strongParamsCound) {
+ final PsiExpression[] expressions = myMethodCall.getArgumentList().getExpressions();
+ final PsiParameter[] parameters = myExtractedMethod.getParameterList().getParameters();
+ final PsiCodeBlock body = myExtractedMethod.getBody();
+ if (body != null) {
+ final LocalSearchScope scope = new LocalSearchScope(body);
+ for(int i = strongParamsCound - 1; i >= 0; i--) {
+ final PsiParameter parameter = parameters[i];
+ if (ReferencesSearch.search(parameter, scope).findFirst() == null) {
+ parameter.delete();
+ expressions[i].delete();
+ }
+ }
+ }
}
private void removeRedundantParametersFromMethodSignature(Map<PsiVariable, PsiExpression> param2ExprMap) {
diff --git a/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/InlineSuperClassRefactoringDialog.java b/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/InlineSuperClassRefactoringDialog.java
index e206e3e..a182e76e 100644
--- a/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/InlineSuperClassRefactoringDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/InlineSuperClassRefactoringDialog.java
@@ -30,6 +30,7 @@
import com.intellij.ui.IdeBorderFactory;
import com.intellij.util.Function;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
@@ -65,6 +66,12 @@
return null;
}
+ @Nullable
+ @Override
+ protected String getHelpId() {
+ return "Inline_Super_Class";
+ }
+
protected JComponent createCenterPanel() {
final JLabel label = new JLabel("<html>Super class \'" +
mySuperClass.getQualifiedName() +
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectProcessor.java b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectProcessor.java
index 54335f2..7d73c57 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectProcessor.java
@@ -211,13 +211,15 @@
final ParameterChunk parameterChunk = ParameterChunk.getChunkByParameter(parameter, parameters);
@NonNls String getter = parameterChunk != null ? parameterChunk.getter : null;
+ final String paramName = parameterChunk != null ? parameterChunk.parameter.name : replacedParameter.getName();
+ final PsiType paramType = parameterChunk != null ? parameterChunk.parameter.type : replacedParameter.getType();
if (getter == null) {
- getter = GenerateMembersUtil.suggestGetterName(replacedParameter.getName(), replacedParameter.getType(), myProject);
+ getter = GenerateMembersUtil.suggestGetterName(paramName, paramType, myProject);
paramsNeedingGetters.add(replacedParameter);
}
@NonNls String setter = parameterChunk != null ? parameterChunk.setter : null;
if (setter == null) {
- setter = GenerateMembersUtil.suggestSetterName(replacedParameter.getName(), replacedParameter.getType(), myProject);
+ setter = GenerateMembersUtil.suggestSetterName(paramName, paramType, myProject);
}
if (RefactoringUtil.isPlusPlusOrMinusMinus(paramUsage.getParent())) {
usages.add(new ReplaceParameterIncrementDecrement(paramUsage, fixedParamName, setter, getter));
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/usageInfo/MergeMethodArguments.java b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/usageInfo/MergeMethodArguments.java
index f127efd..0aecd58 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/usageInfo/MergeMethodArguments.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/usageInfo/MergeMethodArguments.java
@@ -16,6 +16,8 @@
package com.intellij.refactoring.introduceparameterobject.usageInfo;
import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.command.CommandProcessor;
+import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
@@ -66,14 +68,15 @@
}
public void fixUsage() throws IncorrectOperationException {
- final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(method.getProject());
+ final Project project = method.getProject();
+ final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
final PsiMethod deepestSuperMethod = method.findDeepestSuperMethod();
final PsiClass psiClass;
if (myContainingClass != null) {
psiClass = myContainingClass.findInnerClassByName(className, false);
}
else {
- psiClass = psiFacade.findClass(StringUtil.getQualifiedName(packageName, className), GlobalSearchScope.allScope(getProject()));
+ psiClass = psiFacade.findClass(StringUtil.getQualifiedName(packageName, className), GlobalSearchScope.allScope(project));
}
assert psiClass != null;
PsiSubstitutor subst = PsiSubstitutor.EMPTY;
@@ -93,12 +96,12 @@
}
}
final List<ParameterInfoImpl> parametersInfo = new ArrayList<ParameterInfoImpl>();
- final PsiClassType classType = JavaPsiFacade.getElementFactory(getProject()).createType(psiClass, subst);
+ final PsiClassType classType = JavaPsiFacade.getElementFactory(project).createType(psiClass, subst);
final ParameterInfoImpl mergedParamInfo = new ParameterInfoImpl(-1, parameterName, classType, null) {
@Override
public PsiExpression getValue(final PsiCallExpression expr) throws IncorrectOperationException {
- return (PsiExpression)JavaCodeStyleManager.getInstance(getProject())
+ return (PsiExpression)JavaCodeStyleManager.getInstance(project)
.shortenClassReferences(psiFacade.getElementFactory().createExpressionFromText(getMergedParam(expr), expr));
}
};
@@ -114,9 +117,9 @@
}
parametersInfo.add(firstIncludedIdx == -1 ? 0 : firstIncludedIdx, mergedParamInfo);
- final SmartPsiElementPointer<PsiMethod> meth = SmartPointerManager.getInstance(getProject()).createSmartPsiElementPointer(method);
+ final SmartPsiElementPointer<PsiMethod> meth = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(method);
- Runnable performChangeSignatureRunnable = new Runnable() {
+ final Runnable performChangeSignatureRunnable = new Runnable() {
@Override
public void run() {
final PsiMethod psiMethod = meth.getElement();
@@ -134,7 +137,12 @@
if (ApplicationManager.getApplication().isUnitTestMode()) {
performChangeSignatureRunnable.run();
} else {
- ApplicationManager.getApplication().invokeLater(performChangeSignatureRunnable);
+ ApplicationManager.getApplication().invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ CommandProcessor.getInstance().runUndoTransparentAction(performChangeSignatureRunnable);
+ }
+ });
}
}
diff --git a/java/java-impl/src/com/intellij/refactoring/makeStatic/MakeMethodStaticProcessor.java b/java/java-impl/src/com/intellij/refactoring/makeStatic/MakeMethodStaticProcessor.java
index ec8c635..0f31060 100644
--- a/java/java-impl/src/com/intellij/refactoring/makeStatic/MakeMethodStaticProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/makeStatic/MakeMethodStaticProcessor.java
@@ -83,7 +83,7 @@
@Override
protected MultiMap<PsiElement, String> getConflictDescriptions(UsageInfo[] usages) {
MultiMap<PsiElement, String> descriptions = super.getConflictDescriptions(usages);
- if (mySettings.isMakeClassParameter()) {
+ if (mySettings.isMakeClassParameter() || mySettings.isMakeFieldParameters()) {
for (UsageInfo usage : usages) {
PsiElement element = usage.getElement();
if (element instanceof PsiMethodReferenceExpression) {
@@ -329,7 +329,7 @@
if (anchor != null) {
anchor = argList.addAfter(fieldRef, anchor);
}
- else {
+ else if (argList != null) {
if (exprs.length > 0) {
anchor = argList.addBefore(fieldRef, exprs[0]);
}
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/JavaMoveFilesOrDirectoriesHandler.java b/java/java-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/JavaMoveFilesOrDirectoriesHandler.java
index c7d1316..6875287 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/JavaMoveFilesOrDirectoriesHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/JavaMoveFilesOrDirectoriesHandler.java
@@ -51,6 +51,18 @@
}
@Override
+ public boolean canMove(PsiElement[] elements, PsiElement targetContainer) {
+ if (elements.length > 0) {
+ final Project project = elements[0].getProject();
+ final PsiElement[] adjustForMove = adjustForMove(project, elements, targetContainer);
+ if (adjustForMove != null) {
+ return super.canMove(adjustForMove, targetContainer);
+ }
+ }
+ return super.canMove(elements, targetContainer);
+ }
+
+ @Override
public PsiElement[] adjustForMove(Project project, PsiElement[] sourceElements, PsiElement targetElement) {
sourceElements = super.adjustForMove(project, sourceElements, targetElement);
if (sourceElements == null) {
diff --git a/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java b/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java
index c4d42c4..10adac4 100644
--- a/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java
+++ b/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java
@@ -478,6 +478,10 @@
return null;
}
+ public void clearStopException() {
+ myException = null;
+ }
+
boolean addRoot(final TypeMigrationUsageInfo usageInfo, final PsiType type, final PsiElement place, boolean alreadyProcessed) {
if (myShowWarning && myMigrationRoots.size() > 10 && !ApplicationManager.getApplication().isUnitTestMode()) {
myShowWarning = false;
diff --git a/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationProcessor.java b/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationProcessor.java
index 5d71d19..bda1654 100644
--- a/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationProcessor.java
@@ -159,6 +159,7 @@
}
catch (TypeMigrationLabeler.MigrateException e) {
setPreviewUsages(true);
+ myLabeler.clearStopException();
return myLabeler.getMigratedUsages(false, myRoot);
}
}
diff --git a/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/MigrationPanel.java b/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/MigrationPanel.java
index 7c765e7..32bb8a3 100644
--- a/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/MigrationPanel.java
+++ b/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/MigrationPanel.java
@@ -181,8 +181,12 @@
private void expandTree(MigrationNode migrationNode) {
if (!migrationNode.getInfo().isExcluded() || migrationNode.areChildrenInitialized()) { //do not walk into excluded collapsed nodes: nothing to migrate can be found
final Collection<? extends AbstractTreeNode> nodes = migrationNode.getChildren();
- for (AbstractTreeNode node : nodes) {
- expandTree((MigrationNode)node);
+ for (final AbstractTreeNode node : nodes) {
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ public void run() {
+ expandTree((MigrationNode)node);
+ }
+ });
}
}
}
diff --git a/java/java-impl/src/com/intellij/refactoring/ui/TypeSelectorManagerImpl.java b/java/java-impl/src/com/intellij/refactoring/ui/TypeSelectorManagerImpl.java
index b43a5e7..baa0764 100644
--- a/java/java-impl/src/com/intellij/refactoring/ui/TypeSelectorManagerImpl.java
+++ b/java/java-impl/src/com/intellij/refactoring/ui/TypeSelectorManagerImpl.java
@@ -31,6 +31,7 @@
import com.intellij.util.ArrayUtil;
import gnu.trove.THashMap;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.*;
@@ -333,19 +334,24 @@
typeSelected(type, getDefaultType());
}
- public static void typeSelected(final PsiType type, final PsiType defaultType) {
+ public static void typeSelected(@NotNull final PsiType type, @Nullable final PsiType defaultType) {
+ if (defaultType == null) return;
StatisticsManager.getInstance().incUseCount(new StatisticsInfo(getStatsKey(defaultType), serialize(type)));
}
private String getStatsKey() {
- return getStatsKey(getDefaultType());
+ final PsiType defaultType = getDefaultType();
+ if (defaultType == null) {
+ return "IntroduceVariable##";
+ }
+ return getStatsKey(defaultType);
}
private static String getStatsKey(final PsiType defaultType) {
return "IntroduceVariable##" + serialize(defaultType);
}
- private static String serialize(PsiType type) {
+ private static String serialize(@NotNull PsiType type) {
if (PsiUtil.resolveClassInType(type) instanceof PsiTypeParameter) return type.getCanonicalText();
return TypeConversionUtil.erasure(type).getCanonicalText();
}
diff --git a/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java b/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java
index e782fd1..3e0d1e5 100644
--- a/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java
+++ b/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java
@@ -56,6 +56,7 @@
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.HashMap;
import com.intellij.util.containers.HashSet;
+import com.siyeh.ipp.types.ExpandOneLineLambda2CodeBlockIntention;
import gnu.trove.THashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -936,6 +937,21 @@
return element instanceof PsiLoopStatement || element instanceof PsiIfStatement;
}
+ public static PsiElement expandExpressionLambdaToCodeBlock(@NotNull PsiElement element) {
+ final PsiLambdaExpression lambdaExpression = PsiTreeUtil.getParentOfType(element, PsiLambdaExpression.class);
+ LOG.assertTrue(lambdaExpression != null);
+ final PsiElement body = lambdaExpression.getBody();
+ LOG.assertTrue(body instanceof PsiExpression);
+ String blockText = "{";
+ blockText += PsiType.VOID.equals(LambdaUtil.getFunctionalInterfaceReturnType(lambdaExpression)) ? "" : "return ";
+ blockText += body.getText() + ";}";
+
+ final String resultedLambdaText = lambdaExpression.getParameterList().getText() + "->" + blockText;
+ final PsiExpression expressionFromText =
+ JavaPsiFacade.getElementFactory(element.getProject()).createExpressionFromText(resultedLambdaText, lambdaExpression);
+ return CodeStyleManager.getInstance(element.getProject()).reformat(lambdaExpression.replace(expressionFromText));
+ }
+
public interface ImplicitConstructorUsageVisitor {
void visitConstructor(PsiMethod constructor, PsiMethod baseConstructor);
diff --git a/java/java-impl/src/com/intellij/spi/psi/SPIFile.java b/java/java-impl/src/com/intellij/spi/psi/SPIFile.java
index a3858c5..7a92dc3 100644
--- a/java/java-impl/src/com/intellij/spi/psi/SPIFile.java
+++ b/java/java-impl/src/com/intellij/spi/psi/SPIFile.java
@@ -40,6 +40,7 @@
super(viewProvider, SPILanguage.INSTANCE);
}
+ @NotNull
@Override
public PsiReference getReference() {
return new SPIFileName2ClassReference(this, ApplicationManager.getApplication().runReadAction(new Computable<PsiClass>() {
@@ -53,30 +54,36 @@
@NotNull
@Override
public PsiReference[] getReferences() {
- final List<PsiReference> refs = new ArrayList<PsiReference>();
- int idx = 0;
- int d;
- final String fileName = getName();
- while ((d = fileName.indexOf(".", idx)) > -1) {
- final PsiPackage aPackage = JavaPsiFacade.getInstance(getProject()).findPackage(fileName.substring(0, d));
- if (aPackage != null) {
- refs.add(new SPIFileName2PackageReference(this, aPackage));
- }
- idx = d + 1;
- }
- final PsiReference reference = getReference();
- PsiElement resolve = reference.resolve();
- while (resolve instanceof PsiClass) {
- resolve = ((PsiClass)resolve).getContainingClass();
- if (resolve != null) {
- final String jvmClassName = ClassUtil.getJVMClassName((PsiClass)resolve);
- if (jvmClassName != null) {
- refs.add(new SPIFileName2PackageReference(this, resolve));
+ return ApplicationManager.getApplication().runReadAction(new Computable<PsiReference[]>() {
+ @Override
+ public PsiReference[] compute() {
+
+ final List<PsiReference> refs = new ArrayList<PsiReference>();
+ int idx = 0;
+ int d;
+ final String fileName = getName();
+ while ((d = fileName.indexOf(".", idx)) > -1) {
+ final PsiPackage aPackage = JavaPsiFacade.getInstance(getProject()).findPackage(fileName.substring(0, d));
+ if (aPackage != null) {
+ refs.add(new SPIFileName2PackageReference(SPIFile.this, aPackage));
+ }
+ idx = d + 1;
}
+ final PsiReference reference = getReference();
+ PsiElement resolve = reference.resolve();
+ while (resolve instanceof PsiClass) {
+ resolve = ((PsiClass)resolve).getContainingClass();
+ if (resolve != null) {
+ final String jvmClassName = ClassUtil.getJVMClassName((PsiClass)resolve);
+ if (jvmClassName != null) {
+ refs.add(new SPIFileName2PackageReference(SPIFile.this, resolve));
+ }
+ }
+ }
+ refs.add(reference);
+ return refs.toArray(new PsiReference[refs.size()]);
}
- }
- refs.add(reference);
- return refs.toArray(new PsiReference[refs.size()]);
+ });
}
@NotNull
diff --git a/java/java-impl/src/com/intellij/testIntegration/createTest/CreateTestDialog.java b/java/java-impl/src/com/intellij/testIntegration/createTest/CreateTestDialog.java
index c07294b..efdb2e0 100644
--- a/java/java-impl/src/com/intellij/testIntegration/createTest/CreateTestDialog.java
+++ b/java/java-impl/src/com/intellij/testIntegration/createTest/CreateTestDialog.java
@@ -442,6 +442,10 @@
return myTargetClassNameField.getText();
}
+ public PsiClass getTargetClass() {
+ return myTargetClass;
+ }
+
@Nullable
public String getSuperClassName() {
String result = mySuperClassField.getText().trim();
diff --git a/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java b/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java
index 78a6f2a..cb22be3 100644
--- a/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java
+++ b/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java
@@ -126,6 +126,10 @@
final Properties defaultProperties = FileTemplateManager.getInstance(targetDirectory.getProject()).getDefaultProperties();
Properties properties = new Properties(defaultProperties);
properties.setProperty(FileTemplate.ATTRIBUTE_NAME, d.getClassName());
+ final PsiClass targetClass = d.getTargetClass();
+ if (targetClass != null && targetClass.isValid()) {
+ properties.setProperty(FileTemplate.ATTRIBUTE_CLASS_NAME, targetClass.getQualifiedName());
+ }
try {
final PsiElement psiElement = FileTemplateUtil.createFromTemplate(fileTemplate, templateName, properties, targetDirectory);
if (psiElement instanceof PsiClass) {
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/search/SPIReferencesSearcher.java b/java/java-indexing-impl/src/com/intellij/psi/impl/search/SPIReferencesSearcher.java
index 080c800..8ce1add 100644
--- a/java/java-indexing-impl/src/com/intellij/psi/impl/search/SPIReferencesSearcher.java
+++ b/java/java-indexing-impl/src/com/intellij/psi/impl/search/SPIReferencesSearcher.java
@@ -31,7 +31,7 @@
public class SPIReferencesSearcher extends QueryExecutorBase<PsiReference, ReferencesSearch.SearchParameters> {
@Override
- public void processQuery(@NotNull final ReferencesSearch.SearchParameters p, @NotNull Processor<PsiReference> consumer) {
+ public void processQuery(@NotNull final ReferencesSearch.SearchParameters p, @NotNull final Processor<PsiReference> consumer) {
final SearchScope scope = ApplicationManager.getApplication().runReadAction(new Computable<SearchScope>() {
@Override
public SearchScope compute() {
@@ -61,7 +61,12 @@
if (file.getLanguage() == SPILanguage.INSTANCE) {
final PsiReference reference = file.getReference();
if (reference != null) {
- consumer.process(reference);
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ @Override
+ public void run() {
+ consumer.process(reference);
+ }
+ });
}
}
}
@@ -80,9 +85,13 @@
for (PsiFile file : files) {
if (file.getLanguage() == SPILanguage.INSTANCE) {
final PsiReference[] references = file.getReferences();
- for (PsiReference reference : references) {
+ for (final PsiReference reference : references) {
if (reference.getCanonicalText().equals(qualifiedName)) {
- consumer.process(reference);
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ public void run() {
+ consumer.process(reference);
+ }
+ });
}
}
}
diff --git a/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java b/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
index 49a3202..dfaa2b2 100644
--- a/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
@@ -422,7 +422,7 @@
}
else {
final PsiType accepted = typeArgument.accept(this);
- if (typeArgument instanceof PsiIntersectionType) {
+ if (typeArgument instanceof PsiIntersectionType && !(accepted instanceof PsiWildcardType)) {
toPut = PsiWildcardType.createExtends(typeParameter.getManager(), accepted);
}
else {
diff --git a/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java b/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java
index 954dd08..9d4cf55 100644
--- a/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java
@@ -340,6 +340,9 @@
if (gParent instanceof PsiCall) {
final PsiCall contextCall = (PsiCall)gParent;
final MethodCandidateInfo.CurrentCandidateProperties properties = MethodCandidateInfo.getCurrentMethod(contextCall.getArgumentList());
+ if (MethodCandidateInfo.isOverloadCheck()) {
+ MethodCandidateInfo.ourOverloadGuard.prohibitResultCaching(MethodCandidateInfo.ourOverloadGuard.currentStack().get(0));
+ }
if (properties != null && properties.isApplicabilityCheck()) { //todo simplification
final PsiParameter[] parameters = properties.getMethod().getParameterList().getParameters();
final int finalLambdaIdx = adjustLambdaIdx(lambdaIdx, properties.getMethod(), parameters);
diff --git a/java/java-psi-api/src/com/intellij/psi/PsiClassType.java b/java/java-psi-api/src/com/intellij/psi/PsiClassType.java
index 4d3ff91..1d4e1f3 100644
--- a/java/java-psi-api/src/com/intellij/psi/PsiClassType.java
+++ b/java/java-psi-api/src/com/intellij/psi/PsiClassType.java
@@ -82,7 +82,11 @@
public boolean equals(Object obj) {
if (this == obj) return true;
- if (!(obj instanceof PsiClassType)) return false;
+ if (!(obj instanceof PsiClassType)) {
+ return obj instanceof PsiCapturedWildcardType &&
+ ((PsiCapturedWildcardType)obj).getLowerBound().equalsToText(CommonClassNames.JAVA_LANG_OBJECT) &&
+ equalsToText(CommonClassNames.JAVA_LANG_OBJECT);
+ }
PsiClassType otherClassType = (PsiClassType)obj;
String className = getClassName();
diff --git a/java/java-psi-api/src/com/intellij/psi/infos/MethodCandidateInfo.java b/java/java-psi-api/src/com/intellij/psi/infos/MethodCandidateInfo.java
index 9b57ab5d..7a87a8c 100644
--- a/java/java-psi-api/src/com/intellij/psi/infos/MethodCandidateInfo.java
+++ b/java/java-psi-api/src/com/intellij/psi/infos/MethodCandidateInfo.java
@@ -115,34 +115,23 @@
if (myArgumentList == null || !PsiUtil.isLanguageLevel8OrHigher(myArgumentList)) {
return getApplicabilityLevel();
}
- @ApplicabilityLevelConstant int level;
final PsiSubstitutor substitutor = getSubstitutor(false);
- Map<PsiElement, CurrentCandidateProperties> map = CURRENT_CANDIDATE.get();
- if (map == null) {
- map = ContainerUtil.createConcurrentWeakMap();
- CURRENT_CANDIDATE.set(map);
- }
final PsiMethod method = getElement();
- final CurrentCandidateProperties properties = new CurrentCandidateProperties(method, substitutor, isVarargs(), true);
- final CurrentCandidateProperties alreadyThere = map.put(getMarkerList(), properties);
- try {
- PsiType[] argumentTypes = getArgumentTypes();
- if (argumentTypes == null) {
- return ApplicabilityLevel.NOT_APPLICABLE;
- }
+ @ApplicabilityLevelConstant int level = computeForOverloadedCandidate(new Computable<Integer>() {
+ @Override
+ public Integer compute() {
+ PsiType[] argumentTypes = getArgumentTypes();
+ if (argumentTypes == null) {
+ return ApplicabilityLevel.NOT_APPLICABLE;
+ }
- level = PsiUtil.getApplicabilityLevel(method, substitutor, argumentTypes, myLanguageLevel);
- if (!isVarargs() && level < ApplicabilityLevel.FIXED_ARITY) {
- return ApplicabilityLevel.NOT_APPLICABLE;
+ int level = PsiUtil.getApplicabilityLevel(method, substitutor, argumentTypes, myLanguageLevel);
+ if (!isVarargs() && level < ApplicabilityLevel.FIXED_ARITY) {
+ return ApplicabilityLevel.NOT_APPLICABLE;
+ }
+ return level;
}
- }
- finally {
- if (alreadyThere == null) {
- map.remove(getMarkerList());
- } else {
- map.put(getMarkerList(), alreadyThere);
- }
- }
+ }, substitutor);
if (level > ApplicabilityLevel.NOT_APPLICABLE && !isTypeArgumentsApplicable(new Computable<PsiSubstitutor>() {
@Override
public PsiSubstitutor compute() {
@@ -154,6 +143,34 @@
return level;
}
+ public PsiType[] getPertinentArgumentTypes() {
+ return computeForOverloadedCandidate(new Computable<PsiType[]>() {
+ public PsiType[] compute() {
+ return getArgumentTypes();
+ }
+ }, getSubstitutor(false));
+ }
+
+ private <T> T computeForOverloadedCandidate(final Computable<T> computable, final PsiSubstitutor substitutor) {
+ Map<PsiElement, CurrentCandidateProperties> map = CURRENT_CANDIDATE.get();
+ if (map == null) {
+ map = ContainerUtil.createConcurrentWeakMap();
+ CURRENT_CANDIDATE.set(map);
+ }
+ final CurrentCandidateProperties alreadyThere = map.put(getMarkerList(),
+ new CurrentCandidateProperties(getElement(), substitutor, isVarargs(), true));
+ try {
+ return computable.compute();
+ }
+ finally {
+ if (alreadyThere == null) {
+ map.remove(getMarkerList());
+ } else {
+ map.put(getMarkerList(), alreadyThere);
+ }
+ }
+ }
+
@NotNull
public PsiSubstitutor getSiteSubstitutor() {
PsiSubstitutor incompleteSubstitutor = super.getSubstitutor();
@@ -309,9 +326,6 @@
public static CurrentCandidateProperties getCurrentMethod(PsiElement context) {
- if (isOverloadCheck()) {
- ourOverloadGuard.prohibitResultCaching(ourOverloadGuard.currentStack().get(0));
- }
final Map<PsiElement, CurrentCandidateProperties> currentMethodCandidates = CURRENT_CANDIDATE.get();
return currentMethodCandidates != null ? currentMethodCandidates.get(context) : null;
}
diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
index b31aa35..1d1978d 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
@@ -889,6 +889,10 @@
return getLanguageLevel(element).isAtLeast(LanguageLevel.JDK_1_8);
}
+ public static boolean isLanguageLevel9OrHigher(@NotNull final PsiElement element) {
+ return getLanguageLevel(element).isAtLeast(LanguageLevel.JDK_1_9);
+ }
+
@NotNull
public static LanguageLevel getLanguageLevel(@NotNull PsiElement element) {
if (element instanceof PsiDirectory) {
diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
index bdd2ec4..70cbee1 100644
--- a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
+++ b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
@@ -29,6 +29,7 @@
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.CharsetToolkit;
+import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.impl.JavaConstantExpressionEvaluator;
@@ -57,6 +58,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
import java.util.*;
import java.util.regex.Pattern;
@@ -517,7 +519,7 @@
}
// not a javadoc in fact..
- private static void generateVariableJavaDoc(@NonNls StringBuilder buffer, PsiVariable variable, boolean generatePrologueAndEpilogue) {
+ private void generateVariableJavaDoc(@NonNls StringBuilder buffer, PsiVariable variable, boolean generatePrologueAndEpilogue) {
if (generatePrologueAndEpilogue)
generatePrologue(buffer);
@@ -543,7 +545,7 @@
}
// not a javadoc in fact..
- private static void generateFileJavaDoc(StringBuilder buffer, PsiFile file, boolean generatePrologueAndEpilogue) {
+ private void generateFileJavaDoc(StringBuilder buffer, PsiFile file, boolean generatePrologueAndEpilogue) {
if (generatePrologueAndEpilogue)
generatePrologue(buffer);
final VirtualFile virtualFile = file.getVirtualFile();
@@ -1062,10 +1064,13 @@
}
}
- @SuppressWarnings({"HardCodedStringLiteral"})
- private static void generatePrologue(StringBuilder buffer) {
- buffer.append("<html><head>" +
- " <style type=\"text/css\">" +
+ private void generatePrologue(StringBuilder buffer) {
+ URL baseUrl = getBaseUrl();
+ buffer.append("<html><head>");
+ if (baseUrl != null) {
+ buffer.append("<base href=\"").append(baseUrl).append("\">");
+ }
+ buffer.append(" <style type=\"text/css\">" +
" #error {" +
" background-color: #eeeeee;" +
" margin-bottom: 10px;" +
@@ -1076,6 +1081,17 @@
" </style>" +
"</head><body>");
}
+
+ private URL getBaseUrl() {
+ if (myElement == null) return null;
+ PsiElement element = myElement.getNavigationElement();
+ if (element == null) return null;
+ PsiFile file = element.getContainingFile();
+ if (file == null) return null;
+ VirtualFile vFile = file.getVirtualFile();
+ if (vFile == null) return null;
+ return VfsUtilCore.convertToURL(vFile.getUrl());
+ }
@SuppressWarnings({"HardCodedStringLiteral"})
private static void generateEpilogue(StringBuilder buffer) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java b/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java
index 64169e1..228e97f 100644
--- a/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java
@@ -735,7 +735,12 @@
if (lastInstruction instanceof GoToInstruction &&
((GoToInstruction)lastInstruction).role == BranchingInstruction.Role.END &&
!((GoToInstruction)lastInstruction).isReturn) {
- lastOffset--;
+ if (((GoToInstruction)lastInstruction).offset == startOffset) {
+ lastOffset = -1;
+ }
+ else {
+ lastOffset--;
+ }
}
if (lastOffset >= 0) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java
index a825e7c..d0a665a 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java
@@ -50,6 +50,7 @@
import com.intellij.util.indexing.IndexingDataKeys;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collection;
@@ -314,7 +315,12 @@
final PsiElement resolved = statement.resolve();
if (resolved instanceof PsiClass) {
processor.handleEvent(JavaScopeProcessorEvent.SET_CURRENT_FILE_CONTEXT, statement);
- if (!processor.execute(resolved, state)) return false;
+ final PsiClass containingClass = ((PsiClass)resolved).getContainingClass();
+ if (containingClass != null && containingClass.hasTypeParameters()) {
+ if (!processor.execute(resolved, state.put(PsiSubstitutor.KEY,
+ createRawSubstitutor(containingClass)))) return false;
+ }
+ else if (!processor.execute(resolved, state)) return false;
}
}
}
@@ -385,6 +391,11 @@
return true;
}
+ @NotNull
+ private static PsiSubstitutor createRawSubstitutor(PsiClass containingClass) {
+ return JavaPsiFacade.getElementFactory(containingClass.getProject()).createRawSubstitutor(containingClass);
+ }
+
private static boolean processOnDemandTarget(PsiElement target, PsiScopeProcessor processor, ResolveState substitutor, PsiElement place) {
if (target instanceof PsiPackage) {
if (!target.processDeclarations(processor, substitutor, null, place)) {
@@ -393,6 +404,10 @@
}
else if (target instanceof PsiClass) {
PsiClass[] inners = ((PsiClass)target).getInnerClasses();
+ if (((PsiClass)target).hasTypeParameters()) {
+ substitutor = substitutor.put(PsiSubstitutor.KEY, createRawSubstitutor((PsiClass)target));
+ }
+
for (PsiClass inner : inners) {
if (!processor.execute(inner, substitutor)) return false;
}
@@ -494,8 +509,18 @@
@Override
public boolean process(SymbolCollectingProcessor.ResultWithContext result) {
- myProcessor.handleEvent(JavaScopeProcessorEvent.SET_CURRENT_FILE_CONTEXT, result.getFileContext());
- return myProcessor.execute(result.getElement(), myState);
+ final PsiElement context = result.getFileContext();
+ myProcessor.handleEvent(JavaScopeProcessorEvent.SET_CURRENT_FILE_CONTEXT, context);
+ final PsiNamedElement element = result.getElement();
+
+ if (element instanceof PsiClass && context instanceof PsiImportStatement) {
+ final PsiClass containingClass = ((PsiClass)element).getContainingClass();
+ if (containingClass != null && containingClass.hasTypeParameters()) {
+ return myProcessor.execute(element, myState.put(PsiSubstitutor.KEY, createRawSubstitutor(containingClass)));
+ }
+ }
+
+ return myProcessor.execute(element, myState);
}
}
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiModifierListImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiModifierListImpl.java
index 925c0ee..125b4f6 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiModifierListImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiModifierListImpl.java
@@ -130,7 +130,10 @@
return false;
}
if (type == JavaTokenType.ABSTRACT_KEYWORD) {
- return getNode().findChildByType(JavaTokenType.DEFAULT_KEYWORD) == null && getNode().findChildByType(JavaTokenType.STATIC_KEYWORD) == null;
+ final ASTNode node = getNode();
+ return node.findChildByType(JavaTokenType.DEFAULT_KEYWORD) == null &&
+ node.findChildByType(JavaTokenType.STATIC_KEYWORD) == null &&
+ node.findChildByType(JavaTokenType.PRIVATE_KEYWORD) == null;
}
}
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/CheckedExceptionCompatibilityConstraint.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/CheckedExceptionCompatibilityConstraint.java
index cf974c9..f03a796 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/CheckedExceptionCompatibilityConstraint.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/CheckedExceptionCompatibilityConstraint.java
@@ -103,58 +103,31 @@
}
final List<PsiType> thrownTypes = new ArrayList<PsiType>();
- if (myExpression instanceof PsiLambdaExpression) {
- final PsiElement body = ((PsiLambdaExpression)myExpression).getBody();
- if (body != null) {
- final List<PsiClassType> exceptions = ExceptionUtil.ourThrowsGuard.doPreventingRecursion(myExpression, false, new Computable<List<PsiClassType>>() {
+ final PsiElement body = myExpression instanceof PsiLambdaExpression ? ((PsiLambdaExpression)myExpression).getBody() : myExpression;
+ if (body != null) {
+ final List<PsiClassType> exceptions = ExceptionUtil.ourThrowsGuard.doPreventingRecursion(myExpression, false, new Computable<List<PsiClassType>>() {
+ @Override
+ public List<PsiClassType> compute() {
+ return ExceptionUtil.getUnhandledExceptions(new PsiElement[] {body});
+ }
+ });
+ if (exceptions != null) {
+ thrownTypes.addAll(ContainerUtil.filter(exceptions, new Condition<PsiClassType>() {
@Override
- public List<PsiClassType> compute() {
- return ExceptionUtil.getUnhandledExceptions(new PsiElement[] {body});
+ public boolean value(PsiClassType type) {
+ return !ExceptionUtil.isUncheckedException(type);
}
- });
- if (exceptions != null) {
- thrownTypes.addAll(ContainerUtil.filter(exceptions, new Condition<PsiClassType>() {
- @Override
- public boolean value(PsiClassType type) {
- return session.isProperType(type) && InheritanceUtil.isInheritor(type, CommonClassNames.JAVA_LANG_EXCEPTION);
- }
- }));
- }
- }
- } else {
-
- final PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult = PsiMethodReferenceUtil.getQualifierResolveResult((PsiMethodReferenceExpression)myExpression);
- final PsiSubstitutor psiSubstitutor = qualifierResolveResult.getSubstitutor();
- final PsiMethod method;
- if (((PsiMethodReferenceExpression)myExpression).isExact()) {
- final PsiElement resolve = ((PsiMethodReferenceExpression)myExpression).getPotentiallyApplicableMember();
- if (resolve instanceof PsiMethod) {
- method = (PsiMethod)resolve;
- } else {
- method = null;
- }
- }
- else {
- method = interfaceMethod;
- }
-
- if (method != null) {
- for (PsiType type : method.getThrowsList().getReferencedTypes()) {
- type = psiSubstitutor.substitute(type);
- if (type instanceof PsiClassType && !ExceptionUtil.isUncheckedException((PsiClassType)type)) {
- thrownTypes.add(substitutor.substitute(type));
- }
- }
+ }));
}
}
-
+
if (expectedNonProperThrownTypes.isEmpty()) {
for (PsiType thrownType : thrownTypes) {
if (!isAddressed(expectedThrownTypes, thrownType)) return false;
}
} else {
final ArrayList<PsiType> expectedProperTypes = new ArrayList<PsiType>(expectedThrownTypes);
- expectedProperTypes.retainAll(expectedNonProperThrownTypes);
+ expectedProperTypes.removeAll(expectedNonProperThrownTypes);
for (PsiType thrownType : thrownTypes) {
if (!isAddressed(expectedProperTypes, thrownType)) {
for (PsiType expectedNonProperThrownType : expectedNonProperThrownTypes) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
index 4ffc804..5755a53 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
@@ -422,16 +422,6 @@
(method.getCurrentFileResolveScope() instanceof PsiImportStaticStatement ? 0 : 1);
}
- @NotNull
- private PsiType[] getActualParameterTypes() {
- PsiType[] types = myActualParameterTypes;
- if (types == null) {
- LOG.assertTrue(myArgumentsList instanceof PsiExpressionList, myArgumentsList);
- myActualParameterTypes = types = getArgumentTypes();
- }
- return types;
- }
-
private int getActualParametersLength() {
if (myActualParameterTypes == null) {
LOG.assertTrue(myArgumentsList instanceof PsiExpressionList, myArgumentsList);
@@ -440,11 +430,6 @@
return myActualParameterTypes.length;
}
- @NotNull
- protected PsiType[] getArgumentTypes() {
- return ((PsiExpressionList)myArgumentsList).getExpressionTypes();
- }
-
private enum Specifics {
FIRST,
SECOND,
@@ -509,20 +494,23 @@
boolean sameBoxing = true;
int[] boxingHappened = new int[2];
+ final PsiType[] argTypes1 = myActualParameterTypes != null ? myActualParameterTypes : info1.getPertinentArgumentTypes();
+ final PsiType[] argTypes2 = myActualParameterTypes != null ? myActualParameterTypes : info2.getPertinentArgumentTypes();
for (int i = 0; i < types1.length; i++) {
ProgressManager.checkCanceled();
PsiType type1 = classSubstitutor1.substitute(types1[i]);
PsiType type2 = classSubstitutor2.substitute(types2[i]);
- PsiType argType = i < getActualParameterTypes().length ? getActualParameterTypes()[i] : null;
+ final PsiType argType1 = i < getActualParametersLength() ? argTypes1[i] : null;
+ final PsiType argType2 = i < getActualParametersLength() ? argTypes2[i] : null;
boolean boxingInFirst = false;
- if (isBoxingHappened(argType, type1, languageLevel)) {
+ if (isBoxingHappened(argType1, type1, languageLevel)) {
boxingHappened[0] += 1;
boxingInFirst = true;
}
boolean boxingInSecond = false;
- if (isBoxingHappened(argType, type2, languageLevel)) {
+ if (isBoxingHappened(argType2, type2, languageLevel)) {
boxingHappened[1] += 1;
boxingInSecond = true;
}
diff --git a/java/java-tests/testData/actions/reformatFileInEditor/formatSelection_DoNotTouchTrailingWhiteSpaces_after.java b/java/java-tests/testData/actions/reformatFileInEditor/formatSelection_DoNotTouchTrailingWhiteSpaces_after.java
new file mode 100644
index 0000000..3dfde16
--- /dev/null
+++ b/java/java-tests/testData/actions/reformatFileInEditor/formatSelection_DoNotTouchTrailingWhiteSpaces_after.java
@@ -0,0 +1,10 @@
+public class T {
+
+
+ public void tutu() {
+
+ }
+
+
+ public void test() {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/actions/reformatFileInEditor/formatSelection_DoNotTouchTrailingWhiteSpaces_before.java b/java/java-tests/testData/actions/reformatFileInEditor/formatSelection_DoNotTouchTrailingWhiteSpaces_before.java
new file mode 100644
index 0000000..c8d4512
--- /dev/null
+++ b/java/java-tests/testData/actions/reformatFileInEditor/formatSelection_DoNotTouchTrailingWhiteSpaces_before.java
@@ -0,0 +1,10 @@
+public class T {
+
+
+<selection> public void tutu() {
+
+ }</selection>
+
+
+ public void test() {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/PrivateInterfaceMethodBody.java b/java/java-tests/testData/codeInsight/completeStatement/PrivateInterfaceMethodBody.java
new file mode 100644
index 0000000..7135e23
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completeStatement/PrivateInterfaceMethodBody.java
@@ -0,0 +1,3 @@
+public interface Foo {
+ private void foo(<caret>)
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/PrivateInterfaceMethodBody_after.java b/java/java-tests/testData/codeInsight/completeStatement/PrivateInterfaceMethodBody_after.java
new file mode 100644
index 0000000..19bf062
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completeStatement/PrivateInterfaceMethodBody_after.java
@@ -0,0 +1,5 @@
+public interface Foo {
+ private void foo() {
+ <caret>
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/StaticInterfaceMethodBody.java b/java/java-tests/testData/codeInsight/completeStatement/StaticInterfaceMethodBody.java
new file mode 100644
index 0000000..f63c25f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completeStatement/StaticInterfaceMethodBody.java
@@ -0,0 +1,3 @@
+public interface Foo {
+ static void foo(<caret>)
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/StaticInterfaceMethodBody_after.java b/java/java-tests/testData/codeInsight/completeStatement/StaticInterfaceMethodBody_after.java
new file mode 100644
index 0000000..88c8a70
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completeStatement/StaticInterfaceMethodBody_after.java
@@ -0,0 +1,5 @@
+public interface Foo {
+ static void foo() {
+ <caret>
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/UncheckedExtendedWarnings.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/UncheckedExtendedWarnings.java
new file mode 100644
index 0000000..ab60273
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/UncheckedExtendedWarnings.java
@@ -0,0 +1,29 @@
+import java.util.Iterator;
+import java.util.List;
+
+class A<<warning descr="Type parameter 'T' is never used">T</warning>> {
+ List<String> getList() {
+ return null;
+ }
+}
+
+public class DefaultEventSource<<warning descr="Type parameter 'T' is never used">T</warning>> extends A {
+ public Iterator<String> getKeys(){
+ return null;
+ }
+
+ @Override
+ List<String> getList() {
+ return <warning descr="Unchecked assignment: 'java.util.List' to 'java.util.List<java.lang.String>'. Reason: 'super' has raw type, so result of getList is erased">super.getList()</warning>;
+ }
+
+ void f(DefaultEventSource source){
+ final Iterator<String> <warning descr="Variable 'keys' is never used">keys</warning> = <warning descr="Unchecked assignment: 'java.util.Iterator' to 'java.util.Iterator<java.lang.String>'. Reason: 'source' has raw type, so result of getKeys is erased">source. getKeys()</warning>;
+ final Iterator<String> <warning descr="Variable 'keys1' is never used">keys1</warning> = <warning descr="Unchecked cast: 'java.util.Iterator' to 'java.util.Iterator<java.lang.String>'. Reason: 'source' has raw type, so result of getKeys is erased">(Iterator<String>)source.getKeys()</warning>;
+ final Iterator<String> <warning descr="Variable 'keys2' is assigned but never accessed">keys2</warning>;
+ keys2 = <warning descr="Unchecked assignment: 'java.util.Iterator' to 'java.util.Iterator<java.lang.String>'. Reason: 'source' has raw type, so result of getKeys is erased">source.getKeys()</warning>;
+
+ for (<error descr="Incompatible types. Found: 'java.lang.Object', required: 'java.lang.String'">String <warning descr="Parameter 'o' is never used">o</warning> : super.getList()</error>) {}
+ }
+}
+
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/raw/p/Class1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/raw/p/Class1.java
new file mode 100644
index 0000000..71f2a5e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/raw/p/Class1.java
@@ -0,0 +1,9 @@
+package p;
+
+import p2.GenericClass;
+
+public class Class1 extends GenericClass<Integer> {
+ public void map(InnerClass context) {
+ Class2.test(context);
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/raw/p/Class2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/raw/p/Class2.java
new file mode 100644
index 0000000..10506b4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/raw/p/Class2.java
@@ -0,0 +1,10 @@
+package p;
+
+import p2.GenericClass.InnerClass;
+
+public class Class2 {
+
+ public static boolean test(InnerClass context) {
+ return true;
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/raw/p2/GenericClass.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/raw/p2/GenericClass.java
new file mode 100644
index 0000000..21c284b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/raw/p2/GenericClass.java
@@ -0,0 +1,6 @@
+package p2;
+
+public class GenericClass<T> {
+ public class InnerClass {
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/rawOnDemand/p/Class1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/rawOnDemand/p/Class1.java
new file mode 100644
index 0000000..71f2a5e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/rawOnDemand/p/Class1.java
@@ -0,0 +1,9 @@
+package p;
+
+import p2.GenericClass;
+
+public class Class1 extends GenericClass<Integer> {
+ public void map(InnerClass context) {
+ Class2.test(context);
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/rawOnDemand/p/Class2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/rawOnDemand/p/Class2.java
new file mode 100644
index 0000000..55941a9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/rawOnDemand/p/Class2.java
@@ -0,0 +1,10 @@
+package p;
+
+import p2.GenericClass.*;
+
+public class Class2 {
+
+ public static boolean test(InnerClass context) {
+ return true;
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/rawOnDemand/p2/GenericClass.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/rawOnDemand/p2/GenericClass.java
new file mode 100644
index 0000000..21c284b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/rawOnDemand/p2/GenericClass.java
@@ -0,0 +1,6 @@
+package p2;
+
+public class GenericClass<T> {
+ public class InnerClass {
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting9/PrivateInInterfaces.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting9/PrivateInInterfaces.java
new file mode 100644
index 0000000..280cb8a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting9/PrivateInInterfaces.java
@@ -0,0 +1,3 @@
+interface A {
+ private void m() {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/DontReportWeakerVisibilityProblemUpInHierarchy.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/DontReportWeakerVisibilityProblemUpInHierarchy.java
new file mode 100644
index 0000000..2f17edf
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/DontReportWeakerVisibilityProblemUpInHierarchy.java
@@ -0,0 +1,15 @@
+
+class F {
+ public void f() {}
+}
+
+class E extends F {
+ @Override
+ <error descr="'f()' in 'E' clashes with 'f()' in 'F'; attempting to assign weaker access privileges ('protected'); was 'public'">protected</error> void f() {
+ super.f();
+ }
+}
+
+class EE extends E {
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/SuperObjectCapturedWildcardEquality.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/SuperObjectCapturedWildcardEquality.java
new file mode 100644
index 0000000..0edb93c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/SuperObjectCapturedWildcardEquality.java
@@ -0,0 +1,9 @@
+class A<T> {}
+
+class Test {
+ {
+ A<? super Object> queue = null;
+ A<Object> q = queue;
+ queue = q;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/advHighlighting/StrictfpInsideInterface.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/advHighlighting/StrictfpInsideInterface.java
new file mode 100644
index 0000000..580db58
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/advHighlighting/StrictfpInsideInterface.java
@@ -0,0 +1,5 @@
+interface A {
+ <error descr="Illegal combination of modifiers: 'strictfp' and 'abstract'">strictfp</error> void m();
+ strictfp default void m1(){}
+ strictfp static void m2() {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/CheckedExceptionsConstraintsSubstitutions2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/CheckedExceptionsConstraintsSubstitutions2.java
new file mode 100644
index 0000000..e9c5f7f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/CheckedExceptionsConstraintsSubstitutions2.java
@@ -0,0 +1,15 @@
+abstract class Main {
+
+ public interface LifetimeFunction<ELF extends Throwable> {
+ int execute() throws ELF;
+ }
+
+ public final <E extends Throwable> void foo(final LifetimeFunction<E> action) throws E {
+ runSync(() -> {
+ action.execute();
+ return 42;
+ });
+ }
+
+ abstract < E1 extends Throwable> void runSync(LifetimeFunction<E1> action) throws E1;
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/InfiniteLoopAndValueCompatibility.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/InfiniteLoopAndValueCompatibility.java
new file mode 100644
index 0000000..d81a7a4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/InfiniteLoopAndValueCompatibility.java
@@ -0,0 +1,14 @@
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.concurrent.Callable;
+
+class Test {
+ public static final void main(String[] args) throws Exception {
+ Reader r = new StringReader("Elvis lives!");
+ Callable<Integer > c1 = () -> {
+ while (true) {
+ r.read();
+ }
+ };
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/SkipCheckedExceptionsHandledByInterfaceMethod.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/SkipCheckedExceptionsHandledByInterfaceMethod.java
new file mode 100644
index 0000000..e25dc6b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/SkipCheckedExceptionsHandledByInterfaceMethod.java
@@ -0,0 +1,14 @@
+import java.io.IOException;
+
+class MethodReferenceErrorHighlight {
+ {
+ match(String.class, this::foo);
+ }
+
+ <P> void match(final Class<P> type, UnitApply<P> apply) {}
+ void foo(String s) throws IOException { throw new IOException(); }
+}
+
+interface UnitApply<I> {
+ void apply(I i) throws Exception;
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/overloadResolution/MultipleOverloadsWithNestedGeneric.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/overloadResolution/MultipleOverloadsWithNestedGeneric.java
new file mode 100644
index 0000000..14316e0
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/overloadResolution/MultipleOverloadsWithNestedGeneric.java
@@ -0,0 +1,9 @@
+import java.lang.String;
+
+abstract class Test {
+ abstract <T> T get();
+
+ void foo() {
+ String.valueOf(get());
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA137668.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA137668.java
new file mode 100644
index 0000000..0eaa294
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA137668.java
@@ -0,0 +1,48 @@
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InterruptedIOException;
+class Test {
+
+ private InputStream stream;
+
+ public int read(byte[] data, int offset, int len) throws IOException {
+ return apply(() -> {
+ if (stream == null || stream.available() < 0) {
+ throw new FileNotFoundException();
+ }
+ for (long t = System.currentTimeMillis(); stream != null && stream.available() >= 0; ) {
+ if (System.currentTimeMillis() - t >= 10_000) {
+ throw new InterruptedIOException("Timeout exceeded");
+ }
+ final int count = stream.available();
+ if (count > 0) {
+ final int n = Math.min(len, count);
+ final byte[] buf = new byte[n];
+ final int c = stream.read(buf);
+ System.arraycopy(buf, 0, data, offset, c);
+ return c;
+ } else {
+ Thread.sleep(1L);
+ }
+ }
+ throw new FileNotFoundException();
+ });
+ }
+
+ synchronized <T> T apply(SerialPortAction<T> action) throws IOException {
+ try {
+ return action.apply();
+ } catch (InterruptedException x) {
+ final InterruptedIOException y = new InterruptedIOException(x.getMessage());
+ y.initCause(x);
+ throw y;
+ }
+ }
+
+ @FunctionalInterface
+ interface SerialPortAction<T> {
+
+ T apply() throws IOException, InterruptedException;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA137694.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA137694.java
new file mode 100644
index 0000000..e17d624
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA137694.java
@@ -0,0 +1,13 @@
+class Test {
+ Test() {
+ foo(<error descr="Unhandled exception: java.lang.Exception">this::fs</error>);
+ foo((s) -> <error descr="Unhandled exception: java.lang.Exception">fs(s)</error>);
+ }
+
+ void foo(I<String, String> iss) {}
+ String fs(String s) throws Exception { throw new Exception(); }
+}
+
+interface I<T, R> {
+ R f(T t);
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA137795.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA137795.java
new file mode 100644
index 0000000..86d5807
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA137795.java
@@ -0,0 +1,10 @@
+
+import java.util.function.Function;
+
+class Example {
+ void test() {
+ Function<? super Integer, Float> firstFunction = null;
+ Function<Float, String> secondFunction = null;
+ Function<? super Integer, String> function = firstFunction.andThen(secondFunction);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA137893.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA137893.java
new file mode 100644
index 0000000..6ac87c6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/regression/IDEA137893.java
@@ -0,0 +1,29 @@
+import java.util.Map;
+import java.util.Set;
+import java.util.function.UnaryOperator;
+
+final class Example {
+ Map<String, Map<String, Set<String>>> test(Map<String, Map<String, Set<String>>> mapOfMaps) {
+ return processMap(
+ mapOfMaps,
+ mapOfSets -> {
+ return processMap(
+ mapOfSets,
+ set -> {
+ if (true) {
+ return unionSets(set);
+ } else {
+ return unionSets(set);
+ }
+ });
+ });
+ }
+
+ <T> Set<T> unionSets(Set<T>... sets) {
+ return null;
+ }
+
+ <K, V> Map<K, V> processMap(Map<K, V> map, UnaryOperator<V> operator) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/beforeFieldInitializer.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/beforeFieldInitializer.java
new file mode 100644
index 0000000..43349e1
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/beforeFieldInitializer.java
@@ -0,0 +1,5 @@
+// "Assert 'myFoo != null'" "false"
+class A{
+ private final String myFoo = null;
+ String myBar = my<caret>Foo.substring(0);
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterParamCouldBeInferred.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterParamCouldBeInferred.java
new file mode 100644
index 0000000..2779c21
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterParamCouldBeInferred.java
@@ -0,0 +1,19 @@
+// "Replace with lambda" "true"
+
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+class Test {
+ private static final Map<String, Mood> WORD_TO_MOOD = null;
+
+ public static void analyseMood(String[] wordsInMessage) {
+ Stream.of(wordsInMessage)
+ .map(s -> WORD_TO_MOOD.get(s))
+ .filter(mood -> mood != null)
+ .collect(Collectors.toSet());
+ }
+
+ enum Mood {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeParamCouldBeInferred.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeParamCouldBeInferred.java
new file mode 100644
index 0000000..ef91d0d2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeParamCouldBeInferred.java
@@ -0,0 +1,24 @@
+// "Replace with lambda" "true"
+
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+class Test {
+ private static final Map<String, Mood> WORD_TO_MOOD = null;
+
+ public static void analyseMood(String[] wordsInMessage) {
+ Stream.of(wordsInMessage)
+ .map(new Func<caret>tion<String, Mood>() {
+ @Override
+ public Mood apply(String s) {
+ return WORD_TO_MOOD.get(s);
+ }
+ })
+ .filter(mood -> mood != null)
+ .collect(Collectors.toSet());
+ }
+
+ enum Mood {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/changeExtendsToImplements/afterTypeParameter.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/changeExtendsToImplements/afterTypeParameter.java
new file mode 100644
index 0000000..f271af5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/changeExtendsToImplements/afterTypeParameter.java
@@ -0,0 +1,4 @@
+// "Make 'K' implement 'java.lang.Runnable'" "true"
+
+interface RemoteStore<K extends Runnable, V>{}
+class BackedRemoteStore<K extends Runnable, V> implements RemoteStore<K, V> {}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/changeExtendsToImplements/beforeTypeParameter.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/changeExtendsToImplements/beforeTypeParameter.java
new file mode 100644
index 0000000..3c36d87
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/changeExtendsToImplements/beforeTypeParameter.java
@@ -0,0 +1,4 @@
+// "Make 'K' implement 'java.lang.Runnable'" "true"
+
+interface RemoteStore<K extends Runnable, V>{}
+class BackedRemoteStore<K, V> implements RemoteStore<<caret>K, V> {}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/explicit2diamond/afterReformatArgs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/explicit2diamond/afterReformatArgs.java
new file mode 100644
index 0000000..4afd888
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/explicit2diamond/afterReformatArgs.java
@@ -0,0 +1,8 @@
+// "Replace with <>" "true"
+class Test<T> {
+ public Test(String s1, String s2) {}
+
+ Test<String> s = new Test<>("s1",
+ "s2");
+
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/explicit2diamond/beforeReformatArgs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/explicit2diamond/beforeReformatArgs.java
new file mode 100644
index 0000000..9546b5a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/explicit2diamond/beforeReformatArgs.java
@@ -0,0 +1,8 @@
+// "Replace with <>" "true"
+class Test<T> {
+ public Test(String s1, String s2) {}
+
+ Test<String> s = new Test<Str<caret>ing>("s1",
+ "s2");
+
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/surroundWithTry/afterLambdaExpr.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/surroundWithTry/afterLambdaExpr.java
new file mode 100644
index 0000000..9ab9c4d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/surroundWithTry/afterLambdaExpr.java
@@ -0,0 +1,26 @@
+// "Surround with try/catch" "true"
+public class ExTest {
+ public static void maybeThrow(String data) throws Ex {
+ throw new Ex(data);
+ }
+
+ {
+ Block<String> b = (t) -> {
+ try {
+ ExTest.maybeThrow(t);
+ } catch (Ex ex) {
+ ex.printStackTrace();
+ }
+ };
+ }
+
+
+ private static class Ex extends Throwable {
+ public Ex(String s) {
+ }
+ }
+}
+
+interface Block<T> {
+ public void accept(T t);
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/surroundWithTry/beforeLambdaExpr.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/surroundWithTry/beforeLambdaExpr.java
index 2cb6adb..5b163a4 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/surroundWithTry/beforeLambdaExpr.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/surroundWithTry/beforeLambdaExpr.java
@@ -1,4 +1,4 @@
-// "Surround with try/catch" "false"
+// "Surround with try/catch" "true"
public class ExTest {
public static void maybeThrow(String data) throws Ex {
throw new Ex(data);
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/variableType/afterVararg.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/variableType/afterVararg.java
new file mode 100644
index 0000000..d3f05c0
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/variableType/afterVararg.java
@@ -0,0 +1,8 @@
+// "Change field 'foo' type to 'java.lang.String[]'" "true"
+
+class Base {
+ private String[] foo;
+ public void bar(String... args) {
+ foo = args;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/variableType/beforeVararg.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/variableType/beforeVararg.java
new file mode 100644
index 0000000..acdd4b7
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/variableType/beforeVararg.java
@@ -0,0 +1,8 @@
+// "Change field 'foo' type to 'java.lang.String[]'" "true"
+
+class Base {
+ private String foo;
+ public void bar(String... args) {
+ foo<caret> = args;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/documentation/inherit.gif b/java/java-tests/testData/codeInsight/documentation/inherit.gif
deleted file mode 100644
index c814867..0000000
--- a/java/java-tests/testData/codeInsight/documentation/inherit.gif
+++ /dev/null
Binary files differ
diff --git a/java/java-tests/testData/codeInsight/documentation/library-javadoc.jar b/java/java-tests/testData/codeInsight/documentation/library-javadoc.jar
new file mode 100644
index 0000000..1b4c027
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/documentation/library-javadoc.jar
Binary files differ
diff --git a/java/java-tests/testData/codeInsight/documentation/library.jar b/java/java-tests/testData/codeInsight/documentation/library.jar
new file mode 100644
index 0000000..09fef7a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/documentation/library.jar
Binary files differ
diff --git a/java/java-tests/testData/codeInsight/editorActions/moveLine/MoveThroughFolding-after.java b/java/java-tests/testData/codeInsight/editorActions/moveLine/MoveThroughFolding-after.java
new file mode 100644
index 0000000..84b3263
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/editorActions/moveLine/MoveThroughFolding-after.java
@@ -0,0 +1,15 @@
+import javax.swing.*;
+import java.lang.Override;
+import java.lang.Runnable;
+
+class Test {
+ void m() {
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ System.out.println();
+ }
+<selection> System.out.println();
+<caret></selection> });
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/editorActions/moveLine/MoveThroughFolding.java b/java/java-tests/testData/codeInsight/editorActions/moveLine/MoveThroughFolding.java
new file mode 100644
index 0000000..0f5c126
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/editorActions/moveLine/MoveThroughFolding.java
@@ -0,0 +1,15 @@
+import javax.swing.*;
+import java.lang.Override;
+import java.lang.Runnable;
+
+class Test {
+ void m() {
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ System.out.println();
+ }
+ });
+<selection> System.out.println();
+<caret></selection> }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/externalJavadoc/String/invalid/expected.html b/java/java-tests/testData/codeInsight/externalJavadoc/String/invalid/expected.html
new file mode 100644
index 0000000..be05eb1
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/externalJavadoc/String/invalid/expected.html
@@ -0,0 +1,226 @@
+<HTML><style type="text/css"> ul.inheritance {
+ margin:0;
+ padding:0;
+ }
+ ul.inheritance li {
+ display:inline;
+ list-style:none;
+ }
+ ul.inheritance li ul.inheritance {
+ margin-left:15px;
+ padding-left:15px;
+ padding-top:1px;
+ }
+</style>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+ <!-- Generated by javadoc (build 1.6.0_27) on Wed Aug 10 15:58:01 PDT 2011 -->
+ <TITLE>
+ String (Java Platform SE 6)
+ </TITLE>
+
+ <META NAME="date" CONTENT="2011-08-10">
+ <META NAME="keywords" CONTENT="java.lang.String class">
+ <META NAME="keywords" CONTENT="CASE_INSENSITIVE_ORDER">
+ <META NAME="keywords" CONTENT="length()">
+ <META NAME="keywords" CONTENT="isEmpty()">
+ <META NAME="keywords" CONTENT="charAt()">
+ <META NAME="keywords" CONTENT="codePointAt()">
+ <META NAME="keywords" CONTENT="codePointBefore()">
+ <META NAME="keywords" CONTENT="codePointCount()">
+ <META NAME="keywords" CONTENT="offsetByCodePoints()">
+ <META NAME="keywords" CONTENT="getChars()">
+ <META NAME="keywords" CONTENT="getBytes()">
+ <META NAME="keywords" CONTENT="equals()">
+ <META NAME="keywords" CONTENT="contentEquals()">
+ <META NAME="keywords" CONTENT="equalsIgnoreCase()">
+ <META NAME="keywords" CONTENT="compareTo()">
+ <META NAME="keywords" CONTENT="compareToIgnoreCase()">
+ <META NAME="keywords" CONTENT="regionMatches()">
+ <META NAME="keywords" CONTENT="startsWith()">
+ <META NAME="keywords" CONTENT="endsWith()">
+ <META NAME="keywords" CONTENT="hashCode()">
+ <META NAME="keywords" CONTENT="indexOf()">
+ <META NAME="keywords" CONTENT="lastIndexOf()">
+ <META NAME="keywords" CONTENT="substring()">
+ <META NAME="keywords" CONTENT="subSequence()">
+ <META NAME="keywords" CONTENT="concat()">
+ <META NAME="keywords" CONTENT="replace()">
+ <META NAME="keywords" CONTENT="matches()">
+ <META NAME="keywords" CONTENT="contains()">
+ <META NAME="keywords" CONTENT="replaceFirst()">
+ <META NAME="keywords" CONTENT="replaceAll()">
+ <META NAME="keywords" CONTENT="split()">
+ <META NAME="keywords" CONTENT="toLowerCase()">
+ <META NAME="keywords" CONTENT="toUpperCase()">
+ <META NAME="keywords" CONTENT="trim()">
+ <META NAME="keywords" CONTENT="toString()">
+ <META NAME="keywords" CONTENT="toCharArray()">
+ <META NAME="keywords" CONTENT="format()">
+ <META NAME="keywords" CONTENT="valueOf()">
+ <META NAME="keywords" CONTENT="copyValueOf()">
+ <META NAME="keywords" CONTENT="intern()">
+
+ <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
+
+ <SCRIPT type="text/javascript">
+ function windowTitle()
+ {
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="String (Java Platform SE 6)";
+ }
+ }
+ </SCRIPT>
+ <NOSCRIPT>
+ </NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+ <TR>
+ <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+ <A NAME="navbar_top_firstrow"><!-- --></A>
+ <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/String.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+ </TABLE>
+ </TD>
+ <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+ <b>Java™ Platform<br>Standard Ed. 6</b></EM>
+ </TD>
+ </TR>
+
+ <TR>
+ <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../java/lang/StrictMath.html" title="class in java.lang"><B>PREV CLASS</B></A>
+ <A HREF="../../java/lang/StringBuffer.html" title="class in java.lang"><B>NEXT CLASS</B></A></FONT></TD>
+ <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../index.html?java/lang/String.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="String.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+ </SCRIPT>
+ <NOSCRIPT>
+ <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
+ </NOSCRIPT>
+
+
+ </FONT></TD>
+ </TR>
+ <TR>
+ <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
+ <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
+ </TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<H2>
+ <FONT SIZE="-1">
+ java.lang</FONT>
+ <BR>
+ Class String</H2>
+<PRE>
+<A HREF="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</A>
+ <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>java.lang.String</B>
+</PRE>
+<DL><DL>
+ <DT><BR><PRE>public final class <B>String</B><DT><BR>extends <A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A><DT><BR>implements <A HREF="../../java/io/Serializable.html" title="interface in java.io">Serializable</A>, <A HREF="../../java/lang/Comparable.html" title="interface in java.lang">Comparable</A><<A HREF="../../java/lang/String.html" title="class in java.lang">String</A>>, <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A></DL>
+</PRE>
+
+ <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../java/io/Serializable.html" title="interface in java.io">Serializable</A>, <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A>, <A HREF="../../java/lang/Comparable.html" title="interface in java.lang">Comparable</A><<A HREF="../../java/lang/String.html" title="class in java.lang">String</A>></DD>
+</DL>
+<P> The <code>String</code> class represents character strings. All
+ string literals in Java programs, such as <code>"abc"</code>, are
+ implemented as instances of this class.
+<p>
+ Strings are constant; their values cannot be changed after they
+ are created. String buffers support mutable strings.
+ Because String objects are immutable they can be shared. For example:
+<p><blockquote><pre>
+ String str = "abc";
+ </pre></blockquote><p>
+ is equivalent to:
+<p><blockquote><pre>
+ char data[] = {'a', 'b', 'c'};
+ String str = new String(data);
+ </pre></blockquote><p>
+ Here are some more examples of how strings can be used:
+<p><blockquote><pre>
+ System.out.println("abc");
+ String cde = "cde";
+ System.out.println("abc" + cde);
+ String c = "abc".substring(2,3);
+ String d = cde.substring(1, 2);
+ </pre></blockquote>
+<p>
+ The class <code>String</code> includes methods for examining
+ individual characters of the sequence, for comparing strings, for
+ searching strings, for extracting substrings, and for creating a
+ copy of a string with all characters translated to uppercase or to
+ lowercase. Case mapping is based on the Unicode Standard version
+ specified by the <A HREF="../../java/lang/Character.html" title="class in java.lang"><CODE>Character</CODE></A> class.
+<p>
+ The Java language provides special support for the string
+ concatenation operator ( + ), and for conversion of
+ other objects to strings. String concatenation is implemented
+ through the <code>StringBuilder</code>(or <code>StringBuffer</code>)
+ class and its <code>append</code> method.
+ String conversions are implemented through the method
+ <code>toString</code>, defined by <code>Object</code> and
+ inherited by all classes in Java. For additional information on
+ string concatenation and conversion, see Gosling, Joy, and Steele,
+ <i>The Java Language Specification</i>.
+
+<p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
+ or method in this class will cause a <A HREF="../../java/lang/NullPointerException.html" title="class in java.lang"><CODE>NullPointerException</CODE></A> to be
+ thrown.
+
+<p>A <code>String</code> represents a string in the UTF-16 format
+ in which <em>supplementary characters</em> are represented by <em>surrogate
+ pairs</em> (see the section <a href="Character.html#unicode">Unicode
+ Character Representations</a> in the <code>Character</code> class for
+ more information).
+ Index values refer to <code>char</code> code units, so a supplementary
+ character uses two positions in a <code>String</code>.
+<p>The <code>String</code> class provides methods for dealing with
+ Unicode code points (i.e., characters), in addition to those for
+ dealing with Unicode code units (i.e., <code>char</code> values).
+<P>
+
+<P>
+<DL>
+ <DT><B>Since:</B></DT>
+ <DD>JDK1.0</DD>
+ <DT><B>See Also:</B><DD><A HREF="../../java/lang/Object.html#toString()"><CODE>Object.toString()</CODE></A>,
+ <A HREF="../../java/lang/StringBuffer.html" title="class in java.lang"><CODE>StringBuffer</CODE></A>,
+ <A HREF="../../java/lang/StringBuilder.html" title="class in java.lang"><CODE>StringBuilder</CODE></A>,
+ <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset"><CODE>Charset</CODE></A>,
+ <A HREF="../../serialized-form.html#java.lang.String">Serialized Form</A></DL>
+
+<P>
+</HTML>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/externalJavadoc/String/invalid/page.html b/java/java-tests/testData/codeInsight/externalJavadoc/String/invalid/page.html
new file mode 100644
index 0000000..d8bf965
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/externalJavadoc/String/invalid/page.html
@@ -0,0 +1,3543 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+ <!-- Generated by javadoc (build 1.6.0_27) on Wed Aug 10 15:58:01 PDT 2011 -->
+ <TITLE>
+ String (Java Platform SE 6)
+ </TITLE>
+
+ <META NAME="date" CONTENT="2011-08-10">
+ <META NAME="keywords" CONTENT="java.lang.String class">
+ <META NAME="keywords" CONTENT="CASE_INSENSITIVE_ORDER">
+ <META NAME="keywords" CONTENT="length()">
+ <META NAME="keywords" CONTENT="isEmpty()">
+ <META NAME="keywords" CONTENT="charAt()">
+ <META NAME="keywords" CONTENT="codePointAt()">
+ <META NAME="keywords" CONTENT="codePointBefore()">
+ <META NAME="keywords" CONTENT="codePointCount()">
+ <META NAME="keywords" CONTENT="offsetByCodePoints()">
+ <META NAME="keywords" CONTENT="getChars()">
+ <META NAME="keywords" CONTENT="getBytes()">
+ <META NAME="keywords" CONTENT="equals()">
+ <META NAME="keywords" CONTENT="contentEquals()">
+ <META NAME="keywords" CONTENT="equalsIgnoreCase()">
+ <META NAME="keywords" CONTENT="compareTo()">
+ <META NAME="keywords" CONTENT="compareToIgnoreCase()">
+ <META NAME="keywords" CONTENT="regionMatches()">
+ <META NAME="keywords" CONTENT="startsWith()">
+ <META NAME="keywords" CONTENT="endsWith()">
+ <META NAME="keywords" CONTENT="hashCode()">
+ <META NAME="keywords" CONTENT="indexOf()">
+ <META NAME="keywords" CONTENT="lastIndexOf()">
+ <META NAME="keywords" CONTENT="substring()">
+ <META NAME="keywords" CONTENT="subSequence()">
+ <META NAME="keywords" CONTENT="concat()">
+ <META NAME="keywords" CONTENT="replace()">
+ <META NAME="keywords" CONTENT="matches()">
+ <META NAME="keywords" CONTENT="contains()">
+ <META NAME="keywords" CONTENT="replaceFirst()">
+ <META NAME="keywords" CONTENT="replaceAll()">
+ <META NAME="keywords" CONTENT="split()">
+ <META NAME="keywords" CONTENT="toLowerCase()">
+ <META NAME="keywords" CONTENT="toUpperCase()">
+ <META NAME="keywords" CONTENT="trim()">
+ <META NAME="keywords" CONTENT="toString()">
+ <META NAME="keywords" CONTENT="toCharArray()">
+ <META NAME="keywords" CONTENT="format()">
+ <META NAME="keywords" CONTENT="valueOf()">
+ <META NAME="keywords" CONTENT="copyValueOf()">
+ <META NAME="keywords" CONTENT="intern()">
+
+ <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
+
+ <SCRIPT type="text/javascript">
+ function windowTitle()
+ {
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="String (Java Platform SE 6)";
+ }
+ }
+ </SCRIPT>
+ <NOSCRIPT>
+ </NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+ <TR>
+ <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+ <A NAME="navbar_top_firstrow"><!-- --></A>
+ <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/String.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+ </TABLE>
+ </TD>
+ <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+ <b>Java™ Platform<br>Standard Ed. 6</b></EM>
+ </TD>
+ </TR>
+
+ <TR>
+ <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../java/lang/StrictMath.html" title="class in java.lang"><B>PREV CLASS</B></A>
+ <A HREF="../../java/lang/StringBuffer.html" title="class in java.lang"><B>NEXT CLASS</B></A></FONT></TD>
+ <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../index.html?java/lang/String.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="String.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+ </SCRIPT>
+ <NOSCRIPT>
+ <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
+ </NOSCRIPT>
+
+
+ </FONT></TD>
+ </TR>
+ <TR>
+ <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
+ <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
+ </TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<H2>
+ <FONT SIZE="-1">
+ java.lang</FONT>
+ <BR>
+ Class String</H2>
+<PRE>
+<A HREF="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</A>
+ <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>java.lang.String</B>
+</PRE>
+<DL>
+ <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../java/io/Serializable.html" title="interface in java.io">Serializable</A>, <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A>, <A HREF="../../java/lang/Comparable.html" title="interface in java.lang">Comparable</A><<A HREF="../../java/lang/String.html" title="class in java.lang">String</A>></DD>
+</DL>
+<HR>
+<DL>
+ <DT><PRE>public final class <B>String</B><DT>extends <A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A><DT>implements <A HREF="../../java/io/Serializable.html" title="interface in java.io">Serializable</A>, <A HREF="../../java/lang/Comparable.html" title="interface in java.lang">Comparable</A><<A HREF="../../java/lang/String.html" title="class in java.lang">String</A>>, <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A></DL>
+</PRE>
+
+<P>
+ The <code>String</code> class represents character strings. All
+ string literals in Java programs, such as <code>"abc"</code>, are
+ implemented as instances of this class.
+<p>
+ Strings are constant; their values cannot be changed after they
+ are created. String buffers support mutable strings.
+ Because String objects are immutable they can be shared. For example:
+<p><blockquote><pre>
+ String str = "abc";
+ </pre></blockquote><p>
+ is equivalent to:
+<p><blockquote><pre>
+ char data[] = {'a', 'b', 'c'};
+ String str = new String(data);
+ </pre></blockquote><p>
+ Here are some more examples of how strings can be used:
+<p><blockquote><pre>
+ System.out.println("abc");
+ String cde = "cde";
+ System.out.println("abc" + cde);
+ String c = "abc".substring(2,3);
+ String d = cde.substring(1, 2);
+ </pre></blockquote>
+<p>
+ The class <code>String</code> includes methods for examining
+ individual characters of the sequence, for comparing strings, for
+ searching strings, for extracting substrings, and for creating a
+ copy of a string with all characters translated to uppercase or to
+ lowercase. Case mapping is based on the Unicode Standard version
+ specified by the <A HREF="../../java/lang/Character.html" title="class in java.lang"><CODE>Character</CODE></A> class.
+<p>
+ The Java language provides special support for the string
+ concatenation operator ( + ), and for conversion of
+ other objects to strings. String concatenation is implemented
+ through the <code>StringBuilder</code>(or <code>StringBuffer</code>)
+ class and its <code>append</code> method.
+ String conversions are implemented through the method
+ <code>toString</code>, defined by <code>Object</code> and
+ inherited by all classes in Java. For additional information on
+ string concatenation and conversion, see Gosling, Joy, and Steele,
+ <i>The Java Language Specification</i>.
+
+<p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
+ or method in this class will cause a <A HREF="../../java/lang/NullPointerException.html" title="class in java.lang"><CODE>NullPointerException</CODE></A> to be
+ thrown.
+
+<p>A <code>String</code> represents a string in the UTF-16 format
+ in which <em>supplementary characters</em> are represented by <em>surrogate
+ pairs</em> (see the section <a href="Character.html#unicode">Unicode
+ Character Representations</a> in the <code>Character</code> class for
+ more information).
+ Index values refer to <code>char</code> code units, so a supplementary
+ character uses two positions in a <code>String</code>.
+<p>The <code>String</code> class provides methods for dealing with
+ Unicode code points (i.e., characters), in addition to those for
+ dealing with Unicode code units (i.e., <code>char</code> values).
+<P>
+
+<P>
+<DL>
+ <DT><B>Since:</B></DT>
+ <DD>JDK1.0</DD>
+ <DT><B>See Also:</B><DD><A HREF="../../java/lang/Object.html#toString()"><CODE>Object.toString()</CODE></A>,
+ <A HREF="../../java/lang/StringBuffer.html" title="class in java.lang"><CODE>StringBuffer</CODE></A>,
+ <A HREF="../../java/lang/StringBuilder.html" title="class in java.lang"><CODE>StringBuilder</CODE></A>,
+ <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset"><CODE>Charset</CODE></A>,
+ <A HREF="../../serialized-form.html#java.lang.String">Serialized Form</A></DL>
+<HR>
+
+<P>
+ <!-- =========== FIELD SUMMARY =========== -->
+
+ <A NAME="field_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+ <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+ <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+ <B>Field Summary</B></FONT></TH>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE>static <A HREF="../../java/util/Comparator.html" title="interface in java.util">Comparator</A><<A HREF="../../java/lang/String.html" title="class in java.lang">String</A>></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#CASE_INSENSITIVE_ORDER">CASE_INSENSITIVE_ORDER</A></B></CODE>
+
+ <BR>
+ A Comparator that orders <code>String</code> objects as by
+ <code>compareToIgnoreCase</code>.</TD>
+ </TR>
+</TABLE>
+
+<!-- ======== CONSTRUCTOR SUMMARY ======== -->
+
+<A NAME="constructor_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+ <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+ <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+ <B>Constructor Summary</B></FONT></TH>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String()">String</A></B>()</CODE>
+
+ <BR>
+ Initializes a newly created <code>String</code> object so that it represents
+ an empty character sequence.</TD>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[])">String</A></B>(byte[] bytes)</CODE>
+
+ <BR>
+ Constructs a new <code>String</code> by decoding the specified array of bytes
+ using the platform's default charset.</TD>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], java.nio.charset.Charset)">String</A></B>(byte[] bytes,
+ <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">Charset</A> charset)</CODE>
+
+ <BR>
+ Constructs a new <code>String</code> by decoding the specified array of
+ bytes using the specified <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>.</TD>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], int)">String</A></B>(byte[] ascii,
+ int hibyte)</CODE>
+
+ <BR>
+ <B>Deprecated.</B> <I>This method does not properly convert bytes into
+ characters. As of JDK 1.1, the preferred way to do this is via the
+ <code>String</code> constructors that take a <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset"><CODE>Charset</CODE></A>, charset name, or that use the platform's
+ default charset.</I></TD>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], int, int)">String</A></B>(byte[] bytes,
+ int offset,
+ int length)</CODE>
+
+ <BR>
+ Constructs a new <code>String</code> by decoding the specified subarray of
+ bytes using the platform's default charset.</TD>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], int, int, java.nio.charset.Charset)">String</A></B>(byte[] bytes,
+ int offset,
+ int length,
+ <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">Charset</A> charset)</CODE>
+
+ <BR>
+ Constructs a new <code>String</code> by decoding the specified subarray of
+ bytes using the specified <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>.</TD>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], int, int, int)">String</A></B>(byte[] ascii,
+ int hibyte,
+ int offset,
+ int count)</CODE>
+
+ <BR>
+ <B>Deprecated.</B> <I>This method does not properly convert bytes into characters.
+ As of JDK 1.1, the preferred way to do this is via the
+ <code>String</code> constructors that take a <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset"><CODE>Charset</CODE></A>, charset name, or that use the platform's
+ default charset.</I></TD>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], int, int, java.lang.String)">String</A></B>(byte[] bytes,
+ int offset,
+ int length,
+ <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> charsetName)</CODE>
+
+ <BR>
+ Constructs a new <code>String</code> by decoding the specified subarray of
+ bytes using the specified charset.</TD>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String(byte[], java.lang.String)">String</A></B>(byte[] bytes,
+ <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> charsetName)</CODE>
+
+ <BR>
+ Constructs a new <code>String</code> by decoding the specified array of bytes
+ using the specified <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>.</TD>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String(char[])">String</A></B>(char[] value)</CODE>
+
+ <BR>
+ Allocates a new <code>String</code> so that it represents the sequence of
+ characters currently contained in the character array argument.</TD>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String(char[], int, int)">String</A></B>(char[] value,
+ int offset,
+ int count)</CODE>
+
+ <BR>
+ Allocates a new <code>String</code> that contains characters from a subarray
+ of the character array argument.</TD>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String(int[], int, int)">String</A></B>(int[] codePoints,
+ int offset,
+ int count)</CODE>
+
+ <BR>
+ Allocates a new <code>String</code> that contains characters from a subarray
+ of the Unicode code point array argument.</TD>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String(java.lang.String)">String</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> original)</CODE>
+
+ <BR>
+ Initializes a newly created <code>String</code> object so that it represents
+ the same sequence of characters as the argument; in other words, the
+ newly created string is a copy of the argument string.</TD>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String(java.lang.StringBuffer)">String</A></B>(<A HREF="../../java/lang/StringBuffer.html" title="class in java.lang">StringBuffer</A> buffer)</CODE>
+
+ <BR>
+ Allocates a new string that contains the sequence of characters
+ currently contained in the string buffer argument.</TD>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><B><A HREF="../../java/lang/String.html#String(java.lang.StringBuilder)">String</A></B>(<A HREF="../../java/lang/StringBuilder.html" title="class in java.lang">StringBuilder</A> builder)</CODE>
+
+ <BR>
+ Allocates a new string that contains the sequence of characters
+ currently contained in the string builder argument.</TD>
+ </TR>
+</TABLE>
+
+<!-- ========== METHOD SUMMARY =========== -->
+
+<A NAME="method_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+ <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+ <B>Method Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> char</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#charAt(int)">charAt</A></B>(int index)</CODE>
+
+ <BR>
+ Returns the <code>char</code> value at the
+ specified index.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#codePointAt(int)">codePointAt</A></B>(int index)</CODE>
+
+ <BR>
+ Returns the character (Unicode code point) at the specified
+ index.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#codePointBefore(int)">codePointBefore</A></B>(int index)</CODE>
+
+ <BR>
+ Returns the character (Unicode code point) before the specified
+ index.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#codePointCount(int, int)">codePointCount</A></B>(int beginIndex,
+ int endIndex)</CODE>
+
+ <BR>
+ Returns the number of Unicode code points in the specified text
+ range of this <code>String</code>.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#compareTo(java.lang.String)">compareTo</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> anotherString)</CODE>
+
+ <BR>
+ Compares two strings lexicographically.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#compareToIgnoreCase(java.lang.String)">compareToIgnoreCase</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</CODE>
+
+ <BR>
+ Compares two strings lexicographically, ignoring case
+ differences.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#concat(java.lang.String)">concat</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</CODE>
+
+ <BR>
+ Concatenates the specified string to the end of this string.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> boolean</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#contains(java.lang.CharSequence)">contains</A></B>(<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> s)</CODE>
+
+ <BR>
+ Returns true if and only if this string contains the specified
+ sequence of char values.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> boolean</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#contentEquals(java.lang.CharSequence)">contentEquals</A></B>(<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> cs)</CODE>
+
+ <BR>
+ Compares this string to the specified <code>CharSequence</code>.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> boolean</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#contentEquals(java.lang.StringBuffer)">contentEquals</A></B>(<A HREF="../../java/lang/StringBuffer.html" title="class in java.lang">StringBuffer</A> sb)</CODE>
+
+ <BR>
+ Compares this string to the specified <code>StringBuffer</code>.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE>static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#copyValueOf(char[])">copyValueOf</A></B>(char[] data)</CODE>
+
+ <BR>
+ Returns a String that represents the character sequence in the
+ array specified.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE>static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#copyValueOf(char[], int, int)">copyValueOf</A></B>(char[] data,
+ int offset,
+ int count)</CODE>
+
+ <BR>
+ Returns a String that represents the character sequence in the
+ array specified.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> boolean</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#endsWith(java.lang.String)">endsWith</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> suffix)</CODE>
+
+ <BR>
+ Tests if this string ends with the specified suffix.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> boolean</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#equals(java.lang.Object)">equals</A></B>(<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A> anObject)</CODE>
+
+ <BR>
+ Compares this string to the specified object.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> boolean</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#equalsIgnoreCase(java.lang.String)">equalsIgnoreCase</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> anotherString)</CODE>
+
+ <BR>
+ Compares this <code>String</code> to another <code>String</code>, ignoring case
+ considerations.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE>static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#format(java.util.Locale, java.lang.String, java.lang.Object...)">format</A></B>(<A HREF="../../java/util/Locale.html" title="class in java.util">Locale</A> l,
+ <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> format,
+ <A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A>... args)</CODE>
+
+ <BR>
+ Returns a formatted string using the specified locale, format string,
+ and arguments.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE>static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#format(java.lang.String, java.lang.Object...)">format</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> format,
+ <A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A>... args)</CODE>
+
+ <BR>
+ Returns a formatted string using the specified format string and
+ arguments.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> byte[]</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#getBytes()">getBytes</A></B>()</CODE>
+
+ <BR>
+ Encodes this <code>String</code> into a sequence of bytes using the
+ platform's default charset, storing the result into a new byte array.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> byte[]</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#getBytes(java.nio.charset.Charset)">getBytes</A></B>(<A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">Charset</A> charset)</CODE>
+
+ <BR>
+ Encodes this <code>String</code> into a sequence of bytes using the given
+ <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>, storing the result into a
+ new byte array.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> void</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#getBytes(int, int, byte[], int)">getBytes</A></B>(int srcBegin,
+ int srcEnd,
+ byte[] dst,
+ int dstBegin)</CODE>
+
+ <BR>
+ <B>Deprecated.</B> <I>This method does not properly convert characters into
+ bytes. As of JDK 1.1, the preferred way to do this is via the
+ <A HREF="../../java/lang/String.html#getBytes()"><CODE>getBytes()</CODE></A> method, which uses the platform's default charset.</I></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> byte[]</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#getBytes(java.lang.String)">getBytes</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> charsetName)</CODE>
+
+ <BR>
+ Encodes this <code>String</code> into a sequence of bytes using the named
+ charset, storing the result into a new byte array.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> void</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#getChars(int, int, char[], int)">getChars</A></B>(int srcBegin,
+ int srcEnd,
+ char[] dst,
+ int dstBegin)</CODE>
+
+ <BR>
+ Copies characters from this string into the destination character
+ array.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#hashCode()">hashCode</A></B>()</CODE>
+
+ <BR>
+ Returns a hash code for this string.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#indexOf(int)">indexOf</A></B>(int ch)</CODE>
+
+ <BR>
+ Returns the index within this string of the first occurrence of
+ the specified character.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#indexOf(int, int)">indexOf</A></B>(int ch,
+ int fromIndex)</CODE>
+
+ <BR>
+ Returns the index within this string of the first occurrence of the
+ specified character, starting the search at the specified index.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#indexOf(java.lang.String)">indexOf</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</CODE>
+
+ <BR>
+ Returns the index within this string of the first occurrence of the
+ specified substring.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#indexOf(java.lang.String, int)">indexOf</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str,
+ int fromIndex)</CODE>
+
+ <BR>
+ Returns the index within this string of the first occurrence of the
+ specified substring, starting at the specified index.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#intern()">intern</A></B>()</CODE>
+
+ <BR>
+ Returns a canonical representation for the string object.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> boolean</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#isEmpty()">isEmpty</A></B>()</CODE>
+
+ <BR>
+ Returns <tt>true</tt> if, and only if, <A HREF="../../java/lang/String.html#length()"><CODE>length()</CODE></A> is <tt>0</tt>.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#lastIndexOf(int)">lastIndexOf</A></B>(int ch)</CODE>
+
+ <BR>
+ Returns the index within this string of the last occurrence of
+ the specified character.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#lastIndexOf(int, int)">lastIndexOf</A></B>(int ch,
+ int fromIndex)</CODE>
+
+ <BR>
+ Returns the index within this string of the last occurrence of
+ the specified character, searching backward starting at the
+ specified index.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#lastIndexOf(java.lang.String)">lastIndexOf</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</CODE>
+
+ <BR>
+ Returns the index within this string of the rightmost occurrence
+ of the specified substring.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#lastIndexOf(java.lang.String, int)">lastIndexOf</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str,
+ int fromIndex)</CODE>
+
+ <BR>
+ Returns the index within this string of the last occurrence of the
+ specified substring, searching backward starting at the specified index.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#length()">length</A></B>()</CODE>
+
+ <BR>
+ Returns the length of this string.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> boolean</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#matches(java.lang.String)">matches</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex)</CODE>
+
+ <BR>
+ Tells whether or not this string matches the given <a
+ href="../util/regex/Pattern.html#sum">regular expression</a>.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> int</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#offsetByCodePoints(int, int)">offsetByCodePoints</A></B>(int index,
+ int codePointOffset)</CODE>
+
+ <BR>
+ Returns the index within this <code>String</code> that is
+ offset from the given <code>index</code> by
+ <code>codePointOffset</code> code points.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> boolean</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#regionMatches(boolean, int, java.lang.String, int, int)">regionMatches</A></B>(boolean ignoreCase,
+ int toffset,
+ <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> other,
+ int ooffset,
+ int len)</CODE>
+
+ <BR>
+ Tests if two string regions are equal.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> boolean</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#regionMatches(int, java.lang.String, int, int)">regionMatches</A></B>(int toffset,
+ <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> other,
+ int ooffset,
+ int len)</CODE>
+
+ <BR>
+ Tests if two string regions are equal.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#replace(char, char)">replace</A></B>(char oldChar,
+ char newChar)</CODE>
+
+ <BR>
+ Returns a new string resulting from replacing all occurrences of
+ <code>oldChar</code> in this string with <code>newChar</code>.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#replace(java.lang.CharSequence, java.lang.CharSequence)">replace</A></B>(<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> target,
+ <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> replacement)</CODE>
+
+ <BR>
+ Replaces each substring of this string that matches the literal target
+ sequence with the specified literal replacement sequence.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#replaceAll(java.lang.String, java.lang.String)">replaceAll</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex,
+ <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> replacement)</CODE>
+
+ <BR>
+ Replaces each substring of this string that matches the given <a
+ href="../util/regex/Pattern.html#sum">regular expression</a> with the
+ given replacement.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#replaceFirst(java.lang.String, java.lang.String)">replaceFirst</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex,
+ <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> replacement)</CODE>
+
+ <BR>
+ Replaces the first substring of this string that matches the given <a
+ href="../util/regex/Pattern.html#sum">regular expression</a> with the
+ given replacement.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A>[]</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#split(java.lang.String)">split</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex)</CODE>
+
+ <BR>
+ Splits this string around matches of the given <a
+ href="../util/regex/Pattern.html#sum">regular expression</a>.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A>[]</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#split(java.lang.String, int)">split</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex,
+ int limit)</CODE>
+
+ <BR>
+ Splits this string around matches of the given
+ <a href="../util/regex/Pattern.html#sum">regular expression</a>.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> boolean</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#startsWith(java.lang.String)">startsWith</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> prefix)</CODE>
+
+ <BR>
+ Tests if this string starts with the specified prefix.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> boolean</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#startsWith(java.lang.String, int)">startsWith</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> prefix,
+ int toffset)</CODE>
+
+ <BR>
+ Tests if the substring of this string beginning at the
+ specified index starts with the specified prefix.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#subSequence(int, int)">subSequence</A></B>(int beginIndex,
+ int endIndex)</CODE>
+
+ <BR>
+ Returns a new character sequence that is a subsequence of this sequence.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#substring(int)">substring</A></B>(int beginIndex)</CODE>
+
+ <BR>
+ Returns a new string that is a substring of this string.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#substring(int, int)">substring</A></B>(int beginIndex,
+ int endIndex)</CODE>
+
+ <BR>
+ Returns a new string that is a substring of this string.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> char[]</CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#toCharArray()">toCharArray</A></B>()</CODE>
+
+ <BR>
+ Converts this string to a new character array.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#toLowerCase()">toLowerCase</A></B>()</CODE>
+
+ <BR>
+ Converts all of the characters in this <code>String</code> to lower
+ case using the rules of the default locale.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#toLowerCase(java.util.Locale)">toLowerCase</A></B>(<A HREF="../../java/util/Locale.html" title="class in java.util">Locale</A> locale)</CODE>
+
+ <BR>
+ Converts all of the characters in this <code>String</code> to lower
+ case using the rules of the given <code>Locale</code>.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#toString()">toString</A></B>()</CODE>
+
+ <BR>
+ This object (which is already a string!) is itself returned.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#toUpperCase()">toUpperCase</A></B>()</CODE>
+
+ <BR>
+ Converts all of the characters in this <code>String</code> to upper
+ case using the rules of the default locale.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#toUpperCase(java.util.Locale)">toUpperCase</A></B>(<A HREF="../../java/util/Locale.html" title="class in java.util">Locale</A> locale)</CODE>
+
+ <BR>
+ Converts all of the characters in this <code>String</code> to upper
+ case using the rules of the given <code>Locale</code>.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE> <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#trim()">trim</A></B>()</CODE>
+
+ <BR>
+ Returns a copy of the string, with leading and trailing whitespace
+ omitted.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE>static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(boolean)">valueOf</A></B>(boolean b)</CODE>
+
+ <BR>
+ Returns the string representation of the <code>boolean</code> argument.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE>static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(char)">valueOf</A></B>(char c)</CODE>
+
+ <BR>
+ Returns the string representation of the <code>char</code>
+ argument.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE>static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(char[])">valueOf</A></B>(char[] data)</CODE>
+
+ <BR>
+ Returns the string representation of the <code>char</code> array
+ argument.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE>static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(char[], int, int)">valueOf</A></B>(char[] data,
+ int offset,
+ int count)</CODE>
+
+ <BR>
+ Returns the string representation of a specific subarray of the
+ <code>char</code> array argument.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE>static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(double)">valueOf</A></B>(double d)</CODE>
+
+ <BR>
+ Returns the string representation of the <code>double</code> argument.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE>static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(float)">valueOf</A></B>(float f)</CODE>
+
+ <BR>
+ Returns the string representation of the <code>float</code> argument.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE>static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(int)">valueOf</A></B>(int i)</CODE>
+
+ <BR>
+ Returns the string representation of the <code>int</code> argument.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE>static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(long)">valueOf</A></B>(long l)</CODE>
+
+ <BR>
+ Returns the string representation of the <code>long</code> argument.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+ <CODE>static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
+ <TD><CODE><B><A HREF="../../java/lang/String.html#valueOf(java.lang.Object)">valueOf</A></B>(<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A> obj)</CODE>
+
+ <BR>
+ Returns the string representation of the <code>Object</code> argument.</TD>
+</TR>
+</TABLE>
+ <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+ <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+ <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></B></TH>
+ </TR>
+ <TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD><CODE><A HREF="../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD>
+ </TR>
+</TABLE>
+
+<P>
+
+ <!-- ============ FIELD DETAIL =========== -->
+
+ <A NAME="field_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+ <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+ <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+ <B>Field Detail</B></FONT></TH>
+ </TR>
+</TABLE>
+
+<A NAME="CASE_INSENSITIVE_ORDER"><!-- --></A><H3>
+ CASE_INSENSITIVE_ORDER</H3>
+<PRE>
+public static final <A HREF="../../java/util/Comparator.html" title="interface in java.util">Comparator</A><<A HREF="../../java/lang/String.html" title="class in java.lang">String</A>> <B>CASE_INSENSITIVE_ORDER</B></PRE>
+<DL>
+ <DD>A Comparator that orders <code>String</code> objects as by
+ <code>compareToIgnoreCase</code>. This comparator is serializable.
+ <p>
+ Note that this Comparator does <em>not</em> take locale into account,
+ and will result in an unsatisfactory ordering for certain locales.
+ The java.text package provides <em>Collators</em> to allow
+ locale-sensitive ordering.
+ <P>
+ <DL>
+ <DT><B>Since:</B></DT>
+ <DD>1.2</DD>
+ <DT><B>See Also:</B><DD><A HREF="../../java/text/Collator.html#compare(java.lang.String, java.lang.String)"><CODE>Collator.compare(String, String)</CODE></A></DL>
+</DL>
+
+<!-- ========= CONSTRUCTOR DETAIL ======== -->
+
+<A NAME="constructor_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+ <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+ <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+ <B>Constructor Detail</B></FONT></TH>
+ </TR>
+</TABLE>
+
+<A NAME="String()"><!-- --></A><H3>
+ String</H3>
+<PRE>
+public <B>String</B>()</PRE>
+<DL>
+ <DD>Initializes a newly created <code>String</code> object so that it represents
+ an empty character sequence. Note that use of this constructor is
+ unnecessary since Strings are immutable.
+ <P>
+</DL>
+<HR>
+
+<A NAME="String(java.lang.String)"><!-- --></A><H3>
+ String</H3>
+<PRE>
+public <B>String</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> original)</PRE>
+<DL>
+ <DD>Initializes a newly created <code>String</code> object so that it represents
+ the same sequence of characters as the argument; in other words, the
+ newly created string is a copy of the argument string. Unless an
+ explicit copy of <code>original</code> is needed, use of this constructor is
+ unnecessary since Strings are immutable.
+ <P>
+ <DL>
+ <DT><B>Parameters:</B><DD><CODE>original</CODE> - A <code>String</code></DL>
+</DL>
+<HR>
+
+<A NAME="String(char[])"><!-- --></A><H3>
+ String</H3>
+<PRE>
+public <B>String</B>(char[] value)</PRE>
+<DL>
+ <DD>Allocates a new <code>String</code> so that it represents the sequence of
+ characters currently contained in the character array argument. The
+ contents of the character array are copied; subsequent modification of
+ the character array does not affect the newly created string.
+ <P>
+ <DL>
+ <DT><B>Parameters:</B><DD><CODE>value</CODE> - The initial value of the string</DL>
+</DL>
+<HR>
+
+<A NAME="String(char[], int, int)"><!-- --></A><H3>
+ String</H3>
+<PRE>
+public <B>String</B>(char[] value,
+ int offset,
+ int count)</PRE>
+<DL>
+ <DD>Allocates a new <code>String</code> that contains characters from a subarray
+ of the character array argument. The <code>offset</code> argument is the
+ index of the first character of the subarray and the <code>count</code>
+ argument specifies the length of the subarray. The contents of the
+ subarray are copied; subsequent modification of the character array does
+ not affect the newly created string.
+ <P>
+ <DL>
+ <DT><B>Parameters:</B><DD><CODE>value</CODE> - Array that is the source of characters<DD><CODE>offset</CODE> - The initial offset<DD><CODE>count</CODE> - The length
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If the <code>offset</code> and <code>count</code> arguments index
+ characters outside the bounds of the <code>value</code> array</DL>
+</DL>
+<HR>
+
+<A NAME="String(int[], int, int)"><!-- --></A><H3>
+ String</H3>
+<PRE>
+public <B>String</B>(int[] codePoints,
+ int offset,
+ int count)</PRE>
+<DL>
+ <DD>Allocates a new <code>String</code> that contains characters from a subarray
+ of the Unicode code point array argument. The <code>offset</code> argument
+ is the index of the first code point of the subarray and the
+ <code>count</code> argument specifies the length of the subarray. The
+ contents of the subarray are converted to <code>char</code>s; subsequent
+ modification of the <code>int</code> array does not affect the newly created
+ string.
+ <P>
+ <DL>
+ <DT><B>Parameters:</B><DD><CODE>codePoints</CODE> - Array that is the source of Unicode code points<DD><CODE>offset</CODE> - The initial offset<DD><CODE>count</CODE> - The length
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - If any invalid Unicode code point is found in <code>codePoints</code>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If the <code>offset</code> and <code>count</code> arguments index
+ characters outside the bounds of the <code>codePoints</code> array<DT><B>Since:</B></DT>
+ <DD>1.5</DD>
+ </DL>
+</DL>
+<HR>
+
+<A NAME="String(byte[], int, int, int)"><!-- --></A><H3>
+ String</H3>
+<PRE>
+<FONT SIZE="-1"><A HREF="../../java/lang/Deprecated.html" title="annotation in java.lang">@Deprecated</A>
+</FONT>public <B>String</B>(byte[] ascii,
+ int hibyte,
+ int offset,
+ int count)</PRE>
+<DL>
+ <DD><B>Deprecated.</B> <I>This method does not properly convert bytes into characters.
+ As of JDK 1.1, the preferred way to do this is via the
+ <code>String</code> constructors that take a <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset"><CODE>Charset</CODE></A>, charset name, or that use the platform's
+ default charset.</I>
+ <P>
+ <DD>Allocates a new <code>String</code> constructed from a subarray of an array
+ of 8-bit integer values.
+
+ <p> The <code>offset</code> argument is the index of the first byte of the
+ subarray, and the <code>count</code> argument specifies the length of the
+ subarray.
+
+ <p> Each <code>byte</code> in the subarray is converted to a <code>char</code> as
+ specified in the method above.
+ <P>
+ <DL>
+ <DT><B>Parameters:</B><DD><CODE>ascii</CODE> - The bytes to be converted to characters<DD><CODE>hibyte</CODE> - The top 8 bits of each 16-bit Unicode code unit<DD><CODE>offset</CODE> - The initial offset<DD><CODE>count</CODE> - The length
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If the <code>offset</code> or <code>count</code> argument is invalid<DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#String(byte[], int)"><CODE>String(byte[], int)</CODE></A>,
+ <A HREF="../../java/lang/String.html#String(byte[], int, int, java.lang.String)"><CODE>String(byte[], int, int, java.lang.String)</CODE></A>,
+ <A HREF="../../java/lang/String.html#String(byte[], int, int, java.nio.charset.Charset)"><CODE>String(byte[], int, int, java.nio.charset.Charset)</CODE></A>,
+ <A HREF="../../java/lang/String.html#String(byte[], int, int)"><CODE>String(byte[], int, int)</CODE></A>,
+ <A HREF="../../java/lang/String.html#String(byte[], java.lang.String)"><CODE>String(byte[], java.lang.String)</CODE></A>,
+ <A HREF="../../java/lang/String.html#String(byte[], java.nio.charset.Charset)"><CODE>String(byte[], java.nio.charset.Charset)</CODE></A>,
+ <A HREF="../../java/lang/String.html#String(byte[])"><CODE>String(byte[])</CODE></A></DL>
+</DL>
+<HR>
+
+<A NAME="String(byte[], int)"><!-- --></A><H3>
+ String</H3>
+<PRE>
+<FONT SIZE="-1"><A HREF="../../java/lang/Deprecated.html" title="annotation in java.lang">@Deprecated</A>
+</FONT>public <B>String</B>(byte[] ascii,
+ int hibyte)</PRE>
+<DL>
+ <DD><B>Deprecated.</B> <I>This method does not properly convert bytes into
+ characters. As of JDK 1.1, the preferred way to do this is via the
+ <code>String</code> constructors that take a <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset"><CODE>Charset</CODE></A>, charset name, or that use the platform's
+ default charset.</I>
+ <P>
+ <DD>Allocates a new <code>String</code> containing characters constructed from
+ an array of 8-bit integer values. Each character <i>c</i>in the
+ resulting string is constructed from the corresponding component
+ <i>b</i> in the byte array such that:
+
+ <blockquote><pre>
+ <b><i>c</i></b> == (char)(((hibyte & 0xff) << 8)
+ | (<b><i>b</i></b> & 0xff))
+ </pre></blockquote>
+ <P>
+ <DL>
+ <DT><B>Parameters:</B><DD><CODE>ascii</CODE> - The bytes to be converted to characters<DD><CODE>hibyte</CODE> - The top 8 bits of each 16-bit Unicode code unit<DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#String(byte[], int, int, java.lang.String)"><CODE>String(byte[], int, int, java.lang.String)</CODE></A>,
+ <A HREF="../../java/lang/String.html#String(byte[], int, int, java.nio.charset.Charset)"><CODE>String(byte[], int, int, java.nio.charset.Charset)</CODE></A>,
+ <A HREF="../../java/lang/String.html#String(byte[], int, int)"><CODE>String(byte[], int, int)</CODE></A>,
+ <A HREF="../../java/lang/String.html#String(byte[], java.lang.String)"><CODE>String(byte[], java.lang.String)</CODE></A>,
+ <A HREF="../../java/lang/String.html#String(byte[], java.nio.charset.Charset)"><CODE>String(byte[], java.nio.charset.Charset)</CODE></A>,
+ <A HREF="../../java/lang/String.html#String(byte[])"><CODE>String(byte[])</CODE></A></DL>
+</DL>
+<HR>
+
+<A NAME="String(byte[], int, int, java.lang.String)"><!-- --></A><H3>
+ String</H3>
+<PRE>
+public <B>String</B>(byte[] bytes,
+ int offset,
+ int length,
+ <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> charsetName)
+ throws <A HREF="../../java/io/UnsupportedEncodingException.html" title="class in java.io">UnsupportedEncodingException</A></PRE>
+<DL>
+ <DD>Constructs a new <code>String</code> by decoding the specified subarray of
+ bytes using the specified charset. The length of the new <code>String</code>
+ is a function of the charset, and hence may not be equal to the length
+ of the subarray.
+
+ <p> The behavior of this constructor when the given bytes are not valid
+ in the given charset is unspecified. The <A HREF="../../java/nio/charset/CharsetDecoder.html" title="class in java.nio.charset"><CODE>CharsetDecoder</CODE></A> class should be used when more control
+ over the decoding process is required.
+ <P>
+ <DL>
+ <DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be decoded into characters<DD><CODE>offset</CODE> - The index of the first byte to decode<DD><CODE>length</CODE> - The number of bytes to decode<DD><CODE>charsetName</CODE> - The name of a supported <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/io/UnsupportedEncodingException.html" title="class in java.io">UnsupportedEncodingException</A></CODE> - If the named charset is not supported
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If the <code>offset</code> and <code>length</code> arguments index
+ characters outside the bounds of the <code>bytes</code> array<DT><B>Since:</B></DT>
+ <DD>JDK1.1</DD>
+ </DL>
+</DL>
+<HR>
+
+<A NAME="String(byte[], int, int, java.nio.charset.Charset)"><!-- --></A><H3>
+ String</H3>
+<PRE>
+public <B>String</B>(byte[] bytes,
+ int offset,
+ int length,
+ <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">Charset</A> charset)</PRE>
+<DL>
+ <DD>Constructs a new <code>String</code> by decoding the specified subarray of
+ bytes using the specified <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>.
+ The length of the new <code>String</code> is a function of the charset, and
+ hence may not be equal to the length of the subarray.
+
+ <p> This method always replaces malformed-input and unmappable-character
+ sequences with this charset's default replacement string. The <A HREF="../../java/nio/charset/CharsetDecoder.html" title="class in java.nio.charset"><CODE>CharsetDecoder</CODE></A> class should be used when more control
+ over the decoding process is required.
+ <P>
+ <DL>
+ <DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be decoded into characters<DD><CODE>offset</CODE> - The index of the first byte to decode<DD><CODE>length</CODE> - The number of bytes to decode<DD><CODE>charset</CODE> - The <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A> to be used to
+ decode the <code>bytes</code>
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If the <code>offset</code> and <code>length</code> arguments index
+ characters outside the bounds of the <code>bytes</code> array<DT><B>Since:</B></DT>
+ <DD>1.6</DD>
+ </DL>
+</DL>
+<HR>
+
+<A NAME="String(byte[], java.lang.String)"><!-- --></A><H3>
+ String</H3>
+<PRE>
+public <B>String</B>(byte[] bytes,
+ <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> charsetName)
+ throws <A HREF="../../java/io/UnsupportedEncodingException.html" title="class in java.io">UnsupportedEncodingException</A></PRE>
+<DL>
+ <DD>Constructs a new <code>String</code> by decoding the specified array of bytes
+ using the specified <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>. The
+ length of the new <code>String</code> is a function of the charset, and hence
+ may not be equal to the length of the byte array.
+
+ <p> The behavior of this constructor when the given bytes are not valid
+ in the given charset is unspecified. The <A HREF="../../java/nio/charset/CharsetDecoder.html" title="class in java.nio.charset"><CODE>CharsetDecoder</CODE></A> class should be used when more control
+ over the decoding process is required.
+ <P>
+ <DL>
+ <DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be decoded into characters<DD><CODE>charsetName</CODE> - The name of a supported <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/io/UnsupportedEncodingException.html" title="class in java.io">UnsupportedEncodingException</A></CODE> - If the named charset is not supported<DT><B>Since:</B></DT>
+ <DD>JDK1.1</DD>
+ </DL>
+</DL>
+<HR>
+
+<A NAME="String(byte[], java.nio.charset.Charset)"><!-- --></A><H3>
+ String</H3>
+<PRE>
+public <B>String</B>(byte[] bytes,
+ <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">Charset</A> charset)</PRE>
+<DL>
+ <DD>Constructs a new <code>String</code> by decoding the specified array of
+ bytes using the specified <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>.
+ The length of the new <code>String</code> is a function of the charset, and
+ hence may not be equal to the length of the byte array.
+
+ <p> This method always replaces malformed-input and unmappable-character
+ sequences with this charset's default replacement string. The <A HREF="../../java/nio/charset/CharsetDecoder.html" title="class in java.nio.charset"><CODE>CharsetDecoder</CODE></A> class should be used when more control
+ over the decoding process is required.
+ <P>
+ <DL>
+ <DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be decoded into characters<DD><CODE>charset</CODE> - The <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A> to be used to
+ decode the <code>bytes</code><DT><B>Since:</B></DT>
+ <DD>1.6</DD>
+ </DL>
+</DL>
+<HR>
+
+<A NAME="String(byte[], int, int)"><!-- --></A><H3>
+ String</H3>
+<PRE>
+public <B>String</B>(byte[] bytes,
+ int offset,
+ int length)</PRE>
+<DL>
+ <DD>Constructs a new <code>String</code> by decoding the specified subarray of
+ bytes using the platform's default charset. The length of the new
+ <code>String</code> is a function of the charset, and hence may not be equal
+ to the length of the subarray.
+
+ <p> The behavior of this constructor when the given bytes are not valid
+ in the default charset is unspecified. The <A HREF="../../java/nio/charset/CharsetDecoder.html" title="class in java.nio.charset"><CODE>CharsetDecoder</CODE></A> class should be used when more control
+ over the decoding process is required.
+ <P>
+ <DL>
+ <DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be decoded into characters<DD><CODE>offset</CODE> - The index of the first byte to decode<DD><CODE>length</CODE> - The number of bytes to decode
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If the <code>offset</code> and the <code>length</code> arguments index
+ characters outside the bounds of the <code>bytes</code> array<DT><B>Since:</B></DT>
+ <DD>JDK1.1</DD>
+ </DL>
+</DL>
+<HR>
+
+<A NAME="String(byte[])"><!-- --></A><H3>
+ String</H3>
+<PRE>
+public <B>String</B>(byte[] bytes)</PRE>
+<DL>
+ <DD>Constructs a new <code>String</code> by decoding the specified array of bytes
+ using the platform's default charset. The length of the new <code>String</code> is a function of the charset, and hence may not be equal to the
+ length of the byte array.
+
+ <p> The behavior of this constructor when the given bytes are not valid
+ in the default charset is unspecified. The <A HREF="../../java/nio/charset/CharsetDecoder.html" title="class in java.nio.charset"><CODE>CharsetDecoder</CODE></A> class should be used when more control
+ over the decoding process is required.
+ <P>
+ <DL>
+ <DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be decoded into characters<DT><B>Since:</B></DT>
+ <DD>JDK1.1</DD>
+ </DL>
+</DL>
+<HR>
+
+<A NAME="String(java.lang.StringBuffer)"><!-- --></A><H3>
+ String</H3>
+<PRE>
+public <B>String</B>(<A HREF="../../java/lang/StringBuffer.html" title="class in java.lang">StringBuffer</A> buffer)</PRE>
+<DL>
+ <DD>Allocates a new string that contains the sequence of characters
+ currently contained in the string buffer argument. The contents of the
+ string buffer are copied; subsequent modification of the string buffer
+ does not affect the newly created string.
+ <P>
+ <DL>
+ <DT><B>Parameters:</B><DD><CODE>buffer</CODE> - A <code>StringBuffer</code></DL>
+</DL>
+<HR>
+
+<A NAME="String(java.lang.StringBuilder)"><!-- --></A><H3>
+ String</H3>
+<PRE>
+public <B>String</B>(<A HREF="../../java/lang/StringBuilder.html" title="class in java.lang">StringBuilder</A> builder)</PRE>
+<DL>
+ <DD>Allocates a new string that contains the sequence of characters
+ currently contained in the string builder argument. The contents of the
+ string builder are copied; subsequent modification of the string builder
+ does not affect the newly created string.
+
+ <p> This constructor is provided to ease migration to <code>StringBuilder</code>. Obtaining a string from a string builder via the <code>toString</code> method is likely to run faster and is generally preferred.
+ <P>
+ <DL>
+ <DT><B>Parameters:</B><DD><CODE>builder</CODE> - A <code>StringBuilder</code><DT><B>Since:</B></DT>
+ <DD>1.5</DD>
+ </DL>
+</DL>
+
+<!-- ============ METHOD DETAIL ========== -->
+
+<A NAME="method_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+ <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+ <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+ <B>Method Detail</B></FONT></TH>
+ </TR>
+</TABLE>
+
+<A NAME="length()"><!-- --></A><H3>
+ length</H3>
+<PRE>
+public int <B>length</B>()</PRE>
+<DL>
+ <DD>Returns the length of this string.
+ The length is equal to the number of <a href="Character.html#unicode">Unicode
+ code units</a> in the string.
+ <P>
+ <DD><DL>
+ <DT><B>Specified by:</B><DD><CODE><A HREF="../../java/lang/CharSequence.html#length()">length</A></CODE> in interface <CODE><A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A></CODE></DL>
+ </DD>
+ <DD><DL>
+
+ <DT><B>Returns:</B><DD>the length of the sequence of characters represented by this
+ object.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="isEmpty()"><!-- --></A><H3>
+ isEmpty</H3>
+<PRE>
+public boolean <B>isEmpty</B>()</PRE>
+<DL>
+ <DD>Returns <tt>true</tt> if, and only if, <A HREF="../../java/lang/String.html#length()"><CODE>length()</CODE></A> is <tt>0</tt>.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+
+ <DT><B>Returns:</B><DD><tt>true</tt> if <A HREF="../../java/lang/String.html#length()"><CODE>length()</CODE></A> is <tt>0</tt>, otherwise
+ <tt>false</tt><DT><B>Since:</B></DT>
+ <DD>1.6</DD>
+ </DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="charAt(int)"><!-- --></A><H3>
+ charAt</H3>
+<PRE>
+public char <B>charAt</B>(int index)</PRE>
+<DL>
+ <DD>Returns the <code>char</code> value at the
+ specified index. An index ranges from <code>0</code> to
+ <code>length() - 1</code>. The first <code>char</code> value of the sequence
+ is at index <code>0</code>, the next at index <code>1</code>,
+ and so on, as for array indexing.
+
+ <p>If the <code>char</code> value specified by the index is a
+ <a href="Character.html#unicode">surrogate</a>, the surrogate
+ value is returned.
+ <P>
+ <DD><DL>
+ <DT><B>Specified by:</B><DD><CODE><A HREF="../../java/lang/CharSequence.html#charAt(int)">charAt</A></CODE> in interface <CODE><A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A></CODE></DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>index</CODE> - the index of the <code>char</code> value.
+ <DT><B>Returns:</B><DD>the <code>char</code> value at the specified index of this string.
+ The first <code>char</code> value is at index <code>0</code>.
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if the <code>index</code>
+ argument is negative or not less than the length of this
+ string.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="codePointAt(int)"><!-- --></A><H3>
+ codePointAt</H3>
+<PRE>
+public int <B>codePointAt</B>(int index)</PRE>
+<DL>
+ <DD>Returns the character (Unicode code point) at the specified
+ index. The index refers to <code>char</code> values
+ (Unicode code units) and ranges from <code>0</code> to
+ <A HREF="../../java/lang/String.html#length()"><CODE>length()</CODE></A><code> - 1</code>.
+
+ <p> If the <code>char</code> value specified at the given index
+ is in the high-surrogate range, the following index is less
+ than the length of this <code>String</code>, and the
+ <code>char</code> value at the following index is in the
+ low-surrogate range, then the supplementary code point
+ corresponding to this surrogate pair is returned. Otherwise,
+ the <code>char</code> value at the given index is returned.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>index</CODE> - the index to the <code>char</code> values
+ <DT><B>Returns:</B><DD>the code point value of the character at the
+ <code>index</code>
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if the <code>index</code>
+ argument is negative or not less than the length of this
+ string.<DT><B>Since:</B></DT>
+ <DD>1.5</DD>
+ </DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="codePointBefore(int)"><!-- --></A><H3>
+ codePointBefore</H3>
+<PRE>
+public int <B>codePointBefore</B>(int index)</PRE>
+<DL>
+ <DD>Returns the character (Unicode code point) before the specified
+ index. The index refers to <code>char</code> values
+ (Unicode code units) and ranges from <code>1</code> to <A HREF="../../java/lang/CharSequence.html#length()"><CODE>length</CODE></A>.
+
+ <p> If the <code>char</code> value at <code>(index - 1)</code>
+ is in the low-surrogate range, <code>(index - 2)</code> is not
+ negative, and the <code>char</code> value at <code>(index -
+ 2)</code> is in the high-surrogate range, then the
+ supplementary code point value of the surrogate pair is
+ returned. If the <code>char</code> value at <code>index -
+ 1</code> is an unpaired low-surrogate or a high-surrogate, the
+ surrogate value is returned.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>index</CODE> - the index following the code point that should be returned
+ <DT><B>Returns:</B><DD>the Unicode code point value before the given index.
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if the <code>index</code>
+ argument is less than 1 or greater than the length
+ of this string.<DT><B>Since:</B></DT>
+ <DD>1.5</DD>
+ </DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="codePointCount(int, int)"><!-- --></A><H3>
+ codePointCount</H3>
+<PRE>
+public int <B>codePointCount</B>(int beginIndex,
+ int endIndex)</PRE>
+<DL>
+ <DD>Returns the number of Unicode code points in the specified text
+ range of this <code>String</code>. The text range begins at the
+ specified <code>beginIndex</code> and extends to the
+ <code>char</code> at index <code>endIndex - 1</code>. Thus the
+ length (in <code>char</code>s) of the text range is
+ <code>endIndex-beginIndex</code>. Unpaired surrogates within
+ the text range count as one code point each.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>beginIndex</CODE> - the index to the first <code>char</code> of
+ the text range.<DD><CODE>endIndex</CODE> - the index after the last <code>char</code> of
+ the text range.
+ <DT><B>Returns:</B><DD>the number of Unicode code points in the specified text
+ range
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if the
+ <code>beginIndex</code> is negative, or <code>endIndex</code>
+ is larger than the length of this <code>String</code>, or
+ <code>beginIndex</code> is larger than <code>endIndex</code>.<DT><B>Since:</B></DT>
+ <DD>1.5</DD>
+ </DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="offsetByCodePoints(int, int)"><!-- --></A><H3>
+ offsetByCodePoints</H3>
+<PRE>
+public int <B>offsetByCodePoints</B>(int index,
+ int codePointOffset)</PRE>
+<DL>
+ <DD>Returns the index within this <code>String</code> that is
+ offset from the given <code>index</code> by
+ <code>codePointOffset</code> code points. Unpaired surrogates
+ within the text range given by <code>index</code> and
+ <code>codePointOffset</code> count as one code point each.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>index</CODE> - the index to be offset<DD><CODE>codePointOffset</CODE> - the offset in code points
+ <DT><B>Returns:</B><DD>the index within this <code>String</code>
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if <code>index</code>
+ is negative or larger then the length of this
+ <code>String</code>, or if <code>codePointOffset</code> is positive
+ and the substring starting with <code>index</code> has fewer
+ than <code>codePointOffset</code> code points,
+ or if <code>codePointOffset</code> is negative and the substring
+ before <code>index</code> has fewer than the absolute value
+ of <code>codePointOffset</code> code points.<DT><B>Since:</B></DT>
+ <DD>1.5</DD>
+ </DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="getChars(int, int, char[], int)"><!-- --></A><H3>
+ getChars</H3>
+<PRE>
+public void <B>getChars</B>(int srcBegin,
+ int srcEnd,
+ char[] dst,
+ int dstBegin)</PRE>
+<DL>
+ <DD>Copies characters from this string into the destination character
+ array.
+ <p>
+ The first character to be copied is at index <code>srcBegin</code>;
+ the last character to be copied is at index <code>srcEnd-1</code>
+ (thus the total number of characters to be copied is
+ <code>srcEnd-srcBegin</code>). The characters are copied into the
+ subarray of <code>dst</code> starting at index <code>dstBegin</code>
+ and ending at index:
+ <p><blockquote><pre>
+ dstbegin + (srcEnd-srcBegin) - 1
+ </pre></blockquote>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>srcBegin</CODE> - index of the first character in the string
+ to copy.<DD><CODE>srcEnd</CODE> - index after the last character in the string
+ to copy.<DD><CODE>dst</CODE> - the destination array.<DD><CODE>dstBegin</CODE> - the start offset in the destination array.
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If any of the following
+ is true:
+ <ul><li><code>srcBegin</code> is negative.
+ <li><code>srcBegin</code> is greater than <code>srcEnd</code>
+ <li><code>srcEnd</code> is greater than the length of this
+ string
+ <li><code>dstBegin</code> is negative
+ <li><code>dstBegin+(srcEnd-srcBegin)</code> is larger than
+ <code>dst.length</code></ul></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="getBytes(int, int, byte[], int)"><!-- --></A><H3>
+ getBytes</H3>
+<PRE>
+<FONT SIZE="-1"><A HREF="../../java/lang/Deprecated.html" title="annotation in java.lang">@Deprecated</A>
+</FONT>public void <B>getBytes</B>(int srcBegin,
+ int srcEnd,
+ byte[] dst,
+ int dstBegin)</PRE>
+<DL>
+ <DD><B>Deprecated.</B> <I>This method does not properly convert characters into
+ bytes. As of JDK 1.1, the preferred way to do this is via the
+ <A HREF="../../java/lang/String.html#getBytes()"><CODE>getBytes()</CODE></A> method, which uses the platform's default charset.</I>
+ <P>
+ <DD>Copies characters from this string into the destination byte array. Each
+ byte receives the 8 low-order bits of the corresponding character. The
+ eight high-order bits of each character are not copied and do not
+ participate in the transfer in any way.
+
+ <p> The first character to be copied is at index <code>srcBegin</code>; the
+ last character to be copied is at index <code>srcEnd-1</code>. The total
+ number of characters to be copied is <code>srcEnd-srcBegin</code>. The
+ characters, converted to bytes, are copied into the subarray of <code>dst</code> starting at index <code>dstBegin</code> and ending at index:
+
+ <blockquote><pre>
+ dstbegin + (srcEnd-srcBegin) - 1
+ </pre></blockquote>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>srcBegin</CODE> - Index of the first character in the string to copy<DD><CODE>srcEnd</CODE> - Index after the last character in the string to copy<DD><CODE>dst</CODE> - The destination array<DD><CODE>dstBegin</CODE> - The start offset in the destination array
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - If any of the following is true:
+ <ul>
+ <li> <code>srcBegin</code> is negative
+ <li> <code>srcBegin</code> is greater than <code>srcEnd</code>
+ <li> <code>srcEnd</code> is greater than the length of this String
+ <li> <code>dstBegin</code> is negative
+ <li> <code>dstBegin+(srcEnd-srcBegin)</code> is larger than <code>dst.length</code>
+ </ul></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="getBytes(java.lang.String)"><!-- --></A><H3>
+ getBytes</H3>
+<PRE>
+public byte[] <B>getBytes</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> charsetName)
+ throws <A HREF="../../java/io/UnsupportedEncodingException.html" title="class in java.io">UnsupportedEncodingException</A></PRE>
+<DL>
+ <DD>Encodes this <code>String</code> into a sequence of bytes using the named
+ charset, storing the result into a new byte array.
+
+ <p> The behavior of this method when this string cannot be encoded in
+ the given charset is unspecified. The <A HREF="../../java/nio/charset/CharsetEncoder.html" title="class in java.nio.charset"><CODE>CharsetEncoder</CODE></A> class should be used when more control
+ over the encoding process is required.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>charsetName</CODE> - The name of a supported <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>
+ <DT><B>Returns:</B><DD>The resultant byte array
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/io/UnsupportedEncodingException.html" title="class in java.io">UnsupportedEncodingException</A></CODE> - If the named charset is not supported<DT><B>Since:</B></DT>
+ <DD>JDK1.1</DD>
+ </DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="getBytes(java.nio.charset.Charset)"><!-- --></A><H3>
+ getBytes</H3>
+<PRE>
+public byte[] <B>getBytes</B>(<A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">Charset</A> charset)</PRE>
+<DL>
+ <DD>Encodes this <code>String</code> into a sequence of bytes using the given
+ <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">charset</A>, storing the result into a
+ new byte array.
+
+ <p> This method always replaces malformed-input and unmappable-character
+ sequences with this charset's default replacement byte array. The
+ <A HREF="../../java/nio/charset/CharsetEncoder.html" title="class in java.nio.charset"><CODE>CharsetEncoder</CODE></A> class should be used when more
+ control over the encoding process is required.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>charset</CODE> - The <A HREF="../../java/nio/charset/Charset.html" title="class in java.nio.charset">Charset</A> to be used to encode
+ the <code>String</code>
+ <DT><B>Returns:</B><DD>The resultant byte array<DT><B>Since:</B></DT>
+ <DD>1.6</DD>
+ </DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="getBytes()"><!-- --></A><H3>
+ getBytes</H3>
+<PRE>
+public byte[] <B>getBytes</B>()</PRE>
+<DL>
+ <DD>Encodes this <code>String</code> into a sequence of bytes using the
+ platform's default charset, storing the result into a new byte array.
+
+ <p> The behavior of this method when this string cannot be encoded in
+ the default charset is unspecified. The <A HREF="../../java/nio/charset/CharsetEncoder.html" title="class in java.nio.charset"><CODE>CharsetEncoder</CODE></A> class should be used when more control
+ over the encoding process is required.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+
+ <DT><B>Returns:</B><DD>The resultant byte array<DT><B>Since:</B></DT>
+ <DD>JDK1.1</DD>
+ </DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="equals(java.lang.Object)"><!-- --></A><H3>
+ equals</H3>
+<PRE>
+public boolean <B>equals</B>(<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A> anObject)</PRE>
+<DL>
+ <DD>Compares this string to the specified object. The result is <code>true</code> if and only if the argument is not <code>null</code> and is a <code>String</code> object that represents the same sequence of characters as this
+ object.
+ <P>
+ <DD><DL>
+ <DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></CODE></DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>anObject</CODE> - The object to compare this <code>String</code> against
+ <DT><B>Returns:</B><DD><code>true</code> if the given object represents a <code>String</code>
+ equivalent to this string, <code>false</code> otherwise<DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#compareTo(java.lang.String)"><CODE>compareTo(String)</CODE></A>,
+ <A HREF="../../java/lang/String.html#equalsIgnoreCase(java.lang.String)"><CODE>equalsIgnoreCase(String)</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="contentEquals(java.lang.StringBuffer)"><!-- --></A><H3>
+ contentEquals</H3>
+<PRE>
+public boolean <B>contentEquals</B>(<A HREF="../../java/lang/StringBuffer.html" title="class in java.lang">StringBuffer</A> sb)</PRE>
+<DL>
+ <DD>Compares this string to the specified <code>StringBuffer</code>. The result
+ is <code>true</code> if and only if this <code>String</code> represents the same
+ sequence of characters as the specified <code>StringBuffer</code>.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>sb</CODE> - The <code>StringBuffer</code> to compare this <code>String</code> against
+ <DT><B>Returns:</B><DD><code>true</code> if this <code>String</code> represents the same
+ sequence of characters as the specified <code>StringBuffer</code>,
+ <code>false</code> otherwise<DT><B>Since:</B></DT>
+ <DD>1.4</DD>
+ </DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="contentEquals(java.lang.CharSequence)"><!-- --></A><H3>
+ contentEquals</H3>
+<PRE>
+public boolean <B>contentEquals</B>(<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> cs)</PRE>
+<DL>
+ <DD>Compares this string to the specified <code>CharSequence</code>. The result
+ is <code>true</code> if and only if this <code>String</code> represents the same
+ sequence of char values as the specified sequence.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>cs</CODE> - The sequence to compare this <code>String</code> against
+ <DT><B>Returns:</B><DD><code>true</code> if this <code>String</code> represents the same
+ sequence of char values as the specified sequence, <code>false</code> otherwise<DT><B>Since:</B></DT>
+ <DD>1.5</DD>
+ </DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="equalsIgnoreCase(java.lang.String)"><!-- --></A><H3>
+ equalsIgnoreCase</H3>
+<PRE>
+public boolean <B>equalsIgnoreCase</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> anotherString)</PRE>
+<DL>
+ <DD>Compares this <code>String</code> to another <code>String</code>, ignoring case
+ considerations. Two strings are considered equal ignoring case if they
+ are of the same length and corresponding characters in the two strings
+ are equal ignoring case.
+
+ <p> Two characters <code>c1</code> and <code>c2</code> are considered the same
+ ignoring case if at least one of the following is true:
+ <ul>
+ <li> The two characters are the same (as compared by the
+ <code>==</code> operator)
+ <li> Applying the method <A HREF="../../java/lang/Character.html#toUpperCase(char)"><CODE>Character.toUpperCase(char)</CODE></A> to each character
+ produces the same result
+ <li> Applying the method <A HREF="../../java/lang/Character.html#toLowerCase(char)"><CODE>Character.toLowerCase(char)</CODE></A> to each character
+ produces the same result
+ </ul>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>anotherString</CODE> - The <code>String</code> to compare this <code>String</code> against
+ <DT><B>Returns:</B><DD><code>true</code> if the argument is not <code>null</code> and it
+ represents an equivalent <code>String</code> ignoring case; <code>false</code> otherwise<DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="compareTo(java.lang.String)"><!-- --></A><H3>
+ compareTo</H3>
+<PRE>
+public int <B>compareTo</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> anotherString)</PRE>
+<DL>
+ <DD>Compares two strings lexicographically.
+ The comparison is based on the Unicode value of each character in
+ the strings. The character sequence represented by this
+ <code>String</code> object is compared lexicographically to the
+ character sequence represented by the argument string. The result is
+ a negative integer if this <code>String</code> object
+ lexicographically precedes the argument string. The result is a
+ positive integer if this <code>String</code> object lexicographically
+ follows the argument string. The result is zero if the strings
+ are equal; <code>compareTo</code> returns <code>0</code> exactly when
+ the <A HREF="../../java/lang/String.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A> method would return <code>true</code>.
+ <p>
+ This is the definition of lexicographic ordering. If two strings are
+ different, then either they have different characters at some index
+ that is a valid index for both strings, or their lengths are different,
+ or both. If they have different characters at one or more index
+ positions, let <i>k</i> be the smallest such index; then the string
+ whose character at position <i>k</i> has the smaller value, as
+ determined by using the < operator, lexicographically precedes the
+ other string. In this case, <code>compareTo</code> returns the
+ difference of the two character values at position <code>k</code> in
+ the two string -- that is, the value:
+ <blockquote><pre>
+ this.charAt(k)-anotherString.charAt(k)
+ </pre></blockquote>
+ If there is no index position at which they differ, then the shorter
+ string lexicographically precedes the longer string. In this case,
+ <code>compareTo</code> returns the difference of the lengths of the
+ strings -- that is, the value:
+ <blockquote><pre>
+ this.length()-anotherString.length()
+ </pre></blockquote>
+ <P>
+ <DD><DL>
+ <DT><B>Specified by:</B><DD><CODE><A HREF="../../java/lang/Comparable.html#compareTo(T)">compareTo</A></CODE> in interface <CODE><A HREF="../../java/lang/Comparable.html" title="interface in java.lang">Comparable</A><<A HREF="../../java/lang/String.html" title="class in java.lang">String</A>></CODE></DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>anotherString</CODE> - the <code>String</code> to be compared.
+ <DT><B>Returns:</B><DD>the value <code>0</code> if the argument string is equal to
+ this string; a value less than <code>0</code> if this string
+ is lexicographically less than the string argument; and a
+ value greater than <code>0</code> if this string is
+ lexicographically greater than the string argument.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="compareToIgnoreCase(java.lang.String)"><!-- --></A><H3>
+ compareToIgnoreCase</H3>
+<PRE>
+public int <B>compareToIgnoreCase</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</PRE>
+<DL>
+ <DD>Compares two strings lexicographically, ignoring case
+ differences. This method returns an integer whose sign is that of
+ calling <code>compareTo</code> with normalized versions of the strings
+ where case differences have been eliminated by calling
+ <code>Character.toLowerCase(Character.toUpperCase(character))</code> on
+ each character.
+ <p>
+ Note that this method does <em>not</em> take locale into account,
+ and will result in an unsatisfactory ordering for certain locales.
+ The java.text package provides <em>collators</em> to allow
+ locale-sensitive ordering.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>str</CODE> - the <code>String</code> to be compared.
+ <DT><B>Returns:</B><DD>a negative integer, zero, or a positive integer as the
+ specified String is greater than, equal to, or less
+ than this String, ignoring case considerations.<DT><B>Since:</B></DT>
+ <DD>1.2</DD>
+ <DT><B>See Also:</B><DD><A HREF="../../java/text/Collator.html#compare(java.lang.String, java.lang.String)"><CODE>Collator.compare(String, String)</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="regionMatches(int, java.lang.String, int, int)"><!-- --></A><H3>
+ regionMatches</H3>
+<PRE>
+public boolean <B>regionMatches</B>(int toffset,
+ <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> other,
+ int ooffset,
+ int len)</PRE>
+<DL>
+ <DD>Tests if two string regions are equal.
+ <p>
+ A substring of this <tt>String</tt> object is compared to a substring
+ of the argument other. The result is true if these substrings
+ represent identical character sequences. The substring of this
+ <tt>String</tt> object to be compared begins at index <tt>toffset</tt>
+ and has length <tt>len</tt>. The substring of other to be compared
+ begins at index <tt>ooffset</tt> and has length <tt>len</tt>. The
+ result is <tt>false</tt> if and only if at least one of the following
+ is true:
+ <ul><li><tt>toffset</tt> is negative.
+ <li><tt>ooffset</tt> is negative.
+ <li><tt>toffset+len</tt> is greater than the length of this
+ <tt>String</tt> object.
+ <li><tt>ooffset+len</tt> is greater than the length of the other
+ argument.
+ <li>There is some nonnegative integer <i>k</i> less than <tt>len</tt>
+ such that:
+ <tt>this.charAt(toffset+<i>k</i>) != other.charAt(ooffset+<i>k</i>)</tt>
+ </ul>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>toffset</CODE> - the starting offset of the subregion in this string.<DD><CODE>other</CODE> - the string argument.<DD><CODE>ooffset</CODE> - the starting offset of the subregion in the string
+ argument.<DD><CODE>len</CODE> - the number of characters to compare.
+ <DT><B>Returns:</B><DD><code>true</code> if the specified subregion of this string
+ exactly matches the specified subregion of the string argument;
+ <code>false</code> otherwise.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="regionMatches(boolean, int, java.lang.String, int, int)"><!-- --></A><H3>
+ regionMatches</H3>
+<PRE>
+public boolean <B>regionMatches</B>(boolean ignoreCase,
+ int toffset,
+ <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> other,
+ int ooffset,
+ int len)</PRE>
+<DL>
+ <DD>Tests if two string regions are equal.
+ <p>
+ A substring of this <tt>String</tt> object is compared to a substring
+ of the argument <tt>other</tt>. The result is <tt>true</tt> if these
+ substrings represent character sequences that are the same, ignoring
+ case if and only if <tt>ignoreCase</tt> is true. The substring of
+ this <tt>String</tt> object to be compared begins at index
+ <tt>toffset</tt> and has length <tt>len</tt>. The substring of
+ <tt>other</tt> to be compared begins at index <tt>ooffset</tt> and
+ has length <tt>len</tt>. The result is <tt>false</tt> if and only if
+ at least one of the following is true:
+ <ul><li><tt>toffset</tt> is negative.
+ <li><tt>ooffset</tt> is negative.
+ <li><tt>toffset+len</tt> is greater than the length of this
+ <tt>String</tt> object.
+ <li><tt>ooffset+len</tt> is greater than the length of the other
+ argument.
+ <li><tt>ignoreCase</tt> is <tt>false</tt> and there is some nonnegative
+ integer <i>k</i> less than <tt>len</tt> such that:
+ <blockquote><pre>
+ this.charAt(toffset+k) != other.charAt(ooffset+k)
+ </pre></blockquote>
+ <li><tt>ignoreCase</tt> is <tt>true</tt> and there is some nonnegative
+ integer <i>k</i> less than <tt>len</tt> such that:
+ <blockquote><pre>
+ Character.toLowerCase(this.charAt(toffset+k)) !=
+ Character.toLowerCase(other.charAt(ooffset+k))
+ </pre></blockquote>
+ and:
+ <blockquote><pre>
+ Character.toUpperCase(this.charAt(toffset+k)) !=
+ Character.toUpperCase(other.charAt(ooffset+k))
+ </pre></blockquote>
+ </ul>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>ignoreCase</CODE> - if <code>true</code>, ignore case when comparing
+ characters.<DD><CODE>toffset</CODE> - the starting offset of the subregion in this
+ string.<DD><CODE>other</CODE> - the string argument.<DD><CODE>ooffset</CODE> - the starting offset of the subregion in the string
+ argument.<DD><CODE>len</CODE> - the number of characters to compare.
+ <DT><B>Returns:</B><DD><code>true</code> if the specified subregion of this string
+ matches the specified subregion of the string argument;
+ <code>false</code> otherwise. Whether the matching is exact
+ or case insensitive depends on the <code>ignoreCase</code>
+ argument.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="startsWith(java.lang.String, int)"><!-- --></A><H3>
+ startsWith</H3>
+<PRE>
+public boolean <B>startsWith</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> prefix,
+ int toffset)</PRE>
+<DL>
+ <DD>Tests if the substring of this string beginning at the
+ specified index starts with the specified prefix.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>prefix</CODE> - the prefix.<DD><CODE>toffset</CODE> - where to begin looking in this string.
+ <DT><B>Returns:</B><DD><code>true</code> if the character sequence represented by the
+ argument is a prefix of the substring of this object starting
+ at index <code>toffset</code>; <code>false</code> otherwise.
+ The result is <code>false</code> if <code>toffset</code> is
+ negative or greater than the length of this
+ <code>String</code> object; otherwise the result is the same
+ as the result of the expression
+ <pre>
+ this.substring(toffset).startsWith(prefix)
+ </pre></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="startsWith(java.lang.String)"><!-- --></A><H3>
+ startsWith</H3>
+<PRE>
+public boolean <B>startsWith</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> prefix)</PRE>
+<DL>
+ <DD>Tests if this string starts with the specified prefix.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>prefix</CODE> - the prefix.
+ <DT><B>Returns:</B><DD><code>true</code> if the character sequence represented by the
+ argument is a prefix of the character sequence represented by
+ this string; <code>false</code> otherwise.
+ Note also that <code>true</code> will be returned if the
+ argument is an empty string or is equal to this
+ <code>String</code> object as determined by the
+ <A HREF="../../java/lang/String.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A> method.<DT><B>Since:</B></DT>
+ <DD>1. 0</DD>
+ </DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="endsWith(java.lang.String)"><!-- --></A><H3>
+ endsWith</H3>
+<PRE>
+public boolean <B>endsWith</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> suffix)</PRE>
+<DL>
+ <DD>Tests if this string ends with the specified suffix.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>suffix</CODE> - the suffix.
+ <DT><B>Returns:</B><DD><code>true</code> if the character sequence represented by the
+ argument is a suffix of the character sequence represented by
+ this object; <code>false</code> otherwise. Note that the
+ result will be <code>true</code> if the argument is the
+ empty string or is equal to this <code>String</code> object
+ as determined by the <A HREF="../../java/lang/String.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A> method.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="hashCode()"><!-- --></A><H3>
+ hashCode</H3>
+<PRE>
+public int <B>hashCode</B>()</PRE>
+<DL>
+ <DD>Returns a hash code for this string. The hash code for a
+ <code>String</code> object is computed as
+ <blockquote><pre>
+ s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
+ </pre></blockquote>
+ using <code>int</code> arithmetic, where <code>s[i]</code> is the
+ <i>i</i>th character of the string, <code>n</code> is the length of
+ the string, and <code>^</code> indicates exponentiation.
+ (The hash value of the empty string is zero.)
+ <P>
+ <DD><DL>
+ <DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#hashCode()">hashCode</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></CODE></DL>
+ </DD>
+ <DD><DL>
+
+ <DT><B>Returns:</B><DD>a hash code value for this object.<DT><B>See Also:</B><DD><A HREF="../../java/lang/Object.html#equals(java.lang.Object)"><CODE>Object.equals(java.lang.Object)</CODE></A>,
+ <A HREF="../../java/util/Hashtable.html" title="class in java.util"><CODE>Hashtable</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="indexOf(int)"><!-- --></A><H3>
+ indexOf</H3>
+<PRE>
+public int <B>indexOf</B>(int ch)</PRE>
+<DL>
+ <DD>Returns the index within this string of the first occurrence of
+ the specified character. If a character with value
+ <code>ch</code> occurs in the character sequence represented by
+ this <code>String</code> object, then the index (in Unicode
+ code units) of the first such occurrence is returned. For
+ values of <code>ch</code> in the range from 0 to 0xFFFF
+ (inclusive), this is the smallest value <i>k</i> such that:
+ <blockquote><pre>
+ this.charAt(<i>k</i>) == ch
+ </pre></blockquote>
+ is true. For other values of <code>ch</code>, it is the
+ smallest value <i>k</i> such that:
+ <blockquote><pre>
+ this.codePointAt(<i>k</i>) == ch
+ </pre></blockquote>
+ is true. In either case, if no such character occurs in this
+ string, then <code>-1</code> is returned.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>ch</CODE> - a character (Unicode code point).
+ <DT><B>Returns:</B><DD>the index of the first occurrence of the character in the
+ character sequence represented by this object, or
+ <code>-1</code> if the character does not occur.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="indexOf(int, int)"><!-- --></A><H3>
+ indexOf</H3>
+<PRE>
+public int <B>indexOf</B>(int ch,
+ int fromIndex)</PRE>
+<DL>
+ <DD>Returns the index within this string of the first occurrence of the
+ specified character, starting the search at the specified index.
+ <p>
+ If a character with value <code>ch</code> occurs in the
+ character sequence represented by this <code>String</code>
+ object at an index no smaller than <code>fromIndex</code>, then
+ the index of the first such occurrence is returned. For values
+ of <code>ch</code> in the range from 0 to 0xFFFF (inclusive),
+ this is the smallest value <i>k</i> such that:
+ <blockquote><pre>
+ (this.charAt(<i>k</i>) == ch) && (<i>k</i> >= fromIndex)
+ </pre></blockquote>
+ is true. For other values of <code>ch</code>, it is the
+ smallest value <i>k</i> such that:
+ <blockquote><pre>
+ (this.codePointAt(<i>k</i>) == ch) && (<i>k</i> >= fromIndex)
+ </pre></blockquote>
+ is true. In either case, if no such character occurs in this
+ string at or after position <code>fromIndex</code>, then
+ <code>-1</code> is returned.
+
+ <p>
+ There is no restriction on the value of <code>fromIndex</code>. If it
+ is negative, it has the same effect as if it were zero: this entire
+ string may be searched. If it is greater than the length of this
+ string, it has the same effect as if it were equal to the length of
+ this string: <code>-1</code> is returned.
+
+ <p>All indices are specified in <code>char</code> values
+ (Unicode code units).
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>ch</CODE> - a character (Unicode code point).<DD><CODE>fromIndex</CODE> - the index to start the search from.
+ <DT><B>Returns:</B><DD>the index of the first occurrence of the character in the
+ character sequence represented by this object that is greater
+ than or equal to <code>fromIndex</code>, or <code>-1</code>
+ if the character does not occur.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="lastIndexOf(int)"><!-- --></A><H3>
+ lastIndexOf</H3>
+<PRE>
+public int <B>lastIndexOf</B>(int ch)</PRE>
+<DL>
+ <DD>Returns the index within this string of the last occurrence of
+ the specified character. For values of <code>ch</code> in the
+ range from 0 to 0xFFFF (inclusive), the index (in Unicode code
+ units) returned is the largest value <i>k</i> such that:
+ <blockquote><pre>
+ this.charAt(<i>k</i>) == ch
+ </pre></blockquote>
+ is true. For other values of <code>ch</code>, it is the
+ largest value <i>k</i> such that:
+ <blockquote><pre>
+ this.codePointAt(<i>k</i>) == ch
+ </pre></blockquote>
+ is true. In either case, if no such character occurs in this
+ string, then <code>-1</code> is returned. The
+ <code>String</code> is searched backwards starting at the last
+ character.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>ch</CODE> - a character (Unicode code point).
+ <DT><B>Returns:</B><DD>the index of the last occurrence of the character in the
+ character sequence represented by this object, or
+ <code>-1</code> if the character does not occur.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="lastIndexOf(int, int)"><!-- --></A><H3>
+ lastIndexOf</H3>
+<PRE>
+public int <B>lastIndexOf</B>(int ch,
+ int fromIndex)</PRE>
+<DL>
+ <DD>Returns the index within this string of the last occurrence of
+ the specified character, searching backward starting at the
+ specified index. For values of <code>ch</code> in the range
+ from 0 to 0xFFFF (inclusive), the index returned is the largest
+ value <i>k</i> such that:
+ <blockquote><pre>
+ (this.charAt(<i>k</i>) == ch) && (<i>k</i> <= fromIndex)
+ </pre></blockquote>
+ is true. For other values of <code>ch</code>, it is the
+ largest value <i>k</i> such that:
+ <blockquote><pre>
+ (this.codePointAt(<i>k</i>) == ch) && (<i>k</i> <= fromIndex)
+ </pre></blockquote>
+ is true. In either case, if no such character occurs in this
+ string at or before position <code>fromIndex</code>, then
+ <code>-1</code> is returned.
+
+ <p>All indices are specified in <code>char</code> values
+ (Unicode code units).
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>ch</CODE> - a character (Unicode code point).<DD><CODE>fromIndex</CODE> - the index to start the search from. There is no
+ restriction on the value of <code>fromIndex</code>. If it is
+ greater than or equal to the length of this string, it has
+ the same effect as if it were equal to one less than the
+ length of this string: this entire string may be searched.
+ If it is negative, it has the same effect as if it were -1:
+ -1 is returned.
+ <DT><B>Returns:</B><DD>the index of the last occurrence of the character in the
+ character sequence represented by this object that is less
+ than or equal to <code>fromIndex</code>, or <code>-1</code>
+ if the character does not occur before that point.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="indexOf(java.lang.String)"><!-- --></A><H3>
+ indexOf</H3>
+<PRE>
+public int <B>indexOf</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</PRE>
+<DL>
+ <DD>Returns the index within this string of the first occurrence of the
+ specified substring. The integer returned is the smallest value
+ <i>k</i> such that:
+ <blockquote><pre>
+ this.startsWith(str, <i>k</i>)
+ </pre></blockquote>
+ is <code>true</code>.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>str</CODE> - any string.
+ <DT><B>Returns:</B><DD>if the string argument occurs as a substring within this
+ object, then the index of the first character of the first
+ such substring is returned; if it does not occur as a
+ substring, <code>-1</code> is returned.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="indexOf(java.lang.String, int)"><!-- --></A><H3>
+ indexOf</H3>
+<PRE>
+public int <B>indexOf</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str,
+ int fromIndex)</PRE>
+<DL>
+ <DD>Returns the index within this string of the first occurrence of the
+ specified substring, starting at the specified index. The integer
+ returned is the smallest value <tt>k</tt> for which:
+ <blockquote><pre>
+ k >= Math.min(fromIndex, this.length()) && this.startsWith(str, k)
+ </pre></blockquote>
+ If no such value of <i>k</i> exists, then -1 is returned.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>str</CODE> - the substring for which to search.<DD><CODE>fromIndex</CODE> - the index from which to start the search.
+ <DT><B>Returns:</B><DD>the index within this string of the first occurrence of the
+ specified substring, starting at the specified index.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="lastIndexOf(java.lang.String)"><!-- --></A><H3>
+ lastIndexOf</H3>
+<PRE>
+public int <B>lastIndexOf</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</PRE>
+<DL>
+ <DD>Returns the index within this string of the rightmost occurrence
+ of the specified substring. The rightmost empty string "" is
+ considered to occur at the index value <code>this.length()</code>.
+ The returned index is the largest value <i>k</i> such that
+ <blockquote><pre>
+ this.startsWith(str, k)
+ </pre></blockquote>
+ is true.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>str</CODE> - the substring to search for.
+ <DT><B>Returns:</B><DD>if the string argument occurs one or more times as a substring
+ within this object, then the index of the first character of
+ the last such substring is returned. If it does not occur as
+ a substring, <code>-1</code> is returned.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="lastIndexOf(java.lang.String, int)"><!-- --></A><H3>
+ lastIndexOf</H3>
+<PRE>
+public int <B>lastIndexOf</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str,
+ int fromIndex)</PRE>
+<DL>
+ <DD>Returns the index within this string of the last occurrence of the
+ specified substring, searching backward starting at the specified index.
+ The integer returned is the largest value <i>k</i> such that:
+ <blockquote><pre>
+ k <= Math.min(fromIndex, this.length()) && this.startsWith(str, k)
+ </pre></blockquote>
+ If no such value of <i>k</i> exists, then -1 is returned.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>str</CODE> - the substring to search for.<DD><CODE>fromIndex</CODE> - the index to start the search from.
+ <DT><B>Returns:</B><DD>the index within this string of the last occurrence of the
+ specified substring.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="substring(int)"><!-- --></A><H3>
+ substring</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>substring</B>(int beginIndex)</PRE>
+<DL>
+ <DD>Returns a new string that is a substring of this string. The
+ substring begins with the character at the specified index and
+ extends to the end of this string. <p>
+ Examples:
+ <blockquote><pre>
+ "unhappy".substring(2) returns "happy"
+ "Harbison".substring(3) returns "bison"
+ "emptiness".substring(9) returns "" (an empty string)
+ </pre></blockquote>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>beginIndex</CODE> - the beginning index, inclusive.
+ <DT><B>Returns:</B><DD>the specified substring.
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if
+ <code>beginIndex</code> is negative or larger than the
+ length of this <code>String</code> object.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="substring(int, int)"><!-- --></A><H3>
+ substring</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>substring</B>(int beginIndex,
+ int endIndex)</PRE>
+<DL>
+ <DD>Returns a new string that is a substring of this string. The
+ substring begins at the specified <code>beginIndex</code> and
+ extends to the character at index <code>endIndex - 1</code>.
+ Thus the length of the substring is <code>endIndex-beginIndex</code>.
+ <p>
+ Examples:
+ <blockquote><pre>
+ "hamburger".substring(4, 8) returns "urge"
+ "smiles".substring(1, 5) returns "mile"
+ </pre></blockquote>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>beginIndex</CODE> - the beginning index, inclusive.<DD><CODE>endIndex</CODE> - the ending index, exclusive.
+ <DT><B>Returns:</B><DD>the specified substring.
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if the
+ <code>beginIndex</code> is negative, or
+ <code>endIndex</code> is larger than the length of
+ this <code>String</code> object, or
+ <code>beginIndex</code> is larger than
+ <code>endIndex</code>.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="subSequence(int, int)"><!-- --></A><H3>
+ subSequence</H3>
+<PRE>
+public <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> <B>subSequence</B>(int beginIndex,
+ int endIndex)</PRE>
+<DL>
+ <DD>Returns a new character sequence that is a subsequence of this sequence.
+
+ <p> An invocation of this method of the form
+
+ <blockquote><pre>
+ str.subSequence(begin, end)</pre></blockquote>
+
+ behaves in exactly the same way as the invocation
+
+ <blockquote><pre>
+ str.substring(begin, end)</pre></blockquote>
+
+ This method is defined so that the <tt>String</tt> class can implement
+ the <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang"><CODE>CharSequence</CODE></A> interface. </p>
+ <P>
+ <DD><DL>
+ <DT><B>Specified by:</B><DD><CODE><A HREF="../../java/lang/CharSequence.html#subSequence(int, int)">subSequence</A></CODE> in interface <CODE><A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A></CODE></DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>beginIndex</CODE> - the begin index, inclusive.<DD><CODE>endIndex</CODE> - the end index, exclusive.
+ <DT><B>Returns:</B><DD>the specified subsequence.
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if <tt>beginIndex</tt> or <tt>endIndex</tt> are negative,
+ if <tt>endIndex</tt> is greater than <tt>length()</tt>,
+ or if <tt>beginIndex</tt> is greater than <tt>startIndex</tt><DT><B>Since:</B></DT>
+ <DD>1.4</DD>
+ </DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="concat(java.lang.String)"><!-- --></A><H3>
+ concat</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>concat</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> str)</PRE>
+<DL>
+ <DD>Concatenates the specified string to the end of this string.
+ <p>
+ If the length of the argument string is <code>0</code>, then this
+ <code>String</code> object is returned. Otherwise, a new
+ <code>String</code> object is created, representing a character
+ sequence that is the concatenation of the character sequence
+ represented by this <code>String</code> object and the character
+ sequence represented by the argument string.<p>
+ Examples:
+ <blockquote><pre>
+ "cares".concat("s") returns "caress"
+ "to".concat("get").concat("her") returns "together"
+ </pre></blockquote>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>str</CODE> - the <code>String</code> that is concatenated to the end
+ of this <code>String</code>.
+ <DT><B>Returns:</B><DD>a string that represents the concatenation of this object's
+ characters followed by the string argument's characters.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="replace(char, char)"><!-- --></A><H3>
+ replace</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>replace</B>(char oldChar,
+ char newChar)</PRE>
+<DL>
+ <DD>Returns a new string resulting from replacing all occurrences of
+ <code>oldChar</code> in this string with <code>newChar</code>.
+ <p>
+ If the character <code>oldChar</code> does not occur in the
+ character sequence represented by this <code>String</code> object,
+ then a reference to this <code>String</code> object is returned.
+ Otherwise, a new <code>String</code> object is created that
+ represents a character sequence identical to the character sequence
+ represented by this <code>String</code> object, except that every
+ occurrence of <code>oldChar</code> is replaced by an occurrence
+ of <code>newChar</code>.
+ <p>
+ Examples:
+ <blockquote><pre>
+ "mesquite in your cellar".replace('e', 'o')
+ returns "mosquito in your collar"
+ "the war of baronets".replace('r', 'y')
+ returns "the way of bayonets"
+ "sparring with a purple porpoise".replace('p', 't')
+ returns "starring with a turtle tortoise"
+ "JonL".replace('q', 'x') returns "JonL" (no change)
+ </pre></blockquote>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>oldChar</CODE> - the old character.<DD><CODE>newChar</CODE> - the new character.
+ <DT><B>Returns:</B><DD>a string derived from this string by replacing every
+ occurrence of <code>oldChar</code> with <code>newChar</code>.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="matches(java.lang.String)"><!-- --></A><H3>
+ matches</H3>
+<PRE>
+public boolean <B>matches</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex)</PRE>
+<DL>
+ <DD>Tells whether or not this string matches the given <a
+ href="../util/regex/Pattern.html#sum">regular expression</a>.
+
+ <p> An invocation of this method of the form
+ <i>str</i><tt>.matches(</tt><i>regex</i><tt>)</tt> yields exactly the
+ same result as the expression
+
+ <blockquote><tt> <A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A>.<A HREF="../../java/util/regex/Pattern.html#matches(java.lang.String, java.lang.CharSequence)"><CODE>matches</CODE></A>(</tt><i>regex</i><tt>,</tt> <i>str</i><tt>)</tt></blockquote>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>regex</CODE> - the regular expression to which this string is to be matched
+ <DT><B>Returns:</B><DD><tt>true</tt> if, and only if, this string matches the
+ given regular expression
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/util/regex/PatternSyntaxException.html" title="class in java.util.regex">PatternSyntaxException</A></CODE> - if the regular expression's syntax is invalid<DT><B>Since:</B></DT>
+ <DD>1.4</DD>
+ <DT><B>See Also:</B><DD><A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="contains(java.lang.CharSequence)"><!-- --></A><H3>
+ contains</H3>
+<PRE>
+public boolean <B>contains</B>(<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> s)</PRE>
+<DL>
+ <DD>Returns true if and only if this string contains the specified
+ sequence of char values.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>s</CODE> - the sequence to search for
+ <DT><B>Returns:</B><DD>true if this string contains <code>s</code>, false otherwise
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</A></CODE> - if <code>s</code> is <code>null</code><DT><B>Since:</B></DT>
+ <DD>1.5</DD>
+ </DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="replaceFirst(java.lang.String, java.lang.String)"><!-- --></A><H3>
+ replaceFirst</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>replaceFirst</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex,
+ <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> replacement)</PRE>
+<DL>
+ <DD>Replaces the first substring of this string that matches the given <a
+ href="../util/regex/Pattern.html#sum">regular expression</a> with the
+ given replacement.
+
+ <p> An invocation of this method of the form
+ <i>str</i><tt>.replaceFirst(</tt><i>regex</i><tt>,</tt> <i>repl</i><tt>)</tt>
+ yields exactly the same result as the expression
+
+ <blockquote><tt>
+ <A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A>.<A HREF="../../java/util/regex/Pattern.html#compile(java.lang.String)"><CODE>compile</CODE></A>(</tt><i>regex</i><tt>).<A HREF="../../java/util/regex/Pattern.html#matcher(java.lang.CharSequence)"><CODE>matcher</CODE></A>(</tt><i>str</i><tt>).<A HREF="../../java/util/regex/Matcher.html#replaceFirst(java.lang.String)"><CODE>replaceFirst</CODE></A>(</tt><i>repl</i><tt>)</tt></blockquote>
+
+ <p>
+ Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in the
+ replacement string may cause the results to be different than if it were
+ being treated as a literal replacement string; see
+ <A HREF="../../java/util/regex/Matcher.html#replaceFirst(java.lang.String)"><CODE>Matcher.replaceFirst(java.lang.String)</CODE></A>.
+ Use <A HREF="../../java/util/regex/Matcher.html#quoteReplacement(java.lang.String)"><CODE>Matcher.quoteReplacement(java.lang.String)</CODE></A> to suppress the special
+ meaning of these characters, if desired.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>regex</CODE> - the regular expression to which this string is to be matched<DD><CODE>replacement</CODE> - the string to be substituted for the first match
+ <DT><B>Returns:</B><DD>The resulting <tt>String</tt>
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/util/regex/PatternSyntaxException.html" title="class in java.util.regex">PatternSyntaxException</A></CODE> - if the regular expression's syntax is invalid<DT><B>Since:</B></DT>
+ <DD>1.4</DD>
+ <DT><B>See Also:</B><DD><A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="replaceAll(java.lang.String, java.lang.String)"><!-- --></A><H3>
+ replaceAll</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>replaceAll</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex,
+ <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> replacement)</PRE>
+<DL>
+ <DD>Replaces each substring of this string that matches the given <a
+ href="../util/regex/Pattern.html#sum">regular expression</a> with the
+ given replacement.
+
+ <p> An invocation of this method of the form
+ <i>str</i><tt>.replaceAll(</tt><i>regex</i><tt>,</tt> <i>repl</i><tt>)</tt>
+ yields exactly the same result as the expression
+
+ <blockquote><tt>
+ <A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A>.<A HREF="../../java/util/regex/Pattern.html#compile(java.lang.String)"><CODE>compile</CODE></A>(</tt><i>regex</i><tt>).<A HREF="../../java/util/regex/Pattern.html#matcher(java.lang.CharSequence)"><CODE>matcher</CODE></A>(</tt><i>str</i><tt>).<A HREF="../../java/util/regex/Matcher.html#replaceAll(java.lang.String)"><CODE>replaceAll</CODE></A>(</tt><i>repl</i><tt>)</tt></blockquote>
+
+ <p>
+ Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in the
+ replacement string may cause the results to be different than if it were
+ being treated as a literal replacement string; see
+ <A HREF="../../java/util/regex/Matcher.html#replaceAll(java.lang.String)"><CODE>Matcher.replaceAll</CODE></A>.
+ Use <A HREF="../../java/util/regex/Matcher.html#quoteReplacement(java.lang.String)"><CODE>Matcher.quoteReplacement(java.lang.String)</CODE></A> to suppress the special
+ meaning of these characters, if desired.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>regex</CODE> - the regular expression to which this string is to be matched<DD><CODE>replacement</CODE> - the string to be substituted for each match
+ <DT><B>Returns:</B><DD>The resulting <tt>String</tt>
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/util/regex/PatternSyntaxException.html" title="class in java.util.regex">PatternSyntaxException</A></CODE> - if the regular expression's syntax is invalid<DT><B>Since:</B></DT>
+ <DD>1.4</DD>
+ <DT><B>See Also:</B><DD><A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="replace(java.lang.CharSequence, java.lang.CharSequence)"><!-- --></A><H3>
+ replace</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>replace</B>(<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> target,
+ <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> replacement)</PRE>
+<DL>
+ <DD>Replaces each substring of this string that matches the literal target
+ sequence with the specified literal replacement sequence. The
+ replacement proceeds from the beginning of the string to the end, for
+ example, replacing "aa" with "b" in the string "aaa" will result in
+ "ba" rather than "ab".
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>target</CODE> - The sequence of char values to be replaced<DD><CODE>replacement</CODE> - The replacement sequence of char values
+ <DT><B>Returns:</B><DD>The resulting string
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</A></CODE> - if <code>target</code> or
+ <code>replacement</code> is <code>null</code>.<DT><B>Since:</B></DT>
+ <DD>1.5</DD>
+ </DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="split(java.lang.String, int)"><!-- --></A><H3>
+ split</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A>[] <B>split</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex,
+ int limit)</PRE>
+<DL>
+ <DD>Splits this string around matches of the given
+ <a href="../util/regex/Pattern.html#sum">regular expression</a>.
+
+ <p> The array returned by this method contains each substring of this
+ string that is terminated by another substring that matches the given
+ expression or is terminated by the end of the string. The substrings in
+ the array are in the order in which they occur in this string. If the
+ expression does not match any part of the input then the resulting array
+ has just one element, namely this string.
+
+ <p> The <tt>limit</tt> parameter controls the number of times the
+ pattern is applied and therefore affects the length of the resulting
+ array. If the limit <i>n</i> is greater than zero then the pattern
+ will be applied at most <i>n</i> - 1 times, the array's
+ length will be no greater than <i>n</i>, and the array's last entry
+ will contain all input beyond the last matched delimiter. If <i>n</i>
+ is non-positive then the pattern will be applied as many times as
+ possible and the array can have any length. If <i>n</i> is zero then
+ the pattern will be applied as many times as possible, the array can
+ have any length, and trailing empty strings will be discarded.
+
+ <p> The string <tt>"boo:and:foo"</tt>, for example, yields the
+ following results with these parameters:
+
+ <blockquote><table cellpadding=1 cellspacing=0 summary="Split example showing regex, limit, and result">
+ <tr>
+ <th>Regex</th>
+ <th>Limit</th>
+ <th>Result</th>
+ </tr>
+ <tr><td align=center>:</td>
+ <td align=center>2</td>
+ <td><tt>{ "boo", "and:foo" }</tt></td></tr>
+ <tr><td align=center>:</td>
+ <td align=center>5</td>
+ <td><tt>{ "boo", "and", "foo" }</tt></td></tr>
+ <tr><td align=center>:</td>
+ <td align=center>-2</td>
+ <td><tt>{ "boo", "and", "foo" }</tt></td></tr>
+ <tr><td align=center>o</td>
+ <td align=center>5</td>
+ <td><tt>{ "b", "", ":and:f", "", "" }</tt></td></tr>
+ <tr><td align=center>o</td>
+ <td align=center>-2</td>
+ <td><tt>{ "b", "", ":and:f", "", "" }</tt></td></tr>
+ <tr><td align=center>o</td>
+ <td align=center>0</td>
+ <td><tt>{ "b", "", ":and:f" }</tt></td></tr>
+ </table></blockquote>
+
+ <p> An invocation of this method of the form
+ <i>str.</i><tt>split(</tt><i>regex</i><tt>,</tt> <i>n</i><tt>)</tt>
+ yields the same result as the expression
+
+ <blockquote>
+ <A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A>.<A HREF="../../java/util/regex/Pattern.html#compile(java.lang.String)"><CODE>compile</CODE></A><tt>(</tt><i>regex</i><tt>)</tt>.<A HREF="../../java/util/regex/Pattern.html#split(java.lang.CharSequence, int)"><CODE>split</CODE></A><tt>(</tt><i>str</i><tt>,</tt> <i>n</i><tt>)</tt>
+ </blockquote>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>regex</CODE> - the delimiting regular expression<DD><CODE>limit</CODE> - the result threshold, as described above
+ <DT><B>Returns:</B><DD>the array of strings computed by splitting this string
+ around matches of the given regular expression
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/util/regex/PatternSyntaxException.html" title="class in java.util.regex">PatternSyntaxException</A></CODE> - if the regular expression's syntax is invalid<DT><B>Since:</B></DT>
+ <DD>1.4</DD>
+ <DT><B>See Also:</B><DD><A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="split(java.lang.String)"><!-- --></A><H3>
+ split</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A>[] <B>split</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> regex)</PRE>
+<DL>
+ <DD>Splits this string around matches of the given <a
+ href="../util/regex/Pattern.html#sum">regular expression</a>.
+
+ <p> This method works as if by invoking the two-argument <A HREF="../../java/lang/String.html#split(java.lang.String, int)"><CODE>split</CODE></A> method with the given expression and a limit
+ argument of zero. Trailing empty strings are therefore not included in
+ the resulting array.
+
+ <p> The string <tt>"boo:and:foo"</tt>, for example, yields the following
+ results with these expressions:
+
+ <blockquote><table cellpadding=1 cellspacing=0 summary="Split examples showing regex and result">
+ <tr>
+ <th>Regex</th>
+ <th>Result</th>
+ </tr>
+ <tr><td align=center>:</td>
+ <td><tt>{ "boo", "and", "foo" }</tt></td></tr>
+ <tr><td align=center>o</td>
+ <td><tt>{ "b", "", ":and:f" }</tt></td></tr>
+ </table></blockquote>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>regex</CODE> - the delimiting regular expression
+ <DT><B>Returns:</B><DD>the array of strings computed by splitting this string
+ around matches of the given regular expression
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/util/regex/PatternSyntaxException.html" title="class in java.util.regex">PatternSyntaxException</A></CODE> - if the regular expression's syntax is invalid<DT><B>Since:</B></DT>
+ <DD>1.4</DD>
+ <DT><B>See Also:</B><DD><A HREF="../../java/util/regex/Pattern.html" title="class in java.util.regex"><CODE>Pattern</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="toLowerCase(java.util.Locale)"><!-- --></A><H3>
+ toLowerCase</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>toLowerCase</B>(<A HREF="../../java/util/Locale.html" title="class in java.util">Locale</A> locale)</PRE>
+<DL>
+ <DD>Converts all of the characters in this <code>String</code> to lower
+ case using the rules of the given <code>Locale</code>. Case mapping is based
+ on the Unicode Standard version specified by the <A HREF="../../java/lang/Character.html" title="class in java.lang"><CODE>Character</CODE></A>
+ class. Since case mappings are not always 1:1 char mappings, the resulting
+ <code>String</code> may be a different length than the original <code>String</code>.
+ <p>
+ Examples of lowercase mappings are in the following table:
+ <table border="1" summary="Lowercase mapping examples showing language code of locale, upper case, lower case, and description">
+ <tr>
+ <th>Language Code of Locale</th>
+ <th>Upper Case</th>
+ <th>Lower Case</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>tr (Turkish)</td>
+ <td>\u0130</td>
+ <td>\u0069</td>
+ <td>capital letter I with dot above -> small letter i</td>
+ </tr>
+ <tr>
+ <td>tr (Turkish)</td>
+ <td>\u0049</td>
+ <td>\u0131</td>
+ <td>capital letter I -> small letter dotless i </td>
+ </tr>
+ <tr>
+ <td>(all)</td>
+ <td>French Fries</td>
+ <td>french fries</td>
+ <td>lowercased all chars in String</td>
+ </tr>
+ <tr>
+ <td>(all)</td>
+ <td><img src="doc-files/capiota.gif" alt="capiota"><img src="doc-files/capchi.gif" alt="capchi">
+ <img src="doc-files/captheta.gif" alt="captheta"><img src="doc-files/capupsil.gif" alt="capupsil">
+ <img src="doc-files/capsigma.gif" alt="capsigma"></td>
+ <td><img src="doc-files/iota.gif" alt="iota"><img src="doc-files/chi.gif" alt="chi">
+ <img src="doc-files/theta.gif" alt="theta"><img src="doc-files/upsilon.gif" alt="upsilon">
+ <img src="doc-files/sigma1.gif" alt="sigma"></td>
+ <td>lowercased all chars in String</td>
+ </tr>
+ </table>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>locale</CODE> - use the case transformation rules for this locale
+ <DT><B>Returns:</B><DD>the <code>String</code>, converted to lowercase.<DT><B>Since:</B></DT>
+ <DD>1.1</DD>
+ <DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#toLowerCase()"><CODE>toLowerCase()</CODE></A>,
+ <A HREF="../../java/lang/String.html#toUpperCase()"><CODE>toUpperCase()</CODE></A>,
+ <A HREF="../../java/lang/String.html#toUpperCase(java.util.Locale)"><CODE>toUpperCase(Locale)</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="toLowerCase()"><!-- --></A><H3>
+ toLowerCase</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>toLowerCase</B>()</PRE>
+<DL>
+ <DD>Converts all of the characters in this <code>String</code> to lower
+ case using the rules of the default locale. This is equivalent to calling
+ <code>toLowerCase(Locale.getDefault())</code>.
+ <p>
+ <b>Note:</b> This method is locale sensitive, and may produce unexpected
+ results if used for strings that are intended to be interpreted locale
+ independently.
+ Examples are programming language identifiers, protocol keys, and HTML
+ tags.
+ For instance, <code>"TITLE".toLowerCase()</code> in a Turkish locale
+ returns <code>"t?tle"</code>, where '?' is the LATIN SMALL
+ LETTER DOTLESS I character.
+ To obtain correct results for locale insensitive strings, use
+ <code>toLowerCase(Locale.ENGLISH)</code>.
+ <p>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+
+ <DT><B>Returns:</B><DD>the <code>String</code>, converted to lowercase.<DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#toLowerCase(java.util.Locale)"><CODE>toLowerCase(Locale)</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="toUpperCase(java.util.Locale)"><!-- --></A><H3>
+ toUpperCase</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>toUpperCase</B>(<A HREF="../../java/util/Locale.html" title="class in java.util">Locale</A> locale)</PRE>
+<DL>
+ <DD>Converts all of the characters in this <code>String</code> to upper
+ case using the rules of the given <code>Locale</code>. Case mapping is based
+ on the Unicode Standard version specified by the <A HREF="../../java/lang/Character.html" title="class in java.lang"><CODE>Character</CODE></A>
+ class. Since case mappings are not always 1:1 char mappings, the resulting
+ <code>String</code> may be a different length than the original <code>String</code>.
+ <p>
+ Examples of locale-sensitive and 1:M case mappings are in the following table.
+ <p>
+ <table border="1" summary="Examples of locale-sensitive and 1:M case mappings. Shows Language code of locale, lower case, upper case, and description.">
+ <tr>
+ <th>Language Code of Locale</th>
+ <th>Lower Case</th>
+ <th>Upper Case</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>tr (Turkish)</td>
+ <td>\u0069</td>
+ <td>\u0130</td>
+ <td>small letter i -> capital letter I with dot above</td>
+ </tr>
+ <tr>
+ <td>tr (Turkish)</td>
+ <td>\u0131</td>
+ <td>\u0049</td>
+ <td>small letter dotless i -> capital letter I</td>
+ </tr>
+ <tr>
+ <td>(all)</td>
+ <td>\u00df</td>
+ <td>\u0053 \u0053</td>
+ <td>small letter sharp s -> two letters: SS</td>
+ </tr>
+ <tr>
+ <td>(all)</td>
+ <td>Fahrvergnügen</td>
+ <td>FAHRVERGNÜGEN</td>
+ <td></td>
+ </tr>
+ </table>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>locale</CODE> - use the case transformation rules for this locale
+ <DT><B>Returns:</B><DD>the <code>String</code>, converted to uppercase.<DT><B>Since:</B></DT>
+ <DD>1.1</DD>
+ <DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#toUpperCase()"><CODE>toUpperCase()</CODE></A>,
+ <A HREF="../../java/lang/String.html#toLowerCase()"><CODE>toLowerCase()</CODE></A>,
+ <A HREF="../../java/lang/String.html#toLowerCase(java.util.Locale)"><CODE>toLowerCase(Locale)</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="toUpperCase()"><!-- --></A><H3>
+ toUpperCase</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>toUpperCase</B>()</PRE>
+<DL>
+ <DD>Converts all of the characters in this <code>String</code> to upper
+ case using the rules of the default locale. This method is equivalent to
+ <code>toUpperCase(Locale.getDefault())</code>.
+ <p>
+ <b>Note:</b> This method is locale sensitive, and may produce unexpected
+ results if used for strings that are intended to be interpreted locale
+ independently.
+ Examples are programming language identifiers, protocol keys, and HTML
+ tags.
+ For instance, <code>"title".toUpperCase()</code> in a Turkish locale
+ returns <code>"T?TLE"</code>, where '?' is the LATIN CAPITAL
+ LETTER I WITH DOT ABOVE character.
+ To obtain correct results for locale insensitive strings, use
+ <code>toUpperCase(Locale.ENGLISH)</code>.
+ <p>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+
+ <DT><B>Returns:</B><DD>the <code>String</code>, converted to uppercase.<DT><B>See Also:</B><DD><A HREF="../../java/lang/String.html#toUpperCase(java.util.Locale)"><CODE>toUpperCase(Locale)</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="trim()"><!-- --></A><H3>
+ trim</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>trim</B>()</PRE>
+<DL>
+ <DD>Returns a copy of the string, with leading and trailing whitespace
+ omitted.
+ <p>
+ If this <code>String</code> object represents an empty character
+ sequence, or the first and last characters of character sequence
+ represented by this <code>String</code> object both have codes
+ greater than <code>'\u0020'</code> (the space character), then a
+ reference to this <code>String</code> object is returned.
+ <p>
+ Otherwise, if there is no character with a code greater than
+ <code>'\u0020'</code> in the string, then a new
+ <code>String</code> object representing an empty string is created
+ and returned.
+ <p>
+ Otherwise, let <i>k</i> be the index of the first character in the
+ string whose code is greater than <code>'\u0020'</code>, and let
+ <i>m</i> be the index of the last character in the string whose code
+ is greater than <code>'\u0020'</code>. A new <code>String</code>
+ object is created, representing the substring of this string that
+ begins with the character at index <i>k</i> and ends with the
+ character at index <i>m</i>-that is, the result of
+ <code>this.substring(<i>k</i>, <i>m</i>+1)</code>.
+ <p>
+ This method may be used to trim whitespace (as defined above) from
+ the beginning and end of a string.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+
+ <DT><B>Returns:</B><DD>A copy of this string with leading and trailing white
+ space removed, or this string if it has no leading or
+ trailing white space.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="toString()"><!-- --></A><H3>
+ toString</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>toString</B>()</PRE>
+<DL>
+ <DD>This object (which is already a string!) is itself returned.
+ <P>
+ <DD><DL>
+ <DT><B>Specified by:</B><DD><CODE><A HREF="../../java/lang/CharSequence.html#toString()">toString</A></CODE> in interface <CODE><A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A></CODE><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#toString()">toString</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></CODE></DL>
+ </DD>
+ <DD><DL>
+
+ <DT><B>Returns:</B><DD>the string itself.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="toCharArray()"><!-- --></A><H3>
+ toCharArray</H3>
+<PRE>
+public char[] <B>toCharArray</B>()</PRE>
+<DL>
+ <DD>Converts this string to a new character array.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+
+ <DT><B>Returns:</B><DD>a newly allocated character array whose length is the length
+ of this string and whose contents are initialized to contain
+ the character sequence represented by this string.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="format(java.lang.String, java.lang.Object...)"><!-- --></A><H3>
+ format</H3>
+<PRE>
+public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>format</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> format,
+ <A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A>... args)</PRE>
+<DL>
+ <DD>Returns a formatted string using the specified format string and
+ arguments.
+
+ <p> The locale always used is the one returned by <A HREF="../../java/util/Locale.html#getDefault()"><CODE>Locale.getDefault()</CODE></A>.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>format</CODE> - A <a href="../util/Formatter.html#syntax">format string</a><DD><CODE>args</CODE> - Arguments referenced by the format specifiers in the format
+ string. If there are more arguments than format specifiers, the
+ extra arguments are ignored. The number of arguments is
+ variable and may be zero. The maximum number of arguments is
+ limited by the maximum dimension of a Java array as defined by
+ the <a href="http://java.sun.com/docs/books/vmspec/">Java
+ Virtual Machine Specification</a>. The behaviour on a
+ <tt>null</tt> argument depends on the <a
+ href="../util/Formatter.html#syntax">conversion</a>.
+ <DT><B>Returns:</B><DD>A formatted string
+ <DT><B>Throws:</B>
+ <DD><CODE>IllegalFormatException</CODE> - If a format string contains an illegal syntax, a format
+ specifier that is incompatible with the given arguments,
+ insufficient arguments given the format string, or other
+ illegal conditions. For specification of all possible
+ formatting errors, see the <a
+ href="../util/Formatter.html#detail">Details</a> section of the
+ formatter class specification.
+ <DD><CODE><A HREF="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</A></CODE> - If the <tt>format</tt> is <tt>null</tt><DT><B>Since:</B></DT>
+ <DD>1.5</DD>
+ <DT><B>See Also:</B><DD><A HREF="../../java/util/Formatter.html" title="class in java.util"><CODE>Formatter</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="format(java.util.Locale, java.lang.String, java.lang.Object...)"><!-- --></A><H3>
+ format</H3>
+<PRE>
+public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>format</B>(<A HREF="../../java/util/Locale.html" title="class in java.util">Locale</A> l,
+ <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> format,
+ <A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A>... args)</PRE>
+<DL>
+ <DD>Returns a formatted string using the specified locale, format string,
+ and arguments.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>l</CODE> - The <A HREF="../../java/util/Locale.html" title="class in java.util">locale</A> to apply during
+ formatting. If <tt>l</tt> is <tt>null</tt> then no localization
+ is applied.<DD><CODE>format</CODE> - A <a href="../util/Formatter.html#syntax">format string</a><DD><CODE>args</CODE> - Arguments referenced by the format specifiers in the format
+ string. If there are more arguments than format specifiers, the
+ extra arguments are ignored. The number of arguments is
+ variable and may be zero. The maximum number of arguments is
+ limited by the maximum dimension of a Java array as defined by
+ the <a href="http://java.sun.com/docs/books/vmspec/">Java
+ Virtual Machine Specification</a>. The behaviour on a
+ <tt>null</tt> argument depends on the <a
+ href="../util/Formatter.html#syntax">conversion</a>.
+ <DT><B>Returns:</B><DD>A formatted string
+ <DT><B>Throws:</B>
+ <DD><CODE>IllegalFormatException</CODE> - If a format string contains an illegal syntax, a format
+ specifier that is incompatible with the given arguments,
+ insufficient arguments given the format string, or other
+ illegal conditions. For specification of all possible
+ formatting errors, see the <a
+ href="../util/Formatter.html#detail">Details</a> section of the
+ formatter class specification
+ <DD><CODE><A HREF="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</A></CODE> - If the <tt>format</tt> is <tt>null</tt><DT><B>Since:</B></DT>
+ <DD>1.5</DD>
+ <DT><B>See Also:</B><DD><A HREF="../../java/util/Formatter.html" title="class in java.util"><CODE>Formatter</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="valueOf(java.lang.Object)"><!-- --></A><H3>
+ valueOf</H3>
+<PRE>
+public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A> obj)</PRE>
+<DL>
+ <DD>Returns the string representation of the <code>Object</code> argument.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>obj</CODE> - an <code>Object</code>.
+ <DT><B>Returns:</B><DD>if the argument is <code>null</code>, then a string equal to
+ <code>"null"</code>; otherwise, the value of
+ <code>obj.toString()</code> is returned.<DT><B>See Also:</B><DD><A HREF="../../java/lang/Object.html#toString()"><CODE>Object.toString()</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="valueOf(char[])"><!-- --></A><H3>
+ valueOf</H3>
+<PRE>
+public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(char[] data)</PRE>
+<DL>
+ <DD>Returns the string representation of the <code>char</code> array
+ argument. The contents of the character array are copied; subsequent
+ modification of the character array does not affect the newly
+ created string.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>data</CODE> - a <code>char</code> array.
+ <DT><B>Returns:</B><DD>a newly allocated string representing the same sequence of
+ characters contained in the character array argument.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="valueOf(char[], int, int)"><!-- --></A><H3>
+ valueOf</H3>
+<PRE>
+public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(char[] data,
+ int offset,
+ int count)</PRE>
+<DL>
+ <DD>Returns the string representation of a specific subarray of the
+ <code>char</code> array argument.
+ <p>
+ The <code>offset</code> argument is the index of the first
+ character of the subarray. The <code>count</code> argument
+ specifies the length of the subarray. The contents of the subarray
+ are copied; subsequent modification of the character array does not
+ affect the newly created string.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>data</CODE> - the character array.<DD><CODE>offset</CODE> - the initial offset into the value of the
+ <code>String</code>.<DD><CODE>count</CODE> - the length of the value of the <code>String</code>.
+ <DT><B>Returns:</B><DD>a string representing the sequence of characters contained
+ in the subarray of the character array argument.
+ <DT><B>Throws:</B>
+ <DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if <code>offset</code> is
+ negative, or <code>count</code> is negative, or
+ <code>offset+count</code> is larger than
+ <code>data.length</code>.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="copyValueOf(char[], int, int)"><!-- --></A><H3>
+ copyValueOf</H3>
+<PRE>
+public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>copyValueOf</B>(char[] data,
+ int offset,
+ int count)</PRE>
+<DL>
+ <DD>Returns a String that represents the character sequence in the
+ array specified.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>data</CODE> - the character array.<DD><CODE>offset</CODE> - initial offset of the subarray.<DD><CODE>count</CODE> - length of the subarray.
+ <DT><B>Returns:</B><DD>a <code>String</code> that contains the characters of the
+ specified subarray of the character array.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="copyValueOf(char[])"><!-- --></A><H3>
+ copyValueOf</H3>
+<PRE>
+public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>copyValueOf</B>(char[] data)</PRE>
+<DL>
+ <DD>Returns a String that represents the character sequence in the
+ array specified.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>data</CODE> - the character array.
+ <DT><B>Returns:</B><DD>a <code>String</code> that contains the characters of the
+ character array.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="valueOf(boolean)"><!-- --></A><H3>
+ valueOf</H3>
+<PRE>
+public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(boolean b)</PRE>
+<DL>
+ <DD>Returns the string representation of the <code>boolean</code> argument.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>b</CODE> - a <code>boolean</code>.
+ <DT><B>Returns:</B><DD>if the argument is <code>true</code>, a string equal to
+ <code>"true"</code> is returned; otherwise, a string equal to
+ <code>"false"</code> is returned.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="valueOf(char)"><!-- --></A><H3>
+ valueOf</H3>
+<PRE>
+public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(char c)</PRE>
+<DL>
+ <DD>Returns the string representation of the <code>char</code>
+ argument.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>c</CODE> - a <code>char</code>.
+ <DT><B>Returns:</B><DD>a string of length <code>1</code> containing
+ as its single character the argument <code>c</code>.</DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="valueOf(int)"><!-- --></A><H3>
+ valueOf</H3>
+<PRE>
+public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(int i)</PRE>
+<DL>
+ <DD>Returns the string representation of the <code>int</code> argument.
+ <p>
+ The representation is exactly the one returned by the
+ <code>Integer.toString</code> method of one argument.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>i</CODE> - an <code>int</code>.
+ <DT><B>Returns:</B><DD>a string representation of the <code>int</code> argument.<DT><B>See Also:</B><DD><A HREF="../../java/lang/Integer.html#toString(int, int)"><CODE>Integer.toString(int, int)</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="valueOf(long)"><!-- --></A><H3>
+ valueOf</H3>
+<PRE>
+public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(long l)</PRE>
+<DL>
+ <DD>Returns the string representation of the <code>long</code> argument.
+ <p>
+ The representation is exactly the one returned by the
+ <code>Long.toString</code> method of one argument.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>l</CODE> - a <code>long</code>.
+ <DT><B>Returns:</B><DD>a string representation of the <code>long</code> argument.<DT><B>See Also:</B><DD><A HREF="../../java/lang/Long.html#toString(long)"><CODE>Long.toString(long)</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="valueOf(float)"><!-- --></A><H3>
+ valueOf</H3>
+<PRE>
+public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(float f)</PRE>
+<DL>
+ <DD>Returns the string representation of the <code>float</code> argument.
+ <p>
+ The representation is exactly the one returned by the
+ <code>Float.toString</code> method of one argument.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>f</CODE> - a <code>float</code>.
+ <DT><B>Returns:</B><DD>a string representation of the <code>float</code> argument.<DT><B>See Also:</B><DD><A HREF="../../java/lang/Float.html#toString(float)"><CODE>Float.toString(float)</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="valueOf(double)"><!-- --></A><H3>
+ valueOf</H3>
+<PRE>
+public static <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>valueOf</B>(double d)</PRE>
+<DL>
+ <DD>Returns the string representation of the <code>double</code> argument.
+ <p>
+ The representation is exactly the one returned by the
+ <code>Double.toString</code> method of one argument.
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+ <DT><B>Parameters:</B><DD><CODE>d</CODE> - a <code>double</code>.
+ <DT><B>Returns:</B><DD>a string representation of the <code>double</code> argument.<DT><B>See Also:</B><DD><A HREF="../../java/lang/Double.html#toString(double)"><CODE>Double.toString(double)</CODE></A></DL>
+ </DD>
+</DL>
+<HR>
+
+<A NAME="intern()"><!-- --></A><H3>
+ intern</H3>
+<PRE>
+public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>intern</B>()</PRE>
+<DL>
+ <DD>Returns a canonical representation for the string object.
+ <p>
+ A pool of strings, initially empty, is maintained privately by the
+ class <code>String</code>.
+ <p>
+ When the intern method is invoked, if the pool already contains a
+ string equal to this <code>String</code> object as determined by
+ the <A HREF="../../java/lang/String.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A> method, then the string from the pool is
+ returned. Otherwise, this <code>String</code> object is added to the
+ pool and a reference to this <code>String</code> object is returned.
+ <p>
+ It follows that for any two strings <code>s</code> and <code>t</code>,
+ <code>s.intern() == t.intern()</code> is <code>true</code>
+ if and only if <code>s.equals(t)</code> is <code>true</code>.
+ <p>
+ All literal strings and string-valued constant expressions are
+ interned. String literals are defined in §3.10.5 of the
+ <a href="http://java.sun.com/docs/books/jls/html/">Java Language
+ Specification</a>
+ <P>
+ <DD><DL>
+ </DL>
+ </DD>
+ <DD><DL>
+
+ <DT><B>Returns:</B><DD>a string that has the same contents as this string, but is
+ guaranteed to be from a pool of unique strings.</DL>
+ </DD>
+</DL>
+<!-- ========= END OF CLASS DATA ========= -->
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+ <TR>
+ <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+ <A NAME="navbar_bottom_firstrow"><!-- --></A>
+ <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/String.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+ </TABLE>
+ </TD>
+ <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+ <b>Java™ Platform<br>Standard Ed. 6</b></EM>
+ </TD>
+ </TR>
+
+ <TR>
+ <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../java/lang/StrictMath.html" title="class in java.lang"><B>PREV CLASS</B></A>
+ <A HREF="../../java/lang/StringBuffer.html" title="class in java.lang"><B>NEXT CLASS</B></A></FONT></TD>
+ <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../index.html?java/lang/String.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="String.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+ </SCRIPT>
+ <NOSCRIPT>
+ <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
+ </NOSCRIPT>
+
+
+ </FONT></TD>
+ </TR>
+ <TR>
+ <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
+ <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
+ </TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+<font size="-1"> <a href="http://bugs.sun.com/services/bugreport/index.jsp">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/javase/6/webnotes/devdocs-vs-specs.html">Java SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.<p> <a href="../../../legal/cpyr.html">Copyright</a> © 1993, 2011, Oracle and/or its affiliates. All rights reserved. </font>
+<!-- Start SiteCatalyst code -->
+<script language="JavaScript" src="http://www.oracle.com/ocom/groups/systemobject/@mktg_admin/documents/systemobject/s_code_download.js"></script>
+<script language="JavaScript" src="http://www.oracle.com/ocom/groups/systemobject/@mktg_admin/documents/systemobject/s_code.js"></script>
+
+<!-- ********** DO NOT ALTER ANYTHING BELOW THIS LINE ! *********** -->
+<!-- Below code will send the info to Omniture server -->
+<script language="javascript">var s_code=s.t();if(s_code)document.write(s_code)</script>
+
+<!-- End SiteCatalyst code -->
+<noscript>
+ <p>Scripting on this page tracks web page traffic, but does not change the content in any way.</p>
+</noscript>
+</BODY>
+</HTML>
diff --git a/java/java-tests/testData/codeInsight/javadocIG/annotations.html b/java/java-tests/testData/codeInsight/javadocIG/annotations.html
index 39e5747..7e9221d 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/annotations.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/annotations.html
@@ -1,3 +1,3 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE><font color=red>@Nullable</font>
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE><font color=red>@Nullable</font>
@<a href="psi_element://java.lang.Deprecated"><code>Deprecated</code></a>
public <a href="psi_element://java.lang.String"><code>String</code></a> <b>field = null</b></PRE></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.html b/java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.html
index c9b08d6..4a28579 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.html
@@ -1,2 +1,2 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE>public void <b>foo</b>(@<a href="psi_element://java.lang.Deprecated"><code>Deprecated</code></a> <a href="psi_element://java.lang.String"><code>String</code></a> s,
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE>public void <b>foo</b>(@<a href="psi_element://java.lang.Deprecated"><code>Deprecated</code></a> <a href="psi_element://java.lang.String"><code>String</code></a> s,
@<a href="psi_element://java.lang.Deprecated"><code>Deprecated</code></a> <a href="psi_element://java.lang.String"><code>String</code></a> p)</PRE></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/anonymousAndSuperJavadoc.html b/java/java-tests/testData/codeInsight/javadocIG/anonymousAndSuperJavadoc.html
index 05d80ff..d402877 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/anonymousAndSuperJavadoc.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/anonymousAndSuperJavadoc.html
@@ -1,4 +1,4 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE>
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE>
public void <b>foo</b>()</PRE><DD><DL><DT><b>Description copied from interface:</b> <a href="psi_element://Foo"><code>Foo</code></a><br>
some javadoc
</DD></DL></DD><DD><DL><DT><b>Specified by:</b><DD><a href="psi_element://Foo#foo()"><code>foo</code></a> in interface <a href="psi_element://Foo"><code>Foo</code></a></DD></DL></DD></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/apiNotes.html b/java/java-tests/testData/codeInsight/javadocIG/apiNotes.html
index b731e4e..7d457b4 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/apiNotes.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/apiNotes.html
@@ -1 +1 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE>public void <b>foo</b>()</PRE><DD><DL><DT><b>apiNote</b><DD> my api note </DD></DL></DD><DD><DL><DT><b>implSpec</b><DD> my impl spec </DD></DL></DD><DD><DL><DT><b>implNote</b><DD> my impl note</DD></DL></DD></body></html>
\ No newline at end of file
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE>public void <b>foo</b>()</PRE><DD><DL><DT><b>apiNote</b><DD> my api note </DD></DL></DD><DD><DL><DT><b>implSpec</b><DD> my impl spec </DD></DL></DD><DD><DL><DT><b>implNote</b><DD> my impl note</DD></DL></DD></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/classTypeParameter.html b/java/java-tests/testData/codeInsight/javadocIG/classTypeParameter.html
index 92254a8..49ff667 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/classTypeParameter.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/classTypeParameter.html
@@ -1,3 +1,3 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE>class <b>MethodTypeParam</b><T>
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE>class <b>MethodTypeParam</b><T>
extends <a href="psi_element://java.lang.Object"><code>Object</code></a></PRE>
<DD><DL><DT><b>Type parameters:</b><DD><code><T></code> - type param</DD></DL></DD></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/clickableFieldReference.html b/java/java-tests/testData/codeInsight/javadocIG/clickableFieldReference.html
index 5cc9036..584065f 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/clickableFieldReference.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/clickableFieldReference.html
@@ -1,3 +1,3 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE>@<a href="psi_element://Bar"><code>Bar</code></a>(<a href="psi_element://Baz#CONST"><code>Baz.CONST</code></a>, value = {<a href="psi_element://Baz#CONST"><code>Baz.CONST</code></a>})
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE>@<a href="psi_element://Bar"><code>Bar</code></a>(<a href="psi_element://Baz#CONST"><code>Baz.CONST</code></a>, value = {<a href="psi_element://Baz#CONST"><code>Baz.CONST</code></a>})
class <b>Foo</b>
extends <a href="psi_element://java.lang.Object"><code>Object</code></a></PRE></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/code.html b/java/java-tests/testData/codeInsight/javadocIG/code.html
index e75e091..fe44bd2 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/code.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/code.html
@@ -1,4 +1,4 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Foo"><code>Foo</code></a></b></small><PRE>int <b>foo</b></PRE>
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Foo"><code>Foo</code></a></b></small><PRE>int <b>foo</b></PRE>
<pre>
<code>
class Clazzz {
diff --git a/java/java-tests/testData/codeInsight/javadocIG/commaInsideArgsList.html b/java/java-tests/testData/codeInsight/javadocIG/commaInsideArgsList.html
index 4fb3721..6dd4792 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/commaInsideArgsList.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/commaInsideArgsList.html
@@ -1 +1 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE>public <a href="psi_element://java.lang.String"><code>String</code></a> <b>field = foo("", "")</b></PRE></body></html>
\ No newline at end of file
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE>public <a href="psi_element://java.lang.String"><code>String</code></a> <b>field = foo("", "")</b></PRE></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/constantFieldInitializer.html b/java/java-tests/testData/codeInsight/javadocIG/constantFieldInitializer.html
index 3965d05..b717a2f 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/constantFieldInitializer.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/constantFieldInitializer.html
@@ -1,2 +1,2 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE>public static final int <b>field =
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE>public static final int <b>field =
Resolved value: 2</b></PRE></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/enumConstantOrdinal.html b/java/java-tests/testData/codeInsight/javadocIG/enumConstantOrdinal.html
index 613de916..263a86d 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/enumConstantOrdinal.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/enumConstantOrdinal.html
@@ -1,2 +1,2 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://E"><code>E</code></a></b></small><PRE><a href="psi_element://E"><code>E</code></a> <b>A
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://E"><code>E</code></a></b></small><PRE><a href="psi_element://E"><code>E</code></a> <b>A
Enum constant ordinal: 0</b></PRE></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/enumValueOf.html b/java/java-tests/testData/codeInsight/javadocIG/enumValueOf.html
index c17fb4e..f461264 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/enumValueOf.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/enumValueOf.html
@@ -1,4 +1,4 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://En"><code>En</code></a></b></small><PRE><i>@<a href="psi_element://org.jetbrains.annotations.Contract"><code>org.jetbrains.annotations.Contract</code></a>(pure = true)</i>
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://En"><code>En</code></a></b></small><PRE><i>@<a href="psi_element://org.jetbrains.annotations.Contract"><code>org.jetbrains.annotations.Contract</code></a>(pure = true)</i>
static int <b>valueOf</b>(int i)</PRE>
myjavadoc
<DD><DL><DT><b>Parameters:</b><DD><code>i</code> - </DD></DL></DD><DD><DL><DT><b>Returns:</b><DD></DD></DL></DD></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/escapeValues.html b/java/java-tests/testData/codeInsight/javadocIG/escapeValues.html
index e35bd27..fb0fd6c 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/escapeValues.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/escapeValues.html
@@ -1,3 +1,3 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE>class <b>Pattern</b>
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE>class <b>Pattern</b>
extends <a href="psi_element://java.lang.Object"><code>Object</code></a></PRE>
\W \u03A9</body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/fieldValue.html b/java/java-tests/testData/codeInsight/javadocIG/fieldValue.html
index b15488d..aaed481 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/fieldValue.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/fieldValue.html
@@ -1 +1 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static int <b>JAVADOC_ME = 23</b></PRE> The value of the field is 23.</body></html>
\ No newline at end of file
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static int <b>JAVADOC_ME = 23</b></PRE> The value of the field is 23.</body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/ideadev2326.html b/java/java-tests/testData/codeInsight/javadocIG/ideadev2326.html
index e5f6c9f..cbd53c2 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/ideadev2326.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/ideadev2326.html
@@ -1,2 +1,2 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Idea4780"><code>Idea4780</code></a></b></small><PRE>public <a href="psi_element://java.lang.Object"><code>Object</code></a> <b>read</b>()
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Idea4780"><code>Idea4780</code></a></b></small><PRE>public <a href="psi_element://java.lang.Object"><code>Object</code></a> <b>read</b>()
throws <a href="psi_element://java.io.IOException"><code>IOException</code></a></PRE><DD><DL><DT><b>Throws:</b><DD><a href="psi_element://java.io.IOException"><code>IOException</code></a> - if an I/O error occurs while reading. <DD><a href="psi_element://java.io.EOFException"><code>EOFException</code></a> - if this source is already closed when the <code>read()</code> is called, or is closed during the <code>read()</code>. <DD><font color=red>InterruptedIOException</font> - if the reading thread is interrupted.</DD></DL></DD></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows.html b/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows.html
index 7a32b50..81df52e 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows.html
@@ -1,2 +1,2 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://InheritedDocInThrows"><code>InheritedDocInThrows</code></a></b></small><PRE>void <b>foo</b>()
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://InheritedDocInThrows"><code>InheritedDocInThrows</code></a></b></small><PRE>void <b>foo</b>()
throws <a href="psi_element://java.io.IOException"><code>IOException</code></a></PRE><DD><DL><DT><b>Overrides:</b><DD><a href="psi_element://A#foo()"><code>foo</code></a> in class <a href="psi_element://A"><code>A</code></a></DD></DL></DD><DD><DL><DT><b>Throws:</b><DD><a href="psi_element://java.io.IOException"><code>IOException</code></a> - la-la-la</DD></DL></DD></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows1.html b/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows1.html
index 59796e7..f27a085 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows1.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows1.html
@@ -1,2 +1,2 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://InheritedDocInThrows1"><code>InheritedDocInThrows1</code></a></b></small><PRE>void <b>foo</b>()
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://InheritedDocInThrows1"><code>InheritedDocInThrows1</code></a></b></small><PRE>void <b>foo</b>()
throws <a href="psi_element://java.io.IOException"><code>IOException</code></a></PRE><DD><DL><DT><b>Overrides:</b><DD><a href="psi_element://A#foo()"><code>foo</code></a> in class <a href="psi_element://A"><code>A</code></a></DD></DL></DD><DD><DL><DT><b>Throws:</b><DD><a href="psi_element://java.io.IOException"><code>IOException</code></a> - comment</DD></DL></DD></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/inheritedParameter.html b/java/java-tests/testData/codeInsight/javadocIG/inheritedParameter.html
index a95cc83..7beb470 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/inheritedParameter.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/inheritedParameter.html
@@ -1 +1 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE><a href="psi_element://java.lang.String"><code>String</code></a> <b>s</b></PRE><DD><code>s</code> - String parameter.</body></html>
\ No newline at end of file
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE><a href="psi_element://java.lang.String"><code>String</code></a> <b>s</b></PRE><DD><code>s</code> - String parameter.</body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/initializerWithLiteral.html b/java/java-tests/testData/codeInsight/javadocIG/initializerWithLiteral.html
index 57ca00a..da0954a 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/initializerWithLiteral.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/initializerWithLiteral.html
@@ -1 +1 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public <a href="psi_element://java.lang.String"><code>String</code></a> <b>strings = "A<BLANK>B"</b></PRE></body></html>
\ No newline at end of file
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public <a href="psi_element://java.lang.String"><code>String</code></a> <b>strings = "A<BLANK>B"</b></PRE></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/initializerWithNew.html b/java/java-tests/testData/codeInsight/javadocIG/initializerWithNew.html
index d11e238..7032c03 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/initializerWithNew.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/initializerWithNew.html
@@ -1 +1 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public <a href="psi_element://java.util.List"><code>List</code></a><<a href="psi_element://java.lang.String"><code>String</code></a>> <b>strings = new <a href="psi_element://java.util.ArrayList"><code>ArrayList</code></a><<a href="psi_element://java.lang.String"><code>String</code></a>>(new <a href="psi_element://java.util.ArrayList"><code>ArrayList</code></a><<a href="psi_element://java.lang.Integer"><code>Integer</code></a>>(), Collections.singleton(new <a href="psi_element://java.util.ArrayList"><code>ArrayList</code></a><<a href="psi_element://java.lang.Double"><code>Double</code></a>>()))</b></PRE></body></html>
\ No newline at end of file
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public <a href="psi_element://java.util.List"><code>List</code></a><<a href="psi_element://java.lang.String"><code>String</code></a>> <b>strings = new <a href="psi_element://java.util.ArrayList"><code>ArrayList</code></a><<a href="psi_element://java.lang.String"><code>String</code></a>>(new <a href="psi_element://java.util.ArrayList"><code>ArrayList</code></a><<a href="psi_element://java.lang.Integer"><code>Integer</code></a>>(), Collections.singleton(new <a href="psi_element://java.util.ArrayList"><code>ArrayList</code></a><<a href="psi_element://java.lang.Double"><code>Double</code></a>>()))</b></PRE></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/initializerWithReference.html b/java/java-tests/testData/codeInsight/javadocIG/initializerWithReference.html
index f4ba3cb..8780018 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/initializerWithReference.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/initializerWithReference.html
@@ -1 +1 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE>public int <b>field = anotherField</b></PRE></body></html>
\ No newline at end of file
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE>public int <b>field = anotherField</b></PRE></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/lambdaParameter.html b/java/java-tests/testData/codeInsight/javadocIG/lambdaParameter.html
index 3169792..bc06e7a 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/lambdaParameter.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/lambdaParameter.html
@@ -1 +1 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE>int <b>a</b></PRE></body></html>
\ No newline at end of file
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE>int <b>a</b></PRE></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/literal.html b/java/java-tests/testData/codeInsight/javadocIG/literal.html
index a10aecb..cc4d27b 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/literal.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/literal.html
@@ -1,2 +1,2 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Foo"><code>Foo</code></a></b></small><PRE>int <b>foo</b></PRE>
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Foo"><code>Foo</code></a></b></small><PRE>int <b>foo</b></PRE>
foo <></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/methodExpressionWithLiteral.html b/java/java-tests/testData/codeInsight/javadocIG/methodExpressionWithLiteral.html
index 5d73a26..9f87e83 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/methodExpressionWithLiteral.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/methodExpressionWithLiteral.html
@@ -1 +1 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public byte[] <b>bytes = "&amp;".getBytes()</b></PRE></body></html>
\ No newline at end of file
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public byte[] <b>bytes = "&amp;".getBytes()</b></PRE></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/methodFormatting.html b/java/java-tests/testData/codeInsight/javadocIG/methodFormatting.html
index 9cb6179..9d9f05b 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/methodFormatting.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/methodFormatting.html
@@ -1,3 +1,3 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Producer"><code>Producer</code></a></b></small><PRE><E extends <a href="psi_element://java.lang.Exception"><code>Exception</code></a>> void <b>drainTo</b>(<a href="psi_element://Consumer"><code>Consumer</code></a><? super T, E> consumer,
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Producer"><code>Producer</code></a></b></small><PRE><E extends <a href="psi_element://java.lang.Exception"><code>Exception</code></a>> void <b>drainTo</b>(<a href="psi_element://Consumer"><code>Consumer</code></a><? super T, E> consumer,
<a href="psi_element://java.lang.Object"><code>Object</code></a> someParameter)
throws <a href="psi_element://E"><code>E</code></a></PRE><DD><DL><DT><b>Throws:</b><DD><a href="psi_element://E"><code>E</code></a></DD></DL></DD></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/methodTypeParameter.html b/java/java-tests/testData/codeInsight/javadocIG/methodTypeParameter.html
index 86ed662..f3258f5 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/methodTypeParameter.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/methodTypeParameter.html
@@ -1 +1 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://MethodTypeParam"><code>MethodTypeParam</code></a></b></small><PRE><T> void <b>foo</b>(T t)</PRE><DD><DL><DT><b>Type parameters:</b><DD><code><T></code> - type param</DD></DL></DD></body></html>
\ No newline at end of file
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://MethodTypeParam"><code>MethodTypeParam</code></a></b></small><PRE><T> void <b>foo</b>(T t)</PRE><DD><DL><DT><b>Type parameters:</b><DD><code><T></code> - type param</DD></DL></DD></body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/pInsidePre.html b/java/java-tests/testData/codeInsight/javadocIG/pInsidePre.html
index fbfd298..514fb15 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/pInsidePre.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/pInsidePre.html
@@ -1,4 +1,4 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE>public <a href="psi_element://java.lang.String"><code>String</code></a> <b>field = null</b></PRE>
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://Test"><code>Test</code></a></b></small><PRE>public <a href="psi_element://java.lang.String"><code>String</code></a> <b>field = null</b></PRE>
<pre>
foo
<p></p>
diff --git a/java/java-tests/testData/codeInsight/javadocIG/simpleField.html b/java/java-tests/testData/codeInsight/javadocIG/simpleField.html
index 643ceac..b2f9b93 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/simpleField.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/simpleField.html
@@ -1 +1 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static int <b>JAVADOC_ME</b></PRE> Test</body></html>
\ No newline at end of file
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static int <b>JAVADOC_ME</b></PRE> Test</body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/valueInMethod.html b/java/java-tests/testData/codeInsight/javadocIG/valueInMethod.html
index 9b2fe72..8342fea 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/valueInMethod.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/valueInMethod.html
@@ -1 +1 @@
-<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static void <b>JAVADOC_ME</b>()</PRE> The value of A is 23.</body></html>
\ No newline at end of file
+<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static void <b>JAVADOC_ME</b>()</PRE> The value of A is 23.</body></html>
\ No newline at end of file
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature.log b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature.log
new file mode 100644
index 0000000..98d7347
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature.log
@@ -0,0 +1,16 @@
+Cleaning output files:
+out/production/ChangeLambdaSAMMethodSignature/ppp/Client.class
+out/production/ChangeLambdaSAMMethodSignature/ppp/DataProvider.class
+out/production/ChangeLambdaSAMMethodSignature/ppp/Repository.class
+End of files
+Compiling files:
+src/ppp/Client.java
+src/ppp/DataProvider.java
+src/ppp/Repository.java
+End of files
+Cleaning output files:
+out/production/ChangeLambdaSAMMethodSignature/ppp/Main.class
+End of files
+Compiling files:
+src/ppp/Main.java
+End of files
\ No newline at end of file
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Client.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Client.java
new file mode 100644
index 0000000..463efb8
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Client.java
@@ -0,0 +1,8 @@
+package ppp;
+public class Client {
+ public void execute(DataProvider data) {
+ for (String s : data.getData()) {
+ System.out.println(s);
+ }
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Client.java.new b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Client.java.new
new file mode 100644
index 0000000..bcef65b
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Client.java.new
@@ -0,0 +1,8 @@
+package ppp;
+public class Client {
+ public void execute(DataProvider data) {
+ for (String s : data.getData(10)) {
+ System.out.println(s);
+ }
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/DataProvider.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/DataProvider.java
new file mode 100644
index 0000000..867c0ec
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/DataProvider.java
@@ -0,0 +1,7 @@
+package ppp;
+
+import java.util.Collection;
+
+public interface DataProvider {
+ Collection<String> getData();
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/DataProvider.java.new b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/DataProvider.java.new
new file mode 100644
index 0000000..48cad72
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/DataProvider.java.new
@@ -0,0 +1,7 @@
+package ppp;
+
+import java.util.Collection;
+
+public interface DataProvider {
+ Collection<String> getData(int param);
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Main.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Main.java
new file mode 100644
index 0000000..83badb8
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Main.java
@@ -0,0 +1,9 @@
+package ppp;
+
+public class Main {
+ public static void main(String[] args) {
+ Repository repo = new Repository();
+ Client client = new Client();
+ client.execute(()-> repo.getStorages());
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Repository.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Repository.java
new file mode 100644
index 0000000..ff7c586d
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Repository.java
@@ -0,0 +1,10 @@
+package ppp;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class Repository {
+ public List<String> getStorages() {
+ return Arrays.asList("a", "b", "c");
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Repository.java.new b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Repository.java.new
new file mode 100644
index 0000000..29625a0
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaSAMMethodSignature/src/ppp/Repository.java.new
@@ -0,0 +1,10 @@
+package ppp;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class Repository {
+ public List<String> getStorages(int param) {
+ return Arrays.asList("a", "b", "c");
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType.log b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType.log
new file mode 100644
index 0000000..74c5f74
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType.log
@@ -0,0 +1,12 @@
+Cleaning output files:
+out/production/ChangeLambdaTargetReturnType/ppp/Repository.class
+End of files
+Compiling files:
+src/ppp/Repository.java
+End of files
+Cleaning output files:
+out/production/ChangeLambdaTargetReturnType/ppp/Main.class
+End of files
+Compiling files:
+src/ppp/Main.java
+End of files
\ No newline at end of file
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/Client.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/Client.java
new file mode 100644
index 0000000..463efb8
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/Client.java
@@ -0,0 +1,8 @@
+package ppp;
+public class Client {
+ public void execute(DataProvider data) {
+ for (String s : data.getData()) {
+ System.out.println(s);
+ }
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/DataProvider.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/DataProvider.java
new file mode 100644
index 0000000..867c0ec
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/DataProvider.java
@@ -0,0 +1,7 @@
+package ppp;
+
+import java.util.Collection;
+
+public interface DataProvider {
+ Collection<String> getData();
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/Main.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/Main.java
new file mode 100644
index 0000000..83badb8
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/Main.java
@@ -0,0 +1,9 @@
+package ppp;
+
+public class Main {
+ public static void main(String[] args) {
+ Repository repo = new Repository();
+ Client client = new Client();
+ client.execute(()-> repo.getStorages());
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/Repository.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/Repository.java
new file mode 100644
index 0000000..ff7c586d
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/Repository.java
@@ -0,0 +1,10 @@
+package ppp;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class Repository {
+ public List<String> getStorages() {
+ return Arrays.asList("a", "b", "c");
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/Repository.java.new b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/Repository.java.new
new file mode 100644
index 0000000..f70ad61f
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeLambdaTargetReturnType/src/ppp/Repository.java.new
@@ -0,0 +1,10 @@
+package ppp;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+public class Repository {
+ public Collection<String> getStorages() {
+ return Arrays.asList("a", "b", "c");
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType.log b/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType.log
new file mode 100644
index 0000000..19e7ce0
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType.log
@@ -0,0 +1,12 @@
+Cleaning output files:
+out/production/ChangeMethodRefReturnType/ppp/Repository.class
+End of files
+Compiling files:
+src/ppp/Repository.java
+End of files
+Cleaning output files:
+out/production/ChangeMethodRefReturnType/ppp/Main.class
+End of files
+Compiling files:
+src/ppp/Main.java
+End of files
\ No newline at end of file
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/Client.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/Client.java
new file mode 100644
index 0000000..463efb8
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/Client.java
@@ -0,0 +1,8 @@
+package ppp;
+public class Client {
+ public void execute(DataProvider data) {
+ for (String s : data.getData()) {
+ System.out.println(s);
+ }
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/DataProvider.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/DataProvider.java
new file mode 100644
index 0000000..867c0ec
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/DataProvider.java
@@ -0,0 +1,7 @@
+package ppp;
+
+import java.util.Collection;
+
+public interface DataProvider {
+ Collection<String> getData();
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/Main.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/Main.java
new file mode 100644
index 0000000..3f1e038
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/Main.java
@@ -0,0 +1,9 @@
+package ppp;
+
+public class Main {
+ public static void main(String[] args) {
+ Repository repo = new Repository();
+ Client client = new Client();
+ client.execute(repo::getStorages);
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/Repository.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/Repository.java
new file mode 100644
index 0000000..ff7c586d
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/Repository.java
@@ -0,0 +1,10 @@
+package ppp;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class Repository {
+ public List<String> getStorages() {
+ return Arrays.asList("a", "b", "c");
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/Repository.java.new b/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/Repository.java.new
new file mode 100644
index 0000000..f70ad61f
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeMethodRefReturnType/src/ppp/Repository.java.new
@@ -0,0 +1,10 @@
+package ppp;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+public class Repository {
+ public Collection<String> getStorages() {
+ return Arrays.asList("a", "b", "c");
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature.log b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature.log
new file mode 100644
index 0000000..4b61261
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature.log
@@ -0,0 +1,16 @@
+Cleaning output files:
+out/production/ChangeSAMMethodSignature/ppp/Client.class
+out/production/ChangeSAMMethodSignature/ppp/DataProvider.class
+out/production/ChangeSAMMethodSignature/ppp/Repository.class
+End of files
+Compiling files:
+src/ppp/Client.java
+src/ppp/DataProvider.java
+src/ppp/Repository.java
+End of files
+Cleaning output files:
+out/production/ChangeSAMMethodSignature/ppp/Main.class
+End of files
+Compiling files:
+src/ppp/Main.java
+End of files
\ No newline at end of file
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Client.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Client.java
new file mode 100644
index 0000000..463efb8
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Client.java
@@ -0,0 +1,8 @@
+package ppp;
+public class Client {
+ public void execute(DataProvider data) {
+ for (String s : data.getData()) {
+ System.out.println(s);
+ }
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Client.java.new b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Client.java.new
new file mode 100644
index 0000000..bcef65b
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Client.java.new
@@ -0,0 +1,8 @@
+package ppp;
+public class Client {
+ public void execute(DataProvider data) {
+ for (String s : data.getData(10)) {
+ System.out.println(s);
+ }
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/DataProvider.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/DataProvider.java
new file mode 100644
index 0000000..867c0ec
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/DataProvider.java
@@ -0,0 +1,7 @@
+package ppp;
+
+import java.util.Collection;
+
+public interface DataProvider {
+ Collection<String> getData();
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/DataProvider.java.new b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/DataProvider.java.new
new file mode 100644
index 0000000..48cad72
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/DataProvider.java.new
@@ -0,0 +1,7 @@
+package ppp;
+
+import java.util.Collection;
+
+public interface DataProvider {
+ Collection<String> getData(int param);
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Main.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Main.java
new file mode 100644
index 0000000..3f1e038
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Main.java
@@ -0,0 +1,9 @@
+package ppp;
+
+public class Main {
+ public static void main(String[] args) {
+ Repository repo = new Repository();
+ Client client = new Client();
+ client.execute(repo::getStorages);
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Repository.java b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Repository.java
new file mode 100644
index 0000000..ff7c586d
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Repository.java
@@ -0,0 +1,10 @@
+package ppp;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class Repository {
+ public List<String> getStorages() {
+ return Arrays.asList("a", "b", "c");
+ }
+}
diff --git a/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Repository.java.new b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Repository.java.new
new file mode 100644
index 0000000..29625a0
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/methodProperties/changeSAMMethodSignature/src/ppp/Repository.java.new
@@ -0,0 +1,10 @@
+package ppp;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class Repository {
+ public List<String> getStorages(int param) {
+ return Arrays.asList("a", "b", "c");
+ }
+}
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ContractPreservesUnknownMethodNullability.java b/java/java-tests/testData/inspection/dataFlow/fixture/ContractPreservesUnknownMethodNullability.java
new file mode 100644
index 0000000..537a504
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ContractPreservesUnknownMethodNullability.java
@@ -0,0 +1,22 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.Nullable;
+
+class TestCase {
+
+ private void countWordsWarning() {
+ // no warnings should be here
+ String s = normalizeSpace(unknown()).trim();
+ String s3 = normalizeSpaceInverted(unknown()).trim();
+
+ String s4 = <warning descr="Method invocation 'normalizeSpace(null).trim()' may produce 'java.lang.NullPointerException'">normalizeSpace(null).trim()</warning>;
+ }
+
+ public static native String unknown();
+
+ @Contract("null->null")
+ public static native String normalizeSpace(@Nullable String str);
+
+ @Contract("!null->!null; _->null")
+ public static native String normalizeSpaceInverted(String str);
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/extractMethod/SuggestChangeSignatureInitialParameterUnused_after.java b/java/java-tests/testData/refactoring/extractMethod/SuggestChangeSignatureInitialParameterUnused_after.java
index 099717d..2da1ee9 100644
--- a/java/java-tests/testData/refactoring/extractMethod/SuggestChangeSignatureInitialParameterUnused_after.java
+++ b/java/java-tests/testData/refactoring/extractMethod/SuggestChangeSignatureInitialParameterUnused_after.java
@@ -2,12 +2,12 @@
{
int x = 0;
- newMethod(x, "foo".substring(x));
+ newMethod("foo".substring(x));
- newMethod(x, "bar".substring(x));
+ newMethod("bar".substring(x));
}
- private void newMethod(int x, String substring) {
+ private void newMethod(String substring) {
System.out.println(substring);
}
}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/extractMethodObject/multipleExitPoints/ReturnExitStatement.java.after b/java/java-tests/testData/refactoring/extractMethodObject/multipleExitPoints/ReturnExitStatement.java.after
index 35dae91..aab751a 100644
--- a/java/java-tests/testData/refactoring/extractMethodObject/multipleExitPoints/ReturnExitStatement.java.after
+++ b/java/java-tests/testData/refactoring/extractMethodObject/multipleExitPoints/ReturnExitStatement.java.after
@@ -2,7 +2,7 @@
boolean foo() {
Inner inner = new Inner().invoke();
- if (inner.is()) return inner.isFoo();
+ if (inner.is()) return inner.getFoo();
return false;
@@ -16,7 +16,7 @@
return myResult;
}
- public Boolean isFoo() {
+ public Boolean getFoo() {
return foo;
}
diff --git a/java/java-tests/testData/refactoring/introduceVariable/IntersectionWildcardExpectedType.after.java b/java/java-tests/testData/refactoring/introduceVariable/IntersectionWildcardExpectedType.after.java
new file mode 100644
index 0000000..1248f2c
--- /dev/null
+++ b/java/java-tests/testData/refactoring/introduceVariable/IntersectionWildcardExpectedType.after.java
@@ -0,0 +1,13 @@
+import java.util.Arrays;
+import java.util.List;
+
+class Test {
+
+ interface I {}
+ enum X implements I {a}
+ enum Y implements I {a}
+
+ {
+ List<? extends Enum<? extends Enum<? extends Enum<?>>>> l = Arrays.asList(X.a, Y.a);
+ }
+}
diff --git a/java/java-tests/testData/refactoring/introduceVariable/IntersectionWildcardExpectedType.java b/java/java-tests/testData/refactoring/introduceVariable/IntersectionWildcardExpectedType.java
new file mode 100644
index 0000000..d560b1b
--- /dev/null
+++ b/java/java-tests/testData/refactoring/introduceVariable/IntersectionWildcardExpectedType.java
@@ -0,0 +1,12 @@
+import java.util.Arrays;
+
+class Test {
+
+ interface I {}
+ enum X implements I {a}
+ enum Y implements I {a}
+
+ {
+ <selection>Arrays.asList(X.a, Y.a)</selection>;
+ }
+}
diff --git a/java/java-tests/testData/refactoring/makeMethodStatic/afterThisMethodReference.java b/java/java-tests/testData/refactoring/makeMethodStatic/afterThisMethodReference.java
new file mode 100644
index 0000000..787f647
--- /dev/null
+++ b/java/java-tests/testData/refactoring/makeMethodStatic/afterThisMethodReference.java
@@ -0,0 +1,10 @@
+class Test4 {
+ void test() {
+ Runnable f = Test4::yyy;
+ }
+
+ String myField = "";
+ static void yyy() {
+ System.out.println(myField);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/makeMethodStatic/beforeThisMethodReference.java b/java/java-tests/testData/refactoring/makeMethodStatic/beforeThisMethodReference.java
new file mode 100644
index 0000000..68bb883
--- /dev/null
+++ b/java/java-tests/testData/refactoring/makeMethodStatic/beforeThisMethodReference.java
@@ -0,0 +1,10 @@
+class Test4 {
+ void test() {
+ Runnable f = this::yyy;
+ }
+
+ String myField = "";
+ void yy<caret>y() {
+ System.out.println(myField);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/CompleteStatementTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/CompleteStatementTest.java
index 430af5b..ac52cab 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/CompleteStatementTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/CompleteStatementTest.java
@@ -18,7 +18,6 @@
import com.intellij.JavaTestUtil;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.actionSystem.IdeActions;
-import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import com.intellij.testFramework.EditorActionTestCase;
@@ -272,6 +271,8 @@
public void testGenericMethodBody() throws Exception { doTest(); }
public void testDefaultMethodBody() { doTest(); }
+ public void testStaticInterfaceMethodBody() { doTest(); }
+ public void testPrivateInterfaceMethodBody() { doTest(); }
public void testArrayInitializerRBracket() throws Exception { doTest(); }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/JavaExternalDocumentationTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/JavaExternalDocumentationTest.java
new file mode 100644
index 0000000..603ffb0
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/JavaExternalDocumentationTest.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2000-2015 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 com.intellij.codeInsight;
+
+import com.intellij.JavaTestUtil;
+import com.intellij.codeInsight.documentation.DocumentationComponent;
+import com.intellij.codeInsight.documentation.DocumentationManager;
+import com.intellij.lang.java.JavaLanguage;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.EditorFactory;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleManager;
+import com.intellij.openapi.roots.JavadocOrderRootType;
+import com.intellij.openapi.roots.ModuleRootModificationUtil;
+import com.intellij.openapi.roots.OrderRootType;
+import com.intellij.openapi.roots.libraries.Library;
+import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
+import com.intellij.openapi.ui.popup.JBPopup;
+import com.intellij.openapi.util.ActionCallback;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.Ref;
+import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.vfs.JarFileSystem;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiDocumentManager;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiFileFactory;
+import com.intellij.testFramework.PlatformTestCase;
+import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+public class JavaExternalDocumentationTest extends PlatformTestCase {
+ public void testImagesInsideJavadocJar() throws Exception {
+ final VirtualFile libClasses = getJarFile("library.jar");
+ final VirtualFile libJavadocJar = getJarFile("library-javadoc.jar");
+
+ ApplicationManager.getApplication().runWriteAction(new Runnable() {
+ @Override
+ public void run() {
+ final Library library = LibraryTablesRegistrar.getInstance().getLibraryTable(myProject).createLibrary("myLib");
+ final Library.ModifiableModel model = library.getModifiableModel();
+ model.addRoot(libClasses, OrderRootType.CLASSES);
+ model.addRoot(libJavadocJar, JavadocOrderRootType.getInstance());
+ model.commit();
+
+ Module[] modules = ModuleManager.getInstance(myProject).getModules();
+ assertSize(1, modules);
+ ModuleRootModificationUtil.addDependency(modules[0], library);
+ }
+ });
+
+ PsiFile psiFile =
+ PsiFileFactory.getInstance(myProject).createFileFromText(JavaLanguage.INSTANCE, "class Foo { com.jetbrains.Test field; }");
+ Document document = PsiDocumentManager.getInstance(myProject).getDocument(psiFile);
+ assertNotNull(document);
+ Editor editor = EditorFactory.getInstance().createEditor(document, myProject);
+ try {
+ editor.getCaretModel().moveToOffset(document.getText().indexOf("Test"));
+ DocumentationManager documentationManager = DocumentationManager.getInstance(myProject);
+ documentationManager.showJavaDocInfo(editor, psiFile, false);
+ waitTillDone(documentationManager.getLastAction());
+ JBPopup popup = documentationManager.getDocInfoHint();
+ assertNotNull(popup);
+ DocumentationComponent documentationComponent = (DocumentationComponent)popup.getContent().getComponent(0);
+ try {
+ byte[] imageData = getImageDataFromDocumentationComponent(documentationComponent);
+ assertEquals(228, imageData.length);
+ }
+ finally {
+ Disposer.dispose(documentationComponent);
+ }
+ }
+ finally {
+ EditorFactory.getInstance().releaseEditor(editor);
+ }
+ }
+
+ private static void waitTillDone(ActionCallback actionCallback) throws InterruptedException {
+ long start = System.currentTimeMillis();
+ while (System.currentTimeMillis() - start < 300000) {
+ //noinspection BusyWait
+ Thread.sleep(100);
+ UIUtil.dispatchAllInvocationEvents();
+ if (actionCallback.isProcessed()) return;
+ }
+ fail("Timed out waiting for documentation to show");
+ }
+
+ @NotNull
+ private static VirtualFile getJarFile(String name) {
+ VirtualFile file = getVirtualFile(new File(JavaTestUtil.getJavaTestDataPath() + "/codeInsight/documentation/" + name));
+ assertNotNull(file);
+ VirtualFile jarFile = JarFileSystem.getInstance().getJarRootForLocalFile(file);
+ assertNotNull(jarFile);
+ return jarFile;
+ }
+
+ private static byte[] getImageDataFromDocumentationComponent(DocumentationComponent documentationComponent) throws Exception {
+ JEditorPane editorPane = (JEditorPane)documentationComponent.getComponent();
+ final HTMLDocument document = (HTMLDocument)editorPane.getDocument();
+ final Ref<byte[]> result = new Ref<byte[]>();
+ document.render(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ HTMLDocument.Iterator it = document.getIterator(HTML.Tag.IMG);
+ assertTrue(it.isValid());
+ String relativeUrl = (String)it.getAttributes().getAttribute(HTML.Attribute.SRC);
+ it.next();
+ assertFalse(it.isValid());
+ URL imageUrl = new URL(document.getBase(), relativeUrl);
+ InputStream stream = imageUrl.openStream();
+ try {
+ result.set(FileUtil.loadBytes(stream));
+ }
+ finally {
+ stream.close();
+ }
+ }
+ catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+ return result.get();
+ }
+
+ @Override
+ protected boolean isRunInWriteAction() {
+ return false;
+ }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/MultipleModuleHighlightingTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/MultipleModuleHighlightingTest.groovy
deleted file mode 100644
index b02d90b..0000000
--- a/java/java-tests/testSrc/com/intellij/codeInsight/MultipleModuleHighlightingTest.groovy
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2000-2015 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 com.intellij.codeInsight
-
-import com.intellij.idea.Bombed
-import com.intellij.openapi.module.JavaModuleType
-import com.intellij.openapi.roots.ModuleRootModificationUtil
-import com.intellij.testFramework.PsiTestUtil
-import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase
-/**
- * @author peter
- */
-class MultipleModuleHighlightingTest extends JavaCodeInsightFixtureTestCase {
-
- @Bombed(day = 1, month = Calendar.APRIL)
- public void "test use original place classpath for reference type resolving"() {
- addTwoModules()
-
- myFixture.addFileToProject "mod1/Class2.java", '''
-public class Class2 {
- public void m1() {}
- public void m2() {}
-}
-'''
-
- myFixture.addFileToProject "mod2/Class2.java", '''
-public class Class2 {
- public void m1() {}
-}
-'''
- myFixture.addFileToProject "mod2/Class1.java", '''
-public class Class1 {
- public Class2 getClass2() {}
- public Class2 class2Field;
-}
-'''
-
- myFixture.configureFromExistingVirtualFile(myFixture.addClass("""
-class Class3 {
- {
- new Class1().getClass2().m2();
- new Class1().class2Field.m2();
- }
-}
-
-""").containingFile.virtualFile)
- myFixture.checkHighlighting()
- }
-
- @Bombed(day = 1, month = Calendar.APRIL)
- public void "test use original place classpath for new expression type resolving"() {
- addTwoModules()
-
- myFixture.addFileToProject "mod1/A.java", '''
-public class A {
- public void m1();
-}
-'''
-
- myFixture.addFileToProject "mod2/A.java", '''
-public class A {
- public void m2() {}
-}
-'''
- myFixture.addFileToProject "mod2/B.java", '''
-public class B extends A {
-}
-'''
-
- myFixture.configureFromExistingVirtualFile(myFixture.addClass("""
-class Class3 {
- {
- new B().m1();
- new B().<error descr="Cannot resolve method 'm2()'">m2</error>();
- }
-}
-
-""").containingFile.virtualFile)
- myFixture.checkHighlighting()
- }
-
- private void addTwoModules() {
- def mod1 = PsiTestUtil.addModule(project, JavaModuleType.moduleType, "mod1", myFixture.tempDirFixture.findOrCreateDir("mod1"))
- def mod2 = PsiTestUtil.addModule(project, JavaModuleType.moduleType, "mod2", myFixture.tempDirFixture.findOrCreateDir("mod2"))
- ModuleRootModificationUtil.addDependency(myModule, mod1)
- ModuleRootModificationUtil.addDependency(myModule, mod2)
- }
-}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/actions/ReformatCodeActionInEditorTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/actions/ReformatCodeActionInEditorTest.java
index 058d165..578ba79 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/actions/ReformatCodeActionInEditorTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/actions/ReformatCodeActionInEditorTest.java
@@ -102,4 +102,9 @@
public void testFormatOptimizeRearrangeVcsChanges() {
doTest(new ReformatCodeRunOptions(VCS_CHANGED_TEXT).setOptimizeImports(true).setRearrangeCode(true));
}
+
+ public void testFormatSelection_DoNotTouchTrailingWhiteSpaces() {
+ //todo actually test is not working, and working test is not working
+ doTest(new ReformatCodeRunOptions(SELECTED_TEXT));
+ }
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java
index dcac106..19e3b24 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java
@@ -63,6 +63,14 @@
doTest(BASE_PATH + "staticImportConflict/UsageMixed.java", BASE_PATH + "/staticImportConflict", false, false);
}
+ public void testRawInnerClassImport() throws Exception {
+ doTest(BASE_PATH + "raw/p/Class1.java", BASE_PATH + "/raw", false, false);
+ }
+
+ public void testRawInnerClassImportOnDemand() throws Exception {
+ doTest(BASE_PATH + "rawOnDemand/p/Class1.java", BASE_PATH + "/rawOnDemand", false, false);
+ }
+
//ambiguous method calls
private void doTestAmbiguous() throws Exception {
doTestAmbiguous(JavaSdkVersion.JDK_1_7);
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
index b1dff9c..4b8f1b6 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
@@ -467,6 +467,14 @@
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
}
+ public void testDontReportWeakerVisibilityProblemUpInHierarchy() throws Exception {
+ doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
+ }
+
+ public void testSuperObjectCapturedWildcardEquality() throws Exception {
+ doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
+ }
+
public void testJavaUtilCollections_NoVerify() throws Exception {
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
assertNotNull(collectionsClass);
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java
index 1c41cd9..5637abf 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java
@@ -188,4 +188,8 @@
public void testIDEA111450() { doTest(true, false); }
public void testExternalizable() { doTest(true, false); }
public void testAccessToStaticMethodsFromInterfaces() { doTest(true, false); }
+
+ public void testUncheckedExtendedWarnings() throws Exception {
+ doTest(true, false);
+ }
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk9Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk9Test.java
index d36a458..0c48747 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk9Test.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk9Test.java
@@ -53,4 +53,5 @@
}
public void testSafeVarargsApplicability() { doTest(true, false); }
+ public void testPrivateInInterfaces() { doTest(false, false); }
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlightingGenerated8Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlightingGenerated8Test.java
index 8f7b817..f2b2e5c 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlightingGenerated8Test.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlightingGenerated8Test.java
@@ -36,8 +36,7 @@
public void testEmptyTestT() throws Exception {}
- @Bombed(day = 30, month = Calendar.MARCH, year = 2015)
- public void testUnrelatedClasses() throws Exception {
+ public void _testUnrelatedClasses() throws Exception {
doTest();
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Java8RegressionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Java8RegressionTest.java
index 2f513c9..c0d0fe1 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Java8RegressionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Java8RegressionTest.java
@@ -47,6 +47,22 @@
doTest();
}
+ public void testIDEA137694() throws Exception {
+ doTest();
+ }
+
+ public void testIDEA137668() throws Exception {
+ doTest();
+ }
+
+ public void testIDEA137795() throws Exception {
+ doTest();
+ }
+
+ public void testIDEA137893() throws Exception {
+ doTest();
+ }
+
private void doTest() {
doTest(false);
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/LightAdvHighlightingJdk8Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/LightAdvHighlightingJdk8Test.java
index 4ecf0b2..d642892 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/LightAdvHighlightingJdk8Test.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/LightAdvHighlightingJdk8Test.java
@@ -43,6 +43,10 @@
doTest();
}
+ public void testStrictfpInsideInterface() throws Exception {
+ doTest();
+ }
+
private void doTest() {
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", true, false);
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
index b43b210..6a768957 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
@@ -145,6 +145,10 @@
doTest();
}
+ public void testCheckedExceptionsConstraintsSubstitutions2() throws Exception {
+ doTest();
+ }
+
public void testCheckedExceptionsConstraintsSubstitutionsDeepInBody() throws Exception {
doTest();
}
@@ -181,6 +185,10 @@
doTest();
}
+ public void testInfiniteLoopAndValueCompatibility() throws Exception {
+ doTest();
+ }
+
private void doTest() {
doTest(false);
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
index f400763..f8d2982 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
@@ -394,6 +394,10 @@
doTest();
}
+ public void testSkipCheckedExceptionsHandledByInterfaceMethod() throws Exception {
+ doTest();
+ }
+
private void doTest() {
doTest(false);
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/OverloadResolutionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/OverloadResolutionTest.java
index 5ec3590..d2ff3ce 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/OverloadResolutionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/OverloadResolutionTest.java
@@ -98,6 +98,10 @@
}).assertTiming();
}
+ public void testMultipleOverloadsWithNestedGeneric() throws Exception {
+ doTest(false);
+ }
+
private void doTest() {
doTest(true);
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/Simplify2DiamondInspectionsTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/Simplify2DiamondInspectionsTest.java
index 44dcc2e..ac74905 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/Simplify2DiamondInspectionsTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/Simplify2DiamondInspectionsTest.java
@@ -17,12 +17,17 @@
import com.intellij.codeInspection.ExplicitTypeCanBeDiamondInspection;
import com.intellij.codeInspection.LocalInspectionTool;
+import com.intellij.lang.java.JavaLanguage;
import com.intellij.pom.java.LanguageLevel;
+import com.intellij.psi.codeStyle.CodeStyleSettings;
+import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import org.jetbrains.annotations.NotNull;
//todo test3 should be checked if it compiles - as now javac infers Object instead of String?!
public class Simplify2DiamondInspectionsTest extends LightQuickFixParameterizedTestCase {
+
@NotNull
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
@@ -31,6 +36,26 @@
};
}
+ private boolean myAlignment;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ CommonCodeStyleSettings settings = getSettings();
+ myAlignment = settings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS;
+ settings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ getSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = myAlignment;
+ super.tearDown();
+ }
+
+ private CommonCodeStyleSettings getSettings() {
+ return CodeStyleSettingsManager.getSettings(getProject()).getCommonSettings(JavaLanguage.INSTANCE);
+ }
+
public void test() throws Exception { doAllTests(); }
@Override
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/documentation/RefConvertorsTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/documentation/RefConvertorsTest.java
deleted file mode 100644
index 87a32c4..0000000
--- a/java/java-tests/testSrc/com/intellij/codeInsight/documentation/RefConvertorsTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2000-2013 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 com.intellij.codeInsight.documentation;
-
-import com.intellij.JavaTestUtil;
-import com.intellij.codeInsight.javadoc.JavaDocExternalFilter;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.io.FileUtilRt;
-import com.intellij.openapi.vfs.JarFileSystem;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.testFramework.LightCodeInsightTestCase;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.util.jar.JarEntry;
-import java.util.jar.JarOutputStream;
-
-/**
- * @author Denis Zhdanov
- * @since 1/15/13 7:26 PM
- */
-public class RefConvertorsTest extends LightCodeInsightTestCase {
-
- private File myExtractedImagesDir;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- String tempDirectory = FileUtilRt.getTempDirectory();
- myExtractedImagesDir = new File(tempDirectory, AbstractExternalFilter.QUICK_DOC_DIR_NAME);
- }
-
- @Override
- protected void tearDown() throws Exception {
- FileUtil.delete(myExtractedImagesDir);
- super.tearDown();
- }
-
- public void testImgInsideJar() throws Exception {
- String imgJarName = "test-img";
- File imgJar = new File(myExtractedImagesDir, imgJarName + ".jar");
- boolean exist = FileUtil.createIfDoesntExist(imgJar);
- assertTrue(exist);
-
- JarOutputStream out = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(imgJar)));
- try {
- out.putNextEntry(new JarEntry("resources/inherit.gif"));
- FileInputStream fIn = new FileInputStream(JavaTestUtil.getJavaTestDataPath() + "/codeInsight/documentation/inherit.gif");
- try {
- FileUtil.copy(fIn, out);
- }
- finally {
- fIn.close();
- }
- }
- finally {
- out.close();
- }
-
- String textBefore =
- "<HTML>" +
- "java.lang.Object\n" +
- " <IMG SRC=\"../../../resources/inherit.gif\" ALT=\"extended by \"><B>org.bouncycastle.asn1.BERSequenceParser</B>\n" +
- "</HTML>";
-
- File f = new File(myExtractedImagesDir, imgJarName);
- f = new File(f, "resources");
- File extractedImgFile = new File(f, "inherit.gif");
- String expectedTextAfter = String.format(
- "<HTML>" +
- "java.lang.Object\n" +
- " <IMG SRC=\"%s%s\" ALT=\"extended by \"><B>org.bouncycastle.asn1.BERSequenceParser</B>\n" +
- "</HTML>",
- LocalFileSystem.PROTOCOL_PREFIX,
- extractedImgFile.getAbsolutePath());
-
- JavaDocExternalFilter filter = new JavaDocExternalFilter(getProject());
- String textAfter = filter.correctRefs(
- String.format("%s%s!/org/bouncycastle/asn1/BERSequenceParser.html", JarFileSystem.PROTOCOL_PREFIX, imgJar.getAbsolutePath()),
- textBefore
- );
- assertEquals(expectedTextAfter, textAfter);
- assertTrue(extractedImgFile.isFile());
- }
-}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/editorActions/JavaMoveLineTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/editorActions/JavaMoveLineTest.java
new file mode 100644
index 0000000..7fb3cda
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/editorActions/JavaMoveLineTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2015 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 com.intellij.codeInsight.editorActions;
+
+import com.intellij.codeInsight.folding.CodeFoldingManager;
+import com.intellij.openapi.actionSystem.IdeActions;
+import com.intellij.openapi.editor.FoldRegion;
+import com.intellij.pom.java.LanguageLevel;
+import com.intellij.testFramework.LightCodeInsightTestCase;
+
+public class JavaMoveLineTest extends LightCodeInsightTestCase {
+ private static final String BASE_PATH = "/codeInsight/editorActions/moveLine/";
+
+ @Override
+ protected LanguageLevel getLanguageLevel() {
+ return LanguageLevel.JDK_1_7; // to enable folding of lambdas
+ }
+
+ public void testMoveThroughFolding() throws Exception {
+ configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
+ CodeFoldingManager.getInstance(ourProject).buildInitialFoldings(myEditor);
+ FoldRegion lambdaStart = myEditor.getFoldingModel().getFoldRegion(140, 227);
+ assertNotNull(lambdaStart);
+ assertFalse(lambdaStart.isExpanded());
+ FoldRegion lambdaEnd = myEditor.getFoldingModel().getFoldRegion(248, 272);
+ assertNotNull(lambdaEnd);
+ assertFalse(lambdaEnd.isExpanded());
+
+ executeAction(IdeActions.ACTION_MOVE_LINE_UP_ACTION);
+
+ checkResultByFile(BASE_PATH + "/" + getTestName(false) + "-after.java");
+ }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/ExternalJavadocPresentationTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/ExternalJavadocPresentationTest.java
index 540f1e3..e88a902 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/ExternalJavadocPresentationTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/ExternalJavadocPresentationTest.java
@@ -50,12 +50,23 @@
doTest("lang/String.html#toLowerCase()", "String/7/page.html", "String/7/expectedToLowerCase.html");
doTest("lang/String.html#toLowerCase()", "String/6/page.html", "String/6/expectedToLowerCase.html");
}
-
+
+ public void testInvalidJavadoc() throws Exception {
+ doTest("", "String/invalid/page.html", "String/invalid/expected.html", false);
+ }
+
public void testPackageSummary() throws Exception {
doTest("java/lang/package-summary.html", "packageSummary/util/page.html", "packageSummary/util/expected.html");
}
private void doTest(@NonNls String url, @NonNls String pageText, @NonNls String expected) throws Exception {
+ doTest(url, pageText, expected, true);
+ }
+
+ private void doTest(@NonNls String url,
+ @NonNls String pageText,
+ @NonNls String expected,
+ final boolean matchStart) throws Exception {
final String basePath = getTestDataPath() + TEST_ROOT;
final VirtualFile pageTextFile = LocalFileSystem.getInstance().findFileByPath(basePath + pageText);
assertNotNull(pageTextFile);
@@ -71,13 +82,17 @@
}
@Override
- public void doBuildFromStream(String url, Reader input, StringBuilder data, boolean searchForEncoding) throws IOException {
- super.doBuildFromStream(url, input, data, searchForEncoding);
+ public void doBuildFromStream(String url, Reader input, StringBuilder data, boolean searchForEncoding, boolean matchStart) throws IOException {
+ super.doBuildFromStream(url, input, data, searchForEncoding, matchStart);
}
}
JavadocExternalTestFilter filter = new JavadocExternalTestFilter(getProject());
StringBuilder extractedData = new StringBuilder();
- filter.doBuildFromStream(url, new StringReader(LoadTextUtil.loadText(pageTextFile).toString()), extractedData, false);
+ filter.doBuildFromStream(url, new StringReader(LoadTextUtil.loadText(pageTextFile).toString()), extractedData, false, true);
+ if (!matchStart) {
+ assertEmpty(extractedData.toString());
+ filter.doBuildFromStream(url, new StringReader(LoadTextUtil.loadText(pageTextFile).toString()), extractedData, false, false);
+ }
assertEquals(LoadTextUtil.loadText(expectedTextFile).toString(), extractedData.toString());
}
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/JavaDocInfoGeneratorTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/JavaDocInfoGeneratorTest.java
index 5a58e66..7bb0de0 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/JavaDocInfoGeneratorTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/JavaDocInfoGeneratorTest.java
@@ -138,19 +138,22 @@
PsiField field = psiClass.getFields() [0];
String docInfo = new JavaDocumentationProvider().generateDoc(field, field);
assertNotNull(docInfo);
- assertEquals(exampleHtmlFileText(getTestName(true)), StringUtil.convertLineSeparators(docInfo.trim()));
+ assertEquals(exampleHtmlFileText(getTestName(true)), replaceEnvironmentDependentContent(docInfo));
docInfo = new JavaDocumentationProvider().getQuickNavigateInfo(field, field);
assertNotNull(docInfo);
- assertEquals(exampleHtmlFileText(getTestName(true) + "_quick"), StringUtil.convertLineSeparators(docInfo.trim()));
+ assertEquals(exampleHtmlFileText(getTestName(true) + "_quick"), replaceEnvironmentDependentContent(docInfo));
}
public void testClickableFieldReference() throws Exception {
PsiClass aClass = getTestClass();
PsiTypeElement element = aClass.getFields()[0].getTypeElement();
- String docInfo = new JavaDocumentationProvider().generateDoc(element.getInnermostComponentReferenceElement().resolve(), element);
+ assertNotNull(element);
+ PsiJavaCodeReferenceElement innermostComponentReferenceElement = element.getInnermostComponentReferenceElement();
+ assertNotNull(innermostComponentReferenceElement);
+ String docInfo = new JavaDocumentationProvider().generateDoc(innermostComponentReferenceElement.resolve(), element);
assertNotNull(docInfo);
- assertEquals(exampleHtmlFileText(getTestName(true)), StringUtil.convertLineSeparators(docInfo.trim()));
+ assertEquals(exampleHtmlFileText(getTestName(true)), replaceEnvironmentDependentContent(docInfo));
}
private static String exampleHtmlFileText(String name) throws IOException {
@@ -161,12 +164,13 @@
public void testClassTypeParamsPresentation() throws Exception {
PsiClass psiClass = getTestClass();
final PsiReferenceList extendsList = psiClass.getExtendsList();
+ assertNotNull(extendsList);
final PsiJavaCodeReferenceElement referenceElement = extendsList.getReferenceElements()[0];
final PsiClass superClass = extendsList.getReferencedTypes()[0].resolve();
String docInfo = new JavaDocumentationProvider().getQuickNavigateInfo(superClass, referenceElement);
assertNotNull(docInfo);
- assertEquals(exampleHtmlFileText(getTestName(true)), StringUtil.convertLineSeparators(docInfo.trim()));
+ assertEquals(exampleHtmlFileText(getTestName(true)), replaceEnvironmentDependentContent(docInfo));
}
public void testLambdaParameter() throws Exception {
@@ -200,7 +204,7 @@
private void verifyJavaDoc(final PsiElement field) throws IOException {
String docInfo = new JavaDocInfoGenerator(getProject(), field).generateDocInfo(null);
assertNotNull(docInfo);
- assertEquals(exampleHtmlFileText(getTestName(true)), StringUtil.convertLineSeparators(docInfo.trim()));
+ assertEquals(exampleHtmlFileText(getTestName(true)), replaceEnvironmentDependentContent(docInfo));
}
public void testPackageInfo() throws Exception {
@@ -211,13 +215,14 @@
new JavaDocInfoGenerator(getProject(), JavaPsiFacade.getInstance(getProject()).findPackage(getTestName(true))).generateDocInfo(null);
String htmlText = FileUtil.loadFile(new File(packageInfo + File.separator + "packageInfo.html"));
assertNotNull(info);
- assertEquals(StringUtil.convertLineSeparators(htmlText.trim()), StringUtil.convertLineSeparators(info.trim()));
+ assertEquals(StringUtil.convertLineSeparators(htmlText.trim()), replaceEnvironmentDependentContent(info));
}
public void testInheritedParameter() throws Exception {
configureByFile("/codeInsight/javadocIG/" + getTestName(true) + ".java");
PsiClass outerClass = ((PsiJavaFile) myFile).getClasses()[0];
PsiClass innerClass = outerClass.findInnerClassByName("Impl", false);
+ assertNotNull(innerClass);
PsiParameter parameter = innerClass.getMethods()[0].getParameterList().getParameters()[0];
verifyJavaDoc(parameter);
}
@@ -226,4 +231,8 @@
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath();
}
+
+ private static String replaceEnvironmentDependentContent(String html) {
+ return StringUtil.convertLineSeparators(html.trim()).replaceAll("<base href=\"[^\"]*\">", "<base href=\"placeholder\">");
+ }
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
index 84d9a3d..c653763 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
@@ -222,6 +222,7 @@
public void testContractWithNullable() { doTest(); }
public void testContractWithNotNull() { doTest(); }
public void testContractPreservesUnknownNullability() { doTest(); }
+ public void testContractPreservesUnknownMethodNullability() { doTest(); }
public void testContractSeveralClauses() { doTest(); }
public void testContractVarargs() { doTest(); }
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/NullityInferenceFromSourceTestCase.groovy b/java/java-tests/testSrc/com/intellij/codeInspection/NullityInferenceFromSourceTestCase.groovy
index 849d6eb..01a9951 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/NullityInferenceFromSourceTestCase.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/NullityInferenceFromSourceTestCase.groovy
@@ -14,11 +14,13 @@
* limitations under the License.
*/
package com.intellij.codeInspection
+import com.intellij.codeInsight.InferredAnnotationsManager
import com.intellij.codeInsight.NullableNotNullManager
import com.intellij.codeInspection.dataFlow.DfaUtil
import com.intellij.codeInspection.dataFlow.Nullness
import com.intellij.psi.PsiMethod
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
+import org.jetbrains.annotations.Contract
import static com.intellij.codeInspection.dataFlow.Nullness.*
/**
@@ -120,6 +122,13 @@
void "test skip when errors"() {
assert inferNullity(parse('String foo() { if(); return 2; } ')) == UNKNOWN
}
+
+ void "test no nullable annotation in presence of inferred null contract"() {
+ def method = parse('Object foo(Object o) { if (o == null) return null; return 2; }')
+ def annos = InferredAnnotationsManager.getInstance(project).findInferredAnnotations(method)
+ assert annos.collect { it.qualifiedName } == [Contract.name]
+ }
+
}
static class DfaInferenceTest extends NullityInferenceFromSourceTestCase {
diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java
index ecd21f9..6fd6e05 100644
--- a/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java
@@ -584,7 +584,7 @@
assertSame(aClass, aClass2);
}
- public void _testEqualPointerRangesWhenCreatedFromStubAndAST() {
+ public void testEqualPointerRangesWhenCreatedFromStubAndAST() {
final PsiFile file = configureByText(JavaFileType.INSTANCE,
"class S {\n" +
"}");
@@ -603,7 +603,7 @@
assertNotNull(node);
}
- public void _testEqualPointersWhenCreatedFromStubAndAST() {
+ public void testEqualPointersWhenCreatedFromStubAndAST() {
final PsiFile file = configureByText(JavaFileType.INSTANCE,
"class S {\n" +
"}");
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java b/java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java
index e47927e..d883e8d 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java
@@ -449,6 +449,10 @@
doTest(new MockIntroduceVariableHandler("l", false, false, false, "I<java.lang.String>", true));
}
+ public void testIntersectionWildcardExpectedType() {
+ doTest(new MockIntroduceVariableHandler("l", false, false, false, "java.util.List<? extends java.lang.Enum<? extends java.lang.Enum<? extends java.lang.Enum<?>>>>", true));
+ }
+
public void testMethodRefNotInContextInferredFilterWithNonAcceptableSince() {
//though test extracts method reference which is not suppose to appear with language level 1.7
//@since 1.8 in Consumer prevent it to appear at first position
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/MakeMethodStaticTest.java b/java/java-tests/testSrc/com/intellij/refactoring/MakeMethodStaticTest.java
index 6427e2e..ad12405 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/MakeMethodStaticTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/MakeMethodStaticTest.java
@@ -203,6 +203,10 @@
doTest(true);
}
+ public void testThisMethodReference() throws Exception {
+ doTest(false);
+ }
+
public void testPreserveParametersAlignment() throws Exception {
doTest();
}
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/MoveClassAndFileTest.java b/java/java-tests/testSrc/com/intellij/refactoring/MoveClassAndFileTest.java
index 46c6407..f9196ef 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/MoveClassAndFileTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/MoveClassAndFileTest.java
@@ -77,7 +77,9 @@
final PsiDirectory[] dirs = aPackage.getDirectories();
assertEquals(dirs.length, 1);
- new JavaMoveFilesOrDirectoriesHandler().doMove(getProject(), elements, dirs[0], null);
+ final JavaMoveFilesOrDirectoriesHandler handler = new JavaMoveFilesOrDirectoriesHandler();
+ assertTrue(handler.canMove(elements, dirs[0]));
+ handler.doMove(getProject(), elements, dirs[0], null);
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
FileDocumentManager.getInstance().saveAllDocuments();
}
diff --git a/java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ChangeClassParametersIntention.java b/java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ChangeClassParametersIntention.java
index b65e536..0a317ce 100644
--- a/java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ChangeClassParametersIntention.java
+++ b/java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ChangeClassParametersIntention.java
@@ -61,8 +61,8 @@
if (!FileModificationService.getInstance().preparePsiElementsForWrite(element)) return;
final PsiTypeElement typeElement = PsiTreeUtil.getTopmostParentOfType(element, PsiTypeElement.class);
- final PsiReferenceParameterList parameterList = PsiTreeUtil.getParentOfType(element, PsiReferenceParameterList.class);
- if (parameterList != null && typeElement != null) {
+ final PsiReferenceParameterList parameterList = PsiTreeUtil.getParentOfType(typeElement, PsiReferenceParameterList.class);
+ if (parameterList != null) {
final PsiClass aClass = PsiTreeUtil.getParentOfType(element, PsiClass.class);
if (aClass instanceof PsiAnonymousClass) {
editor.getCaretModel().moveToOffset(aClass.getTextOffset());
diff --git a/java/typeMigration/test/com/intellij/codeInsight/ChangeClassParametersTest.groovy b/java/typeMigration/test/com/intellij/codeInsight/ChangeClassParametersTest.groovy
new file mode 100644
index 0000000..714955d
--- /dev/null
+++ b/java/typeMigration/test/com/intellij/codeInsight/ChangeClassParametersTest.groovy
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2000-2015 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 com.intellij.codeInsight
+import com.intellij.codeInsight.template.impl.TemplateManagerImpl
+import com.intellij.codeInsight.template.impl.TemplateState
+import com.intellij.refactoring.typeMigration.intentions.ChangeClassParametersIntention
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
+/**
+ * User: anna
+ */
+class ChangeClassParametersTest extends LightCodeInsightFixtureTestCase {
+ public void "test nested type elements"() {
+ def text = """\
+ interface Fun<A, B> {}
+ class Test {
+ {
+ new Fun<java.util.List<Int<caret>eger>, String> () {};
+ }
+ }
+ """
+
+ doTest(text)
+ }
+
+ private doTest(String text) {
+ myFixture.configureByText("a.java", text)
+ try {
+ myFixture.doHighlighting()
+ myFixture.launchAction(new ChangeClassParametersIntention())
+ }
+ finally {
+ TemplateState state = TemplateManagerImpl.getTemplateState(editor)
+ assertNull(state)
+ }
+ }
+}
\ No newline at end of file
diff --git a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/ClassfileAnalyzer.java b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/ClassfileAnalyzer.java
index 137f452..2b11ac6 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/ClassfileAnalyzer.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/ClassfileAnalyzer.java
@@ -19,6 +19,7 @@
import gnu.trove.THashMap;
import gnu.trove.THashSet;
import gnu.trove.TIntHashSet;
+import org.jetbrains.annotations.Nullable;
import org.jetbrains.org.objectweb.asm.*;
import org.jetbrains.org.objectweb.asm.signature.SignatureReader;
import org.jetbrains.org.objectweb.asm.signature.SignatureVisitor;
@@ -34,6 +35,7 @@
*/
class ClassfileAnalyzer {
+ public static final String LAMBDA_FACTORY_CLASS = "java/lang/invoke/LambdaMetafactory";
private final DependencyContext myContext;
ClassfileAnalyzer(DependencyContext context) {
@@ -390,11 +392,11 @@
}
@Override
- public FieldVisitor visitField(int access, String n, String desc, String signature, Object value) {
+ public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
processSignature(signature);
if ((access & Opcodes.ACC_SYNTHETIC) == 0) {
- myFields.add(new FieldRepr(myContext, access, myContext.get(n), myContext.get(desc), myContext.get(signature), value));
+ myFields.add(new FieldRepr(myContext, access, myContext.get(name), myContext.get(desc), myContext.get(signature), value));
}
return new FieldVisitor(Opcodes.ASM5) {
@@ -504,34 +506,102 @@
@Override
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
- final int fieldName = myContext.get(name);
- final int fieldOwner = myContext.get(owner);
- final int descr = myContext.get(desc);
-
- if (opcode == Opcodes.PUTFIELD || opcode == Opcodes.PUTSTATIC) {
- myUsages.add(UsageRepr.createFieldAssignUsage(myContext, fieldName, fieldOwner, descr));
- }
-
- if (opcode == Opcodes.GETFIELD || opcode == Opcodes.GETSTATIC) {
- addClassUsage(TypeRepr.getType(myContext, descr));
- }
-
- myUsages.add(UsageRepr.createFieldUsage(myContext, fieldName, fieldOwner, descr));
+ registerFieldUsage(opcode, owner, name, desc);
super.visitFieldInsn(opcode, owner, name, desc);
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
- final int methodName = myContext.get(name);
- final int methodOwner = myContext.get(owner);
-
- myUsages.add(UsageRepr.createMethodUsage(myContext, methodName, methodOwner, desc));
- myUsages.add(UsageRepr.createMetaMethodUsage(myContext, methodName, methodOwner));
- addClassUsage(TypeRepr.getType(myContext, Type.getReturnType(desc)));
-
+ registerMethodUsage(owner, name, desc);
super.visitMethodInsn(opcode, owner, name, desc, itf);
}
+ @Override
+ public void visitInvokeDynamicInsn(String methodName, String desc, Handle bsm, Object... bsmArgs) {
+ final Type returnType = Type.getReturnType(desc);
+ addClassUsage(TypeRepr.getType(myContext, returnType));
+
+ // common args processing
+ for (Object arg : bsmArgs) {
+ if (arg instanceof Type) {
+ final Type type = (Type)arg;
+ if (type.getSort() == Type.METHOD) {
+ for (Type argType : type.getArgumentTypes()) {
+ addClassUsage(TypeRepr.getType(myContext, argType));
+ }
+ addClassUsage(TypeRepr.getType(myContext, type.getReturnType()));
+ }
+ else {
+ addClassUsage(TypeRepr.getType(myContext, type));
+ }
+ }
+ else if (arg instanceof Handle) {
+ processMethodHandle((Handle)arg);
+ }
+ }
+
+ if (LAMBDA_FACTORY_CLASS.equals(bsm.getOwner())) {
+ // This invokeDynamic implements a lambda or method reference usage.
+ // Need to register method usage for the corresponding SAM-type.
+ // First three arguments to the bootstrap methods are provided automatically by VM.
+ // Arguments in args array are expected to be as following:
+ // [0]: Type: Signature and return type of method to be implemented by the function object.
+ // [1]: Handle: implementation method handle
+ // [2]: Type: The signature and return type that should be enforced dynamically at invocation time. May be the same as samMethodType, or may be a specialization of it
+ // [...]: optional additional arguments
+
+ if (returnType.getSort() == Type.OBJECT && bsmArgs.length >= 3) {
+ if (bsmArgs[0] instanceof Type) {
+ final Type samMethodType = (Type)bsmArgs[0];
+ if (samMethodType.getSort() == Type.METHOD) {
+ registerMethodUsage(returnType.getInternalName(), methodName, samMethodType.getDescriptor());
+ }
+ }
+ }
+ }
+
+ super.visitInvokeDynamicInsn(methodName, desc, bsm, bsmArgs);
+ }
+
+ private void processMethodHandle(Handle handle) {
+ final String memberOwner = handle.getOwner();
+ if (myContext.get(memberOwner) != myName) {
+ // do not register access to own class members
+ final String memberName = handle.getName();
+ final String memberDescriptor = handle.getDesc();
+ final int opCode = getFieldAccessOpcode(handle);
+ if (opCode > 0) {
+ registerFieldUsage(opCode, memberOwner, memberName, memberDescriptor);
+ }
+ else {
+ registerMethodUsage(memberOwner, memberName, memberDescriptor);
+ }
+ }
+ }
+
+ private void registerFieldUsage(int opcode, String owner, String fName, String desc) {
+ final int fieldName = myContext.get(fName);
+ final int fieldOwner = myContext.get(owner);
+ final int descr = myContext.get(desc);
+ if (opcode == Opcodes.PUTFIELD || opcode == Opcodes.PUTSTATIC) {
+ myUsages.add(UsageRepr.createFieldAssignUsage(myContext, fieldName, fieldOwner, descr));
+ }
+ if (opcode == Opcodes.GETFIELD || opcode == Opcodes.GETSTATIC) {
+ addClassUsage(TypeRepr.getType(myContext, descr));
+ }
+ myUsages.add(UsageRepr.createFieldUsage(myContext, fieldName, fieldOwner, descr));
+ }
+
+ private void registerMethodUsage(String owner, String name, @Nullable String desc) {
+ final int methodOwner = myContext.get(owner);
+ final int methodName = myContext.get(name);
+ myUsages.add(UsageRepr.createMetaMethodUsage(myContext, methodName, methodOwner));
+ if (desc != null) {
+ myUsages.add(UsageRepr.createMethodUsage(myContext, methodName, methodOwner, desc));
+ addClassUsage(TypeRepr.getType(myContext, Type.getReturnType(desc)));
+ }
+ }
+
private void addClassUsage(final TypeRepr.AbstractType type) {
TypeRepr.ClassType classType = null;
if (type instanceof TypeRepr.ClassType) {
@@ -551,6 +621,20 @@
};
}
+ /**
+ * @param handle
+ * @return corresponding field access opcode or -1 if the handle does not represent field access handle
+ */
+ private int getFieldAccessOpcode(Handle handle) {
+ switch (handle.getTag()) {
+ case Opcodes.H_GETFIELD: return Opcodes.GETFIELD;
+ case Opcodes.H_GETSTATIC: return Opcodes.GETSTATIC;
+ case Opcodes.H_PUTFIELD: return Opcodes.PUTFIELD;
+ case Opcodes.H_PUTSTATIC: return Opcodes.PUTSTATIC;
+ default: return -1;
+ }
+ }
+
@Override
public void visitInnerClass(String name, String outerName, String innerName, int access) {
if (outerName != null) {
diff --git a/jps/jps-builders/testSrc/org/jetbrains/ether/IncrementalTestCase.java b/jps/jps-builders/testSrc/org/jetbrains/ether/IncrementalTestCase.java
index 4525aa7..a611784 100644
--- a/jps/jps-builders/testSrc/org/jetbrains/ether/IncrementalTestCase.java
+++ b/jps/jps-builders/testSrc/org/jetbrains/ether/IncrementalTestCase.java
@@ -37,7 +37,9 @@
import org.jetbrains.jps.model.serialization.PathMacroUtil;
import org.jetbrains.jps.util.JpsPathUtil;
-import java.io.*;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
/**
* @author db
diff --git a/jps/jps-builders/testSrc/org/jetbrains/ether/MethodPropertyTest.java b/jps/jps-builders/testSrc/org/jetbrains/ether/MethodPropertyTest.java
index 28093d9..c890dc4 100644
--- a/jps/jps-builders/testSrc/org/jetbrains/ether/MethodPropertyTest.java
+++ b/jps/jps-builders/testSrc/org/jetbrains/ether/MethodPropertyTest.java
@@ -15,6 +15,8 @@
*/
package org.jetbrains.ether;
+import com.intellij.openapi.util.SystemInfo;
+
/**
* @author: db
* Date: 05.10.11
@@ -32,6 +34,42 @@
doTest();
}
+ public void testChangeMethodRefReturnType() throws Exception {
+ if (SystemInfo.isJavaVersionAtLeast("1.8")) {
+ doTest();
+ }
+ else {
+ System.err.println("Skipping test " + getTestName(true) + ": java version 8 or higher required to run it");
+ }
+ }
+
+ public void testChangeLambdaTargetReturnType() throws Exception {
+ if (SystemInfo.isJavaVersionAtLeast("1.8")) {
+ doTest();
+ }
+ else {
+ System.err.println("Skipping test " + getTestName(true) + ": java version 8 or higher required to run it");
+ }
+ }
+
+ public void testChangeSAMMethodSignature() throws Exception {
+ if (SystemInfo.isJavaVersionAtLeast("1.8")) {
+ doTest();
+ }
+ else {
+ System.err.println("Skipping test " + getTestName(true) + ": java version 8 or higher required to run it");
+ }
+ }
+
+ public void testChangeLambdaSAMMethodSignature() throws Exception {
+ if (SystemInfo.isJavaVersionAtLeast("1.8")) {
+ doTest();
+ }
+ else {
+ System.err.println("Skipping test " + getTestName(true) + ": java version 8 or higher required to run it");
+ }
+ }
+
public void testChangeReturnType1() throws Exception {
doTest();
}
diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/java/MockPackageFacadeBuilderService.java b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/java/MockPackageFacadeBuilderService.java
index 5470c5d..15e9505 100644
--- a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/java/MockPackageFacadeBuilderService.java
+++ b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/java/MockPackageFacadeBuilderService.java
@@ -37,6 +37,9 @@
catch (ClassNotFoundException e) {
return Collections.emptyList();
}
+ catch (NoClassDefFoundError e) {
+ return Collections.emptyList();
+ }
catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/lib/libpty/win/x86/winpty-agent.exe b/lib/libpty/win/x86/winpty-agent.exe
index 4f9d847..52238a7 100755
--- a/lib/libpty/win/x86/winpty-agent.exe
+++ b/lib/libpty/win/x86/winpty-agent.exe
Binary files differ
diff --git a/lib/libpty/win/x86_64/cyglaunch.exe b/lib/libpty/win/x86_64/cyglaunch.exe
index c39f07b..61c6cc9 100755
--- a/lib/libpty/win/x86_64/cyglaunch.exe
+++ b/lib/libpty/win/x86_64/cyglaunch.exe
Binary files differ
diff --git a/lib/libpty/win/x86_64/winpty-agent.exe b/lib/libpty/win/x86_64/winpty-agent.exe
index 49bb304..94e65bc 100755
--- a/lib/libpty/win/x86_64/winpty-agent.exe
+++ b/lib/libpty/win/x86_64/winpty-agent.exe
Binary files differ
diff --git a/lib/libpty/win/xp/winpty-agent.exe b/lib/libpty/win/xp/winpty-agent.exe
index 8702e7c..5712d76 100755
--- a/lib/libpty/win/xp/winpty-agent.exe
+++ b/lib/libpty/win/xp/winpty-agent.exe
Binary files differ
diff --git a/lib/required_for_dist.txt b/lib/required_for_dist.txt
index 7f163e6..e86d366 100644
--- a/lib/required_for_dist.txt
+++ b/lib/required_for_dist.txt
@@ -62,6 +62,8 @@
serviceMessages.jar
snappy-in-java-0.3.1.jar
swingx-core-1.6.2.jar
+slf4j-api-1.7.10.jar
+slf4j-log4j12-1.7.10.jar
trove4j.jar
velocity.jar
winp-1.21-patched.jar
diff --git a/lib/slf4j-api-1.7.10.jar b/lib/slf4j-api-1.7.10.jar
new file mode 100644
index 0000000..ac7da37
--- /dev/null
+++ b/lib/slf4j-api-1.7.10.jar
Binary files differ
diff --git a/lib/slf4j-log4j12-1.7.10.jar b/lib/slf4j-log4j12-1.7.10.jar
new file mode 100644
index 0000000..25d5275
--- /dev/null
+++ b/lib/slf4j-log4j12-1.7.10.jar
Binary files differ
diff --git a/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java b/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java
index 8b7fc87..7325705 100644
--- a/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java
+++ b/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java
@@ -27,6 +27,7 @@
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
+import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectCoreUtil;
import com.intellij.openapi.project.ProjectUtilCore;
@@ -419,21 +420,40 @@
accessToken.finish();
}
- if (needReadAction) {
- PsiDocumentManager.getInstance(psiManager.getProject()).commitAndRunReadAction(new Runnable(){
- @Override
- public void run() {
- doProcessFile(visitor, psiManager, file);
- }
- });
+ final Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ doProcessFile(visitor, psiManager, file);
+ }
+ };
+ if (needReadAction && !ApplicationManager.getApplication().isDispatchThread()) {
+ commitAndRunInSmartMode(runnable, psiManager.getProject());
}
else {
- doProcessFile(visitor, psiManager, file);
+ runnable.run();
}
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
return indicator == null || !indicator.isCanceled();
}
+ private static void commitAndRunInSmartMode(final Runnable runnable, final Project project) {
+ while (true) {
+ final DumbService dumbService = DumbService.getInstance(project);
+ dumbService.waitForSmartMode();
+ boolean passed = PsiDocumentManager.getInstance(project).commitAndRunReadAction(new Computable<Boolean>() {
+ @Override
+ public Boolean compute() {
+ if (dumbService.isDumb()) return false;
+ runnable.run();
+ return true;
+ }
+ });
+ if (passed) {
+ break;
+ }
+ }
+ }
+
protected static boolean shouldHighlightFile(@NotNull PsiFile file) {
return ProblemHighlightFilter.shouldProcessFileInBatch(file);
}
diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java
index 9dbedf6..1acee69 100644
--- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java
+++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java
@@ -52,6 +52,7 @@
import javax.swing.*;
import java.awt.*;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -810,9 +811,16 @@
myCanCleanup = toolWrapper.isCleanupTool();
- ContainerUtil.addIfNotNull(newOptions, intentionManager.createFixAllIntention(toolWrapper, myAction));
+ final IntentionAction fixAllIntention = intentionManager.createFixAllIntention(toolWrapper, myAction);
InspectionProfileEntry wrappedTool = toolWrapper instanceof LocalInspectionToolWrapper ? ((LocalInspectionToolWrapper)toolWrapper).getTool()
: ((GlobalInspectionToolWrapper)toolWrapper).getTool();
+ if (wrappedTool instanceof DefaultHighlightVisitorBasedInspection.AnnotatorBasedInspection) {
+ if (fixAllIntention != null) {
+ return Collections.<IntentionAction>singletonList(fixAllIntention);
+ }
+ return Collections.<IntentionAction>emptyList();
+ }
+ ContainerUtil.addIfNotNull(newOptions, fixAllIntention);
if (wrappedTool instanceof CustomSuppressableInspectionTool) {
final IntentionAction[] suppressActions = ((CustomSuppressableInspectionTool)wrappedTool).getSuppressActions(element);
if (suppressActions != null) {
diff --git a/platform/core-api/src/com/intellij/openapi/application/ApplicationInfo.java b/platform/core-api/src/com/intellij/openapi/application/ApplicationInfo.java
index 49fb907..e7a02e5 100644
--- a/platform/core-api/src/com/intellij/openapi/application/ApplicationInfo.java
+++ b/platform/core-api/src/com/intellij/openapi/application/ApplicationInfo.java
@@ -27,6 +27,8 @@
public abstract String getApiVersion();
public abstract String getMajorVersion();
public abstract String getMinorVersion();
+ public abstract String getMicroVersion();
+ public abstract String getPatchVersion();
public abstract String getVersionName();
public abstract String getHelpURL();
public abstract String getCompanyName();
@@ -38,21 +40,8 @@
public abstract boolean hasHelp();
public abstract boolean hasContextHelp();
- public String getFullVersion() {
- final String majorVersion = getMajorVersion();
- if (majorVersion != null && majorVersion.trim().length() > 0) {
- final String minorVersion = getMinorVersion();
- if (minorVersion != null && minorVersion.trim().length() > 0) {
- return majorVersion + "." + minorVersion;
- }
- else {
- return majorVersion + ".0";
- }
- }
- else {
- return getVersionName();
- }
- }
+ public abstract String getFullVersion();
+ public abstract String getStrictVersion();
public static ApplicationInfo getInstance() {
return ServiceManager.getService(ApplicationInfo.class);
diff --git a/platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java b/platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java
index 427a1f5..54dc3d9 100644
--- a/platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java
+++ b/platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java
@@ -47,6 +47,7 @@
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vfs.VfsUtilCore");
@NonNls private static final String MAILTO = "mailto";
+
public static final String LOCALHOST_URI_PATH_PREFIX = "localhost/";
public static final char VFS_SEPARATOR_CHAR = '/';
@@ -439,6 +440,34 @@
return toIdeaUrl(url, false);
}
+ @NotNull
+ public static String convertFromUrl(@NotNull URL url) {
+ String protocol = url.getProtocol();
+ String path = url.getPath();
+ if (protocol.equals(URLUtil.JAR_PROTOCOL)) {
+ if (StringUtil.startsWithConcatenation(path, URLUtil.FILE_PROTOCOL, PROTOCOL_DELIMITER)) {
+ try {
+ URL subURL = new URL(path);
+ path = subURL.getPath();
+ }
+ catch (MalformedURLException e) {
+ throw new RuntimeException(VfsBundle.message("url.parse.unhandled.exception"), e);
+ }
+ }
+ else {
+ throw new RuntimeException(new IOException(VfsBundle.message("url.parse.error", url.toExternalForm())));
+ }
+ }
+ if (SystemInfo.isWindows || SystemInfo.isOS2) {
+ while (!path.isEmpty() && path.charAt(0) == '/') {
+ path = path.substring(1, path.length());
+ }
+ }
+
+ path = URLUtil.unescapePercentSequences(path);
+ return protocol + "://" + path;
+ }
+
/**
* Converts VsfUrl info {@link URL}.
*
@@ -489,33 +518,6 @@
return null;
}
}
- @NotNull
- public static String convertFromUrl(@NotNull URL url) {
- String protocol = url.getProtocol();
- String path = url.getPath();
- if (protocol.equals(URLUtil.JAR_PROTOCOL)) {
- if (StringUtil.startsWithConcatenation(path, URLUtil.FILE_PROTOCOL, PROTOCOL_DELIMITER)) {
- try {
- URL subURL = new URL(path);
- path = subURL.getPath();
- }
- catch (MalformedURLException e) {
- throw new RuntimeException(VfsBundle.message("url.parse.unhandled.exception"), e);
- }
- }
- else {
- throw new RuntimeException(new IOException(VfsBundle.message("url.parse.error", url.toExternalForm())));
- }
- }
- if (SystemInfo.isWindows || SystemInfo.isOS2) {
- while (!path.isEmpty() && path.charAt(0) == '/') {
- path = path.substring(1, path.length());
- }
- }
-
- path = URLUtil.unescapePercentSequences(path);
- return protocol + "://" + path;
- }
@NotNull
public static String fixIDEAUrl(@NotNull String ideaUrl ) {
diff --git a/platform/core-api/src/com/intellij/util/IconUtil.java b/platform/core-api/src/com/intellij/util/IconUtil.java
index 8491941..77831aa 100644
--- a/platform/core-api/src/com/intellij/util/IconUtil.java
+++ b/platform/core-api/src/com/intellij/util/IconUtil.java
@@ -425,9 +425,8 @@
final BufferedImage img = UIUtil.createImage(source.getIconWidth(), source.getIconHeight(), Transparency.TRANSLUCENT);
int[] rgba = new int[4];
float[] hsb = new float[3];
- boolean hiDPI = RetinaImage.isAppleHiDPIScaledImage(image);
- for (int y = 0; y < image.getHeight() * (hiDPI ? 2 : 1); y++) {
- for (int x = 0; x < image.getWidth() * (hiDPI ? 2 : 1); x++) {
+ for (int y = 0; y < image.getRaster().getHeight(); y++) {
+ for (int x = 0; x < image.getRaster().getWidth(); x++) {
image.getRaster().getPixel(x, y, rgba);
if (rgba[3] != 0) {
Color.RGBtoHSB(rgba[0], rgba[1], rgba[2], hsb);
diff --git a/platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java b/platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java
index d75c5d8..7ed7f94 100644
--- a/platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java
+++ b/platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java
@@ -34,6 +34,7 @@
import java.awt.*;
import java.io.File;
import java.io.FileNotFoundException;
+import java.text.MessageFormat;
import java.util.*;
import java.util.List;
import java.util.jar.JarEntry;
@@ -45,6 +46,9 @@
private String myCodeName = null;
private String myMajorVersion = null;
private String myMinorVersion = null;
+ private String myMicroVersion = null;
+ private String myPatchVersion = null;
+ private String myFullVersion = null;
private String myBuildNumber = null;
private String myApiVersion = null;
private String myCompanyName = "JetBrains s.r.o.";
@@ -106,6 +110,9 @@
private static final String ELEMENT_VERSION = "version";
private static final String ATTRIBUTE_MAJOR = "major";
private static final String ATTRIBUTE_MINOR = "minor";
+ private static final String ATTRIBUTE_MICRO = "micro";
+ private static final String ATTRIBUTE_PATCH = "patch";
+ private static final String ATTRIBUTE_FULL = "full";
private static final String ATTRIBUTE_CODENAME = "codename";
private static final String ATTRIBUTE_NAME = "name";
private static final String ELEMENT_BUILD = "build";
@@ -219,6 +226,40 @@
}
@Override
+ public String getMicroVersion() {
+ return myMicroVersion;
+ }
+
+ @Override
+ public String getPatchVersion() {
+ return myPatchVersion;
+ }
+
+ @Override
+ public String getFullVersion() {
+ if (myFullVersion == null) {
+ if (myMajorVersion != null && !myMajorVersion.trim().isEmpty()) {
+ if (myMinorVersion != null && !myMinorVersion.trim().isEmpty()) {
+ return myMajorVersion + "." + myMinorVersion;
+ }
+ else {
+ return myMajorVersion + ".0";
+ }
+ }
+ else {
+ return getVersionName();
+ }
+ } else {
+ return MessageFormat.format(myFullVersion, myMajorVersion, myMinorVersion, myMicroVersion, myPatchVersion);
+ }
+ }
+
+ @Override
+ public String getStrictVersion() {
+ return myMajorVersion + "." + myMinorVersion + "." + myMicroVersion + "." + myPatchVersion;
+ }
+
+ @Override
public String getVersionName() {
final String fullName = ApplicationNamesInfo.getInstance().getFullProductName();
if (myEAP && !StringUtil.isEmptyOrSpaces(myCodeName)) {
@@ -433,12 +474,7 @@
buffer.append(getVersionName());
buffer.append(" ");
if (getMajorVersion() != null && !isEAP() && !isBetaOrRC()) {
- buffer.append(getMajorVersion());
-
- if (getMinorVersion() != null && getMinorVersion().length() > 0){
- buffer.append(".");
- buffer.append(getMinorVersion());
- }
+ buffer.append(getFullVersion());
}
else {
buffer.append(getBuild().asStringWithAllDetails());
@@ -513,6 +549,9 @@
if (versionElement != null) {
myMajorVersion = versionElement.getAttributeValue(ATTRIBUTE_MAJOR);
myMinorVersion = versionElement.getAttributeValue(ATTRIBUTE_MINOR);
+ myMicroVersion = versionElement.getAttributeValue(ATTRIBUTE_MICRO);
+ myPatchVersion = versionElement.getAttributeValue(ATTRIBUTE_PATCH);
+ myFullVersion = versionElement.getAttributeValue(ATTRIBUTE_FULL);
myCodeName = versionElement.getAttributeValue(ATTRIBUTE_CODENAME);
myEAP = Boolean.parseBoolean(versionElement.getAttributeValue(ATTRIBUTE_EAP));
}
diff --git a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java
index b511687..1b14a41 100644
--- a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java
+++ b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java
@@ -16,17 +16,15 @@
package com.intellij.psi.impl.smartPointers;
import com.intellij.lang.LanguageUtil;
+import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.RangeMarker;
-import com.intellij.openapi.util.ProperTextRange;
-import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.util.*;
import com.intellij.psi.PsiAnchor;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
-import com.intellij.psi.impl.source.PsiFileImpl;
import com.intellij.psi.impl.source.PsiFileWithStubSupport;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.tree.IElementType;
-import com.intellij.psi.tree.IStubFileElementType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -34,34 +32,42 @@
* User: cdr
*/
class AnchorElementInfo extends SelfElementInfo {
- private int stubId;
- private IStubElementType myStubElementType;
+ private volatile long myStubElementTypeAndId; // stubId in the lower 32 bits; stubElementTypeIndex in the high 32 bits packed together for atomicity
AnchorElementInfo(@NotNull PsiElement anchor, @NotNull PsiFile containingFile) {
- super(containingFile.getProject(), ProperTextRange.create(anchor.getTextRange()), anchor.getClass(), containingFile, LanguageUtil.getRootLanguage(anchor));
+ super(containingFile.getProject(), ProperTextRange.create(anchor.getTextRange()), anchor.getClass(), containingFile, LanguageUtil.getRootLanguage(
+ anchor));
assert !(anchor instanceof PsiFile) : "FileElementInfo must be used for file: "+anchor;
- stubId = -1;
+ myStubElementTypeAndId = pack(-1, null);
}
// will restore by stub index until file tree get loaded
AnchorElementInfo(@NotNull PsiElement anchor,
@NotNull PsiFileWithStubSupport containingFile,
int stubId,
@NotNull IStubElementType stubElementType) {
- super(containingFile.getProject(), new ProperTextRange(0,0), anchor.getClass(), containingFile, containingFile.getLanguage());
- this.stubId = stubId;
- myStubElementType = stubElementType;
- IElementType contentElementType = ((PsiFileImpl)containingFile).getContentElementType();
- assert contentElementType instanceof IStubFileElementType : contentElementType;
+ super(containingFile.getProject(), new ProperTextRange(0, 0), anchor.getClass(), containingFile, containingFile.getLanguage());
+ myStubElementTypeAndId = pack(stubId, stubElementType);
assert !(anchor instanceof PsiFile) : "FileElementInfo must be used for file: "+anchor;
}
+ private static long pack(int stubId, IStubElementType stubElementType) {
+ return ((long)stubId) | (stubElementType == null ? 0 : (((long)stubElementType.getIndex()) << 32));
+ }
+
+ private int getStubId() {
+ return (int)myStubElementTypeAndId;
+ }
+
@Override
@Nullable
public PsiElement restoreElement() {
+ long typeAndId = myStubElementTypeAndId;
+ int stubId = (int)typeAndId;
if (stubId != -1) {
PsiFile file = restoreFile();
if (!(file instanceof PsiFileWithStubSupport)) return null;
- return PsiAnchor.restoreFromStubIndex((PsiFileWithStubSupport)file, stubId, myStubElementType, false);
+ IStubElementType stubElementType = (IStubElementType)IElementType.find((short)(typeAndId >> 32));
+ return PsiAnchor.restoreFromStubIndex((PsiFileWithStubSupport)file, stubId, stubElementType, false);
}
if (!mySyncMarkerIsValid) return null;
PsiFile file = restoreFile();
@@ -80,27 +86,46 @@
}
@Override
- public boolean pointsToTheSameElementAs(@NotNull SmartPointerElementInfo other) {
+ public boolean pointsToTheSameElementAs(@NotNull final SmartPointerElementInfo other) {
if (other instanceof AnchorElementInfo) {
AnchorElementInfo otherAnchor = (AnchorElementInfo)other;
- if (stubId != -1 && otherAnchor.stubId != -1 && stubId != otherAnchor.stubId) return false;
- if (myStubElementType != null && otherAnchor.myStubElementType != null && myStubElementType != otherAnchor.myStubElementType) return false;
+ if ((getStubId() == -1) != (otherAnchor.getStubId() == -1)) {
+ return ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
+ @Override
+ public Boolean compute() {
+ return Comparing.equal(restoreElement(), other.restoreElement());
+ }
+ });
+ }
+ if (myStubElementTypeAndId != otherAnchor.myStubElementTypeAndId) return false;
}
return super.pointsToTheSameElementAs(other);
}
@Override
public void fastenBelt(int offset, RangeMarker[] cachedRangeMarker) {
- if (stubId != -1) {
- PsiElement element = restoreElement();
- if (element != null) {
- // switch to tree
- stubId = -1;
- myStubElementType = null;
- PsiElement anchor = AnchorElementInfoFactory.getAnchor(element);
- setRange((anchor == null ? element : anchor).getTextRange());
- }
+ if (getStubId() != -1) {
+ switchToTree();
}
super.fastenBelt(offset, cachedRangeMarker);
}
+
+ private void switchToTree() {
+ PsiElement element = restoreElement();
+ if (element != null) {
+ // switch to tree
+ myStubElementTypeAndId = pack(-1, null);
+ PsiElement anchor = AnchorElementInfoFactory.getAnchor(element);
+ setRange((anchor == null ? element : anchor).getTextRange());
+ }
+ }
+
+ @Override
+ public Segment getRange() {
+ if (getStubId() != -1) {
+ switchToTree();
+ }
+ return super.getRange();
+ }
+
}
diff --git a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfoFactory.java b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfoFactory.java
index a06b410..e39a5e3 100644
--- a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfoFactory.java
+++ b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfoFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -19,9 +19,12 @@
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.StubBasedPsiElement;
+import com.intellij.psi.impl.source.PsiFileImpl;
import com.intellij.psi.impl.source.PsiFileWithStubSupport;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.stubs.StubTree;
+import com.intellij.psi.tree.IElementType;
+import com.intellij.psi.tree.IStubFileElementType;
import com.intellij.psi.util.PsiUtilCore;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -39,7 +42,8 @@
StubBasedPsiElement stubPsi = (StubBasedPsiElement)element;
int stubId = PsiAnchor.calcStubIndex(stubPsi);
IStubElementType myStubElementType = stubPsi.getElementType();
- if (stubId != -1) {
+ IElementType contentElementType = ((PsiFileImpl)containingFile).getContentElementType();
+ if (stubId != -1 && contentElementType instanceof IStubFileElementType) { // TemplateDataElementType is not IStubFileElementType
return new AnchorElementInfo(element, stubFile, stubId, myStubElementType);
}
}
diff --git a/platform/diff-api/src/com/intellij/diff/comparison/ComparisonManager.java b/platform/diff-api/src/com/intellij/diff/comparison/ComparisonManager.java
index 272a1f1..db5bee2 100644
--- a/platform/diff-api/src/com/intellij/diff/comparison/ComparisonManager.java
+++ b/platform/diff-api/src/com/intellij/diff/comparison/ComparisonManager.java
@@ -39,32 +39,32 @@
public abstract List<LineFragment> compareLines(@NotNull CharSequence text1,
@NotNull CharSequence text2,
@NotNull ComparisonPolicy policy,
- @NotNull ProgressIndicator indicator);
+ @NotNull ProgressIndicator indicator) throws DiffTooBigException;
@NotNull
public abstract List<LineFragment> compareLinesInner(@NotNull CharSequence text1,
@NotNull CharSequence text2,
@NotNull ComparisonPolicy policy,
- @NotNull ProgressIndicator indicator);
+ @NotNull ProgressIndicator indicator) throws DiffTooBigException;
@NotNull
public abstract List<LineFragment> compareLinesInner(@NotNull CharSequence text1,
@NotNull CharSequence text2,
@NotNull List<LineFragment> lineFragments,
@NotNull ComparisonPolicy policy,
- @NotNull ProgressIndicator indicator);
+ @NotNull ProgressIndicator indicator) throws DiffTooBigException;
@NotNull
public abstract List<DiffFragment> compareWords(@NotNull CharSequence text1,
@NotNull CharSequence text2,
@NotNull ComparisonPolicy policy,
- @NotNull ProgressIndicator indicator);
+ @NotNull ProgressIndicator indicator) throws DiffTooBigException;
@NotNull
public abstract List<DiffFragment> compareChars(@NotNull CharSequence text1,
@NotNull CharSequence text2,
@NotNull ComparisonPolicy policy,
- @NotNull ProgressIndicator indicator);
+ @NotNull ProgressIndicator indicator) throws DiffTooBigException;
public abstract boolean isEquals(@NotNull CharSequence text1, @NotNull CharSequence text2, @NotNull ComparisonPolicy policy);
diff --git a/platform/diff-api/src/com/intellij/diff/requests/NoDiffRequest.java b/platform/diff-api/src/com/intellij/diff/requests/NoDiffRequest.java
index fd5e42a8..f039dfd 100644
--- a/platform/diff-api/src/com/intellij/diff/requests/NoDiffRequest.java
+++ b/platform/diff-api/src/com/intellij/diff/requests/NoDiffRequest.java
@@ -18,6 +18,8 @@
import org.jetbrains.annotations.Nullable;
public class NoDiffRequest extends MessageDiffRequest {
+ public static NoDiffRequest INSTANCE = new NoDiffRequest();
+
public NoDiffRequest(@Nullable String title) {
super(title, "Nothing to show");
}
diff --git a/platform/diff-impl/src/com/intellij/diff/applications/DiffApplication.java b/platform/diff-impl/src/com/intellij/diff/applications/DiffApplication.java
index 8de2d02..0bbc064 100644
--- a/platform/diff-impl/src/com/intellij/diff/applications/DiffApplication.java
+++ b/platform/diff-impl/src/com/intellij/diff/applications/DiffApplication.java
@@ -21,6 +21,8 @@
import com.intellij.diff.requests.DiffRequest;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.diff.DiffBundle;
+import com.intellij.openapi.project.DefaultProjectFactory;
+import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -59,6 +61,7 @@
file2.refresh(false, true);
DiffRequest request = DiffRequestFactory.getInstance().createFromFiles(null, file1, file2);
- DiffManagerEx.getInstance().showDiffBuiltin(null, request, DiffDialogHints.MODAL);
+ Project project = DefaultProjectFactory.getInstance().getDefaultProject();
+ DiffManagerEx.getInstance().showDiffBuiltin(project, request, DiffDialogHints.MODAL);
}
}
diff --git a/platform/diff-impl/src/com/intellij/diff/comparison/ComparisonManagerImpl.java b/platform/diff-impl/src/com/intellij/diff/comparison/ComparisonManagerImpl.java
index d9ae5a1..27f619a 100644
--- a/platform/diff-impl/src/com/intellij/diff/comparison/ComparisonManagerImpl.java
+++ b/platform/diff-impl/src/com/intellij/diff/comparison/ComparisonManagerImpl.java
@@ -41,7 +41,7 @@
public List<LineFragment> compareLines(@NotNull CharSequence text1,
@NotNull CharSequence text2,
@NotNull ComparisonPolicy policy,
- @NotNull ProgressIndicator indicator) {
+ @NotNull ProgressIndicator indicator) throws DiffTooBigException {
if (policy == ComparisonPolicy.IGNORE_WHITESPACES) {
return ByLine.compare(text1, text2, policy, indicator);
}
@@ -54,7 +54,7 @@
public List<LineFragment> compareLinesInner(@NotNull CharSequence text1,
@NotNull CharSequence text2,
@NotNull ComparisonPolicy policy,
- @NotNull ProgressIndicator indicator) {
+ @NotNull ProgressIndicator indicator) throws DiffTooBigException {
List<LineFragment> fragments = compareLines(text1, text2, policy, indicator);
return compareLinesInner(text1, text2, fragments, policy, indicator);
}
@@ -64,7 +64,7 @@
@NotNull CharSequence text2,
@NotNull List<LineFragment> lineFragments,
@NotNull ComparisonPolicy policy,
- @NotNull ProgressIndicator indicator) {
+ @NotNull ProgressIndicator indicator) throws DiffTooBigException {
List<LineFragment> fineFragments = new ArrayList<LineFragment>(lineFragments.size());
int tooBigChunksCount = 0;
@@ -128,7 +128,7 @@
public List<DiffFragment> compareWords(@NotNull CharSequence text1,
@NotNull CharSequence text2,
@NotNull ComparisonPolicy policy,
- @NotNull ProgressIndicator indicator) {
+ @NotNull ProgressIndicator indicator) throws DiffTooBigException {
return ByWord.compare(text1, text2, policy, indicator);
}
@@ -136,7 +136,7 @@
public List<DiffFragment> compareChars(@NotNull CharSequence text1,
@NotNull CharSequence text2,
@NotNull ComparisonPolicy policy,
- @NotNull ProgressIndicator indicator) {
+ @NotNull ProgressIndicator indicator) throws DiffTooBigException {
if (policy == ComparisonPolicy.IGNORE_WHITESPACES) {
return convertIntoFragments(ByChar.compareIgnoreWhitespaces(text1, text2, indicator));
}
diff --git a/platform/diff-impl/src/com/intellij/diff/contents/BinaryFileContentImpl.java b/platform/diff-impl/src/com/intellij/diff/contents/BinaryFileContentImpl.java
index e61040b..155e3fd 100644
--- a/platform/diff-impl/src/com/intellij/diff/contents/BinaryFileContentImpl.java
+++ b/platform/diff-impl/src/com/intellij/diff/contents/BinaryFileContentImpl.java
@@ -42,7 +42,7 @@
@Nullable
@Override
public OpenFileDescriptor getOpenFileDescriptor() {
- if (myProject == null) return null;
+ if (myProject == null || myProject.isDefault()) return null;
return new OpenFileDescriptor(myProject, myFile);
}
diff --git a/platform/diff-impl/src/com/intellij/diff/contents/DirectoryContentImpl.java b/platform/diff-impl/src/com/intellij/diff/contents/DirectoryContentImpl.java
index b59154f..9f61507 100644
--- a/platform/diff-impl/src/com/intellij/diff/contents/DirectoryContentImpl.java
+++ b/platform/diff-impl/src/com/intellij/diff/contents/DirectoryContentImpl.java
@@ -35,7 +35,7 @@
@Nullable
@Override
public OpenFileDescriptor getOpenFileDescriptor() {
- if (myProject == null) return null;
+ if (myProject == null || myProject.isDefault()) return null;
return new OpenFileDescriptor(myProject, myFile);
}
diff --git a/platform/diff-impl/src/com/intellij/diff/contents/FileDocumentContentImpl.java b/platform/diff-impl/src/com/intellij/diff/contents/FileDocumentContentImpl.java
index cccce65..0ced908 100644
--- a/platform/diff-impl/src/com/intellij/diff/contents/FileDocumentContentImpl.java
+++ b/platform/diff-impl/src/com/intellij/diff/contents/FileDocumentContentImpl.java
@@ -39,7 +39,7 @@
@Nullable
@Override
public OpenFileDescriptor getOpenFileDescriptor(int offset) {
- if (myProject == null) return null;
+ if (myProject == null || myProject.isDefault()) return null;
return new OpenFileDescriptor(myProject, myFile, offset);
}
diff --git a/platform/diff-impl/src/com/intellij/diff/impl/CacheDiffRequestChainProcessor.java b/platform/diff-impl/src/com/intellij/diff/impl/CacheDiffRequestChainProcessor.java
index 3871360..49a4000 100644
--- a/platform/diff-impl/src/com/intellij/diff/impl/CacheDiffRequestChainProcessor.java
+++ b/platform/diff-impl/src/com/intellij/diff/impl/CacheDiffRequestChainProcessor.java
@@ -66,7 +66,7 @@
List<? extends DiffRequestProducer> requests = myRequestChain.getRequests();
int index = myRequestChain.getIndex();
if (index < 0 || index >= requests.size()) {
- applyRequest(new NoDiffRequest(), force, scrollToChangePolicy);
+ applyRequest(NoDiffRequest.INSTANCE, force, scrollToChangePolicy);
return;
}
diff --git a/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestPanelImpl.java b/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestPanelImpl.java
index 08ea37e..964c09b 100644
--- a/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestPanelImpl.java
+++ b/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestPanelImpl.java
@@ -83,7 +83,7 @@
private static class MyCacheDiffRequestChainProcessor extends DiffRequestProcessor {
@Nullable private final Window myWindow;
- @NotNull private DiffRequest myRequest = new NoDiffRequest();
+ @NotNull private DiffRequest myRequest = NoDiffRequest.INSTANCE;
public MyCacheDiffRequestChainProcessor(@Nullable Project project, @Nullable Window window) {
super(project);
@@ -91,7 +91,7 @@
}
public void setRequest(@Nullable DiffRequest request) {
- myRequest = request != null ? request : new NoDiffRequest();
+ myRequest = request != null ? request : NoDiffRequest.INSTANCE;
}
@Override
diff --git a/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java b/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java
index 56f1ef3..0965c8d3 100644
--- a/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java
+++ b/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java
@@ -107,7 +107,7 @@
myToolOrder = new LinkedList<DiffTool>();
myContext = new MyDiffContext(context);
- myActiveRequest = new NoDiffRequest();
+ myActiveRequest = NoDiffRequest.INSTANCE;
myDiffSettings = DiffSettingsHolder.getInstance().getSettings(getContextUserData(DiffUserDataKeysEx.PLACE));
diff --git a/platform/dvcs-api/src/com/intellij/dvcs/push/PushTargetPanel.java b/platform/dvcs-api/src/com/intellij/dvcs/push/PushTargetPanel.java
index 245748c..cfbe45b 100644
--- a/platform/dvcs-api/src/com/intellij/dvcs/push/PushTargetPanel.java
+++ b/platform/dvcs-api/src/com/intellij/dvcs/push/PushTargetPanel.java
@@ -49,4 +49,7 @@
* Add an ability to track edit field process
*/
public abstract void addTargetEditorListener(@NotNull PushTargetEditorListener listener);
+
+ public void forceUpdateEditableUiModel(@NotNull String forcedText) {
+ }
}
diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/PushLog.java b/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/PushLog.java
index 60832f1..e976aa7 100644
--- a/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/PushLog.java
+++ b/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/PushLog.java
@@ -489,6 +489,14 @@
public void fireEditorUpdated(@NotNull String currentText) {
if (mySyncStrategy) {
+ //update ui model
+ List<RepositoryNode> repositoryNodes =
+ getChildNodesByType((DefaultMutableTreeNode)myTree.getModel().getRoot(), RepositoryNode.class, false);
+ for (RepositoryNode node : repositoryNodes) {
+ if (node.isEditableNow()) {
+ node.forceUpdateUiModelWithTypedText(currentText);
+ }
+ }
setSyncText(currentText);
myTree.repaint();
}
diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/RepositoryNode.java b/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/RepositoryNode.java
index 434b559..675af3a 100644
--- a/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/RepositoryNode.java
+++ b/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/RepositoryNode.java
@@ -72,6 +72,10 @@
return !myLoading.get();
}
+ public void forceUpdateUiModelWithTypedText(@NotNull String forceText) {
+ myRepositoryPanel.getTargetPanel().forceUpdateEditableUiModel(forceText);
+ }
+
@Override
public void render(@NotNull ColoredTreeCellRenderer renderer) {
render(renderer, null);
diff --git a/platform/external-system-api/resources/i18n/ExternalSystemBundle.properties b/platform/external-system-api/resources/i18n/ExternalSystemBundle.properties
index a2d53c3..c81b1cb 100644
--- a/platform/external-system-api/resources/i18n/ExternalSystemBundle.properties
+++ b/platform/external-system-api/resources/i18n/ExternalSystemBundle.properties
@@ -28,7 +28,8 @@
error.project.already.registered=The project is already registered
error.cannot.parse.project=Can not parse {0} project
error.resolve.with.reason={0}\n\nConsult IDE log for more details (Help | Show Log)
-error.resolve.generic=Resolve error
+error.resolve.with.log_link=<html>{0}<br><br>Consult IDE log for more details (Help | <a href="{1}">Show Log</a>)<html>
+error.resolve.generic=Resolve Error
error.resolve.already.running=Another 'refresh project' task is currently running for the project: {0}
# Tool window
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/RemoteExternalSystemCommunicationManager.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/RemoteExternalSystemCommunicationManager.java
index fe0287f..25e6d52d 100644
--- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/RemoteExternalSystemCommunicationManager.java
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/RemoteExternalSystemCommunicationManager.java
@@ -45,6 +45,10 @@
import com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemFacadeWrapper;
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
import com.intellij.openapi.externalSystem.util.ExternalSystemConstants;
+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.project.ProjectBundle;
import com.intellij.openapi.projectRoots.JavaSdkType;
import com.intellij.openapi.projectRoots.JdkUtil;
@@ -140,6 +144,10 @@
ContainerUtil.addIfNotNull(PathUtil.getJarPathForClass(ExtensionPointName.class), classPath);
ContainerUtil.addIfNotNull(PathUtil.getJarPathForClass(StorageUtil.class), classPath);
ContainerUtil.addIfNotNull(PathUtil.getJarPathForClass(ExternalSystemTaskNotificationListener.class), classPath);
+ ContainerUtil.addIfNotNull(PathUtil.getJarPathForClass(StdModuleTypes.class), classPath);
+ ContainerUtil.addIfNotNull(PathUtil.getJarPathForClass(JavaModuleType.class), classPath);
+ ContainerUtil.addIfNotNull(PathUtil.getJarPathForClass(ModuleType.class), classPath);
+ ContainerUtil.addIfNotNull(PathUtil.getJarPathForClass(EmptyModuleType.class), classPath);
// External system module jars
ContainerUtil.addIfNotNull(PathUtil.getJarPathForClass(getClass()), classPath);
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/NotSupportedException.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/NotSupportedException.java
new file mode 100644
index 0000000..31e6533
--- /dev/null
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/NotSupportedException.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2000-2015 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 com.intellij.openapi.externalSystem.service.execution;
+
+import com.intellij.openapi.externalSystem.model.ExternalSystemException;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 12/12/2014
+ */
+public class NotSupportedException extends ExternalSystemException {
+ public NotSupportedException(@Nullable String message) {
+ super(message);
+ }
+
+ public NotSupportedException(@Nullable Throwable cause) {
+ super(cause);
+ }
+
+ public NotSupportedException(@Nullable String message, @NotNull String... quickFixes) {
+ super(message, quickFixes);
+ }
+
+ public NotSupportedException(@Nullable String message, @Nullable Throwable cause, @NotNull String... quickFixes) {
+ super(message, cause, quickFixes);
+ }
+}
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/internal/AbstractExternalSystemTask.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/internal/AbstractExternalSystemTask.java
index 305114c..3c7f547 100644
--- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/internal/AbstractExternalSystemTask.java
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/internal/AbstractExternalSystemTask.java
@@ -6,7 +6,8 @@
import com.intellij.openapi.externalSystem.model.task.*;
import com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager;
import com.intellij.openapi.externalSystem.service.RemoteExternalSystemFacade;
-import com.intellij.openapi.externalSystem.service.notification.ExternalSystemProgressNotificationManager;
+import com.intellij.openapi.externalSystem.service.execution.NotSupportedException;
+import com.intellij.openapi.externalSystem.service.notification.*;
import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.Project;
@@ -190,6 +191,12 @@
setState(result ? ExternalSystemTaskState.CANCELED : ExternalSystemTaskState.CANCELLATION_FAILED);
return result;
}
+ catch (NotSupportedException e) {
+ NotificationData notification =
+ new NotificationData("Cancellation failed", e.getMessage(), NotificationCategory.WARNING, NotificationSource.PROJECT_SYNC);
+ notification.setBalloonNotification(true);
+ ExternalSystemNotificationManager.getInstance(getIdeProject()).showNotification(getExternalSystemId(), notification);
+ }
catch (Throwable e) {
setState(ExternalSystemTaskState.CANCELLATION_FAILED);
myError.set(e);
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractExternalProjectImportBuilder.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractExternalProjectImportBuilder.java
index 6a3bb5a..c1e04c1 100644
--- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractExternalProjectImportBuilder.java
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/wizard/AbstractExternalProjectImportBuilder.java
@@ -1,6 +1,7 @@
package com.intellij.openapi.externalSystem.service.project.wizard;
import com.intellij.ide.util.projectWizard.WizardContext;
+import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.externalSystem.model.DataNode;
@@ -276,8 +277,9 @@
if (!StringUtil.isEmpty(errorDetails)) {
LOG.warn(errorDetails);
}
- error.set(new ConfigurationException(ExternalSystemBundle.message("error.resolve.with.reason", errorMessage),
- ExternalSystemBundle.message("error.resolve.generic")));
+ error.set(new ConfigurationException(
+ ExternalSystemBundle.message("error.resolve.with.log_link", errorMessage, PathManager.getLogPath()),
+ ExternalSystemBundle.message("error.resolve.generic")));
}
};
diff --git a/platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerInfo.java b/platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerInfo.java
index 0c8236c..d0ecab7 100644
--- a/platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerInfo.java
+++ b/platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerInfo.java
@@ -98,7 +98,9 @@
if (tooltip.length() > 0) {
tooltip.append(UIUtil.BORDER_LINE);
}
- tooltip.append(UIUtil.getHtmlBody(info));
+ if (info != null) {
+ tooltip.append(UIUtil.getHtmlBody(info));
+ }
}
return XmlStringUtil.wrapInHtml(tooltip);
}
diff --git a/platform/lang-api/src/com/intellij/diagnostic/logging/LogFilter.java b/platform/lang-api/src/com/intellij/diagnostic/logging/LogFilter.java
index ad01d50..81750fb 100644
--- a/platform/lang-api/src/com/intellij/diagnostic/logging/LogFilter.java
+++ b/platform/lang-api/src/com/intellij/diagnostic/logging/LogFilter.java
@@ -20,6 +20,7 @@
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.util.ImageLoader;
import org.jdom.Element;
@@ -83,7 +84,7 @@
if (myIconPath != null && new File(FileUtil.toSystemDependentName(myIconPath)).exists()) {
Image image = null;
try {
- image = ImageLoader.loadFromStream(VfsUtil.convertToURL(VfsUtil.pathToUrl(myIconPath)).openStream());
+ image = ImageLoader.loadFromStream(VfsUtilCore.convertToURL(VfsUtil.pathToUrl(myIconPath)).openStream());
}
catch (IOException e) {
LOG.debug(e);
diff --git a/platform/lang-api/src/com/intellij/execution/configurations/RunConfigurationBase.java b/platform/lang-api/src/com/intellij/execution/configurations/RunConfigurationBase.java
index 020395f..bc36407 100644
--- a/platform/lang-api/src/com/intellij/execution/configurations/RunConfigurationBase.java
+++ b/platform/lang-api/src/com/intellij/execution/configurations/RunConfigurationBase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -22,12 +22,14 @@
import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.InvalidDataException;
+import com.intellij.openapi.util.JDOMExternalizerUtil;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.util.WriteExternalException;
+import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
+import com.intellij.util.xmlb.XmlSerializer;
import com.intellij.util.xmlb.annotations.Attribute;
import com.intellij.util.xmlb.annotations.Transient;
import org.jdom.Element;
-import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -40,24 +42,22 @@
*
* @author dyoma
*/
-public abstract class RunConfigurationBase extends UserDataHolderBase
- implements RunConfiguration, TargetAwareRunProfile {
+public abstract class RunConfigurationBase extends UserDataHolderBase implements RunConfiguration, TargetAwareRunProfile {
+ private static final String LOG_FILE = "log_file";
+ private static final String PREDEFINED_LOG_FILE_ELEMENT = "predefined_log_file";
+ private static final String FILE_OUTPUT = "output_file";
+ private static final String SAVE = "is_save";
+ private static final String OUTPUT_FILE = "path";
+ private static final String SHOW_CONSOLE_ON_STD_OUT = "show_console_on_std_out";
+ private static final String SHOW_CONSOLE_ON_STD_ERR = "show_console_on_std_err";
+
private final ConfigurationFactory myFactory;
private final Project myProject;
private String myName = "";
+ private final Icon myIcon;
private ArrayList<LogFileOptions> myLogFiles = new ArrayList<LogFileOptions>();
private ArrayList<PredefinedLogFile> myPredefinedLogFiles = new ArrayList<PredefinedLogFile>();
-
- @NonNls private static final String LOG_FILE = "log_file";
- @NonNls private static final String PREDEFINED_LOG_FILE_ELEMENT = "predefined_log_file";
- @NonNls private static final String FILE_OUTPUT = "output_file";
- @NonNls private static final String SAVE = "is_save";
- @NonNls private static final String OUTPUT_FILE = "path";
- @NonNls private static final String SHOW_CONSOLE_ON_STD_OUT = "show_console_on_std_out";
- @NonNls private static final String SHOW_CONSOLE_ON_STD_ERR = "show_console_on_std_err";
-
- private final Icon myIcon;
private boolean mySaveOutput = false;
private boolean myShowConsoleOnStdOut = false;
private boolean myShowConsoleOnStdErr = false;
@@ -111,7 +111,8 @@
return super.hashCode();
}
- public void checkRunnerSettings(@NotNull ProgramRunner runner, @Nullable RunnerSettings runnerSettings,
+ public void checkRunnerSettings(@NotNull ProgramRunner runner,
+ @Nullable RunnerSettings runnerSettings,
@Nullable ConfigurationPerRunnerSettings configurationPerRunnerSettings) throws RuntimeConfigurationException {
}
@@ -223,22 +224,17 @@
@Override
public void writeExternal(Element element) throws WriteExternalException {
- for (final LogFileOptions options : myLogFiles) {
- Element logFile = new Element(LOG_FILE);
- options.writeExternal(logFile);
- element.addContent(logFile);
- }
- for (PredefinedLogFile predefinedLogFile : myPredefinedLogFiles) {
- Element fileElement = new Element(PREDEFINED_LOG_FILE_ELEMENT);
- predefinedLogFile.writeExternal(fileElement);
- element.addContent(fileElement);
- }
- final Element fileOutputPathElement = new Element(FILE_OUTPUT);
- if (myFileOutputPath != null) {
- fileOutputPathElement.setAttribute(OUTPUT_FILE, myFileOutputPath);
- }
- fileOutputPathElement.setAttribute(SAVE, String.valueOf(mySaveOutput));
+ JDOMExternalizerUtil.addChildren(element, LOG_FILE, myLogFiles);
+ JDOMExternalizerUtil.addChildren(element, PREDEFINED_LOG_FILE_ELEMENT, myPredefinedLogFiles);
+
if (myFileOutputPath != null || mySaveOutput) {
+ Element fileOutputPathElement = new Element(FILE_OUTPUT);
+ if (myFileOutputPath != null) {
+ fileOutputPathElement.setAttribute(OUTPUT_FILE, myFileOutputPath);
+ }
+ if (mySaveOutput) {
+ fileOutputPathElement.setAttribute(SAVE, String.valueOf(mySaveOutput));
+ }
element.addContent(fileOutputPathElement);
}
diff --git a/platform/lang-api/src/com/intellij/ide/util/projectWizard/SettingsStep.java b/platform/lang-api/src/com/intellij/ide/util/projectWizard/SettingsStep.java
index a8941d3..0d435fe 100644
--- a/platform/lang-api/src/com/intellij/ide/util/projectWizard/SettingsStep.java
+++ b/platform/lang-api/src/com/intellij/ide/util/projectWizard/SettingsStep.java
@@ -26,7 +26,6 @@
*/
public interface SettingsStep {
- @Nullable
WizardContext getContext();
void addSettingsField(@NotNull String label, @NotNull JComponent field);
diff --git a/platform/lang-api/src/com/intellij/lang/documentation/CompositeDocumentationProvider.java b/platform/lang-api/src/com/intellij/lang/documentation/CompositeDocumentationProvider.java
index 14a7c4b..6986207 100644
--- a/platform/lang-api/src/com/intellij/lang/documentation/CompositeDocumentationProvider.java
+++ b/platform/lang-api/src/com/intellij/lang/documentation/CompositeDocumentationProvider.java
@@ -16,6 +16,7 @@
package com.intellij.lang.documentation;
+import com.intellij.ide.BrowserUtil;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
@@ -190,7 +191,7 @@
if (((ExternalDocumentationProvider)provider).hasDocumentationFor(element, originalElement)) return true;
}
else {
- if (hasUrlsFor(provider, element, originalElement)) return true;
+ if (hasBrowsableUrlsFor(provider, element, originalElement)) return true;
}
}
return false;
@@ -224,6 +225,12 @@
return false;
}
+ public static boolean hasBrowsableUrlsFor(DocumentationProvider provider, PsiElement element, PsiElement originalElement) {
+ final List<String> urls = BrowserUtil.retainBrowsableUrls(provider.getUrlFor(element, originalElement));
+ if (urls != null && !urls.isEmpty()) return true;
+ return false;
+ }
+
@Nullable
@Override
public PsiElement getCustomDocumentationElement(@NotNull Editor editor,
diff --git a/platform/lang-api/src/com/intellij/lang/documentation/ExternalDocumentationProvider.java b/platform/lang-api/src/com/intellij/lang/documentation/ExternalDocumentationProvider.java
index 3172726..5d8ab61 100644
--- a/platform/lang-api/src/com/intellij/lang/documentation/ExternalDocumentationProvider.java
+++ b/platform/lang-api/src/com/intellij/lang/documentation/ExternalDocumentationProvider.java
@@ -31,8 +31,10 @@
String fetchExternalDocumentation(final Project project, PsiElement element, final List<String> docUrls);
/**
- * Quick check for existence of external documentation for specified element. Called from action update, so must be fast.
- * If not implemented, update check is performed by calling {@link DocumentationProvider#getUrlFor(com.intellij.psi.PsiElement, com.intellij.psi.PsiElement)}.
+ * Quick check for existence of external documentation for specified element which can be displayed in external browser.
+ * Called from action update, so must be fast. If not implemented, update check is performed by calling
+ * {@link DocumentationProvider#getUrlFor(PsiElement, PsiElement)} and retaining only 'browsable' urls
+ * (see {@link com.intellij.ide.BrowserUtil#canBeBrowsed(String)}).
*
* @param element the element to check for existence of documentation
* @param originalElement the element at caret (on which the action was invoked)
diff --git a/platform/lang-api/src/com/intellij/lang/folding/CustomFoldingSurroundDescriptor.java b/platform/lang-api/src/com/intellij/lang/folding/CustomFoldingSurroundDescriptor.java
index e5b6014..1e42c22 100644
--- a/platform/lang-api/src/com/intellij/lang/folding/CustomFoldingSurroundDescriptor.java
+++ b/platform/lang-api/src/com/intellij/lang/folding/CustomFoldingSurroundDescriptor.java
@@ -134,6 +134,9 @@
@Nullable
private static PsiElement findCommonAncestorForWholeRange(@NotNull PsiElement start, @NotNull PsiElement end) {
+ if (start.getContainingFile() != end.getContainingFile()) {
+ return null;
+ }
final PsiElement parent = PsiTreeUtil.findCommonParent(start, end);
if (parent == null) {
return null;
diff --git a/platform/lang-api/src/com/intellij/openapi/projectRoots/JdkUtil.java b/platform/lang-api/src/com/intellij/openapi/projectRoots/JdkUtil.java
index 6641d53..b8d12b2 100644
--- a/platform/lang-api/src/com/intellij/openapi/projectRoots/JdkUtil.java
+++ b/platform/lang-api/src/com/intellij/openapi/projectRoots/JdkUtil.java
@@ -98,8 +98,12 @@
return null;
}
+ public static boolean checkForJdk(@NotNull String homePath) {
+ return checkForJdk(new File(FileUtil.toSystemDependentName(homePath)));
+ }
+
public static boolean checkForJdk(@NotNull File homePath) {
- File binPath = new File(homePath.getAbsolutePath() + File.separator + "bin");
+ File binPath = new File(homePath, "bin");
if (!binPath.exists()) return false;
FileFilter fileFilter = new FileFilter() {
@@ -117,8 +121,11 @@
}
public static boolean checkForJre(@NotNull String homePath) {
- homePath = new File(FileUtil.toSystemDependentName(homePath)).getAbsolutePath();
- File binPath = new File(homePath + File.separator + "bin");
+ return checkForJre(new File(FileUtil.toSystemDependentName(homePath)));
+ }
+
+ public static boolean checkForJre(@NotNull File homePath) {
+ File binPath = new File(homePath, "bin");
if (!binPath.exists()) return false;
FileFilter fileFilter = new FileFilter() {
@@ -130,7 +137,7 @@
File[] children = binPath.listFiles(fileFilter);
return children != null && children.length >= 1 &&
- checkForRuntime(homePath);
+ checkForRuntime(homePath.getAbsolutePath());
}
public static boolean checkForRuntime(@NotNull String homePath) {
diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java
index aebd6c6..7f61d2e 100644
--- a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java
+++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java
@@ -169,10 +169,13 @@
public boolean AUTODETECT_INDENTS = true;
+ @SuppressWarnings("UnusedDeclaration")
@Deprecated
public final IndentOptions JAVA_INDENT_OPTIONS = new IndentOptions();
+ @SuppressWarnings("UnusedDeclaration")
@Deprecated
public final IndentOptions JSP_INDENT_OPTIONS = new IndentOptions();
+ @SuppressWarnings("UnusedDeclaration")
@Deprecated
public final IndentOptions XML_INDENT_OPTIONS = new IndentOptions();
@@ -475,7 +478,6 @@
IMPORT_LAYOUT_TABLE.addEntry(PackageEntry.ALL_OTHER_STATIC_IMPORTS_ENTRY);
}
}
- boolean oldOptionsImported = importOldIndentOptions(element);
for (final CustomCodeStyleSettings settings : getCustomSettingsValues()) {
settings.readExternal(element);
settings.importLegacySettings();
@@ -504,86 +506,9 @@
myCommonSettingsManager.readExternal(element);
- if (oldOptionsImported) {
- copyOldIndentOptions("java", JAVA_INDENT_OPTIONS);
- copyOldIndentOptions("jsp", JSP_INDENT_OPTIONS);
- copyOldIndentOptions("xml", XML_INDENT_OPTIONS);
- }
-
if (USE_SAME_INDENTS) IGNORE_SAME_INDENTS_FOR_LANGUAGES = true;
}
- private void copyOldIndentOptions(@NonNls final String extension, final IndentOptions options) {
- final FileType fileType = FileTypeManager.getInstance().getFileTypeByExtension(extension);
- if (fileType != FileTypes.UNKNOWN && fileType != FileTypes.PLAIN_TEXT && !myAdditionalIndentOptions.containsKey(fileType) &&
- !fileType.getDefaultExtension().isEmpty()) {
- registerAdditionalIndentOptions(fileType, options);
- //
- // Upgrade to version 11
- //
- if (fileType instanceof LanguageFileType) {
- Language lang = ((LanguageFileType)fileType).getLanguage();
- CommonCodeStyleSettings langSettings = myCommonSettingsManager.getCommonSettings(lang);
- if (langSettings != this && langSettings.getIndentOptions() != null) {
- langSettings.importOldIndentOptions(this);
- }
- }
- }
- }
-
- private boolean importOldIndentOptions(@NonNls Element element) {
- final List options = element.getChildren("option");
- boolean optionsImported = false;
- for (Object option1 : options) {
- @NonNls Element option = (Element)option1;
- @NonNls final String name = option.getAttributeValue("name");
- if ("TAB_SIZE".equals(name)) {
- final int value = Integer.parseInt(option.getAttributeValue("value"));
- JAVA_INDENT_OPTIONS.TAB_SIZE = value;
- JSP_INDENT_OPTIONS.TAB_SIZE = value;
- XML_INDENT_OPTIONS.TAB_SIZE = value;
- OTHER_INDENT_OPTIONS.TAB_SIZE = value;
- optionsImported = true;
- }
- else if ("INDENT_SIZE".equals(name)) {
- final int value = Integer.parseInt(option.getAttributeValue("value"));
- JAVA_INDENT_OPTIONS.INDENT_SIZE = value;
- JSP_INDENT_OPTIONS.INDENT_SIZE = value;
- XML_INDENT_OPTIONS.INDENT_SIZE = value;
- OTHER_INDENT_OPTIONS.INDENT_SIZE = value;
- optionsImported = true;
- }
- else if ("CONTINUATION_INDENT_SIZE".equals(name)) {
- final int value = Integer.parseInt(option.getAttributeValue("value"));
- JAVA_INDENT_OPTIONS.CONTINUATION_INDENT_SIZE = value;
- JSP_INDENT_OPTIONS.CONTINUATION_INDENT_SIZE = value;
- XML_INDENT_OPTIONS.CONTINUATION_INDENT_SIZE = value;
- OTHER_INDENT_OPTIONS.CONTINUATION_INDENT_SIZE = value;
- optionsImported = true;
- }
- else if ("USE_TAB_CHARACTER".equals(name)) {
- final boolean value = Boolean.parseBoolean(option.getAttributeValue("value"));
- JAVA_INDENT_OPTIONS.USE_TAB_CHARACTER = value;
- JSP_INDENT_OPTIONS.USE_TAB_CHARACTER = value;
- XML_INDENT_OPTIONS.USE_TAB_CHARACTER = value;
- OTHER_INDENT_OPTIONS.USE_TAB_CHARACTER = value;
- optionsImported = true;
- }
- else if ("SMART_TABS".equals(name)) {
- final boolean value = Boolean.parseBoolean(option.getAttributeValue("value"));
- JAVA_INDENT_OPTIONS.SMART_TABS = value;
- JSP_INDENT_OPTIONS.SMART_TABS = value;
- XML_INDENT_OPTIONS.SMART_TABS = value;
- OTHER_INDENT_OPTIONS.SMART_TABS = value;
- optionsImported = true;
- }
- else if ("SPACE_AFTER_UNARY_OPERATOR".equals(name)) {
- SPACE_AROUND_UNARY_OPERATOR = Boolean.parseBoolean(option.getAttributeValue("value"));
- optionsImported = true;
- }
- }
- return optionsImported;
- }
@Override
public void writeExternal(Element element) throws WriteExternalException {
@@ -697,8 +622,14 @@
if (file != null && file.isValid() && file.isWritable()) {
boolean isFullReformat = isFileFullyCoveredByRange(file, formatRange);
if (!ignoreDocOptions && !isFullReformat) {
- IndentOptions docOptions = IndentOptions.retrieveFromAssociatedDocument(file);
- if (docOptions != null) return docOptions;
+ IndentOptions options = IndentOptions.retrieveFromAssociatedDocument(file);
+ if (options != null) {
+ FileIndentOptionsProvider provider = options.getFileIndentOptionsProvider();
+ if (providerProcessor != null && provider != null) {
+ providerProcessor.process(provider);
+ }
+ return options;
+ }
}
FileIndentOptionsProvider[] providers = Extensions.getExtensions(FileIndentOptionsProvider.EP_NAME);
for (FileIndentOptionsProvider provider : providers) {
@@ -708,6 +639,7 @@
if (providerProcessor != null) {
providerProcessor.process(provider);
}
+ indentOptions.setFileIndentOptionsProvider(provider);
logIndentOptions(file, provider, indentOptions);
return indentOptions;
}
@@ -882,10 +814,6 @@
myAdditionalIndentOptions.put(fileType, options);
}
}
-
- public void unregisterAdditionalIndentOptions(FileType fileType) {
- myAdditionalIndentOptions.remove(fileType);
- }
public IndentOptions getAdditionalIndentOptions(FileType fileType) {
if (!myLoadedAdditionalIndentOptions) {
diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java
index 4197c13..47e9caf 100644
--- a/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java
+++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettings.java
@@ -77,21 +77,6 @@
return myLanguage;
}
- void importOldIndentOptions(@NotNull CodeStyleSettings rootSettings) {
- if (myFileType != null && myIndentOptions != null) {
- if (getFileTypeIndentOptionsProvider() == null) {
- IndentOptions fileTypeIdentOptions = rootSettings.getAdditionalIndentOptions(myFileType);
- if (fileTypeIdentOptions != null) {
- myIndentOptions.copyFrom(fileTypeIdentOptions);
- rootSettings.unregisterAdditionalIndentOptions(myFileType);
- }
- else if (rootSettings.USE_SAME_INDENTS && !rootSettings.IGNORE_SAME_INDENTS_FOR_LANGUAGES) {
- myIndentOptions.copyFrom(rootSettings.OTHER_INDENT_OPTIONS);
- }
- }
- }
- }
-
@NotNull
public IndentOptions initIndentOptions() {
myIndentOptions = new IndentOptions();
@@ -99,18 +84,6 @@
}
@Nullable
- private FileTypeIndentOptionsProvider getFileTypeIndentOptionsProvider() {
- final FileTypeIndentOptionsProvider[] providers = Extensions.getExtensions(FileTypeIndentOptionsProvider.EP_NAME);
- for (FileTypeIndentOptionsProvider provider : providers) {
- if (provider.getFileType().equals(myFileType)) {
- return provider;
- }
- }
- return null;
- }
-
-
- @Nullable
public FileType getFileType() {
return myFileType;
}
@@ -930,7 +903,8 @@
public boolean USE_RELATIVE_INDENTS = false;
public boolean KEEP_INDENTS_ON_EMPTY_LINES = false;
- private final static Key<CommonCodeStyleSettings.IndentOptions> INDENT_OPTIONS_KEY = Key.create("INDENT_OPTIONS");
+ private FileIndentOptionsProvider myFileIndentOptionsProvider;
+ private static final Key<CommonCodeStyleSettings.IndentOptions> INDENT_OPTIONS_KEY = Key.create("INDENT_OPTIONS_KEY");
@Override
public void readExternal(Element element) throws InvalidDataException {
@@ -1013,17 +987,22 @@
}
@Nullable
- static IndentOptions retrieveFromAssociatedDocument(@NotNull PsiFile file) {
- PsiDocumentManager documentManager = PsiDocumentManager.getInstance(file.getProject());
- if (documentManager != null) {
- Document document = documentManager.getDocument(file);
- if (document != null) return document.getUserData(INDENT_OPTIONS_KEY);
- }
- return null;
+ FileIndentOptionsProvider getFileIndentOptionsProvider() {
+ return myFileIndentOptionsProvider;
+ }
+
+ void setFileIndentOptionsProvider(@NotNull FileIndentOptionsProvider provider) {
+ myFileIndentOptionsProvider = provider;
}
void associateWithDocument(@NotNull Document document) {
document.putUserData(INDENT_OPTIONS_KEY, this);
}
+
+ @Nullable
+ static IndentOptions retrieveFromAssociatedDocument(@NotNull PsiFile file) {
+ Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
+ return document != null ? document.getUserData(INDENT_OPTIONS_KEY) : null;
+ }
}
}
diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettingsManager.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettingsManager.java
index 7b9d9fe..b59f14a 100644
--- a/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettingsManager.java
+++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CommonCodeStyleSettingsManager.java
@@ -112,7 +112,6 @@
if (!myCommonSettingsMap.containsKey(target)) {
CommonCodeStyleSettings initialSettings = provider.getDefaultCommonSettings();
if (initialSettings != null) {
- initialSettings.copyNonDefaultValuesFrom(myParentSettings);
init(initialSettings, target);
}
}
@@ -121,7 +120,6 @@
private void init(@NotNull CommonCodeStyleSettings initialSettings, @NotNull Language target) {
initialSettings.setRootSettings(myParentSettings);
- initialSettings.importOldIndentOptions(myParentSettings);
registerCommonSettings(target, initialSettings);
}
diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleMainPanel.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleMainPanel.java
index aff417c..6d155c9 100644
--- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleMainPanel.java
+++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleMainPanel.java
@@ -91,7 +91,9 @@
@Override
public void currentSettingsChanged() {
- ensureCurrentPanel().onSomethingChanged();
+ if (!myIsDisposed) {
+ ensureCurrentPanel().onSomethingChanged();
+ }
}
@Override
diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesUIConfiguration.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesUIConfiguration.java
index 7780f7a..b7485e0 100644
--- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesUIConfiguration.java
+++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesUIConfiguration.java
@@ -17,6 +17,7 @@
import com.intellij.openapi.components.*;
import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.xmlb.XmlSerializerUtil;
import org.jetbrains.annotations.NotNull;
@@ -75,7 +76,7 @@
public static void setRecentImportFile(@NotNull VirtualFile recentFile) {
CodeStyleSchemesUIConfiguration configuration = getInstance();
if (configuration != null) {
- URL url = VfsUtil.convertToURL(recentFile.getUrl());
+ URL url = VfsUtilCore.convertToURL(recentFile.getUrl());
if (url != null) {
configuration.RECENT_IMPORT_FILE_LOCATION = url.toString();
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeProcessor.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeProcessor.java
index e9f80bd..0bfb4cc 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeProcessor.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeProcessor.java
@@ -54,7 +54,7 @@
}
public ReformatCodeProcessor(@NotNull PsiFile file, @NotNull SelectionModel selectionModel) {
- super(file.getProject(), file, COMMAND_NAME, PROGRESS_TEXT, false);
+ super(file.getProject(), file, PROGRESS_TEXT, COMMAND_NAME, false);
mySelectionModel = selectionModel;
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/AbstractExternalFilter.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/AbstractExternalFilter.java
index eb65563..812fc77 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/AbstractExternalFilter.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/AbstractExternalFilter.java
@@ -20,15 +20,14 @@
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProcessCanceledException;
-import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Trinity;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.*;
+import com.intellij.openapi.vfs.CharsetToolkit;
+import com.intellij.openapi.vfs.VfsUtilCore;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.psi.PsiElement;
-import com.intellij.util.SystemProperties;
import com.intellij.util.io.HttpRequests;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -37,20 +36,12 @@
import java.io.*;
import java.net.URL;
import java.util.Locale;
-import java.util.jar.JarFile;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import java.util.zip.ZipEntry;
public abstract class AbstractExternalFilter {
private static final Logger LOG = Logger.getInstance(AbstractExternalFilter.class);
- private static final boolean EXTRACT_IMAGES_FROM_JARS = SystemProperties.getBooleanProperty("extract.doc.images", true);
-
- @NotNull
- @NonNls
- public static final String QUICK_DOC_DIR_NAME = "quickdoc";
-
private static final Pattern ourClassDataStartPattern = Pattern.compile("START OF CLASS DATA", Pattern.CASE_INSENSITIVE);
private static final Pattern ourClassDataEndPattern = Pattern.compile("SUMMARY ========", Pattern.CASE_INSENSITIVE);
private static final Pattern ourNonClassDataEndPattern = Pattern.compile("<A NAME=", Pattern.CASE_INSENSITIVE);
@@ -59,12 +50,6 @@
protected static final Pattern ourAnchorSuffix = Pattern.compile("#(.*)$");
protected static @NonNls final Pattern ourHtmlFileSuffix = Pattern.compile("/([^/]*[.][hH][tT][mM][lL]?)$");
private static @NonNls final Pattern ourAnnihilator = Pattern.compile("/[^/^.]*/[.][.]/");
- private static @NonNls final Pattern ourImgSelector =
- Pattern.compile("<IMG[ \\t\\n\\r\\f]+SRC=\"([^>]*?)\"", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
- private static @NonNls final Pattern ourPathInsideJarPattern = Pattern.compile(
- String.format("%s(.+\\.jar)!/(.+?)[^/]+", JarFileSystem.PROTOCOL_PREFIX),
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL
- );
private static @NonNls final String JAR_PROTOCOL = "jar:";
@NonNls private static final String HR = "<HR>";
@NonNls private static final String P = "<P>";
@@ -118,78 +103,6 @@
}
}
- protected final RefConvertor myIMGConvertor = new RefConvertor(ourImgSelector) {
- @Override
- protected String convertReference(String root, String href) {
- if (StringUtil.startsWithChar(href, '#')) {
- return DocumentationManagerProtocol.DOC_ELEMENT_PROTOCOL + root + href;
- }
-
- String protocol = VirtualFileManager.extractProtocol(root);
- if (EXTRACT_IMAGES_FROM_JARS && Comparing.strEqual(protocol, JarFileSystem.PROTOCOL)) {
- Matcher matcher = ourPathInsideJarPattern.matcher(root);
- if (matcher.matches()) {
- // There is a possible case that javadoc jar is assembled with images inside. However, our standard quick doc
- // renderer (JEditorPane) doesn't know how to reference images from such jars. That's why we unpack them to temp
- // directory if necessary and substitute that 'inside jar path' to usual file url.
- String jarPath = matcher.group(1);
- String jarName = jarPath;
- int i = jarName.lastIndexOf(File.separatorChar);
- if (i >= 0 && i < jarName.length() - 1) {
- jarName = jarName.substring(i + 1);
- }
- jarName = jarName.substring(0, jarName.length() - ".jar".length());
- String basePath = matcher.group(2);
- String imgPath = FileUtil.toCanonicalPath(basePath + href);
- File unpackedImagesRoot = new File(FileUtilRt.getTempDirectory(), QUICK_DOC_DIR_NAME);
- File unpackedJarImagesRoot = new File(unpackedImagesRoot, jarName);
- File unpackedImage = new File(unpackedJarImagesRoot, imgPath);
- boolean referenceUnpackedImage = true;
- if (!unpackedImage.isFile()) {
- referenceUnpackedImage = false;
- try {
- JarFile jarFile = new JarFile(jarPath);
- try {
- ZipEntry entry = jarFile.getEntry(imgPath);
- if (entry != null) {
- FileUtilRt.createIfNotExists(unpackedImage);
- FileOutputStream fOut = new FileOutputStream(unpackedImage);
- try {
- // Don't bother with wrapping file output stream into buffered stream in assumption that FileUtil operates
- // on NIO channels.
- FileUtilRt.copy(jarFile.getInputStream(entry), fOut);
- referenceUnpackedImage = true;
- }
- finally {
- fOut.close();
- }
- }
- unpackedImage.deleteOnExit();
- }
- finally {
- jarFile.close();
- }
- }
- catch (IOException e) {
- LOG.debug(e);
- }
- }
- if (referenceUnpackedImage) {
- return LocalFileSystem.PROTOCOL_PREFIX + unpackedImage.getAbsolutePath();
- }
- }
- }
-
- if (Comparing.strEqual(protocol, LocalFileSystem.PROTOCOL)) {
- final String path = VirtualFileManager.extractPath(root);
- if (!path.startsWith("/")) {//skip host for local file system files (format - file://host_name/path)
- root = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, "/" + path);
- }
- }
- return ourHtmlFileSuffix.matcher(root).replaceAll("/") + href;
- }
- };
-
protected static String doAnnihilate(String path) {
int len = path.length();
@@ -258,10 +171,10 @@
}
protected void doBuildFromStream(String url, Reader input, StringBuilder data) throws IOException {
- doBuildFromStream(url, input, data, true);
+ doBuildFromStream(url, input, data, true, true);
}
- protected void doBuildFromStream(final String url, Reader input, final StringBuilder data, boolean searchForEncoding) throws IOException {
+ protected void doBuildFromStream(final String url, Reader input, final StringBuilder data, boolean searchForEncoding, boolean matchStart) throws IOException {
Trinity<Pattern, Pattern, Boolean> settings = getParseSettings(url);
@NonNls Pattern startSection = settings.first;
@NonNls Pattern endSection = settings.second;
@@ -269,6 +182,10 @@
@NonNls String greatestEndSection = "<!-- ========= END OF CLASS DATA ========= -->";
data.append(HTML);
+ URL baseUrl = VfsUtilCore.convertToURL(url);
+ if (baseUrl != null) {
+ data.append("<base href=\"").append(baseUrl).append("\">");
+ }
data.append("<style type=\"text/css\">" +
" ul.inheritance {\n" +
" margin:0;\n" +
@@ -298,14 +215,14 @@
}
}
}
- while (read != null && !startSection.matcher(StringUtil.toUpperCase(read)).find());
+ while (read != null && matchStart && !startSection.matcher(StringUtil.toUpperCase(read)).find());
if (input instanceof MyReader && contentEncoding != null && !contentEncoding.equalsIgnoreCase(CharsetToolkit.UTF8) &&
!contentEncoding.equals(((MyReader)input).getEncoding())) {
//restart page parsing with correct encoding
try {
data.setLength(0);
- doBuildFromStream(url, new MyReader(((MyReader)input).myInputStream, contentEncoding), data, false);
+ doBuildFromStream(url, new MyReader(((MyReader)input).myInputStream, contentEncoding), data, false, true);
}
catch (ProcessCanceledException e) {
return;
@@ -315,6 +232,14 @@
if (read == null) {
data.setLength(0);
+ if (matchStart && input instanceof MyReader) {
+ try {
+ final MyReader reader = contentEncoding != null ? new MyReader(((MyReader)input).myInputStream, contentEncoding)
+ : new MyReader(((MyReader)input).myInputStream, ((MyReader)input).getEncoding());
+ doBuildFromStream(url, reader, data, false, false);
+ }
+ catch (ProcessCanceledException ignored) {}
+ }
return;
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java
index 4606dbb..bb22d98 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java
@@ -21,6 +21,7 @@
import com.intellij.codeInsight.hint.HintManagerImpl;
import com.intellij.codeInsight.hint.HintUtil;
import com.intellij.icons.AllIcons;
+import com.intellij.ide.BrowserUtil;
import com.intellij.ide.DataManager;
import com.intellij.ide.actions.BaseNavigateToSourceAction;
import com.intellij.ide.actions.ExternalJavaDocAction;
@@ -42,7 +43,6 @@
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.ex.WindowManagerEx;
import com.intellij.pom.Navigatable;
import com.intellij.psi.PsiElement;
@@ -56,7 +56,6 @@
import com.intellij.ui.components.JBScrollPane;
import com.intellij.util.Consumer;
import com.intellij.util.containers.HashMap;
-import com.intellij.util.io.URLUtil;
import com.intellij.util.ui.GraphicsUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
@@ -69,11 +68,9 @@
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import javax.swing.text.*;
-import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;
import java.awt.*;
import java.awt.event.*;
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
import java.util.List;
@@ -96,7 +93,7 @@
private volatile boolean myIsEmpty;
private boolean myIsShown;
private final JLabel myElementLabel;
- private Style myFontSizeStyle;
+ private final MutableAttributeSet myFontSizeStyle = new SimpleAttributeSet();
private JSlider myFontSizeSlider;
private final JComponent mySettingsPanel;
private final MyShowSettingsButton myShowSettingsButton;
@@ -556,38 +553,18 @@
private void setDataInternal(SmartPsiElementPointer element, String text, final Rectangle viewRect, boolean skip) {
setElement(element);
- boolean justShown = false;
- if (!myIsShown && myHint != null) {
- myEditorPane.setText(text);
- applyFontSize();
+ myEditorPane.setText(text);
+ applyFontSize();
+
+ if (!myIsShown && myHint != null && !ApplicationManager.getApplication().isUnitTestMode()) {
myManager.showHint(myHint);
- myIsShown = justShown = true;
- }
-
- if (!justShown) {
- myEditorPane.setText(text);
- applyFontSize();
+ myIsShown = true;
}
if (!skip) {
myText = text;
}
- Document document = myEditorPane.getDocument();
- if (document instanceof HTMLDocument && element != null) {
- // set base URL for this javadoc to resolve relative images correctly
- VirtualFile virtualFile = element.getVirtualFile();
- VirtualFile directory = virtualFile == null ? null : virtualFile.getParent();
- String path = directory == null ? "" : directory.getPath()+"/";
-
- try {
- URL url = new URL(URLUtil.FILE_PROTOCOL, null, path);
- ((HTMLDocument)document).setBase(url);
- }
- catch (MalformedURLException ignored) {
- }
- }
-
//noinspection SSBasedInspection
SwingUtilities.invokeLater(new Runnable() {
@Override
@@ -604,9 +581,6 @@
}
final StyledDocument styledDocument = (StyledDocument)document;
- if (myFontSizeStyle == null) {
- myFontSizeStyle = styledDocument.addStyle("active", null);
- }
EditorColorsManager colorsManager = EditorColorsManager.getInstance();
EditorColorsScheme scheme = colorsManager.getGlobalScheme();
@@ -615,11 +589,10 @@
StyleConstants.setFontFamily(myFontSizeStyle, scheme.getEditorFontName());
}
- final Style sizeStyle = myFontSizeStyle;
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
- styledDocument.setCharacterAttributes(0, styledDocument.getLength(), sizeStyle, false);
+ styledDocument.setCharacterAttributes(0, styledDocument.getLength(), myFontSizeStyle, false);
}
});
}
@@ -724,7 +697,6 @@
}
}
-
private class ExternalDocAction extends AnAction implements HintManagerImpl.ActionToIgnore {
public ExternalDocAction() {
super(CodeInsightBundle.message("javadoc.action.view.external"), null, AllIcons.Actions.Browser_externalJavaDoc);
@@ -750,10 +722,10 @@
if (!processed) {
final Component component = PlatformDataKeys.CONTEXT_COMPONENT.getData(e.getDataContext());
final List<String> urls;
- if (!StringUtil.isEmptyOrSpaces(myEffectiveExternalUrl)) {
+ if (!StringUtil.isEmptyOrSpaces(myEffectiveExternalUrl) && BrowserUtil.canBeBrowsed(myEffectiveExternalUrl)) {
urls = Collections.singletonList(myEffectiveExternalUrl);
} else {
- urls = provider.getUrlFor(element, originalElement);
+ urls = BrowserUtil.retainBrowsableUrls(provider.getUrlFor(element, originalElement));
assert urls != null : provider;
assert !urls.isEmpty() : provider;
}
@@ -774,7 +746,7 @@
presentation.setEnabled(element != null && ((ExternalDocumentationProvider)provider).hasDocumentationFor(element, originalElement));
}
else {
- final List<String> urls = provider.getUrlFor(element, originalElement);
+ List<String> urls = BrowserUtil.retainBrowsableUrls(provider.getUrlFor(element, originalElement));
presentation.setEnabled(element != null && urls != null && !urls.isEmpty());
}
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java
index bddd5ac..20c4ce3 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java
@@ -71,6 +71,7 @@
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
import javax.swing.*;
import java.awt.*;
@@ -101,6 +102,8 @@
private static final int ourFlagsForTargetElements = TargetElementUtilBase.getInstance().getAllAccepted();
private boolean myCloseOnSneeze;
+
+ private ActionCallback myLastAction;
@Override
protected String getToolwindowId() {
@@ -642,7 +645,7 @@
public JBPopup getDocInfoHint() {
if (myDocInfoHintRef == null) return null;
JBPopup hint = myDocInfoHintRef.get();
- if (hint == null || !hint.isVisible()) {
+ if (hint == null || !hint.isVisible() && !ApplicationManager.getApplication().isUnitTestMode()) {
myDocInfoHintRef = null;
return null;
}
@@ -671,6 +674,7 @@
private ActionCallback doFetchDocInfo(final DocumentationComponent component, final DocumentationCollector provider, final boolean cancelRequests, final boolean clearHistory) {
final ActionCallback callback = new ActionCallback();
+ myLastAction = callback;
boolean wasEmpty = component.isEmpty();
component.startWait();
if (cancelRequests) {
@@ -1030,6 +1034,11 @@
}
return null;
}
+
+ @TestOnly
+ public ActionCallback getLastAction() {
+ return myLastAction;
+ }
private interface DocumentationCollector {
@Nullable
@@ -1071,10 +1080,7 @@
public List<String> compute() {
final SmartPsiElementPointer originalElementPtr = myElement.getUserData(ORIGINAL_ELEMENT_KEY);
final PsiElement originalElement = originalElementPtr != null ? originalElementPtr.getElement() : null;
- if (((ExternalDocumentationProvider)provider).hasDocumentationFor(myElement, originalElement)) {
- return provider.getUrlFor(myElement, originalElement);
- }
- return null;
+ return provider.getUrlFor(myElement, originalElement);
}
}
);
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EndHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EndHandler.java
index dd00e26..dce7674 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EndHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EndHandler.java
@@ -41,11 +41,11 @@
}
@Override
- public void execute(final Editor editor, DataContext dataContext) {
+ protected void doExecute(final Editor editor, Caret caret, DataContext dataContext) {
CodeInsightSettings settings = CodeInsightSettings.getInstance();
if (!settings.SMART_END_ACTION) {
if (myOriginalHandler != null) {
- myOriginalHandler.execute(editor, dataContext);
+ myOriginalHandler.execute(editor, caret, dataContext);
}
return;
}
@@ -53,7 +53,7 @@
final Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(editor.getComponent()));
if (project == null) {
if (myOriginalHandler != null) {
- myOriginalHandler.execute(editor, dataContext);
+ myOriginalHandler.execute(editor, caret, dataContext);
}
return;
}
@@ -62,17 +62,15 @@
if (file == null) {
if (myOriginalHandler != null){
- myOriginalHandler.execute(editor, dataContext);
+ myOriginalHandler.execute(editor, caret, dataContext);
}
return;
}
final EditorNavigationDelegate[] extensions = EditorNavigationDelegate.EP_NAME.getExtensions();
- if (extensions != null) {
- for (EditorNavigationDelegate delegate : extensions) {
- if (delegate.navigateToLineEnd(editor, dataContext) == EditorNavigationDelegate.Result.STOP) {
- return;
- }
+ for (EditorNavigationDelegate delegate : extensions) {
+ if (delegate.navigateToLineEnd(editor, dataContext) == EditorNavigationDelegate.Result.STOP) {
+ return;
}
}
@@ -84,7 +82,7 @@
if (caretOffset < length) {
final int offset1 = CharArrayUtil.shiftBackward(chars, caretOffset - 1, " \t");
if (offset1 < 0 || chars.charAt(offset1) == '\n' || chars.charAt(offset1) == '\r') {
- int offset2 = CharArrayUtil.shiftForward(chars, offset1 + 1, " \t");
+ final int offset2 = CharArrayUtil.shiftForward(chars, offset1 + 1, " \t");
boolean isEmptyLine = offset2 >= length || chars.charAt(offset2) == '\n' || chars.charAt(offset2) == '\r';
if (isEmptyLine) {
@@ -108,7 +106,7 @@
return;
}
editor.getSelectionModel().removeSelection();
- EditorModificationUtil.insertStringAtCaret(editor, lineIndent);
+ document.replaceString(offset1 + 1, offset2, lineIndent);
}
}
else {
@@ -136,7 +134,7 @@
}
if (myOriginalHandler != null){
- myOriginalHandler.execute(editor, dataContext);
+ myOriginalHandler.execute(editor, caret, dataContext);
}
}
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EnterHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EnterHandler.java
index 2dec8bd..1c51f79 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EnterHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/EnterHandler.java
@@ -424,7 +424,7 @@
myOffset = codeStyleManager.adjustLineIndent(myFile, myOffset);
psiDocumentManager.commitAllDocuments();
- if (!StringUtil.isEmpty(indentInsideJavadoc) && myOffset < myDocument.getTextLength()) {
+ if (commentContext.docAsterisk && !StringUtil.isEmpty(indentInsideJavadoc) && myOffset < myDocument.getTextLength()) {
myDocument.insertString(myOffset + 1, indentInsideJavadoc);
myOffset += indentInsideJavadoc.length();
docIndentApplied = true;
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/moveUpDown/MoverWrapper.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/moveUpDown/MoverWrapper.java
index fd4c45a..dfd7d21 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/moveUpDown/MoverWrapper.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/moveUpDown/MoverWrapper.java
@@ -18,6 +18,7 @@
import com.intellij.codeInsight.folding.CodeFoldingManager;
import com.intellij.openapi.editor.*;
+import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
@@ -206,6 +207,6 @@
final int selectionRelativeOffset = selectionStart - moveOffset;
int newSelectionStart = insOffset + selectionRelativeOffset;
int newSelectionEnd = newSelectionStart + selectionEnd - selectionStart;
- editor.getSelectionModel().setSelection(newSelectionStart, newSelectionEnd);
+ EditorUtil.setSelectionExpandingFoldedRegionsIfNeeded(editor, newSelectionStart, newSelectionEnd);
}
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightUsagesHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightUsagesHandler.java
index bdb8bf1..e5517f4 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightUsagesHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightUsagesHandler.java
@@ -38,6 +38,7 @@
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.keymap.KeymapUtil;
+import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
@@ -61,10 +62,10 @@
public class HighlightUsagesHandler extends HighlightHandlerBase {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.highlighting.HighlightUsagesHandler");
- public static void invoke(@NotNull Project project, @NotNull Editor editor, PsiFile file) {
+ public static void invoke(@NotNull final Project project, @NotNull final Editor editor, final PsiFile file) {
PsiDocumentManager.getInstance(project).commitAllDocuments();
- SelectionModel selectionModel = editor.getSelectionModel();
+ final SelectionModel selectionModel = editor.getSelectionModel();
if (file == null && !selectionModel.hasSelection()) {
selectionModel.selectWordAtCaret(false);
}
@@ -85,6 +86,25 @@
return;
}
+ DumbService.getInstance(project).withAlternativeResolveEnabled(new Runnable() {
+ @Override
+ public void run() {
+ UsageTarget[] usageTargets = getUsageTargets(editor, file);
+ if (usageTargets == null) {
+ handleNoUsageTargets(file, editor, selectionModel, project);
+ return;
+ }
+
+ boolean clearHighlights = isClearHighlights(editor);
+ for (UsageTarget target : usageTargets) {
+ target.highlightUsages(file, editor, clearHighlights);
+ }
+ }
+ });
+ }
+
+ @Nullable
+ private static UsageTarget[] getUsageTargets(@NotNull Editor editor, PsiFile file) {
UsageTarget[] usageTargets = UsageTargetUtil.findUsageTargets(editor, file);
if (usageTargets == null) {
@@ -116,28 +136,25 @@
}
}
}
+ return usageTargets;
+ }
- if (usageTargets == null) {
- if (file.findElementAt(editor.getCaretModel().getOffset()) instanceof PsiWhiteSpace) return;
- selectionModel.selectWordAtCaret(false);
- String selection = selectionModel.getSelectedText();
- LOG.assertTrue(selection != null);
- for (int i = 0; i < selection.length(); i++) {
- if (!Character.isJavaIdentifierPart(selection.charAt(i))) {
- selectionModel.removeSelection();
- return;
- }
+ private static void handleNoUsageTargets(PsiFile file,
+ @NotNull Editor editor,
+ SelectionModel selectionModel,
+ @NotNull Project project) {
+ if (file.findElementAt(editor.getCaretModel().getOffset()) instanceof PsiWhiteSpace) return;
+ selectionModel.selectWordAtCaret(false);
+ String selection = selectionModel.getSelectedText();
+ LOG.assertTrue(selection != null);
+ for (int i = 0; i < selection.length(); i++) {
+ if (!Character.isJavaIdentifierPart(selection.charAt(i))) {
+ selectionModel.removeSelection();
}
-
- doRangeHighlighting(editor, project);
- selectionModel.removeSelection();
- return;
}
- boolean clearHighlights = isClearHighlights(editor);
- for (UsageTarget target : usageTargets) {
- target.highlightUsages(file, editor, clearHighlights);
- }
+ doRangeHighlighting(editor, project);
+ selectionModel.removeSelection();
}
@Nullable
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/ShowImplementationsAction.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/ShowImplementationsAction.java
index 29aacc3..c7232ed 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/ShowImplementationsAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/ShowImplementationsAction.java
@@ -148,6 +148,11 @@
}
}
+ //check attached sources if any
+ if (element instanceof PsiCompiledElement) {
+ element = element.getNavigationElement();
+ }
+
String text = "";
PsiElement[] impls = new PsiElement[0];
if (element != null) {
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoSuperAction.java b/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoSuperAction.java
index fc0e0cd..6439d4f 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoSuperAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoSuperAction.java
@@ -23,6 +23,7 @@
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
@@ -41,7 +42,7 @@
}
@Override
- public void invoke(@NotNull final Project project, @NotNull Editor editor, @NotNull PsiFile file) {
+ public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) {
PsiDocumentManager.getInstance(project).commitAllDocuments();
int offset = editor.getCaretModel().getOffset();
@@ -49,7 +50,12 @@
final CodeInsightActionHandler codeInsightActionHandler = CodeInsightActions.GOTO_SUPER.forLanguage(language);
if (codeInsightActionHandler != null) {
- codeInsightActionHandler.invoke(project, editor, file);
+ DumbService.getInstance(project).withAlternativeResolveEnabled(new Runnable() {
+ @Override
+ public void run() {
+ codeInsightActionHandler.invoke(project, editor, file);
+ }
+ });
}
}
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java b/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java
index 264c5c6..62bda6e 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java
@@ -41,6 +41,10 @@
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiManager;
+import com.intellij.psi.search.GlobalSearchScopes;
+import com.intellij.psi.search.GlobalSearchScopesCore;
+import com.intellij.psi.search.scope.packageSet.NamedScope;
+import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
import com.thoughtworks.xstream.io.xml.PrettyPrintWriter;
import org.jdom.JDOMException;
import org.jetbrains.annotations.NonNls;
@@ -165,7 +169,10 @@
final AnalysisScope scope;
if (mySourceDirectory == null) {
- scope = new AnalysisScope(myProject);
+ final String scopeName = System.getProperty("idea.analyze.scope");
+ final NamedScope namedScope = scopeName != null ? NamedScopesHolder.getScope(myProject, scopeName) : null;
+ scope = namedScope != null ? new AnalysisScope(GlobalSearchScopesCore.filterScope(myProject, namedScope), myProject)
+ : new AnalysisScope(myProject);
}
else {
mySourceDirectory = mySourceDirectory.replace(File.separatorChar, '/');
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionRVContentProvider.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionRVContentProvider.java
index 001930c..24b7b44 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionRVContentProvider.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionRVContentProvider.java
@@ -21,6 +21,7 @@
package com.intellij.codeInspection.ex;
import com.intellij.codeInspection.CommonProblemDescriptor;
+import com.intellij.codeInspection.QuickFix;
import com.intellij.codeInspection.offlineViewer.OfflineInspectionRVContentProvider;
import com.intellij.codeInspection.reference.RefEntity;
import com.intellij.codeInspection.ui.*;
@@ -38,6 +39,7 @@
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.MutableTreeNode;
import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
import java.util.*;
public abstract class InspectionRVContentProvider {
@@ -68,6 +70,28 @@
public abstract boolean checkReportedProblems(@NotNull GlobalInspectionContextImpl context, @NotNull InspectionToolWrapper toolWrapper);
+ public boolean hasQuickFixes(InspectionTree tree) {
+ final TreePath[] treePaths = tree.getSelectionPaths();
+ if (treePaths == null) return false;
+ for (TreePath selectionPath : treePaths) {
+ if (!TreeUtil.traverseDepth((TreeNode)selectionPath.getLastPathComponent(), new TreeUtil.Traverse() {
+ @Override
+ public boolean accept(final Object node) {
+ if (!((InspectionTreeNode)node).isValid()) return true;
+ if (node instanceof ProblemDescriptionNode) {
+ final CommonProblemDescriptor descriptor = ((ProblemDescriptionNode)node).getDescriptor();
+ final QuickFix[] fixes = descriptor != null ? descriptor.getFixes() : null;
+ return fixes == null || fixes.length == 0;
+ }
+ return true;
+ }
+ })) {
+ return true;
+ }
+ }
+ return false;
+ }
+
@Nullable
public abstract QuickFixAction[] getQuickFixes(@NotNull InspectionToolWrapper toolWrapper, @NotNull InspectionTree tree);
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/QuickFixAction.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/QuickFixAction.java
index b9aa7ec..2be41ef 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/ex/QuickFixAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/QuickFixAction.java
@@ -53,6 +53,7 @@
* @author max
*/
public class QuickFixAction extends AnAction {
+ public static final QuickFixAction[] EMPTY = new QuickFixAction[0];
protected final InspectionToolWrapper myToolWrapper;
public static InspectionResultsView getInvoker(AnActionEvent e) {
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/offlineViewer/OfflineInspectionRVContentProvider.java b/platform/lang-impl/src/com/intellij/codeInspection/offlineViewer/OfflineInspectionRVContentProvider.java
index 70707de..f9ee787 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/offlineViewer/OfflineInspectionRVContentProvider.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/offlineViewer/OfflineInspectionRVContentProvider.java
@@ -62,6 +62,7 @@
@Nullable
public QuickFixAction[] getQuickFixes(@NotNull final InspectionToolWrapper toolWrapper, @NotNull final InspectionTree tree) {
final TreePath[] treePaths = tree.getSelectionPaths();
+ if (treePaths == null) return QuickFixAction.EMPTY;
final List<RefEntity> selectedElements = new ArrayList<RefEntity>();
final Map<RefEntity, Set<QuickFix>> actions = new HashMap<RefEntity, Set<QuickFix>>();
for (TreePath selectionPath : treePaths) {
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/DefaultInspectionToolPresentation.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/DefaultInspectionToolPresentation.java
index 66fcefa..ff70607 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/ui/DefaultInspectionToolPresentation.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/DefaultInspectionToolPresentation.java
@@ -62,7 +62,7 @@
@NotNull
private final GlobalInspectionContextImpl myContext;
protected static String ourOutputPath;
- protected InspectionNode myToolNode;
+ private InspectionNode myToolNode;
private static final Object lock = new Object();
private final Map<RefEntity, CommonProblemDescriptor[]> myProblemElements = Collections.synchronizedMap(new THashMap<RefEntity, CommonProblemDescriptor[]>());
@@ -77,6 +77,8 @@
protected static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ex.DescriptorProviderInspection");
private boolean isDisposed;
+ private final Object myToolLock = new Object();
+
public DefaultInspectionToolPresentation(@NotNull InspectionToolWrapper toolWrapper, @NotNull GlobalInspectionContextImpl context) {
myToolWrapper = toolWrapper;
myContext = context;
@@ -226,14 +228,16 @@
return;
}
final InspectionNode toolNode;
- if (myToolNode == null) {
- final HighlightSeverity currentSeverity = getSeverity((RefElement)refElement);
- toolNode = view.addTool(myToolWrapper, HighlightDisplayLevel.find(currentSeverity), context.getUIOptions().GROUP_BY_SEVERITY);
- }
- else {
- toolNode = myToolNode;
- if (toolNode.isTooBigForOnlineRefresh()) {
- return;
+ synchronized (myToolLock) {
+ if (myToolNode == null) {
+ final HighlightSeverity currentSeverity = getSeverity((RefElement)refElement);
+ toolNode = view.addTool(myToolWrapper, HighlightDisplayLevel.find(currentSeverity), context.getUIOptions().GROUP_BY_SEVERITY);
+ }
+ else {
+ toolNode = myToolNode;
+ if (toolNode.isTooBigForOnlineRefresh()) {
+ return;
+ }
}
}
final Map<RefEntity, CommonProblemDescriptor[]> problems = new HashMap<RefEntity, CommonProblemDescriptor[]>();
@@ -262,6 +266,13 @@
}
}
+
+ public void setToolNode(InspectionNode toolNode) {
+ synchronized (myToolLock) {
+ myToolNode = toolNode;
+ }
+ }
+
protected boolean isDisposed() {
return isDisposed;
}
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java
index 85e6604..268e48a 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java
@@ -469,7 +469,7 @@
myProvider.appendToolNodeContent(myGlobalInspectionContext, toolNode, parentNode, showStructure);
InspectionToolPresentation presentation = myGlobalInspectionContext.getPresentation(toolWrapper);
toolNode = presentation.createToolNode(myGlobalInspectionContext, toolNode, myProvider, parentNode, showStructure);
- ((DefaultInspectionToolPresentation)presentation).myToolNode = toolNode;
+ ((DefaultInspectionToolPresentation)presentation).setToolNode(toolNode);
registerActionShortcuts(presentation);
return toolNode;
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/InvokeQuickFixAction.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/InvokeQuickFixAction.java
index f21b42e..21b9ae0 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/InvokeQuickFixAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/InvokeQuickFixAction.java
@@ -49,21 +49,14 @@
@Override
public void update(AnActionEvent e) {
- if (!myView.isSingleToolInSelection()) {
- e.getPresentation().setEnabled(false);
- return;
- }
-
- //noinspection ConstantConditions
- @NotNull InspectionToolWrapper toolWrapper = myView.getTree().getSelectedToolWrapper();
+ final Presentation presentation = e.getPresentation();
+ InspectionToolWrapper toolWrapper = myView.getTree().getSelectedToolWrapper();
final InspectionRVContentProvider provider = myView.getProvider();
- if (provider.isContentLoaded()) {
- final QuickFixAction[] quickFixes = provider.getQuickFixes(toolWrapper, myView.getTree());
- if (quickFixes == null || quickFixes.length == 0) {
- e.getPresentation().setEnabled(false);
- return;
- }
- e.getPresentation().setEnabled(!ActionGroupUtil.isGroupEmpty(getFixes(quickFixes), e));
+ if (toolWrapper != null && provider.isContentLoaded()) {
+ presentation.setEnabled(provider.hasQuickFixes(myView.getTree()));
+ }
+ else {
+ presentation.setEnabled(false);
}
}
diff --git a/platform/lang-impl/src/com/intellij/execution/RunContentExecutor.java b/platform/lang-impl/src/com/intellij/execution/RunContentExecutor.java
index 525c5a6..6738cb6 100644
--- a/platform/lang-impl/src/com/intellij/execution/RunContentExecutor.java
+++ b/platform/lang-impl/src/com/intellij/execution/RunContentExecutor.java
@@ -174,6 +174,7 @@
@Override
public void update(AnActionEvent e) {
e.getPresentation().setVisible(myRerunAction != null);
+ e.getPresentation().setEnabled(myRerunAction != null);
}
}
diff --git a/platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java b/platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java
index 186aa88..c5d443f 100644
--- a/platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java
+++ b/platform/lang-impl/src/com/intellij/execution/configuration/EnvironmentVariablesTextFieldWithBrowseButton.java
@@ -43,6 +43,7 @@
public class EnvironmentVariablesTextFieldWithBrowseButton extends TextFieldWithBrowseButton implements UserActivityProviderComponent {
+ // immutable map instance with reliable user-specified iteration order
private Map<String, String> myEnvs = Collections.emptyMap();
private boolean myPassParentEnvs;
private final List<ChangeListener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList();
@@ -63,7 +64,7 @@
*/
@NotNull
public Map<String, String> getEnvs() {
- return Collections.unmodifiableMap(myEnvs);
+ return myEnvs;
}
/**
diff --git a/platform/lang-impl/src/com/intellij/execution/console/ConsoleHistoryController.java b/platform/lang-impl/src/com/intellij/execution/console/ConsoleHistoryController.java
index 4b12e9a..0a59778 100644
--- a/platform/lang-impl/src/com/intellij/execution/console/ConsoleHistoryController.java
+++ b/platform/lang-impl/src/com/intellij/execution/console/ConsoleHistoryController.java
@@ -513,7 +513,7 @@
OutputStream os = null;
try {
os = new SafeFileOutputStream(file);
- XmlSerializer serializer = XmlPullParserFactory.newInstance().newSerializer();
+ XmlSerializer serializer = XmlPullParserFactory.newInstance("org.xmlpull.mxp1.MXParserFactory", null).newSerializer();
try {
serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-indentation", " ");
}
diff --git a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java
index 23366fb..0a87853 100644
--- a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java
@@ -466,7 +466,11 @@
@Nullable
@Override
public Object getData(@NonNls String dataId) {
- if (OpenFileDescriptor.NAVIGATE_IN_EDITOR.is(dataId)) {
+ Object data = super.getData(dataId);
+ if (data != null) {
+ return data;
+ }
+ else if (OpenFileDescriptor.NAVIGATE_IN_EDITOR.is(dataId)) {
return myConsoleEditor;
}
else if (getProject().isInitialized()) {
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java
index 6f9dc08..aa2524c 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java
@@ -100,10 +100,14 @@
public static final Key<ConsoleViewImpl> CONSOLE_VIEW_IN_EDITOR_VIEW = Key.create("CONSOLE_VIEW_IN_EDITOR_VIEW");
- static {
+ private static boolean ourTypedHandlerInitialized;
+
+ private static synchronized void initTypedHandler() {
+ if (ourTypedHandlerInitialized) return;
final EditorActionManager actionManager = EditorActionManager.getInstance();
final TypedAction typedAction = actionManager.getTypedAction();
typedAction.setupHandler(new MyTypedHandler(typedAction.getHandler()));
+ ourTypedHandlerInitialized = true;
}
@@ -281,6 +285,7 @@
boolean usePredefinedMessageFilter)
{
super(new BorderLayout());
+ initTypedHandler();
myIsViewer = viewer;
myState = initialState;
myPsiDisposedCheck = new DisposedPsiManagerCheck(project);
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java
index 6e2e638..b8b8a27 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java
@@ -52,6 +52,7 @@
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
import javax.swing.*;
import java.util.Collections;
@@ -59,6 +60,7 @@
public class ExecutionManagerImpl extends ExecutionManager implements Disposable {
public static final Key<Object> EXECUTION_SESSION_ID_KEY = Key.create("EXECUTION_SESSION_ID_KEY");
+ public static final Key<Boolean> EXECUTION_SKIP_RUN = Key.create("EXECUTION_SKIP_RUN");
private static final Logger LOG = Logger.getInstance(ExecutionManagerImpl.class);
private static final ProcessHandler[] EMPTY_PROCESS_HANDLERS = new ProcessHandler[0];
@@ -69,8 +71,9 @@
private final Alarm awaitingTerminationAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
private final List<Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor>> myRunningConfigurations =
ContainerUtil.createLockFreeCopyOnWriteList();
+ private volatile boolean myForceCompilationInTests;
- ExecutionManagerImpl(@NotNull Project project) {
+ protected ExecutionManagerImpl(@NotNull Project project) {
myProject = project;
}
@@ -159,16 +162,29 @@
return;
}
}
- // important! Do not use DumbService.smartInvokeLater here because it depends on modality state
- // and execution of startRunnable could be skipped if modality state check fails
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- if (!myProject.isDisposed()) {
- DumbService.getInstance(myProject).runWhenSmart(startRunnable);
- }
- }
- });
+
+ doRun(environment, startRunnable);
+ }
+ });
+ }
+ }
+
+ protected void doRun(@NotNull final ExecutionEnvironment environment, @NotNull final Runnable startRunnable) {
+ Boolean allowSkipRun = environment.getUserData(EXECUTION_SKIP_RUN);
+ if (allowSkipRun != null && allowSkipRun) {
+ environment.getProject().getMessageBus().syncPublisher(EXECUTION_TOPIC).processNotStarted(environment.getExecutor().getId(),
+ environment);
+ }
+ else {
+ // important! Do not use DumbService.smartInvokeLater here because it depends on modality state
+ // and execution of startRunnable could be skipped if modality state check fails
+ //noinspection SSBasedInspection
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ if (!myProject.isDisposed()) {
+ DumbService.getInstance(myProject).runWhenSmart(startRunnable);
+ }
}
});
}
@@ -236,7 +252,7 @@
}
};
- if (ApplicationManager.getApplication().isUnitTestMode()) {
+ if (ApplicationManager.getApplication().isUnitTestMode() && !myForceCompilationInTests) {
startRunnable.run();
}
else {
@@ -370,6 +386,11 @@
}, 50);
}
+ @TestOnly
+ public void setForceCompilationInTests(boolean forceCompilationInTests) {
+ myForceCompilationInTests = forceCompilationInTests;
+ }
+
private static void start(@NotNull ExecutionEnvironment environment) {
RunnerAndConfigurationSettings settings = environment.getRunnerAndConfigurationSettings();
ProgramRunnerUtil.executeConfiguration(environment, settings != null && settings.isEditBeforeRun(), true);
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurationBeforeRunProvider.java b/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurationBeforeRunProvider.java
index 6c9b951..469e194 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurationBeforeRunProvider.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurationBeforeRunProvider.java
@@ -31,6 +31,7 @@
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.Disposer;
@@ -183,9 +184,9 @@
if (builder == null) {
return false;
}
- final ExecutionEnvironment environment = builder.build();
+ final ExecutionEnvironment environment = builder.target(env.getExecutionTarget()).build();
environment.setExecutionId(env.getExecutionId());
- if (!ExecutionTargetManager.canRun(settings, env.getExecutionTarget())) {
+ if (!ExecutionTargetManager.canRun(settings, environment.getExecutionTarget())) {
return false;
}
@@ -193,6 +194,8 @@
return false;
}
else {
+ beforeRun(environment);
+
final Semaphore targetDone = new Semaphore();
final Ref<Boolean> result = new Ref<Boolean>(false);
final Disposable disposable = Disposer.newDisposable();
@@ -208,6 +211,10 @@
@Override
public void processNotStarted(final String executorIdLocal, @NotNull final ExecutionEnvironment environmentLocal) {
if (executorId.equals(executorIdLocal) && environment.equals(environmentLocal)) {
+ Boolean skipRun = environment.getUserData(ExecutionManagerImpl.EXECUTION_SKIP_RUN);
+ if (skipRun != null && skipRun) {
+ result.set(true);
+ }
targetDone.up();
}
}
@@ -255,7 +262,13 @@
}
}
- class RunConfigurableBeforeRunTask extends BeforeRunTask<RunConfigurableBeforeRunTask> {
+ private static void beforeRun(@NotNull ExecutionEnvironment environment) {
+ for (RunConfigurationBeforeRunProviderDelegate delegate : Extensions.getExtensions(RunConfigurationBeforeRunProviderDelegate.EP_NAME)) {
+ delegate.beforeRun(environment);
+ }
+ }
+
+ public class RunConfigurableBeforeRunTask extends BeforeRunTask<RunConfigurableBeforeRunTask> {
private String myConfigurationName;
private String myConfigurationType;
private boolean myInitialized = false;
@@ -305,7 +318,7 @@
}
}
- void setSettings(RunnerAndConfigurationSettings settings) {
+ public void setSettings(RunnerAndConfigurationSettings settings) {
mySettings = settings;
myInitialized = true;
}
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurationBeforeRunProviderDelegate.java b/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurationBeforeRunProviderDelegate.java
new file mode 100644
index 0000000..a9b3c58
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurationBeforeRunProviderDelegate.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2000-2015 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 com.intellij.execution.impl;
+
+import com.intellij.execution.runners.ExecutionEnvironment;
+import com.intellij.openapi.extensions.ExtensionPointName;
+import org.jetbrains.annotations.NotNull;
+
+public interface RunConfigurationBeforeRunProviderDelegate {
+ ExtensionPointName<RunConfigurationBeforeRunProviderDelegate> EP_NAME = ExtensionPointName.create("com.intellij.runConfigurationBeforeRunProviderDelegate");
+
+ void beforeRun(@NotNull ExecutionEnvironment environment);
+}
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java
index 82d3423..504bfb3 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java
@@ -25,6 +25,7 @@
import com.intellij.openapi.components.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
+import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModuleRootAdapter;
import com.intellij.openapi.roots.ModuleRootEvent;
@@ -705,6 +706,9 @@
try {
configurationSettings = loadConfiguration(element, false);
}
+ catch (ProcessCanceledException e) {
+ configurationSettings = null;
+ }
catch (Throwable e) {
LOG.error(e);
continue;
diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/JBRunnerTabs.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/JBRunnerTabs.java
index d876a11..6393bd7 100644
--- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/JBRunnerTabs.java
+++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/JBRunnerTabs.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2015 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.
diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java
index f1e84a3..109ff6f 100644
--- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java
+++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java
@@ -145,7 +145,7 @@
private Image myCurrentOverImg;
private TabInfo myCurrentOverInfo;
private MyDropAreaPainter myCurrentPainter;
-
+
private RunnerContentUi myOriginal;
private final CopyOnWriteArraySet<Listener> myDockingListeners = new CopyOnWriteArraySet<Listener>();
private final Set<RunnerContentUi> myChildren = new TreeSet<RunnerContentUi>(new Comparator<RunnerContentUi>() {
@@ -588,10 +588,10 @@
// 1/3 (left) | (center/bottom) | 1/3 (right)
if (point.x < size.width / 3) return PlaceInGrid.left;
if (point.x > size.width * 2 / 3) return PlaceInGrid.right;
-
+
// 3/4 (center with tab titles) | 1/4 (bottom)
if (point.y > size.height * 3 / 4) return PlaceInGrid.bottom;
-
+
return PlaceInGrid.center;
}
diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayoutUiFactoryImpl.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayoutUiFactoryImpl.java
index 313f723..5891f3d 100644
--- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayoutUiFactoryImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayoutUiFactoryImpl.java
@@ -16,6 +16,7 @@
package com.intellij.execution.ui.layout.impl;
+import com.intellij.execution.ExecutionManager;
import com.intellij.execution.ui.RunnerLayoutUi;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.project.Project;
@@ -24,8 +25,9 @@
public class RunnerLayoutUiFactoryImpl extends RunnerLayoutUi.Factory {
private final Project myProject;
- public RunnerLayoutUiFactoryImpl(Project project) {
+ public RunnerLayoutUiFactoryImpl(Project project, ExecutionManager executionManager) {
myProject = project;
+ executionManager.getContentManager(); // ensure dockFactory is registered
}
@NotNull
diff --git a/platform/lang-impl/src/com/intellij/facet/FacetManagerImpl.java b/platform/lang-impl/src/com/intellij/facet/FacetManagerImpl.java
index cd2cf53..6d909a4 100644
--- a/platform/lang-impl/src/com/intellij/facet/FacetManagerImpl.java
+++ b/platform/lang-impl/src/com/intellij/facet/FacetManagerImpl.java
@@ -238,7 +238,7 @@
FacetLoadingErrorDescription description = new FacetLoadingErrorDescription(facet);
ProjectLoadingErrorsNotifier.getInstance(myModule.getProject()).registerError(description);
if (typeId != null) {
- UnknownFeaturesCollector.getInstance(myModule.getProject()).registerUnknownFeature("com.intellij.facetType", typeId);
+ UnknownFeaturesCollector.getInstance(myModule.getProject()).registerUnknownFeature("com.intellij.facetType", typeId, "Facet");
}
}
}
diff --git a/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java b/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java
index cabb8f3..7290a1b 100644
--- a/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java
+++ b/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java
@@ -230,7 +230,7 @@
final FindResult cursor = mySearchResults.getCursor();
Editor editor = mySearchResults.getEditor();
- if (cursor != null) {
+ if (cursor != null && cursor.getEndOffset() <= editor.getDocument().getTextLength()) {
Set<RangeHighlighter> dummy = new HashSet<RangeHighlighter>();
Color color = editor.getColorsScheme().getColor(EditorColors.CARET_COLOR);
highlightRange(cursor, new TextAttributes(null, null, color, EffectType.ROUNDED_BOX, 0), dummy);
@@ -338,6 +338,7 @@
final HashSet<RangeHighlighter> toRemove = new HashSet<RangeHighlighter>();
Set<RangeHighlighter> toAdd = new HashSet<RangeHighlighter>();
for (RangeHighlighter highlighter : myHighlighters) {
+ if (!highlighter.isValid()) continue;
boolean intersectsWithSelection = false;
for (int i = 0; i < starts.length; ++i) {
TextRange selectionRange = new TextRange(starts[i], ends[i]);
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/CopyReferenceAction.java b/platform/lang-impl/src/com/intellij/ide/actions/CopyReferenceAction.java
index dd6f0e8..0f42870 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/CopyReferenceAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/CopyReferenceAction.java
@@ -33,6 +33,7 @@
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.ide.CopyPasteManager;
import com.intellij.openapi.project.DumbAwareAction;
+import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.io.FileUtil;
@@ -260,9 +261,15 @@
@Nullable
private static String getQualifiedNameFromProviders(@Nullable PsiElement element) {
if (element == null) return null;
- for (QualifiedNameProvider provider : Extensions.getExtensions(QualifiedNameProvider.EP_NAME)) {
- String result = provider.getQualifiedName(element);
- if (result != null) return result;
+ DumbService.getInstance(element.getProject()).setAlternativeResolveEnabled(true);
+ try {
+ for (QualifiedNameProvider provider : Extensions.getExtensions(QualifiedNameProvider.EP_NAME)) {
+ String result = provider.getQualifiedName(element);
+ if (result != null) return result;
+ }
+ }
+ finally {
+ DumbService.getInstance(element.getProject()).setAlternativeResolveEnabled(false);
}
return null;
}
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/ExternalJavaDocAction.java b/platform/lang-impl/src/com/intellij/ide/actions/ExternalJavaDocAction.java
index 50525bc..2e3325b 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/ExternalJavaDocAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/ExternalJavaDocAction.java
@@ -78,7 +78,7 @@
return;
}
- final List<String> urls = provider.getUrlFor(element, originalElement);
+ final List<String> urls = BrowserUtil.retainBrowsableUrls(provider.getUrlFor(element, originalElement));
if (urls != null && !urls.isEmpty()) {
showExternalJavadoc(urls, PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext));
}
@@ -126,7 +126,7 @@
enabled = edProvider.hasDocumentationFor(element, originalElement) || edProvider.canPromptToConfigureDocumentation(element);
}
else {
- final List<String> urls = provider.getUrlFor(element, originalElement);
+ final List<String> urls = BrowserUtil.retainBrowsableUrls(provider.getUrlFor(element, originalElement));
enabled = urls != null && !urls.isEmpty();
}
if (editor != null) {
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SelectInAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SelectInAction.java
index 55d5321..ed9d69b 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/SelectInAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/SelectInAction.java
@@ -20,6 +20,7 @@
import com.intellij.ide.*;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.ListPopup;
@@ -120,6 +121,9 @@
@Override
public boolean isSelectable(final SelectInTarget target) {
+ if (DumbService.isDumb(mySelectInContext.getProject()) && !DumbService.isDumbAware(target)) {
+ return false;
+ }
return target.canSelect(mySelectInContext);
}
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewDropTarget.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewDropTarget.java
index 369301a..413de4b 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewDropTarget.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewDropTarget.java
@@ -24,7 +24,9 @@
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
@@ -307,6 +309,12 @@
private void doDrop(TreeNode targetNode, PsiElement[] sourceElements, final boolean externalDrop) {
final PsiElement targetElement = getPsiElement(targetNode);
if (targetElement == null) return;
+
+ if (DumbService.isDumb(myProject)) {
+ Messages.showMessageDialog(myProject, "Move refactoring is not available while indexing is in progress", "Indexing", null);
+ return;
+ }
+
final Module module = getModule(targetNode);
final DataContext dataContext = DataManager.getInstance().getDataContext(myTree);
getActionHandler().invoke(myProject, sourceElements, new DataContext() {
diff --git a/platform/lang-impl/src/com/intellij/ide/todo/ChangeListTodosPanel.java b/platform/lang-impl/src/com/intellij/ide/todo/ChangeListTodosPanel.java
index 2a6c396..583c1ee 100644
--- a/platform/lang-impl/src/com/intellij/ide/todo/ChangeListTodosPanel.java
+++ b/platform/lang-impl/src/com/intellij/ide/todo/ChangeListTodosPanel.java
@@ -48,7 +48,7 @@
ChangeListManager.getInstance(myProject).removeChangeListListener(myChangeListManagerListener);
}
});
- myAlarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD, project);
+ myAlarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, project);
}
private final class MyChangeListManagerListener extends ChangeListAdapter {
diff --git a/platform/lang-impl/src/com/intellij/ide/todo/ScopeBasedTodosPanel.java b/platform/lang-impl/src/com/intellij/ide/todo/ScopeBasedTodosPanel.java
index 0570821..f2222dd 100644
--- a/platform/lang-impl/src/com/intellij/ide/todo/ScopeBasedTodosPanel.java
+++ b/platform/lang-impl/src/com/intellij/ide/todo/ScopeBasedTodosPanel.java
@@ -49,7 +49,7 @@
public ScopeBasedTodosPanel(final Project project, TodoPanelSettings settings, Content content){
super(project,settings,false,content);
- myAlarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD, project);
+ myAlarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, project);
myScopes.getChildComponent().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
diff --git a/platform/lang-impl/src/com/intellij/ide/todo/TodoPanel.java b/platform/lang-impl/src/com/intellij/ide/todo/TodoPanel.java
index 6b01cf3..bfcc182 100644
--- a/platform/lang-impl/src/com/intellij/ide/todo/TodoPanel.java
+++ b/platform/lang-impl/src/com/intellij/ide/todo/TodoPanel.java
@@ -66,7 +66,9 @@
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
abstract class TodoPanel extends SimpleToolWindowPanel implements OccurenceNavigator, DataProvider, Disposable {
protected static final Logger LOG = Logger.getInstance(TodoPanel.class);
@@ -424,11 +426,18 @@
alarm.addRequest(new Runnable() {
@Override
public void run() {
+ final Set<VirtualFile> files = new HashSet<VirtualFile>();
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
try {
- myTodoTreeBuilder.rebuildCache();
+ myTodoTreeBuilder.collectFiles(new Processor<VirtualFile>() {
+ @Override
+ public boolean process(VirtualFile virtualFile) {
+ files.add(virtualFile);
+ return true;
+ }
+ });
}
catch (IndexNotReadyException ignore) {
}
@@ -437,6 +446,7 @@
final Runnable runnable = new Runnable() {
@Override
public void run() {
+ myTodoTreeBuilder.rebuildCache(files);
updateTree();
}
};
diff --git a/platform/lang-impl/src/com/intellij/ide/todo/TodoToolWindowFactory.java b/platform/lang-impl/src/com/intellij/ide/todo/TodoToolWindowFactory.java
index e53271f..8a7ebd4 100644
--- a/platform/lang-impl/src/com/intellij/ide/todo/TodoToolWindowFactory.java
+++ b/platform/lang-impl/src/com/intellij/ide/todo/TodoToolWindowFactory.java
@@ -17,6 +17,7 @@
package com.intellij.ide.todo;
import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
@@ -27,7 +28,12 @@
*/
public class TodoToolWindowFactory implements ToolWindowFactory {
@Override
- public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
- ServiceManager.getService(project, TodoView.class).initToolWindow(toolWindow);
+ public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {
+ DumbService.getInstance(project).runWhenSmart(new Runnable() {
+ @Override
+ public void run() {
+ ServiceManager.getService(project, TodoView.class).initToolWindow(toolWindow);
+ }
+ });
}
}
diff --git a/platform/lang-impl/src/com/intellij/ide/todo/TodoTreeBuilder.java b/platform/lang-impl/src/com/intellij/ide/todo/TodoTreeBuilder.java
index 7b7e1da..5f52f5d 100644
--- a/platform/lang-impl/src/com/intellij/ide/todo/TodoTreeBuilder.java
+++ b/platform/lang-impl/src/com/intellij/ide/todo/TodoTreeBuilder.java
@@ -45,6 +45,7 @@
import com.intellij.psi.search.PsiTodoSearchHelper;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.usageView.UsageTreeColorsScheme;
+import com.intellij.util.Processor;
import com.intellij.util.containers.HashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -361,15 +362,36 @@
myDirtyFileSet.clear();
myFile2Highlighter.clear();
+ collectFiles(new Processor<VirtualFile>() {
+ @Override
+ public boolean process(VirtualFile virtualFile) {
+ myFileTree.add(virtualFile);
+ return true;
+ }
+ });
+ getTodoTreeStructure().validateCache();
+ }
+
+ void collectFiles(Processor<VirtualFile> collector) {
TodoTreeStructure treeStructure=getTodoTreeStructure();
PsiFile[] psiFiles= mySearchHelper.findFilesWithTodoItems();
for (PsiFile psiFile : psiFiles) {
if (mySearchHelper.getTodoItemsCount(psiFile) > 0 && treeStructure.accept(psiFile)) {
- myFileTree.add(psiFile.getVirtualFile());
+ collector.process(psiFile.getVirtualFile());
}
}
+ }
- treeStructure.validateCache();
+ void rebuildCache(Set<VirtualFile> files){
+ myFileTree.clear();
+ myDirtyFileSet.clear();
+ myFile2Highlighter.clear();
+
+ for (VirtualFile virtualFile : files) {
+ myFileTree.add(virtualFile);
+ }
+
+ getTodoTreeStructure().validateCache();
}
private void validateCache() {
diff --git a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ProjectSettingsStepBase.java b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ProjectSettingsStepBase.java
index 9d3d09b..f9e8f919 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ProjectSettingsStepBase.java
+++ b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ProjectSettingsStepBase.java
@@ -265,7 +265,7 @@
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
myLocationField.addBrowseFolderListener("Select base directory", "Select base directory for the Project",
null, descriptor);
- return LabeledComponent.create(myLocationField, "Location");
+ return LabeledComponent.create(myLocationField, "&Location");
}
private static File findSequentNonExistingUntitled() {
diff --git a/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/AbstractGithubTagDownloadedProjectGenerator.java b/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/AbstractGithubTagDownloadedProjectGenerator.java
index 247aae9..1bc90e9 100644
--- a/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/AbstractGithubTagDownloadedProjectGenerator.java
+++ b/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/AbstractGithubTagDownloadedProjectGenerator.java
@@ -12,6 +12,7 @@
import com.intellij.platform.templates.github.GeneratorException;
import com.intellij.platform.templates.github.GithubTagInfo;
import com.intellij.platform.templates.github.ZipUtil;
+import com.intellij.util.NullableFunction;
import com.intellij.util.PlatformUtils;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
@@ -39,10 +40,10 @@
protected abstract String getDisplayName();
@NotNull
- protected abstract String getGithubUserName();
+ public abstract String getGithubUserName();
@NotNull
- protected abstract String getGithubRepositoryName();
+ public abstract String getGithubRepositoryName();
@Override
@Nullable
@@ -128,7 +129,12 @@
);
LOG.info("Content of " + url + " has been successfully downloaded to " + zipArchiveFile.getAbsolutePath()
+ ", size " + zipArchiveFile.length() + " bytes");
- ZipUtil.unzipWithProgressSynchronously(project, getTitle(), zipArchiveFile, extractToDir, true);
+ ZipUtil.unzipWithProgressSynchronously(project, getTitle(), zipArchiveFile, extractToDir, getPathConvertor(), true);
+ }
+
+ @Nullable
+ protected NullableFunction<String, String> getPathConvertor() {
+ return null;
}
@Nullable
diff --git a/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubProjectGeneratorPeer.java b/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubProjectGeneratorPeer.java
index 7c069b5..df78bef 100644
--- a/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubProjectGeneratorPeer.java
+++ b/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubProjectGeneratorPeer.java
@@ -180,7 +180,7 @@
@Override
public void buildUI(@NotNull SettingsStep settingsStep) {
- settingsStep.addSettingsField("\u001BVersion:", myVersionPanel);
+ settingsStep.addSettingsField("&Version:", myVersionPanel);
settingsStep.addSettingsComponent(myReloadableComboBoxPanel.getErrorComponent());
}
diff --git a/platform/lang-impl/src/com/intellij/openapi/application/PathMappingsMacroFilter.java b/platform/lang-impl/src/com/intellij/openapi/application/PathMappingsMacroFilter.java
new file mode 100644
index 0000000..6cebf17
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/openapi/application/PathMappingsMacroFilter.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2000-2015 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 com.intellij.openapi.application;
+
+import org.jdom.Attribute;
+import org.jdom.Element;
+
+/**
+ * Filter remote path in {@link com.intellij.util.PathMappingSettings.PathMapping}
+ *
+ * @author Svetlana.Zemlyanskaya
+ */
+public class PathMappingsMacroFilter extends PathMacroFilter {
+ @Override
+ public boolean skipPathMacros(Attribute attribute) {
+ final Element parent = attribute.getParent();
+ if ("mapping".equals(parent.getName()) && "remote-root".equals(attribute.getName())) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/UniqueNameEditorTabTitleProvider.java b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/UniqueNameEditorTabTitleProvider.java
index b84513d..4ba54e5 100644
--- a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/UniqueNameEditorTabTitleProvider.java
+++ b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/UniqueNameEditorTabTitleProvider.java
@@ -30,7 +30,10 @@
if (!UISettings.getInstance().SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES || DumbService.isDumb(project)) {
return null;
}
- final String uniqueName = UniqueVFilePathBuilder.getInstance().getUniqueVirtualFilePathWithinOpenedFileEditors(project, file);
+ // Even though this is a 'tab title provider' it is used also when tabs are not shown, namely for building IDE frame title.
+ final String uniqueName = UISettings.getInstance().EDITOR_TAB_PLACEMENT == UISettings.TABS_NONE ?
+ UniqueVFilePathBuilder.getInstance().getUniqueVirtualFilePath(project, file) :
+ UniqueVFilePathBuilder.getInstance().getUniqueVirtualFilePathWithinOpenedFileEditors(project, file);
return uniqueName.equals(file.getName()) ? null : uniqueName;
}
}
diff --git a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/http/JumpFromRemoteFileToLocalAction.java b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/http/JumpFromRemoteFileToLocalAction.java
index 92901eb..2426980 100644
--- a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/http/JumpFromRemoteFileToLocalAction.java
+++ b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/http/JumpFromRemoteFileToLocalAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -40,7 +40,7 @@
import java.util.Collection;
import java.util.Collections;
-public class JumpFromRemoteFileToLocalAction extends AnAction {
+class JumpFromRemoteFileToLocalAction extends AnAction {
private final HttpVirtualFile myFile;
private final Project myProject;
diff --git a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorProvider.java b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorProvider.java
index 217e605..c28fea8 100644
--- a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorProvider.java
+++ b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorProvider.java
@@ -56,17 +56,19 @@
LOG.error("Cannot open text editor for " + file);
}
CodeFoldingState state = null;
- try {
- Document document = FileDocumentManager.getInstance().getDocument(file);
- if (document != null) {
- state = CodeFoldingManager.getInstance(project).buildInitialFoldings(document);
+ if (!project.isDefault()) { // There's no CodeFoldingManager for default project (which is used in diff command-line application)
+ try {
+ Document document = FileDocumentManager.getInstance().getDocument(file);
+ if (document != null) {
+ state = CodeFoldingManager.getInstance(project).buildInitialFoldings(document);
+ }
}
- }
- catch (ProcessCanceledException e) {
- throw e;
- }
- catch (Exception e) {
- LOG.error("Error building initial foldings", e);
+ catch (ProcessCanceledException e) {
+ throw e;
+ }
+ catch (Exception e) {
+ LOG.error("Error building initial foldings", e);
+ }
}
final CodeFoldingState finalState = state;
return new Builder() {
diff --git a/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java b/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java
index c6a3211..2e50214 100644
--- a/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java
+++ b/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java
@@ -59,7 +59,6 @@
import com.intellij.ui.treeStructure.Tree;
import com.intellij.usageView.UsageViewBundle;
import com.intellij.util.*;
-import com.intellij.util.ui.StatusText;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.tree.TreeUtil;
import com.intellij.xml.util.XmlStringUtil;
@@ -81,7 +80,7 @@
public class DependenciesPanel extends JPanel implements Disposable, DataProvider {
private final Map<PsiFile, Set<PsiFile>> myDependencies;
- private Map<PsiFile, Map<DependencyRule, Set<PsiFile>>> myIllegalDependencies;
+ private Map<VirtualFile, Map<DependencyRule, Set<PsiFile>>> myIllegalDependencies;
private final MyTree myLeftTree = new MyTree();
private final MyTree myRightTree = new MyTree();
private final DependenciesUsagesPanel myUsagesPanel;
@@ -92,7 +91,7 @@
private final Marker myRightTreeMarker;
private final Marker myLeftTreeMarker;
- private Set<PsiFile> myIllegalsInRightTree = new HashSet<PsiFile>();
+ private Set<VirtualFile> myIllegalsInRightTree = new HashSet<VirtualFile>();
private final Project myProject;
private final List<DependenciesBuilder> myBuilders;
@@ -118,10 +117,10 @@
myScopeOfInterest = main.getScopeOfInterest();
myTransitiveBorder = main.getTransitiveBorder();
myDependencies = new HashMap<PsiFile, Set<PsiFile>>();
- myIllegalDependencies = new HashMap<PsiFile, Map<DependencyRule, Set<PsiFile>>>();
+ myIllegalDependencies = new HashMap<VirtualFile, Map<DependencyRule, Set<PsiFile>>>();
for (DependenciesBuilder builder : builders) {
myDependencies.putAll(builder.getDependencies());
- myIllegalDependencies.putAll(builder.getIllegalDependencies());
+ putAllDependencies(builder);
}
exclude(excluded);
myProject = project;
@@ -240,6 +239,13 @@
TreeUtil.selectFirstNode(myLeftTree);
}
+ private void putAllDependencies(DependenciesBuilder builder) {
+ final Map<PsiFile, Map<DependencyRule, Set<PsiFile>>> dependencies = builder.getIllegalDependencies();
+ for (Map.Entry<PsiFile, Map<DependencyRule, Set<PsiFile>>> entry : dependencies.entrySet()) {
+ myIllegalDependencies.put(entry.getKey().getVirtualFile(), entry.getValue());
+ }
+ }
+
private void processDependencies(final Set<PsiFile> searchIn, final Set<PsiFile> searchFor, Processor<List<PsiFile>> processor) {
if (myTransitiveBorder == 0) return;
Set<PsiFile> initialSearchFor = new HashSet<PsiFile>(searchFor);
@@ -320,9 +326,9 @@
}
private void rebuild() {
- myIllegalDependencies = new HashMap<PsiFile, Map<DependencyRule, Set<PsiFile>>>();
+ myIllegalDependencies = new HashMap<VirtualFile, Map<DependencyRule, Set<PsiFile>>>();
for (DependenciesBuilder builder : myBuilders) {
- myIllegalDependencies.putAll(builder.getIllegalDependencies());
+ putAllDependencies(builder);
}
updateLeftTreeModel();
updateRightTreeModel();
@@ -347,12 +353,15 @@
private void updateRightTreeModel() {
Set<PsiFile> deps = new HashSet<PsiFile>();
Set<PsiFile> scope = getSelectedScope(myLeftTree);
- myIllegalsInRightTree = new HashSet<PsiFile>();
+ myIllegalsInRightTree = new HashSet<VirtualFile>();
for (PsiFile psiFile : scope) {
- Map<DependencyRule, Set<PsiFile>> illegalDeps = myIllegalDependencies.get(psiFile);
+ Map<DependencyRule, Set<PsiFile>> illegalDeps = myIllegalDependencies.get(psiFile.getVirtualFile());
if (illegalDeps != null) {
for (final DependencyRule rule : illegalDeps.keySet()) {
- myIllegalsInRightTree.addAll(illegalDeps.get(rule));
+ final Set<PsiFile> files = illegalDeps.get(rule);
+ for (PsiFile file : files) {
+ myIllegalsInRightTree.add(file.getVirtualFile());
+ }
}
}
final Set<PsiFile> psiFiles = myDependencies.get(psiFile);
@@ -897,7 +906,7 @@
public void run() {
myBuilders.add(builder);
myDependencies.putAll(builder.getDependencies());
- myIllegalDependencies.putAll(builder.getIllegalDependencies());
+ putAllDependencies(builder);
exclude(myExcluded);
rebuild();
}
diff --git a/platform/lang-impl/src/com/intellij/platform/templates/github/ZipUtil.java b/platform/lang-impl/src/com/intellij/platform/templates/github/ZipUtil.java
index 355e8a46..7fb48b8 100644
--- a/platform/lang-impl/src/com/intellij/platform/templates/github/ZipUtil.java
+++ b/platform/lang-impl/src/com/intellij/platform/templates/github/ZipUtil.java
@@ -41,13 +41,24 @@
@NotNull final File extractToDir,
final boolean unwrapSingleTopLevelFolder) throws GeneratorException
{
+ unzipWithProgressSynchronously(project, progressTitle, zipArchive, extractToDir, null, unwrapSingleTopLevelFolder);
+ }
+
+ public static void unzipWithProgressSynchronously(
+ @Nullable Project project,
+ @NotNull String progressTitle,
+ @NotNull final File zipArchive,
+ @NotNull final File extractToDir,
+ @Nullable final NullableFunction<String, String> pathConvertor,
+ final boolean unwrapSingleTopLevelFolder) throws GeneratorException
+ {
final Outcome<Boolean> outcome = DownloadUtil.provideDataWithProgressSynchronously(
project, progressTitle, "Unpacking ...",
new Callable<Boolean>() {
@Override
public Boolean call() throws IOException {
ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
- unzip(progress, extractToDir, zipArchive, null, null, unwrapSingleTopLevelFolder);
+ unzip(progress, extractToDir, zipArchive, pathConvertor, null, unwrapSingleTopLevelFolder);
return true;
}
},
diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/arrangement/engine/ArrangementEngine.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/arrangement/engine/ArrangementEngine.java
index b3d39da..45b4693 100644
--- a/platform/lang-impl/src/com/intellij/psi/codeStyle/arrangement/engine/ArrangementEngine.java
+++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/arrangement/engine/ArrangementEngine.java
@@ -19,6 +19,7 @@
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ex.DocumentEx;
+import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
@@ -127,9 +128,14 @@
documentEx = null;
}
- final Context<? extends ArrangementEntry> context = Context.from(
- rearranger, document, file, ranges, arrangementSettings, settings
- );
+ final Context<? extends ArrangementEntry> context;
+ DumbService.getInstance(file.getProject()).setAlternativeResolveEnabled(true);
+ try {
+ context = Context.from(rearranger, document, file, ranges, arrangementSettings, settings);
+ }
+ finally {
+ DumbService.getInstance(file.getProject()).setAlternativeResolveEnabled(false);
+ }
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java
index 24d7453..3ccdf18 100644
--- a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java
+++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/DetectedIndentOptionsNotificationProvider.java
@@ -33,8 +33,9 @@
import com.intellij.util.Processor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
-import static com.intellij.psi.codeStyle.EditorNotificationInfo.*;
+import static com.intellij.psi.codeStyle.EditorNotificationInfo.ActionLabelData;
/**
* @author Rustam Vishnyakov
@@ -42,6 +43,9 @@
public class DetectedIndentOptionsNotificationProvider extends EditorNotifications.Provider<EditorNotificationPanel> {
private static final Key<EditorNotificationPanel> KEY = Key.create("indent.options.notification.provider");
private static final Key<Boolean> NOTIFIED_FLAG = Key.create("indent.options.notification.provider.status");
+ protected static final Key<Boolean> DETECT_INDENT_NOTIFICATION_SHOWN_KEY = Key.create("indent.options.notification.provider.status.test.notification.shown");
+
+ private static boolean myShowNotificationInTest = false;
@NotNull
@Override
@@ -93,6 +97,9 @@
};
panel.createActionLabel(actionLabelData.label, onClickAction);
}
+ if (ApplicationManager.getApplication().isUnitTestMode()) {
+ file.putUserData(DETECT_INDENT_NOTIFICATION_SHOWN_KEY, Boolean.TRUE);
+ }
return panel;
}
}
@@ -102,15 +109,25 @@
}
public static void updateIndentNotification(@NotNull PsiFile file, boolean enforce) {
- if (!(ApplicationManager.getApplication().isHeadlessEnvironment() || ApplicationManager.getApplication().isUnitTestMode())) {
- FileEditor fileEditor = FileEditorManager.getInstance(file.getProject()).getSelectedEditor(file.getVirtualFile());
+ VirtualFile vFile = file.getVirtualFile();
+ if (vFile == null) return;
+
+ if (!ApplicationManager.getApplication().isHeadlessEnvironment()
+ || ApplicationManager.getApplication().isUnitTestMode() && myShowNotificationInTest)
+ {
+ FileEditor fileEditor = FileEditorManager.getInstance(file.getProject()).getSelectedEditor(vFile);
if (fileEditor != null) {
Boolean notifiedFlag = fileEditor.getUserData(NOTIFIED_FLAG);
if (notifiedFlag == null || enforce) {
fileEditor.putUserData(NOTIFIED_FLAG, Boolean.TRUE);
- EditorNotifications.getInstance(file.getProject()).updateNotifications(file.getVirtualFile());
+ EditorNotifications.getInstance(file.getProject()).updateNotifications(vFile);
}
}
}
}
+
+ @TestOnly
+ static void setShowNotificationInTest(boolean show) {
+ myShowNotificationInTest = show;
+ }
}
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiCommentManipulator.java b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiCommentManipulator.java
index b81518b..552e519 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiCommentManipulator.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiCommentManipulator.java
@@ -37,7 +37,7 @@
FileType type = psiComment.getContainingFile().getFileType();
PsiFile fromText = PsiFileFactory.getInstance(psiComment.getProject()).createFileFromText("__." + type.getDefaultExtension(), type, newText);
PsiComment newElement = PsiTreeUtil.getParentOfType(fromText.findElementAt(0), psiComment.getClass(), false);
- assert newElement != null;
+ assert newElement != null : type + " " + type.getDefaultExtension() + " " + newText;
return (PsiComment)psiComment.replace(newElement);
}
diff --git a/platform/lang-impl/src/com/intellij/refactoring/IntroduceTargetChooser.java b/platform/lang-impl/src/com/intellij/refactoring/IntroduceTargetChooser.java
index 982c5ca0..8a55242 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/IntroduceTargetChooser.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/IntroduceTargetChooser.java
@@ -23,6 +23,9 @@
import com.intellij.openapi.util.Pass;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
+import com.intellij.psi.SmartPointerManager;
+import com.intellij.psi.SmartPsiElementPointer;
+import com.intellij.ui.JBColor;
import com.intellij.ui.components.JBList;
import com.intellij.util.Function;
import com.intellij.util.NotNullFunction;
@@ -70,7 +73,7 @@
final ScopeHighlighter highlighter = new ScopeHighlighter(editor, ranger);
final DefaultListModel model = new DefaultListModel();
for (T expr : expressions) {
- model.addElement(expr);
+ model.addElement(SmartPointerManager.getInstance(expr.getProject()).createSmartPsiElementPointer(expr));
}
final JList list = new JBList(model);
list.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
@@ -84,15 +87,19 @@
final boolean isSelected,
final boolean cellHasFocus) {
final Component rendererComponent = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
-
- final T expr = (T)value;
- if (expr.isValid()) {
+ SmartPsiElementPointer<T> pointer = (SmartPsiElementPointer<T>)value;
+ final T expr = pointer.getElement();
+ if (expr != null) {
String text = renderer.fun(expr);
int firstNewLinePos = text.indexOf('\n');
String trimmedText = text.substring(0, firstNewLinePos != -1 ? firstNewLinePos : Math.min(100, text.length()));
if (trimmedText.length() != text.length()) trimmedText += " ...";
setText(trimmedText);
}
+ else {
+ setForeground(JBColor.RED);
+ setText("Invalid");
+ }
return rendererComponent;
}
});
@@ -102,29 +109,36 @@
public void valueChanged(final ListSelectionEvent e) {
highlighter.dropHighlight();
final int index = list.getSelectedIndex();
- if (index < 0 ) return;
- final T expr = (T)model.get(index);
- highlighter.highlight(expr, Collections.<PsiElement>singletonList(expr));
+ if (index < 0) return;
+ SmartPsiElementPointer<T> pointer = ((SmartPsiElementPointer<T>)model.get(index));
+ final T expr = pointer.getElement();
+ if (expr != null) {
+ highlighter.highlight(expr, Collections.<PsiElement>singletonList(expr));
+ }
}
});
JBPopupFactory.getInstance().createListPopupBuilder(list)
- .setTitle(title)
- .setMovable(false)
- .setResizable(false)
- .setRequestFocus(true)
- .setItemChoosenCallback(new Runnable() {
- @Override
- public void run() {
- callback.pass((T)list.getSelectedValue());
- }
- })
- .addListener(new JBPopupAdapter() {
- @Override
- public void onClosed(LightweightWindowEvent event) {
- highlighter.dropHighlight();
- }
- })
- .createPopup().showInBestPositionFor(editor);
+ .setTitle(title)
+ .setMovable(false)
+ .setResizable(false)
+ .setRequestFocus(true)
+ .setItemChoosenCallback(new Runnable() {
+ @Override
+ public void run() {
+ SmartPsiElementPointer<T> value = (SmartPsiElementPointer<T>)list.getSelectedValue();
+ T expr = value.getElement();
+ if (expr != null) {
+ callback.pass(expr);
+ }
+ }
+ })
+ .addListener(new JBPopupAdapter() {
+ @Override
+ public void onClosed(LightweightWindowEvent event) {
+ highlighter.dropHighlight();
+ }
+ })
+ .createPopup().showInBestPositionFor(editor);
}
}
diff --git a/platform/lang-impl/src/com/intellij/ui/tabs/FileColorManagerImpl.java b/platform/lang-impl/src/com/intellij/ui/tabs/FileColorManagerImpl.java
index cadccd5..be0ddc2 100644
--- a/platform/lang-impl/src/com/intellij/ui/tabs/FileColorManagerImpl.java
+++ b/platform/lang-impl/src/com/intellij/ui/tabs/FileColorManagerImpl.java
@@ -54,12 +54,12 @@
private FileColorSharedConfigurationManager mySharedConfigurationManager;
private static final Map<String, Color> ourDefaultColors = ContainerUtil.<String, Color>immutableMapBuilder()
- .put("Blue", new JBColor(new Color(0xdcf0ff), new Color(0x2B3557)))
- .put("Green", new JBColor(new Color(231, 250, 219), new Color(0x2A3B2C)))
- .put("Orange", new JBColor(new Color(246, 224, 202), new Color(0x823B1C)))
- .put("Rose", new JBColor(new Color(242, 206, 202), new Color(0x542F3A)))
- .put("Violet", new JBColor(new Color(222, 213, 241), new Color(0x4f4056)))
- .put("Yellow", new JBColor(new Color(255, 255, 228), new Color(0x494539)))
+ .put("Blue", new JBColor(new Color(0xdcf0ff), new Color(0x3C476B)))
+ .put("Green", new JBColor(new Color(231, 250, 219), new Color(0x425444)))
+ .put("Orange", new JBColor(new Color(246, 224, 202), new Color(0x804A33)))
+ .put("Rose", new JBColor(new Color(242, 206, 202), new Color(0x6E414E)))
+ .put("Violet", new JBColor(new Color(222, 213, 241), new Color(0x504157)))
+ .put("Yellow", new JBColor(new Color(255, 255, 228), new Color(0x4F4838)))
.build();
public FileColorManagerImpl(@NotNull final Project project) {
diff --git a/platform/lang-impl/testSources/com/intellij/psi/codeStyle/autodetect/DetectedIndentNotificationTest.java b/platform/lang-impl/testSources/com/intellij/psi/codeStyle/autodetect/DetectedIndentNotificationTest.java
new file mode 100644
index 0000000..d7e4f0e
--- /dev/null
+++ b/platform/lang-impl/testSources/com/intellij/psi/codeStyle/autodetect/DetectedIndentNotificationTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2000-2015 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 com.intellij.psi.codeStyle.autodetect;
+
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.codeStyle.CodeStyleSettings;
+import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import com.intellij.testFramework.PlatformTestCase;
+import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
+import org.jetbrains.annotations.NotNull;
+
+public class DetectedIndentNotificationTest extends LightPlatformCodeInsightFixtureTestCase {
+
+ static {
+ PlatformTestCase.initPlatformLangPrefix();
+ }
+
+ private CodeStyleSettings mySettings;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ mySettings = CodeStyleSettingsManager.getInstance(getProject()).getCurrentSettings();
+ mySettings.AUTODETECT_INDENTS = true;
+ DetectableIndentOptionsProvider optionsProvider = DetectableIndentOptionsProvider.getInstance();
+ if (optionsProvider != null) {
+ optionsProvider.setEnabledInTest(true);
+ }
+ DetectedIndentOptionsNotificationProvider.setShowNotificationInTest(true);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ mySettings.AUTODETECT_INDENTS = false;
+ DetectableIndentOptionsProvider optionsProvider = DetectableIndentOptionsProvider.getInstance();
+ if (optionsProvider != null) {
+ optionsProvider.setEnabledInTest(false);
+ }
+ DetectedIndentOptionsNotificationProvider.setShowNotificationInTest(false);
+ super.tearDown();
+ }
+
+ public void testNotificationShownOnEnter_WhenIndentDetected() throws Exception {
+ myFixture.configureByText("Test.java",
+ "class Test {\n" +
+ " public void main() {\n" +
+ " int a;<caret>\n" +
+ " int b;\n" +
+ " }\n" +
+ "}");
+
+ PsiFile file = myFixture.getFile();
+ VirtualFile vFile = file.getVirtualFile();
+
+ assert !isNotificationShown(vFile);
+ myFixture.type('\n');
+ assert isNotificationShown(vFile);
+ }
+
+ public void testNoNotification_WhenNothingDetected() throws Exception {
+ myFixture.configureByText("Test.java",
+ "class Test {\n" +
+ " public void main() {\n" +
+ " int a;<caret>\n" +
+ " int b;\n" +
+ " }\n" +
+ "}");
+
+ PsiFile file = myFixture.getFile();
+ VirtualFile vFile = file.getVirtualFile();
+
+ assert !isNotificationShown(vFile);
+ myFixture.type('\n');
+ assert !isNotificationShown(vFile);
+ }
+
+ private boolean isNotificationShown(@NotNull VirtualFile vFile) {
+ return vFile.getUserData(DetectedIndentOptionsNotificationProvider.DETECT_INDENT_NOTIFICATION_SHOWN_KEY) != null;
+ }
+}
diff --git a/platform/platform-api/src/com/intellij/ide/BrowserUtil.java b/platform/platform-api/src/com/intellij/ide/BrowserUtil.java
index 85c0efd..dc043f1 100644
--- a/platform/platform-api/src/com/intellij/ide/BrowserUtil.java
+++ b/platform/platform-api/src/com/intellij/ide/BrowserUtil.java
@@ -21,9 +21,12 @@
import com.intellij.ide.browsers.BrowserLauncherAppless;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -51,11 +54,28 @@
private static final Pattern ourExternalPrefix = Pattern.compile("^[\\w\\+\\.\\-]{2,}:");
private static final Pattern ourAnchorSuffix = Pattern.compile("#(.*)$");
+ private static final Condition<String> BROWSABLE_URL = new Condition<String>() {
+ @Override
+ public boolean value(String s) {
+ return canBeBrowsed(s);
+ }
+ };
+
private BrowserUtil() { }
public static boolean isAbsoluteURL(String url) {
return ourExternalPrefix.matcher(url.toLowerCase(Locale.ENGLISH)).find();
}
+
+ public static boolean canBeBrowsed(String url) {
+ return url != null && !url.startsWith("jar:");
+ }
+
+ @Nullable
+ public static List<String> retainBrowsableUrls(@Nullable List<String> urls) {
+ return urls == null ? null : ContainerUtil.filter(urls, BROWSABLE_URL);
+ }
+
public static String getDocURL(String url) {
Matcher anchorMatcher = ourAnchorSuffix.matcher(url);
@@ -64,7 +84,7 @@
@Nullable
public static URL getURL(String url) throws MalformedURLException {
- return isAbsoluteURL(url) ? VfsUtil.convertToURL(url) : new URL("file", "", url);
+ return isAbsoluteURL(url) ? VfsUtilCore.convertToURL(url) : new URL("file", "", url);
}
public static void browse(@NotNull VirtualFile file) {
diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java
index ea2e71e..26953ed 100644
--- a/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java
+++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java
@@ -288,6 +288,8 @@
String ACTION_MOVE_STATEMENT_UP_ACTION = "MoveStatementUp";
String ACTION_MOVE_STATEMENT_DOWN_ACTION = "MoveStatementDown";
+
+ String ACTION_MOVE_LINE_UP_ACTION = "MoveLineUp";
String ACTION_COMPARE_CLIPBOARD_WITH_SELECTION = "CompareClipboardWithSelection";
diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java b/platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java
index 3097cf2..97eaffc 100644
--- a/platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java
+++ b/platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java
@@ -29,7 +29,6 @@
import com.intellij.util.*;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.Convertor;
-import com.intellij.util.lang.UrlClassLoader;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -39,7 +38,6 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -211,8 +209,6 @@
return file;
}
- @NonNls private static final String MAILTO = "mailto";
-
/**
* Searches for the file specified by given java,net.URL.
* Note that this method currently tested only for "file" and "jar" protocols under Unix and Windows
@@ -241,51 +237,16 @@
}
/**
- * Converts VsfUrl info java.net.URL. Does not support "jar:" protocol.
+ * Converts VsfUrl info java.net.URL.
*
* @param vfsUrl VFS url (as constructed by VfsFile.getUrl())
* @return converted URL or null if error has occured
+ * @deprecated Use {@link VfsUtilCore#convertToURL(String)} instead. To be removed in IDEA 16.
*/
-
+ @SuppressWarnings("MethodOverridesStaticMethodOfSuperclass")
@Nullable
public static URL convertToURL(@NotNull String vfsUrl) {
- if (vfsUrl.startsWith(StandardFileSystems.JAR_PROTOCOL)) {
- LOG.error("jar: protocol not supported.");
- return null;
- }
-
- // [stathik] for supporting mail URLs in Plugin Manager
- if (vfsUrl.startsWith(MAILTO)) {
- try {
- return new URL (vfsUrl);
- }
- catch (MalformedURLException e) {
- return null;
- }
- }
-
- String[] split = vfsUrl.split("://");
-
- if (split.length != 2) {
- LOG.debug("Malformed VFS URL: " + vfsUrl);
- return null;
- }
-
- String protocol = split[0];
- String path = split[1];
-
- try {
- if (protocol.equals(StandardFileSystems.FILE_PROTOCOL)) {
- return new URL(StandardFileSystems.FILE_PROTOCOL, "", path);
- }
- else {
- return UrlClassLoader.internProtocol(new URL(vfsUrl));
- }
- }
- catch (MalformedURLException e) {
- LOG.debug("MalformedURLException occurred:" + e.getMessage());
- return null;
- }
+ return VfsUtilCore.convertToURL(vfsUrl);
}
public static VirtualFile copyFileRelative(Object requestor, @NotNull VirtualFile file, @NotNull VirtualFile toDir, @NotNull String relativePath) throws IOException {
diff --git a/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.java b/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.java
index d0a8755..8baa090 100644
--- a/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.java
+++ b/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.java
@@ -97,6 +97,9 @@
public abstract ToolWindow registerToolWindow(@NotNull String id, boolean canCloseContent, @NotNull ToolWindowAnchor anchor, Disposable parentDisposable, boolean canWorkInDumbMode);
@NotNull
+ public abstract ToolWindow registerToolWindow(@NotNull String id, boolean canCloseContent, @NotNull ToolWindowAnchor anchor, Disposable parentDisposable, boolean canWorkInDumbMode, boolean secondary);
+
+ @NotNull
public ToolWindow registerToolWindow(@NotNull final String id,
final boolean canCloseContent,
@NotNull final ToolWindowAnchor anchor,
diff --git a/platform/platform-api/src/com/intellij/ui/BooleanTableCellEditor.java b/platform/platform-api/src/com/intellij/ui/BooleanTableCellEditor.java
index a23f988..332f2b5 100644
--- a/platform/platform-api/src/com/intellij/ui/BooleanTableCellEditor.java
+++ b/platform/platform-api/src/com/intellij/ui/BooleanTableCellEditor.java
@@ -16,6 +16,7 @@
package com.intellij.ui;
import javax.swing.*;
+import java.awt.*;
/**
* @author peter
@@ -34,6 +35,11 @@
this(false);
}
+ @Override
+ public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
+ return super.getTableCellEditorComponent(table, value, true, row, column);
+ }
+
public Object getCellEditorValue() {
Object value = super.getCellEditorValue();
if (myStringEditor && value instanceof Boolean) {
diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayoutStrategy.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayoutStrategy.java
index d95e9e0..dd3c43f 100644
--- a/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayoutStrategy.java
+++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayoutStrategy.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2015 JetBrains s.r.o.
+ * Copyright 2000-2012 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.
@@ -113,7 +113,7 @@
public int getToFitLength(final SingleRowPassInfo data) {
if (data.hToolbar != null) {
- return myTabs.getWidth() - data.insets.left - data.insets.right - data.hToolbar.getMinimumSize().width;
+ return myTabs.getWidth() - data.insets.left - data.insets.right - data.hToolbar.getMinimumSize().width;
} else {
return myTabs.getWidth() - data.insets.left - data.insets.right;
}
diff --git a/platform/platform-impl/src/com/intellij/errorreport/itn/ITNProxy.java b/platform/platform-impl/src/com/intellij/errorreport/itn/ITNProxy.java
index 9984e47..160c6b5 100644
--- a/platform/platform-impl/src/com/intellij/errorreport/itn/ITNProxy.java
+++ b/platform/platform-impl/src/com/intellij/errorreport/itn/ITNProxy.java
@@ -163,7 +163,7 @@
params.put("app.name.version", appInfo.getVersionName());
params.put("app.eap", Boolean.toString(appInfo.isEAP()));
params.put("app.internal", Boolean.toString(application.isInternal()));
- params.put("app.build", appInfo.getBuild().asString());
+ params.put("app.build", appInfo.getApiVersion());
params.put("app.version.major", appInfo.getMajorVersion());
params.put("app.version.minor", appInfo.getMinorVersion());
params.put("app.build.date", format(appInfo.getBuildDate()));
diff --git a/platform/platform-impl/src/com/intellij/help/impl/HelpManagerImpl.java b/platform/platform-impl/src/com/intellij/help/impl/HelpManagerImpl.java
index 8d8fa2d..f743059 100644
--- a/platform/platform-impl/src/com/intellij/help/impl/HelpManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/help/impl/HelpManagerImpl.java
@@ -29,6 +29,7 @@
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
+import com.intellij.util.PlatformUtils;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
@@ -66,7 +67,19 @@
}
if (myHelpSet == null) {
- BrowserUtil.browse(ApplicationInfoEx.getInstanceEx().getWebHelpUrl() + "?" + id);
+ ApplicationInfoEx info = ApplicationInfoEx.getInstanceEx();
+ String url = info.getWebHelpUrl() + "?";
+ if (PlatformUtils.isCLion()) {
+ url += "Keyword=" + id;
+ url += "&ProductVersion=" + info.getMajorVersion() + "." + info.getMinorVersion();
+
+ if (info.isEAP()) {
+ url += "&EAP";
+ }
+ } else {
+ url += id;
+ }
+ BrowserUtil.browse(url);
return;
}
diff --git a/platform/platform-impl/src/com/intellij/ide/SwingCleanuper.java b/platform/platform-impl/src/com/intellij/ide/SwingCleanuper.java
index baefe3d..6fd0cd8 100644
--- a/platform/platform-impl/src/com/intellij/ide/SwingCleanuper.java
+++ b/platform/platform-impl/src/com/intellij/ide/SwingCleanuper.java
@@ -56,13 +56,9 @@
public final class SwingCleanuper implements ApplicationComponent{
private final Alarm myAlarm;
- /** Invoked by reflection
- * @param projectManager */
- SwingCleanuper(ProjectManager projectManager){
- myAlarm=new Alarm();
-
- projectManager.addProjectManagerListener(
- new ProjectManagerAdapter(){
+ public SwingCleanuper(Application application, ProjectManager projectManager) {
+ myAlarm = new Alarm(application);
+ projectManager.addProjectManagerListener(new ProjectManagerAdapter(){
public void projectOpened(final Project project) {
myAlarm.cancelAllRequests();
}
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/GotoLineAction.java b/platform/platform-impl/src/com/intellij/ide/actions/GotoLineAction.java
index 80952de..682da3e 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/GotoLineAction.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/GotoLineAction.java
@@ -31,7 +31,7 @@
public void actionPerformed(AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
- final Editor editor = e.getData(CommonDataKeys.EDITOR);
+ final Editor editor = e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE);
if (Boolean.TRUE.equals(e.getData(PlatformDataKeys.IS_MODAL_CONTEXT))) {
GotoLineNumberDialog dialog = new GotoLineNumberDialog(project, editor);
dialog.show();
@@ -60,7 +60,7 @@
presentation.setVisible(false);
return;
}
- Editor editor = event.getData(CommonDataKeys.EDITOR);
+ Editor editor = event.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE);
presentation.setEnabled(editor != null);
presentation.setVisible(editor != null);
}
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ShowRecentFilesAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ShowRecentFilesAction.java
index 29c181c..cde6c49 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/ShowRecentFilesAction.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/ShowRecentFilesAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -32,7 +32,7 @@
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.recent.files");
- Switcher.createAndShowSwitcher(e.getProject(), IdeBundle.message("title.popup.recent.files"), true);
+ Switcher.createAndShowSwitcher(e, IdeBundle.message("title.popup.recent.files"), true);
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java b/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java
index 6572129..7e8d2bb 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java
@@ -153,7 +153,7 @@
}
if (SWITCHER == null) {
isNewSwitcher = true;
- SWITCHER = createAndShowSwitcher(project, SWITCHER_TITLE, false);
+ SWITCHER = createAndShowSwitcher(e, SWITCHER_TITLE, false);
FeatureUsageTracker.getInstance().triggerFeatureUsed(SWITCHER_FEATURE_ID);
}
}
@@ -175,7 +175,12 @@
}
}
- public static SwitcherPanel createAndShowSwitcher(Project project, String title, boolean pinned) {
+ public static SwitcherPanel createAndShowSwitcher(AnActionEvent e, String title, boolean pinned) {
+ Project project = getEventProject(e);
+ if (SWITCHER != null) {
+ SWITCHER.goForward();
+ return null;
+ }
return createAndShowSwitcher(project, title, pinned, null);
}
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ToggleFullScreenAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ToggleFullScreenAction.java
index 3719ad5..3ada731 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/ToggleFullScreenAction.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/ToggleFullScreenAction.java
@@ -16,6 +16,7 @@
package com.intellij.ide.actions;
import com.intellij.idea.ActionsBundle;
+import com.intellij.openapi.actionSystem.ActionPlaces;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.actionSystem.ToggleAction;
@@ -57,7 +58,9 @@
IdeFrameEx frame = null;
boolean isApplicable = WindowManager.getInstance().isFullScreenSupportedInCurrentOS() && (frame = getFrame()) != null;
- p.setVisible(isApplicable);
+ if (e.getPlace() != ActionPlaces.MAIN_TOOLBAR) {
+ p.setVisible(isApplicable);
+ }
p.setEnabled(isApplicable);
if (isApplicable) {
@@ -70,7 +73,7 @@
Component focusOwner = IdeFocusManager.getGlobalInstance().getFocusOwner();
if (focusOwner != null) {
Window window = focusOwner instanceof JFrame ? (Window) focusOwner : SwingUtilities.getWindowAncestor(focusOwner);
- if (window instanceof JDialog) {
+ if (!(window instanceof IdeFrameEx)) {
window = SwingUtilities.getWindowAncestor(window);
}
if (window instanceof IdeFrameEx) {
diff --git a/platform/platform-impl/src/com/intellij/ide/diff/VirtualFileDiffElement.java b/platform/platform-impl/src/com/intellij/ide/diff/VirtualFileDiffElement.java
index 136271b..b697be1 100644
--- a/platform/platform-impl/src/com/intellij/ide/diff/VirtualFileDiffElement.java
+++ b/platform/platform-impl/src/com/intellij/ide/diff/VirtualFileDiffElement.java
@@ -96,7 +96,7 @@
@Override
@Nullable
public OpenFileDescriptor getOpenFileDescriptor(@Nullable Project project) {
- if (project == null) return null;
+ if (project == null || project.isDefault()) return null;
return new OpenFileDescriptor(project, myFile);
}
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.java b/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.java
index ed56542..a1cc90a 100644
--- a/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.java
+++ b/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.java
@@ -32,6 +32,7 @@
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.wm.ex.WindowManagerEx;
import com.intellij.openapi.wm.impl.IdeFrameImpl;
import com.intellij.util.ImageLoader;
@@ -327,7 +328,7 @@
if (iconPath != null && new File(FileUtil.toSystemDependentName(iconPath)).exists()) {
Image image = null;
try {
- image = ImageLoader.loadFromStream(VfsUtil.convertToURL(VfsUtil.pathToUrl(iconPath)).openStream());
+ image = ImageLoader.loadFromStream(VfsUtilCore.convertToURL(VfsUtil.pathToUrl(iconPath)).openStream());
}
catch (IOException e) {
LOG.debug(e);
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomizableActionsPanel.java b/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomizableActionsPanel.java
index d99b277..b6e95f8 100644
--- a/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomizableActionsPanel.java
+++ b/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomizableActionsPanel.java
@@ -38,6 +38,7 @@
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.ex.WindowManagerEx;
import com.intellij.openapi.wm.impl.IdeFrameImpl;
@@ -528,8 +529,8 @@
if (StringUtil.isNotEmpty(path)) {
Image image = null;
try {
- image = ImageLoader.loadFromStream(VfsUtil.convertToURL(VfsUtil.pathToUrl(path.replace(File.separatorChar,
- '/'))).openStream());
+ image = ImageLoader.loadFromStream(VfsUtilCore.convertToURL(VfsUtil.pathToUrl(path.replace(File.separatorChar,
+ '/'))).openStream());
}
catch (IOException e) {
LOG.debug(e);
diff --git a/platform/platform-impl/src/com/intellij/ide/util/ExportToFileUtil.java b/platform/platform-impl/src/com/intellij/ide/util/ExportToFileUtil.java
index 995709c..8e74ab2 100644
--- a/platform/platform-impl/src/com/intellij/ide/util/ExportToFileUtil.java
+++ b/platform/platform-impl/src/com/intellij/ide/util/ExportToFileUtil.java
@@ -123,7 +123,6 @@
myTfFile = new TextFieldWithBrowseButton();
myTfFile.addBrowseFolderListener(null, null, myProject, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
- setHorizontalStretch(1.5f);
setTitle(IdeBundle.message("title.export.preview"));
setOKButtonText(IdeBundle.message("button.save"));
setButtonsMargin(null);
@@ -166,6 +165,7 @@
settings.setAdditionalColumnsCount(0);
settings.setAdditionalPageAtBottom(false);
((EditorEx)myTextArea).setBackgroundColor(UIUtil.getInactiveTextFieldBackgroundColor());
+ myTextArea.getComponent().setPreferredSize(new Dimension(700, 400));
return myTextArea.getComponent();
}
diff --git a/platform/platform-impl/src/com/intellij/ide/util/GotoLineNumberDialog.java b/platform/platform-impl/src/com/intellij/ide/util/GotoLineNumberDialog.java
index 10d360b..5e52643 100644
--- a/platform/platform-impl/src/com/intellij/ide/util/GotoLineNumberDialog.java
+++ b/platform/platform-impl/src/com/intellij/ide/util/GotoLineNumberDialog.java
@@ -22,6 +22,7 @@
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
+import com.intellij.openapi.wm.IdeFocusManager;
import javax.swing.*;
import java.awt.*;
@@ -49,6 +50,7 @@
myEditor.getCaretModel().moveToOffset(offset);
myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
myEditor.getSelectionModel().removeSelection();
+ IdeFocusManager.getGlobalInstance().requestFocus(myEditor.getContentComponent(), true);
super.doOKAction();
}
return;
@@ -65,6 +67,7 @@
myEditor.getCaretModel().moveToLogicalPosition(new LogicalPosition(Math.max(0, lineNumber - 1), Math.max(0, columnNumber - 1)));
myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
myEditor.getSelectionModel().removeSelection();
+ IdeFocusManager.getGlobalInstance().requestFocus(myEditor.getContentComponent(), true);
super.doOKAction();
}
diff --git a/platform/platform-impl/src/com/intellij/notification/impl/IdeNotificationArea.java b/platform/platform-impl/src/com/intellij/notification/impl/IdeNotificationArea.java
index ab62eb2..9ff729d 100644
--- a/platform/platform-impl/src/com/intellij/notification/impl/IdeNotificationArea.java
+++ b/platform/platform-impl/src/com/intellij/notification/impl/IdeNotificationArea.java
@@ -26,14 +26,12 @@
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.wm.CustomStatusBarWidget;
import com.intellij.openapi.wm.IconLikeCustomStatusBarWidget;
import com.intellij.openapi.wm.StatusBar;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.ui.ClickListener;
import com.intellij.ui.LayeredIcon;
-import com.intellij.util.Alarm;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -49,12 +47,9 @@
*/
public class IdeNotificationArea extends JLabel implements CustomStatusBarWidget, IconLikeCustomStatusBarWidget {
public static final String WIDGET_ID = "Notifications";
-
private StatusBar myStatusBar;
- private final Alarm myLogAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
public IdeNotificationArea() {
- Disposer.register(this, myLogAlarm);
UISettings.getInstance().addUISettingsListener(new UISettingsListener() {
@Override
public void uiSettingsChanged(UISettings source) {
@@ -69,7 +64,7 @@
}
}.installOn(this);
- ApplicationManager.getApplication().getMessageBus().connect().subscribe(LogModel.LOG_MODEL_CHANGED, new Runnable() {
+ ApplicationManager.getApplication().getMessageBus().connect(this).subscribe(LogModel.LOG_MODEL_CHANGED, new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java
index 9b8f767..77c865f 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java
@@ -196,7 +196,7 @@
}
catch (ReadOnlyModificationException e) {
LOG.warn(e);
- readonlyFiles.add(Pair.create(session, e.getFile()));
+ readonlyFiles.add(Pair.create(e.getSession() == null ? session : e.getSession(), e.getFile()));
}
catch (Exception e) {
if (errors == null) {
@@ -299,8 +299,7 @@
}
Class<T> stateClass = ComponentSerializationUtil.getStateClass(component.getClass());
- // todo remove assert before last EAP
- if (!stateSpec.defaultStateAsResource() && getDefaultState(component, name, stateClass) != null) {
+ if (LOG.isDebugEnabled() && getDefaultState(component, name, stateClass) != null) {
LOG.error(name + " has default state, but not marked to load it");
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DirectoryBasedStorage.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DirectoryBasedStorage.java
index ed22efe..a51630c 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DirectoryBasedStorage.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DirectoryBasedStorage.java
@@ -287,12 +287,17 @@
}
}
- private void deleteFiles(@NotNull VirtualFile dir) {
+ private void deleteFiles(@NotNull VirtualFile dir) throws IOException {
AccessToken token = ApplicationManager.getApplication().acquireWriteActionLock(DocumentRunnable.IgnoreDocumentRunnable.class);
try {
for (VirtualFile file : dir.getChildren()) {
if (removedFileNames.contains(file.getName())) {
- deleteFile(file, this);
+ try {
+ file.delete(this);
+ }
+ catch (FileNotFoundException e) {
+ throw new ReadOnlyModificationException(file, e, null);
+ }
}
}
}
@@ -301,16 +306,4 @@
}
}
}
-
- public static void deleteFile(@NotNull VirtualFile file, @NotNull Object requestor) {
- try {
- file.delete(requestor);
- }
- catch (FileNotFoundException e) {
- throw new ReadOnlyModificationException(file, e);
- }
- catch (IOException e) {
- throw new StateStorageException(e);
- }
- }
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java
index 9af268b..7cefd70 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java
@@ -42,10 +42,7 @@
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileEvent;
-import com.intellij.util.LineSeparator;
-import com.intellij.util.PathUtilRt;
-import com.intellij.util.SmartList;
-import com.intellij.util.SystemProperties;
+import com.intellij.util.*;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import org.jdom.Element;
@@ -121,15 +118,40 @@
}
@NotNull
- public static VirtualFile writeFile(@Nullable File file, @NotNull Object requestor, @Nullable VirtualFile virtualFile, @NotNull BufferExposingByteArrayOutputStream content, @Nullable LineSeparator lineSeparatorIfPrependXmlProlog) throws IOException {
- // mark this action as modifying the file which daemon analyzer should ignore
- AccessToken token = ApplicationManager.getApplication().acquireWriteActionLock(DocumentRunnable.IgnoreDocumentRunnable.class);
+ public static VirtualFile writeFile(@Nullable File file,
+ @NotNull Object requestor,
+ @Nullable VirtualFile virtualFile,
+ @NotNull BufferExposingByteArrayOutputStream content,
+ @Nullable LineSeparator lineSeparatorIfPrependXmlProlog) throws IOException {
+ final VirtualFile result;
+ if (file != null && (virtualFile == null || !virtualFile.isValid())) {
+ result = getOrCreateVirtualFile(requestor, file.getAbsolutePath());
+ }
+ else {
+ result = virtualFile;
+ assert result != null;
+ }
+
+ boolean equals = isEqualContent(result, lineSeparatorIfPrependXmlProlog, content);
+ if (equals) {
+ // commented — the upcoming fix of such warnings will not be cherry-picked to release (is not safe)
+ //LOG.warn("Content equals, but it must be handled not on this level — " + result.getName());
+ return result;
+ }
+ else {
+ doWrite(requestor, result, virtualFile, content, lineSeparatorIfPrependXmlProlog);
+ return result;
+ }
+ }
+
+ private static void doWrite(@NotNull final Object requestor,
+ @NotNull final VirtualFile file,
+ @Nullable final VirtualFile proposedFile,
+ @NotNull final BufferExposingByteArrayOutputStream content,
+ @Nullable final LineSeparator lineSeparatorIfPrependXmlProlog) throws IOException {
+ AccessToken token = WriteAction.start();
try {
- if (file != null && (virtualFile == null || !virtualFile.isValid())) {
- virtualFile = getOrCreateVirtualFile(requestor, file.getAbsolutePath());
- }
- assert virtualFile != null;
- OutputStream out = virtualFile.getOutputStream(requestor);
+ OutputStream out = file.getOutputStream(requestor);
try {
if (lineSeparatorIfPrependXmlProlog != null) {
out.write(XML_PROLOG);
@@ -140,14 +162,18 @@
finally {
out.close();
}
- return virtualFile;
}
catch (FileNotFoundException e) {
- if (virtualFile == null) {
+ if (proposedFile == null) {
throw e;
}
else {
- throw new ReadOnlyModificationException(virtualFile, e);
+ throw new ReadOnlyModificationException(proposedFile, e, new StateStorage.SaveSession() {
+ @Override
+ public void save() throws IOException {
+ doWrite(requestor, file, proposedFile, content, lineSeparatorIfPrependXmlProlog);
+ }
+ });
}
}
finally {
@@ -155,7 +181,31 @@
}
}
- public static void deleteFile(@NotNull File file, @NotNull Object requestor, @Nullable VirtualFile virtualFile) throws IOException {
+ private static boolean isEqualContent(VirtualFile result,
+ @Nullable LineSeparator lineSeparatorIfPrependXmlProlog,
+ @NotNull BufferExposingByteArrayOutputStream content) throws IOException {
+ boolean equals = true;
+ int headerLength = lineSeparatorIfPrependXmlProlog == null ? 0 : XML_PROLOG.length + lineSeparatorIfPrependXmlProlog.getSeparatorBytes().length;
+ int toWriteLength = headerLength + content.size();
+
+ if (result.getLength() != toWriteLength) {
+ equals = false;
+ }
+ else {
+ byte[] bytes = result.contentsToByteArray();
+ if (lineSeparatorIfPrependXmlProlog != null) {
+ if (!ArrayUtil.startsWith(bytes, XML_PROLOG) || !ArrayUtil.startsWith(bytes, XML_PROLOG.length, lineSeparatorIfPrependXmlProlog.getSeparatorBytes())) {
+ equals = false;
+ }
+ }
+ if (!ArrayUtil.startsWith(bytes, headerLength, content.toByteArray())) {
+ equals = false;
+ }
+ }
+ return equals;
+ }
+
+ public static void deleteFile(@NotNull File file, @NotNull final Object requestor, @Nullable final VirtualFile virtualFile) throws IOException {
if (virtualFile == null) {
LOG.warn("Cannot find virtual file " + file.getAbsolutePath());
}
@@ -166,7 +216,17 @@
}
}
else if (virtualFile.exists()) {
- deleteFile(requestor, virtualFile);
+ try {
+ deleteFile(requestor, virtualFile);
+ }
+ catch (FileNotFoundException e) {
+ throw new ReadOnlyModificationException(virtualFile, e, new StateStorage.SaveSession() {
+ @Override
+ public void save() throws IOException {
+ deleteFile(requestor, virtualFile);
+ }
+ });
+ }
}
}
@@ -175,9 +235,6 @@
try {
virtualFile.delete(requestor);
}
- catch (FileNotFoundException e) {
- throw new ReadOnlyModificationException(virtualFile, e);
- }
finally {
token.finish();
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/store/ReadOnlyModificationException.java b/platform/platform-impl/src/com/intellij/openapi/components/store/ReadOnlyModificationException.java
index 8550341..e7361b16 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/store/ReadOnlyModificationException.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/store/ReadOnlyModificationException.java
@@ -15,20 +15,29 @@
*/
package com.intellij.openapi.components.store;
+import com.intellij.openapi.components.StateStorage;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
public final class ReadOnlyModificationException extends RuntimeException {
private final VirtualFile myFile;
+ private final StateStorage.SaveSession mySession;
- public ReadOnlyModificationException(@NotNull VirtualFile file, @NotNull Throwable cause) {
+ public ReadOnlyModificationException(@NotNull VirtualFile file, @Nullable Throwable cause, StateStorage.SaveSession session) {
super(cause);
myFile = file;
+ mySession = session;
}
@NotNull
public VirtualFile getFile() {
return myFile;
}
+
+ @Nullable
+ public StateStorage.SaveSession getSession() {
+ return mySession;
+ }
}
\ No newline at end of file
diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffPanelOptions.java b/platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffPanelOptions.java
index d3911ac..5f1baa1a 100644
--- a/platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffPanelOptions.java
+++ b/platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffPanelOptions.java
@@ -59,7 +59,7 @@
}
public void showSource(@Nullable OpenFileDescriptor descriptor) {
- if (descriptor == null || myDiffPanel.getProject() == null) return;
+ if (descriptor == null || myDiffPanel.getProject() == null || myDiffPanel.getProject().isDefault()) return;
myShowSourcePolicy.showSource(descriptor, myDiffPanel);
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java
index e1c160f..b08b0c4 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java
@@ -39,11 +39,13 @@
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
import com.intellij.openapi.editor.impl.EditorImpl;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import com.intellij.psi.tree.IElementType;
import com.intellij.util.EditorPopupHandler;
import org.jetbrains.annotations.NotNull;
@@ -252,11 +254,20 @@
return isWordEnd(chars, offset, isCamel) || !isWordStart(chars, offset, isCamel) && isLexemeBoundary(editor, offset);
}
+ /**
+ * Finds out whether there's a boundary between two lexemes of different type at given offset.
+ */
public static boolean isLexemeBoundary(@NotNull Editor editor, int offset) {
if (!(editor instanceof EditorEx) || offset <= 0 || offset >= editor.getDocument().getTextLength()) return false;
EditorHighlighter highlighter = ((EditorEx)editor).getHighlighter();
HighlighterIterator it = highlighter.createIterator(offset);
- return it.getStart() == offset;
+ if (it.getStart() != offset) {
+ return false;
+ }
+ IElementType rightToken = it.getTokenType();
+ it.retreat();
+ IElementType leftToken = it.getTokenType();
+ return !Comparing.equal(leftToken, rightToken);
}
public static boolean isWordStart(@NotNull CharSequence text, int offset, boolean isCamel) {
@@ -542,6 +553,18 @@
}
public static void moveCaretToLineEnd(@NotNull Editor editor, boolean isWithSelection) {
+ moveCaretToLineEnd(editor, isWithSelection, true);
+ }
+
+ /**
+ * Moves caret to visual line end.
+ *
+ * @param editor target editor
+ * @param isWithSelection whether selection should be set from original caret position to its target position
+ * @param ignoreTrailingWhitespace if <code>true</code>, line end will be determined while ignoring trailing whitespace, unless caret is
+ * already at so-determined target position, in which case trailing whitespace will be taken into account
+ */
+ public static void moveCaretToLineEnd(@NotNull Editor editor, boolean isWithSelection, boolean ignoreTrailingWhitespace) {
Document document = editor.getDocument();
SelectionModel selectionModel = editor.getSelectionModel();
int selectionStart = selectionModel.getLeadSelectionOffset();
@@ -604,7 +627,7 @@
// Move to the calculated end of visual line if caret is located on a last non-white space symbols on a line and there are
// remaining white space symbols.
- if (newOffset == offset || newOffset == caretModel.getOffset()) {
+ if (newOffset == offset || newOffset == caretModel.getOffset() || !ignoreTrailingWhitespace) {
caretModel.moveToVisualPosition(visualEndOfLineWithCaret);
}
else {
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/LineEndAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/LineEndAction.java
index 9fcbbe8..8777955 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/LineEndAction.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/LineEndAction.java
@@ -25,8 +25,10 @@
package com.intellij.openapi.editor.actions;
import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
+import com.intellij.openapi.editor.textarea.TextComponentEditor;
public class LineEndAction extends TextComponentEditorAction {
public LineEndAction() {
@@ -39,8 +41,8 @@
}
@Override
- public void execute(Editor editor, DataContext dataContext) {
- EditorActionUtil.moveCaretToLineEnd(editor, false);
+ protected void doExecute(Editor editor, Caret caret, DataContext dataContext) {
+ EditorActionUtil.moveCaretToLineEnd(editor, false, !(editor instanceof TextComponentEditor));
}
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/LineEndWithSelectionAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/LineEndWithSelectionAction.java
index 3b7ce32..b9eec81 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/LineEndWithSelectionAction.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/LineEndWithSelectionAction.java
@@ -25,8 +25,10 @@
package com.intellij.openapi.editor.actions;
import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
+import com.intellij.openapi.editor.textarea.TextComponentEditor;
public class LineEndWithSelectionAction extends TextComponentEditorAction {
public LineEndWithSelectionAction() {
@@ -39,8 +41,8 @@
}
@Override
- public void execute(Editor editor, DataContext dataContext) {
- EditorActionUtil.moveCaretToLineEnd(editor, true);
+ protected void doExecute(Editor editor, Caret caret, DataContext dataContext) {
+ EditorActionUtil.moveCaretToLineEnd(editor, true, !(editor instanceof TextComponentEditor));
}
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/util/EditorUtil.java b/platform/platform-impl/src/com/intellij/openapi/editor/ex/util/EditorUtil.java
index e4da9a4..0b960c0 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/ex/util/EditorUtil.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/ex/util/EditorUtil.java
@@ -866,6 +866,36 @@
int line = document.getLineNumber(offset);
return offset == document.getLineEndOffset(line);
}
+
+ /**
+ * Setting selection using {@link SelectionModel#setSelection(int, int)} or {@link Caret#setSelection(int, int)} methods can result
+ * in resulting selection range to be larger than requested (in case requested range intersects with collapsed fold regions).
+ * This method will make sure interfering collapsed regions are expanded first, so that resulting selection range is exactly as
+ * requested.
+ */
+ public static void setSelectionExpandingFoldedRegionsIfNeeded(@NotNull Editor editor, int startOffset, int endOffset) {
+ FoldingModel foldingModel = editor.getFoldingModel();
+ FoldRegion startFoldRegion = foldingModel.getCollapsedRegionAtOffset(startOffset);
+ if (startFoldRegion != null && (startFoldRegion.getStartOffset() == startOffset || startFoldRegion.isExpanded())) {
+ startFoldRegion = null;
+ }
+ FoldRegion endFoldRegion = foldingModel.getCollapsedRegionAtOffset(endOffset);
+ if (endFoldRegion != null && (endFoldRegion.getStartOffset() == endOffset || endFoldRegion.isExpanded())) {
+ endFoldRegion = null;
+ }
+ if (startFoldRegion != null || endFoldRegion != null) {
+ final FoldRegion finalStartFoldRegion = startFoldRegion;
+ final FoldRegion finalEndFoldRegion = endFoldRegion;
+ foldingModel.runBatchFoldingOperation(new Runnable() {
+ @Override
+ public void run() {
+ if (finalStartFoldRegion != null) finalStartFoldRegion.setExpanded(true);
+ if (finalEndFoldRegion != null) finalEndFoldRegion.setExpanded(true);
+ }
+ });
+ }
+ editor.getSelectionModel().setSelection(startOffset, endOffset);
+ }
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java
index 134d571..29defee 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java
@@ -28,10 +28,7 @@
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.FoldRegion;
-import com.intellij.openapi.editor.FoldingGroup;
-import com.intellij.openapi.editor.LogicalPosition;
-import com.intellij.openapi.editor.ScrollingModel;
+import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.ex.DocumentEx;
@@ -40,6 +37,7 @@
import com.intellij.openapi.editor.ex.PrioritizedDocumentListener;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.Key;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
@@ -51,6 +49,8 @@
public class FoldingModelImpl implements FoldingModelEx, PrioritizedDocumentListener, Dumpable {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.impl.EditorFoldingModelImpl");
+
+ private static final Key<LogicalPosition> SAVED_CARET_POSITION = Key.create("saved.position.before.folding");
private final List<FoldingListener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList();
@@ -62,10 +62,7 @@
private boolean myDoNotCollapseCaret;
private boolean myFoldRegionsProcessed;
- private int mySavedCaretX;
- private int mySavedCaretY;
private int mySavedCaretShift;
- private boolean myCaretPositionSaved;
private final MultiMap<FoldingGroup, FoldRegion> myGroups = new MultiMap<FoldingGroup, FoldRegion>();
private boolean myDocumentChangeProcessed = true;
@@ -317,13 +314,15 @@
LOG.error("Fold regions must be collapsed or expanded inside batchFoldProcessing() only.");
}
- if (myCaretPositionSaved) {
- int savedOffset = myEditor.logicalPositionToOffset(new LogicalPosition(mySavedCaretY, mySavedCaretX));
+ for (Caret caret : myEditor.getCaretModel().getAllCarets()) {
+ LogicalPosition savedPosition = caret.getUserData(SAVED_CARET_POSITION);
+ if (savedPosition != null) {
+ int savedOffset = myEditor.logicalPositionToOffset(savedPosition);
- FoldRegion[] allCollapsed = myFoldTree.fetchCollapsedAt(savedOffset);
- if (allCollapsed.length == 1 && allCollapsed[0] == region) {
- LogicalPosition pos = new LogicalPosition(mySavedCaretY, mySavedCaretX);
- myEditor.getCaretModel().moveToLogicalPosition(pos);
+ FoldRegion[] allCollapsed = myFoldTree.fetchCollapsedAt(savedOffset);
+ if (allCollapsed.length == 1 && allCollapsed[0] == region) {
+ caret.moveToLogicalPosition(savedPosition);
+ }
}
}
@@ -340,17 +339,23 @@
LOG.error("Fold regions must be collapsed or expanded inside batchFoldProcessing() only.");
}
- LogicalPosition caretPosition = myEditor.getCaretModel().getLogicalPosition();
-
- int caretOffset = myEditor.logicalPositionToOffset(caretPosition);
-
- if (FoldRegionsTree.contains(region, caretOffset)) {
- if (myDoNotCollapseCaret) return;
-
- if (!myCaretPositionSaved) {
- mySavedCaretX = caretPosition.column;
- mySavedCaretY = caretPosition.line;
- myCaretPositionSaved = true;
+ List<Caret> carets = myEditor.getCaretModel().getAllCarets();
+ for (Caret caret : carets) {
+ LogicalPosition caretPosition = caret.getLogicalPosition();
+ int caretOffset = myEditor.logicalPositionToOffset(caretPosition);
+
+ if (FoldRegionsTree.contains(region, caretOffset)) {
+ if (myDoNotCollapseCaret) return;
+ }
+ }
+ for (Caret caret : carets) {
+ LogicalPosition caretPosition = caret.getLogicalPosition();
+ int caretOffset = myEditor.logicalPositionToOffset(caretPosition);
+
+ if (FoldRegionsTree.contains(region, caretOffset)) {
+ if (caret.getUserData(SAVED_CARET_POSITION) == null) {
+ caret.putUserData(SAVED_CARET_POSITION, caretPosition.withoutVisualPositionInfo());
+ }
}
}
@@ -371,59 +376,54 @@
myEditor.getGutterComponentEx().updateSize();
myEditor.getGutterComponentEx().repaint();
- LogicalPosition caretPosition = myEditor.getCaretModel().getLogicalPosition();
- // There is a possible case that caret position is already visual position aware. But visual position depends on number of folded
- // logical lines as well, hence, we can't be sure that target logical position defines correct visual position because fold
- // regions have just changed. Hence, we use 'raw' logical position instead.
- if (caretPosition.visualPositionAware) {
- caretPosition = new LogicalPosition(caretPosition.line, caretPosition.column);
- }
- int caretOffset = myEditor.logicalPositionToOffset(caretPosition);
- int selectionStart = myEditor.getSelectionModel().getSelectionStart();
- int selectionEnd = myEditor.getSelectionModel().getSelectionEnd();
+ for (Caret caret : myEditor.getCaretModel().getAllCarets()) {
+ // There is a possible case that caret position is already visual position aware. But visual position depends on number of folded
+ // logical lines as well, hence, we can't be sure that target logical position defines correct visual position because fold
+ // regions have just changed. Hence, we use 'raw' logical position instead.
+ LogicalPosition caretPosition = caret.getLogicalPosition().withoutVisualPositionInfo();
+ int caretOffset = myEditor.logicalPositionToOffset(caretPosition);
+ int selectionStart = caret.getSelectionStart();
+ int selectionEnd = caret.getSelectionEnd();
- int column = -1;
- int line = -1;
- int offsetToUse = -1;
+ LogicalPosition positionToUse = null;
+ int offsetToUse = -1;
- FoldRegion collapsed = myFoldTree.fetchOutermost(caretOffset);
- if (myCaretPositionSaved) {
- int savedOffset = myEditor.logicalPositionToOffset(new LogicalPosition(mySavedCaretY, mySavedCaretX));
- FoldRegion collapsedAtSaved = myFoldTree.fetchOutermost(savedOffset);
- if (collapsedAtSaved == null) {
- column = mySavedCaretX;
- line = mySavedCaretY;
+ FoldRegion collapsed = myFoldTree.fetchOutermost(caretOffset);
+ LogicalPosition savedPosition = caret.getUserData(SAVED_CARET_POSITION);
+ if (savedPosition != null) {
+ int savedOffset = myEditor.logicalPositionToOffset(savedPosition);
+ FoldRegion collapsedAtSaved = myFoldTree.fetchOutermost(savedOffset);
+ if (collapsedAtSaved == null) {
+ positionToUse = savedPosition;
+ }
+ else {
+ offsetToUse = collapsedAtSaved.getStartOffset();
+ }
}
- else {
- offsetToUse = collapsedAtSaved.getStartOffset();
+
+ if (collapsed != null && positionToUse == null) {
+ positionToUse = myEditor.offsetToLogicalPosition(collapsed.getStartOffset());
}
- }
- if (collapsed != null && column == -1) {
- line = collapsed.getDocument().getLineNumber(collapsed.getStartOffset());
- column = myEditor.offsetToLogicalPosition(collapsed.getStartOffset()).column;
- }
-
- boolean oldCaretPositionSaved = myCaretPositionSaved;
-
- if (moveCaretFromCollapsedRegion && myEditor.getCaretModel().isUpToDate()) {
- if (offsetToUse >= 0) {
- myEditor.getCaretModel().moveToOffset(offsetToUse);
+ if (moveCaretFromCollapsedRegion && caret.isUpToDate()) {
+ if (offsetToUse >= 0) {
+ caret.moveToOffset(offsetToUse);
+ }
+ else if (positionToUse != null) {
+ caret.moveToLogicalPosition(positionToUse);
+ }
+ else {
+ caret.moveToLogicalPosition(caretPosition);
+ }
}
- else if (column != -1) {
- myEditor.getCaretModel().moveToLogicalPosition(new LogicalPosition(line, column));
- }
- else {
- myEditor.getCaretModel().moveToLogicalPosition(caretPosition);
- }
- }
- myCaretPositionSaved = oldCaretPositionSaved;
+ caret.putUserData(SAVED_CARET_POSITION, savedPosition);
- if (isOffsetInsideCollapsedRegion(selectionStart) || isOffsetInsideCollapsedRegion(selectionEnd)) {
- myEditor.getSelectionModel().removeSelection();
- } else if (selectionStart < myEditor.getDocument().getTextLength()) {
- myEditor.getSelectionModel().setSelection(selectionStart, selectionEnd);
+ if (isOffsetInsideCollapsedRegion(selectionStart) || isOffsetInsideCollapsedRegion(selectionEnd)) {
+ caret.removeSelection();
+ } else if (selectionStart < myEditor.getDocument().getTextLength()) {
+ caret.setSelection(selectionStart, selectionEnd);
+ }
}
if (mySavedCaretShift > 0) {
@@ -490,7 +490,9 @@
}
public void flushCaretPosition() {
- myCaretPositionSaved = false;
+ for (Caret caret : myEditor.getCaretModel().getAllCarets()) {
+ caret.putUserData(SAVED_CARET_POSITION, null);
+ }
}
void onBulkDocumentUpdateStarted() {
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java
index 1cf6b6f..ada2456 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java
@@ -114,7 +114,8 @@
private final List<Pair<VirtualFile, EditorWindow>> mySelectionHistory = new ArrayList<Pair<VirtualFile, EditorWindow>>();
private Reference<EditorComposite> myLastSelectedComposite = new WeakReference<EditorComposite>(null);
- private final MergingUpdateQueue myQueue = new MergingUpdateQueue("FileEditorManagerUpdateQueue", 50, true, null);
+ private final MergingUpdateQueue myQueue = new MergingUpdateQueue("FileEditorManagerUpdateQueue", 50, true,
+ MergingUpdateQueue.ANY_COMPONENT);
private final BusyObject.Impl.Simple myBusyObject = new BusyObject.Impl.Simple();
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorComponent.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorComponent.java
index a476264b..d24b810 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorComponent.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorComponent.java
@@ -133,7 +133,9 @@
*/
void dispose(){
myDocument.removeDocumentListener(myDocumentListener);
- EditorHistoryManager.getInstance(myProject).updateHistoryEntry(myFile, false);
+ if (!myProject.isDefault()) { // There's no EditorHistoryManager for default project (which is used in diff command-line application)
+ EditorHistoryManager.getInstance(myProject).updateHistoryEntry(myFile, false);
+ }
disposeEditor(myEditor);
myConnection.disconnect();
@@ -276,7 +278,8 @@
final Editor e = validateCurrentEditor();
if (e == null) return null;
- if (!myProject.isDisposed()) {
+ // There's no FileEditorManager for default project (which is used in diff command-line application)
+ if (!myProject.isDisposed() && !myProject.isDefault()) {
final Object o = FileEditorManager.getInstance(myProject).getData(dataId, e, e.getCaretModel().getCurrentCaret());
if (o != null) return o;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java
index bd40c3a..c8212fe 100644
--- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java
+++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -36,6 +36,7 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.popup.JBPopup;
+import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.ListPopupStep;
import com.intellij.openapi.ui.popup.PopupStep;
import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
@@ -571,9 +572,20 @@
}
@Override
- public void performAction(final InputEvent e, @NotNull final AnAction action, @NotNull final AnActionEvent actionEvent) {
+ public void performAction(@NotNull InputEvent e, @NotNull AnAction action, @NotNull AnActionEvent actionEvent) {
e.consume();
- action.actionPerformed(actionEvent);
+
+ DataContext ctx = actionEvent.getDataContext();
+ if (action instanceof ActionGroup && !((ActionGroup)action).canBePerformed(ctx)) {
+ ActionGroup group = (ActionGroup)action;
+ JBPopupFactory.getInstance()
+ .createActionGroupPopup(group.getTemplatePresentation().getText(), group, ctx, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false)
+ .showInBestPositionFor(ctx);
+ }
+ else {
+ action.actionPerformed(actionEvent);
+ }
+
if (Registry.is("actionSystem.fixLostTyping")) {
IdeEventQueue.getInstance().doWhenReady(new Runnable() {
@Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/ActionsTree.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/ActionsTree.java
index 79a0d53..e8136e7 100644
--- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/ActionsTree.java
+++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/ActionsTree.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -56,7 +56,6 @@
public class ActionsTree {
private static final Icon EMPTY_ICON = EmptyIcon.ICON_18;
- private static final Icon OPEN_ICON = new DefaultTreeCellRenderer().getOpenIcon();
private static final Icon CLOSE_ICON = AllIcons.Nodes.Folder;
private final JTree myTree;
@@ -161,6 +160,7 @@
Object userObject = getSelectedObject();
if (userObject instanceof String) return (String)userObject;
if (userObject instanceof QuickList) return ((QuickList)userObject).getActionId();
+ if (userObject instanceof Group) return ((Group)userObject).getId();
return null;
}
@@ -322,7 +322,8 @@
}
}
}
- return false;
+
+ return isActionChanged(group.getId(), oldKeymap, newKeymap);
}
public void selectAction(String actionId) {
@@ -473,7 +474,8 @@
private class KeymapsRenderer extends ColoredTreeCellRenderer {
// Make sure that the text rendered by this method is 'searchable' via com.intellij.openapi.keymap.impl.ui.ActionsTree.filter method.
- public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
+ @Override
+ public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
final boolean showIcons = UISettings.getInstance().SHOW_ICONS_IN_MENUS;
Keymap originalKeymap = myKeymap != null ? myKeymap.getParent() : null;
Icon icon = null;
@@ -531,7 +533,7 @@
}
if (showIcons) {
- setIcon(ActionsTree.getEvenIcon(icon));
+ setIcon(getEvenIcon(icon));
}
Color foreground;
@@ -556,6 +558,7 @@
}
}
+ @SuppressWarnings("UseJBColor")
private void paintRowData(Tree tree, Object data, Rectangle bounds, Graphics2D g) {
Shortcut[] shortcuts = null;
Set<String> abbreviations = null;
@@ -567,6 +570,9 @@
else if (data instanceof QuickList) {
shortcuts = myKeymap.getShortcuts(((QuickList)data).getActionId());
}
+ else if (data instanceof Group) {
+ shortcuts = myKeymap.getShortcuts(((Group)data).getId());
+ }
final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
diff --git a/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java
index eab5684..e885101 100644
--- a/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java
@@ -20,7 +20,6 @@
import com.intellij.openapi.application.ex.DecodeDefaultsUtil;
import com.intellij.openapi.components.RoamingType;
import com.intellij.openapi.components.ServiceManager;
-import com.intellij.openapi.components.StateStorageException;
import com.intellij.openapi.components.impl.stores.DirectoryBasedStorage;
import com.intellij.openapi.components.impl.stores.DirectoryStorageData;
import com.intellij.openapi.components.impl.stores.StorageUtil;
@@ -503,6 +502,7 @@
}
}
+ List<Throwable> errors = null;
VirtualFile dir = getVirtualDir();
if (!hasSchemes) {
myFilesToDelete.clear();
@@ -510,14 +510,14 @@
try {
StorageUtil.deleteFile(this, dir);
}
- catch (IOException e) {
- throw new StateStorageException(e);
+ catch (Throwable e) {
+ errors = new SmartList<Throwable>();
+ errors.add(e);
}
}
return;
}
- List<Throwable> errors = null;
for (E scheme : schemesToSave) {
try {
saveScheme(scheme, nameGenerator);
@@ -530,7 +530,7 @@
}
}
- deleteFiles(dir);
+ errors = deleteFiles(dir, errors);
CompoundRuntimeException.doThrow(errors);
}
@@ -620,9 +620,10 @@
return !scheme.getName().equals(scheme.getExternalInfo().getPreviouslySavedName());
}
- private void deleteFiles(@Nullable VirtualFile dir) {
+ @Nullable
+ private List<Throwable> deleteFiles(@Nullable VirtualFile dir, List<Throwable> errors) {
if (myFilesToDelete.isEmpty()) {
- return;
+ return errors;
}
if (myProvider != null && myProvider.isEnabled()) {
@@ -639,7 +640,15 @@
try {
for (VirtualFile file : dir.getChildren()) {
if (myFilesToDelete.contains(file.getNameWithoutExtension())) {
- DirectoryBasedStorage.deleteFile(file, this);
+ try {
+ file.delete(this);
+ }
+ catch (IOException e) {
+ if (errors == null) {
+ errors = new SmartList<Throwable>();
+ }
+ errors.add(e);
+ }
}
}
myFilesToDelete.clear();
@@ -648,6 +657,7 @@
token.finish();
}
}
+ return errors;
}
@Nullable
diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsDialog.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsDialog.java
index 39b0afd..71e9b30 100644
--- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsDialog.java
+++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsDialog.java
@@ -123,7 +123,10 @@
if (reset != null && myResetButtonNeeded) {
actions.add(reset);
}
- actions.add(getHelpAction());
+ String topic = myEditor.getHelpTopic();
+ if (topic != null) {
+ actions.add(getHelpAction());
+ }
return actions.toArray(new Action[actions.size()]);
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsEditor.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsEditor.java
index ba7cf59..cc84882 100644
--- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsEditor.java
+++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsEditor.java
@@ -306,7 +306,7 @@
}
configurable = myFilter.myContext.getParentConfigurable(configurable);
}
- return null;
+ return "preferences";
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsTreeView.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsTreeView.java
index 8e4cbbc..c55b359 100644
--- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsTreeView.java
+++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsTreeView.java
@@ -24,6 +24,7 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.*;
import com.intellij.ui.components.GradientViewport;
import com.intellij.ui.treeStructure.CachingSimpleNode;
@@ -33,8 +34,11 @@
import com.intellij.ui.treeStructure.filtered.FilteringTreeBuilder;
import com.intellij.ui.treeStructure.filtered.FilteringTreeStructure;
import com.intellij.util.ArrayUtil;
+import com.intellij.util.NullableFunction;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.ButtonlessScrollBarUI;
import com.intellij.util.ui.GraphicsUtil;
+import com.intellij.util.ui.TextTransferable;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.tree.TreeUtil;
import com.intellij.util.ui.tree.WideSelectionTreeUI;
@@ -54,6 +58,7 @@
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
import java.awt.*;
+import java.awt.datatransfer.Transferable;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.KeyEvent;
@@ -106,6 +111,38 @@
myTree.setExpandableItemsEnabled(false);
RelativeFont.BOLD.install(myTree);
+ myTree.setTransferHandler(new TransferHandler() {
+ @Nullable
+ @Override
+ protected Transferable createTransferable(JComponent c) {
+ final TreePath path = myTree.getPathForRow(myTree.getLeadSelectionRow());
+ if (path != null) {
+ final String pathInTheTree = StringUtil.join(ContainerUtil.mapNotNull(path.getPath(), new NullableFunction<Object, String>() {
+ @Nullable
+ @Override
+ public String fun(Object o) {
+ if (o == path.getPath()[0]) {
+ return null;
+ }
+ else {
+ final MyNode node = extractNode(o);
+ return node != null ? node.myDisplayName : null;
+ }
+ }
+ }), " | ");
+ if (!StringUtil.isEmpty(pathInTheTree)) {
+ return new TextTransferable("File | Settings | " + pathInTheTree);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public int getSourceActions(JComponent c) {
+ return COPY;
+ }
+ });
+
myScroller = ScrollPaneFactory.createScrollPane(null, true);
myScroller.setViewport(new GradientViewport(myTree, 5, 0, 0, 0, true) {
private JLabel myHeader;
diff --git a/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressWindow.form b/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressDialog.form
similarity index 98%
rename from platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressWindow.form
rename to platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressDialog.form
index 533fd88..14fbefd 100644
--- a/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressWindow.form
+++ b/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressDialog.form
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.openapi.progress.util.ProgressWindow.MyDialog">
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.openapi.progress.util.ProgressDialog">
<grid id="ee919" binding="myPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
diff --git a/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressDialog.java b/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressDialog.java
new file mode 100644
index 0000000..b373d78
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressDialog.java
@@ -0,0 +1,448 @@
+/*
+ * Copyright 2000-2015 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 com.intellij.openapi.progress.util;
+
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.DialogWrapper;
+import com.intellij.openapi.ui.DialogWrapperPeer;
+import com.intellij.openapi.ui.impl.DialogWrapperPeerImpl;
+import com.intellij.openapi.ui.impl.FocusTrackbackProvider;
+import com.intellij.openapi.ui.impl.GlassPaneDialogWrapperPeer;
+import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.wm.WindowManager;
+import com.intellij.openapi.wm.ex.WindowManagerEx;
+import com.intellij.ui.FocusTrackback;
+import com.intellij.ui.PopupBorder;
+import com.intellij.ui.TitlePanel;
+import com.intellij.ui.awt.RelativePoint;
+import com.intellij.ui.components.JBLabel;
+import com.intellij.util.Alarm;
+import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import javax.swing.border.Border;
+import java.awt.*;
+import java.awt.event.*;
+import java.io.File;
+
+
+class ProgressDialog implements Disposable {
+ private final ProgressWindow myProgressWindow;
+ private long myLastTimeDrawn = -1;
+ private volatile boolean myShouldShowBackground;
+ private final Alarm myUpdateAlarm = new Alarm(this);
+ boolean myWasShown;
+
+ final Runnable myRepaintRunnable = new Runnable() {
+ @Override
+ public void run() {
+ String text = myProgressWindow.getText();
+ double fraction = myProgressWindow.getFraction();
+ String text2 = myProgressWindow.getText2();
+
+ myTextLabel.setText(text != null && !text.isEmpty() ? text : " ");
+
+ if (myProgressBar.isShowing()) {
+ final int perc = (int)(fraction * 100);
+ myProgressBar.setIndeterminate(perc == 0 || myProgressWindow.isIndeterminate());
+ myProgressBar.setValue(perc);
+ }
+
+ myText2Label.setText(getTitle2Text(text2, myText2Label.getWidth()));
+
+ myTitlePanel.setText(myProgressWindow.getTitle() != null && !myProgressWindow.getTitle().isEmpty() ? myProgressWindow.getTitle() : " ");
+
+ myLastTimeDrawn = System.currentTimeMillis();
+ myRepaintedFlag = true;
+ }
+ };
+
+ private String getTitle2Text(String fullText, int labelWidth) {
+ if (fullText == null || fullText.isEmpty()) return " ";
+ while (myText2Label.getFontMetrics(myText2Label.getFont()).stringWidth(fullText) > labelWidth) {
+ int sep = fullText.indexOf(File.separatorChar, 4);
+ if (sep < 0) return fullText;
+ fullText = "..." + fullText.substring(sep);
+ }
+
+ return fullText;
+ }
+
+ private final Runnable myUpdateRequest = new Runnable() {
+ @Override
+ public void run() {
+ update();
+ }
+ };
+
+ JPanel myPanel;
+
+ private JLabel myTextLabel;
+ private JBLabel myText2Label;
+
+ private JButton myCancelButton;
+ private JButton myBackgroundButton;
+
+ private JProgressBar myProgressBar;
+ private boolean myRepaintedFlag = true;
+ private TitlePanel myTitlePanel;
+ private JPanel myInnerPanel;
+ DialogWrapper myPopup;
+ private final Window myParentWindow;
+ private Point myLastClicked;
+
+ public ProgressDialog(ProgressWindow progressWindow, boolean shouldShowBackground, Project project, String cancelText) {
+ myProgressWindow = progressWindow;
+ Window parentWindow = WindowManager.getInstance().suggestParentWindow(project);
+ if (parentWindow == null) {
+ parentWindow = WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow();
+ }
+ myParentWindow = parentWindow;
+
+ initDialog(shouldShowBackground, cancelText);
+ }
+
+ public ProgressDialog(ProgressWindow progressWindow, boolean shouldShowBackground, Component parent, String cancelText) {
+ myProgressWindow = progressWindow;
+ myParentWindow = parent instanceof Window
+ ? (Window)parent
+ : (Window)SwingUtilities.getAncestorOfClass(Window.class, parent);
+ initDialog(shouldShowBackground, cancelText);
+ }
+
+ private void initDialog(boolean shouldShowBackground, String cancelText) {
+ if (SystemInfo.isMac) {
+ UIUtil.applyStyle(UIUtil.ComponentStyle.SMALL, myText2Label);
+ }
+ myInnerPanel.setPreferredSize(new Dimension(SystemInfo.isMac ? 350 : 450, -1));
+
+ myCancelButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ doCancelAction();
+ }
+ });
+
+ myCancelButton.registerKeyboardAction(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (myCancelButton.isEnabled()) {
+ doCancelAction();
+ }
+ }
+ }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+
+ myShouldShowBackground = shouldShowBackground;
+ if (cancelText != null) {
+ myProgressWindow.setCancelButtonText(cancelText);
+ }
+ myProgressBar.setMaximum(100);
+ createCenterPanel();
+
+ myTitlePanel.setActive(true);
+ myTitlePanel.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mousePressed(MouseEvent e) {
+ final Point titleOffset = RelativePoint.getNorthWestOf(myTitlePanel).getScreenPoint();
+ myLastClicked = new RelativePoint(e).getScreenPoint();
+ myLastClicked.x -= titleOffset.x;
+ myLastClicked.y -= titleOffset.y;
+ }
+ });
+
+ myTitlePanel.addMouseMotionListener(new MouseMotionAdapter() {
+ @Override
+ public void mouseDragged(MouseEvent e) {
+ if (myLastClicked == null) {
+ return;
+ }
+ final Point draggedTo = new RelativePoint(e).getScreenPoint();
+ draggedTo.x -= myLastClicked.x;
+ draggedTo.y -= myLastClicked.y;
+
+ if (myPopup != null) {
+ myPopup.setLocation(draggedTo);
+ }
+ }
+ });
+ }
+
+ @Override
+ public void dispose() {
+ UIUtil.disposeProgress(myProgressBar);
+ UIUtil.dispose(myTitlePanel);
+ final ActionListener[] listeners = myCancelButton.getActionListeners();
+ for (ActionListener listener : listeners) {
+ myCancelButton.removeActionListener(listener);
+ }
+ }
+
+ JPanel getPanel() {
+ return myPanel;
+ }
+
+ void setShouldShowBackground(final boolean shouldShowBackground) {
+ myShouldShowBackground = shouldShowBackground;
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ myBackgroundButton.setVisible(shouldShowBackground);
+ myPanel.revalidate();
+ }
+ });
+ }
+
+ void changeCancelButtonText(String text) {
+ myCancelButton.setText(text);
+ }
+
+ private void doCancelAction() {
+ if (myProgressWindow.myShouldShowCancel) {
+ myProgressWindow.cancel();
+ }
+ }
+
+ void cancel() {
+ if (myProgressWindow.myShouldShowCancel) {
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ myCancelButton.setEnabled(false);
+ }
+ });
+ }
+ }
+
+ private void createCenterPanel() {
+ // Cancel button (if any)
+
+ if (myProgressWindow.myCancelText != null) {
+ myCancelButton.setText(myProgressWindow.myCancelText);
+ }
+ myCancelButton.setVisible(myProgressWindow.myShouldShowCancel);
+
+ myBackgroundButton.setVisible(myShouldShowBackground);
+ myBackgroundButton.addActionListener(
+ new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (myShouldShowBackground) {
+ myProgressWindow.background();
+ }
+ }
+ }
+ );
+ }
+
+ private static final int UPDATE_INTERVAL = 50; //msec. 20 frames per second.
+
+ synchronized void update() {
+ if (myRepaintedFlag) {
+ if (System.currentTimeMillis() > myLastTimeDrawn + UPDATE_INTERVAL) {
+ myRepaintedFlag = false;
+ SwingUtilities.invokeLater(myRepaintRunnable);
+ }
+ else {
+ // later to avoid concurrent dispose/addRequest
+ if (!myUpdateAlarm.isDisposed() && myUpdateAlarm.getActiveRequestCount() == 0) {
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ if (!myUpdateAlarm.isDisposed() && myUpdateAlarm.getActiveRequestCount() == 0) {
+ myUpdateAlarm.addRequest(myUpdateRequest, 500, myProgressWindow.getModalityState());
+ }
+ }
+ });
+ }
+ }
+ }
+ }
+
+ synchronized void background() {
+ if (myShouldShowBackground) {
+ myBackgroundButton.setEnabled(false);
+ }
+
+ hide();
+ }
+
+ void hide() {
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ if (myPopup != null) {
+ myPopup.close(DialogWrapper.CANCEL_EXIT_CODE);
+ myPopup = null;
+ }
+ }
+ });
+ }
+
+ void show() {
+ myWasShown = true;
+ if (ApplicationManager.getApplication().isHeadlessEnvironment()) return;
+ if (myParentWindow == null) return;
+ if (myPopup != null) {
+ myPopup.close(DialogWrapper.CANCEL_EXIT_CODE);
+ }
+
+ myPopup = myParentWindow.isShowing()
+ ? new MyDialogWrapper(myParentWindow, myProgressWindow.myShouldShowCancel)
+ : new MyDialogWrapper(myProgressWindow.myProject, myProgressWindow.myShouldShowCancel);
+ myPopup.setUndecorated(true);
+ if (SystemInfo.isAppleJvm) {
+ // With Apple JDK we look for MacMessage parent by the window title.
+ // Let's set just the title as the window title for simplicity.
+ myPopup.setTitle(myProgressWindow.getTitle());
+ }
+ if (myPopup.getPeer() instanceof DialogWrapperPeerImpl) {
+ ((DialogWrapperPeerImpl)myPopup.getPeer()).setAutoRequestFocus(false);
+ }
+ myPopup.pack();
+
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ if (myPopup != null) {
+ if (myPopup.getPeer() instanceof FocusTrackbackProvider) {
+ final FocusTrackback focusTrackback = ((FocusTrackbackProvider)myPopup.getPeer()).getFocusTrackback();
+ if (focusTrackback != null) {
+ focusTrackback.consume();
+ }
+ }
+
+ myProgressWindow.getFocusManager().requestFocus(myCancelButton, true);
+ }
+ }
+ });
+
+ myPopup.show();
+ }
+
+ boolean wasShown() {
+ return myProgressWindow.isShowing();
+ }
+
+ private class MyDialogWrapper extends DialogWrapper {
+ private final boolean myIsCancellable;
+
+ public MyDialogWrapper(Project project, final boolean cancellable) {
+ super(project, false);
+ init();
+ myIsCancellable = cancellable;
+ }
+
+ public MyDialogWrapper(Component parent, final boolean cancellable) {
+ super(parent, false);
+ init();
+ myIsCancellable = cancellable;
+ }
+
+ @Override
+ public void doCancelAction() {
+ if (myIsCancellable) {
+ super.doCancelAction();
+ }
+ }
+
+ @NotNull
+ @Override
+ protected DialogWrapperPeer createPeer(@NotNull final Component parent, final boolean canBeParent) {
+ if (System.getProperty("vintage.progress") == null) {
+ try {
+ return new GlassPaneDialogWrapperPeer(this, parent, canBeParent);
+ }
+ catch (GlassPaneDialogWrapperPeer.GlasspanePeerUnavailableException e) {
+ return super.createPeer(parent, canBeParent);
+ }
+ }
+ else {
+ return super.createPeer(parent, canBeParent);
+ }
+ }
+
+ @NotNull
+ @Override
+ protected DialogWrapperPeer createPeer(final boolean canBeParent, final boolean applicationModalIfPossible) {
+ return createPeer(null, canBeParent, applicationModalIfPossible);
+ }
+
+ @NotNull
+ @Override
+ protected DialogWrapperPeer createPeer(final Window owner, final boolean canBeParent, final boolean applicationModalIfPossible) {
+ if (System.getProperty("vintage.progress") == null) {
+ try {
+ return new GlassPaneDialogWrapperPeer(this, canBeParent);
+ }
+ catch (GlassPaneDialogWrapperPeer.GlasspanePeerUnavailableException e) {
+ return super.createPeer(WindowManager.getInstance().suggestParentWindow(myProgressWindow.myProject), canBeParent, applicationModalIfPossible);
+ }
+ }
+ else {
+ return super.createPeer(WindowManager.getInstance().suggestParentWindow(myProgressWindow.myProject), canBeParent, applicationModalIfPossible);
+ }
+ }
+
+ @NotNull
+ @Override
+ protected DialogWrapperPeer createPeer(final Project project, final boolean canBeParent) {
+ if (System.getProperty("vintage.progress") == null) {
+ try {
+ return new GlassPaneDialogWrapperPeer(this, project, canBeParent);
+ }
+ catch (GlassPaneDialogWrapperPeer.GlasspanePeerUnavailableException e) {
+ return super.createPeer(project, canBeParent);
+ }
+ }
+ else {
+ return super.createPeer(project, canBeParent);
+ }
+ }
+
+ @Override
+ protected void init() {
+ super.init();
+ setUndecorated(true);
+ myPanel.setBorder(PopupBorder.Factory.create(true, true));
+ }
+
+ @Override
+ protected boolean isProgressDialog() {
+ return true;
+ }
+
+ @Override
+ protected JComponent createCenterPanel() {
+ return myPanel;
+ }
+
+ @Override
+ @Nullable
+ protected JComponent createSouthPanel() {
+ return null;
+ }
+
+ @Override
+ @Nullable
+ protected Border createContentPaneBorder() {
+ return null;
+ }
+ }
+}
diff --git a/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressWindow.java b/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressWindow.java
index 8b56fb9..510c05d 100644
--- a/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressWindow.java
+++ b/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressWindow.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -21,29 +21,22 @@
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.ui.DialogWrapperPeer;
-import com.intellij.openapi.ui.impl.DialogWrapperPeerImpl;
-import com.intellij.openapi.ui.impl.FocusTrackbackProvider;
-import com.intellij.openapi.ui.impl.GlassPaneDialogWrapperPeer;
-import com.intellij.openapi.util.*;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.EmptyRunnable;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.openapi.wm.WindowManager;
-import com.intellij.openapi.wm.ex.WindowManagerEx;
import com.intellij.ui.FocusTrackback;
-import com.intellij.ui.PopupBorder;
-import com.intellij.ui.TitlePanel;
-import com.intellij.ui.awt.RelativePoint;
-import com.intellij.ui.components.JBLabel;
-import com.intellij.util.Alarm;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
-import javax.swing.border.Border;
import java.awt.*;
-import java.awt.event.*;
-import java.io.File;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
@SuppressWarnings({"NonStaticInitializer"})
public class ProgressWindow extends ProgressIndicatorBase implements BlockingProgressIndicator, Disposable {
@@ -56,14 +49,11 @@
*/
public static final int DEFAULT_PROGRESS_DIALOG_POSTPONE_TIME_MILLIS = 300;
- private static final int UPDATE_INTERVAL = 50; //msec. 20 frames per second.
+ private ProgressDialog myDialog;
- private MyDialog myDialog;
- private final Alarm myUpdateAlarm = new Alarm(this);
-
- private final Project myProject;
- private final boolean myShouldShowCancel;
- private String myCancelText;
+ final Project myProject;
+ final boolean myShouldShowCancel;
+ String myCancelText;
private String myTitle = null;
@@ -71,7 +61,6 @@
protected final FocusTrackback myFocusTrackback;
private boolean myStarted = false;
protected boolean myBackgrounded = false;
- private boolean myWasShown;
private String myProcessId = "<unknown>";
@Nullable private volatile Runnable myBackgroundHandler;
private int myDelayInMillis = DEFAULT_PROGRESS_DIALOG_POSTPONE_TIME_MILLIS;
@@ -105,10 +94,10 @@
}
if (parent == null) {
- myDialog = new MyDialog(shouldShowBackground, myProject, myCancelText);
+ myDialog = new ProgressDialog(this, shouldShowBackground, myProject, myCancelText);
}
else {
- myDialog = new MyDialog(shouldShowBackground, parent, myCancelText);
+ myDialog = new ProgressDialog(this, shouldShowBackground, parent, myCancelText);
}
Disposer.register(this, myDialog);
@@ -178,7 +167,7 @@
}
});
if (popup.isShowing()) {
- myWasShown = true;
+ myDialog.myWasShown = true;
}
}
}
@@ -241,7 +230,6 @@
return;
}
- myWasShown = true;
myDialog.show();
if (myDialog != null) {
myDialog.myRepaintRunnable.run();
@@ -365,395 +353,6 @@
return myTitle;
}
- protected class MyDialog implements Disposable {
- private long myLastTimeDrawn = -1;
- private volatile boolean myShouldShowBackground;
-
- private final Runnable myRepaintRunnable = new Runnable() {
- @Override
- public void run() {
- String text = getText();
- double fraction = getFraction();
- String text2 = getText2();
-
- myTextLabel.setText(text != null && !text.isEmpty() ? text : " ");
-
- if (myProgressBar.isShowing()) {
- final int perc = (int)(fraction * 100);
- myProgressBar.setIndeterminate(perc == 0 || isIndeterminate());
- myProgressBar.setValue(perc);
- }
-
- myText2Label.setText(getTitle2Text(text2, myText2Label.getWidth()));
-
- myTitlePanel.setText(myTitle != null && !myTitle.isEmpty() ? myTitle : " ");
-
- myLastTimeDrawn = System.currentTimeMillis();
- myRepaintedFlag = true;
- }
- };
-
- private String getTitle2Text(String fullText, int labelWidth) {
- if (fullText == null || fullText.isEmpty()) return " ";
- while (myText2Label.getFontMetrics(myText2Label.getFont()).stringWidth(fullText) > labelWidth) {
- int sep = fullText.indexOf(File.separatorChar, 4);
- if (sep < 0) return fullText;
- fullText = "..." + fullText.substring(sep);
- }
-
- return fullText;
- }
-
- private final Runnable myUpdateRequest = new Runnable() {
- @Override
- public void run() {
- update();
- }
- };
-
- private JPanel myPanel;
-
- private JLabel myTextLabel;
- private JBLabel myText2Label;
-
- private JButton myCancelButton;
- private JButton myBackgroundButton;
-
- private JProgressBar myProgressBar;
- private boolean myRepaintedFlag = true;
- private TitlePanel myTitlePanel;
- private JPanel myInnerPanel;
- private DialogWrapper myPopup;
- private final Window myParentWindow;
- private Point myLastClicked;
-
- public MyDialog(boolean shouldShowBackground, Project project, String cancelText) {
- Window parentWindow = WindowManager.getInstance().suggestParentWindow(project);
- if (parentWindow == null) {
- parentWindow = WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow();
- }
- myParentWindow = parentWindow;
-
- initDialog(shouldShowBackground, cancelText);
- }
-
- public MyDialog(boolean shouldShowBackground, Component parent, String cancelText) {
- myParentWindow = parent instanceof Window
- ? (Window)parent
- : (Window)SwingUtilities.getAncestorOfClass(Window.class, parent);
- initDialog(shouldShowBackground, cancelText);
- }
-
- private void initDialog(boolean shouldShowBackground, String cancelText) {
- if (SystemInfo.isMac) {
- UIUtil.applyStyle(UIUtil.ComponentStyle.SMALL, myText2Label);
- }
- myInnerPanel.setPreferredSize(new Dimension(SystemInfo.isMac ? 350 : 450, -1));
-
- myCancelButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- doCancelAction();
- }
- });
-
- myCancelButton.registerKeyboardAction(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- if (myCancelButton.isEnabled()) {
- doCancelAction();
- }
- }
- }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-
- myShouldShowBackground = shouldShowBackground;
- if (cancelText != null) {
- setCancelButtonText(cancelText);
- }
- myProgressBar.setMaximum(100);
- createCenterPanel();
-
- myTitlePanel.setActive(true);
- myTitlePanel.addMouseListener(new MouseAdapter() {
- @Override
- public void mousePressed(MouseEvent e) {
- final Point titleOffset = RelativePoint.getNorthWestOf(myTitlePanel).getScreenPoint();
- myLastClicked = new RelativePoint(e).getScreenPoint();
- myLastClicked.x -= titleOffset.x;
- myLastClicked.y -= titleOffset.y;
- }
- });
-
- myTitlePanel.addMouseMotionListener(new MouseMotionAdapter() {
- @Override
- public void mouseDragged(MouseEvent e) {
- if (myLastClicked == null) {
- return;
- }
- final Point draggedTo = new RelativePoint(e).getScreenPoint();
- draggedTo.x -= myLastClicked.x;
- draggedTo.y -= myLastClicked.y;
-
- if (myPopup != null) {
- myPopup.setLocation(draggedTo);
- }
- }
- });
- }
-
- @Override
- public void dispose() {
- UIUtil.disposeProgress(myProgressBar);
- UIUtil.dispose(myTitlePanel);
- final ActionListener[] listeners = myCancelButton.getActionListeners();
- for (ActionListener listener : listeners) {
- myCancelButton.removeActionListener(listener);
- }
-
- }
-
- private JPanel getPanel() {
- return myPanel;
- }
-
- private void setShouldShowBackground(final boolean shouldShowBackground) {
- myShouldShowBackground = shouldShowBackground;
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- myBackgroundButton.setVisible(shouldShowBackground);
- myPanel.revalidate();
- }
- });
- }
-
- private void changeCancelButtonText(String text) {
- myCancelButton.setText(text);
- }
-
- private void doCancelAction() {
- if (myShouldShowCancel) {
- ProgressWindow.this.cancel();
- }
- }
-
- private void cancel() {
- if (myShouldShowCancel) {
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- myCancelButton.setEnabled(false);
- }
- });
- }
- }
-
- private void createCenterPanel() {
- // Cancel button (if any)
-
- if (myCancelText != null) {
- myCancelButton.setText(myCancelText);
- }
- myCancelButton.setVisible(myShouldShowCancel);
-
- myBackgroundButton.setVisible(myShouldShowBackground);
- myBackgroundButton.addActionListener(
- new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- if (myShouldShowBackground) {
- ProgressWindow.this.background();
- }
- }
- }
- );
- }
-
- private synchronized void update() {
- if (myRepaintedFlag) {
- if (System.currentTimeMillis() > myLastTimeDrawn + UPDATE_INTERVAL) {
- myRepaintedFlag = false;
- SwingUtilities.invokeLater(myRepaintRunnable);
- }
- else {
- if (myUpdateAlarm.getActiveRequestCount() == 0 && !myUpdateAlarm.isDisposed()) {
- myUpdateAlarm.addRequest(myUpdateRequest, 500, getModalityState());
- }
- }
- }
- }
-
- private synchronized void background() {
- if (myShouldShowBackground) {
- myBackgroundButton.setEnabled(false);
- }
-
- hide();
- }
-
- private void hide() {
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- if (myPopup != null) {
- myPopup.close(DialogWrapper.CANCEL_EXIT_CODE);
- myPopup = null;
- }
- }
- });
- }
-
- private void show() {
- if (ApplicationManager.getApplication().isHeadlessEnvironment()) return;
- if (myParentWindow == null) return;
- if (myPopup != null) {
- myPopup.close(DialogWrapper.CANCEL_EXIT_CODE);
- }
-
- myPopup = myParentWindow.isShowing()
- ? new MyDialogWrapper(myParentWindow, myShouldShowCancel)
- : new MyDialogWrapper(myProject, myShouldShowCancel);
- myPopup.setUndecorated(true);
- if (SystemInfo.isAppleJvm) {
- // With Apple JDK we look for MacMessage parent by the window title.
- // Let's set just the title as the window title for simplicity.
- myPopup.setTitle(myTitle);
- }
- if (myPopup.getPeer() instanceof DialogWrapperPeerImpl) {
- ((DialogWrapperPeerImpl)myPopup.getPeer()).setAutoRequestFocus(false);
- }
- myPopup.pack();
-
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- if (myPopup != null) {
- if (myPopup.getPeer() instanceof FocusTrackbackProvider) {
- final FocusTrackback focusTrackback = ((FocusTrackbackProvider)myPopup.getPeer()).getFocusTrackback();
- if (focusTrackback != null) {
- focusTrackback.consume();
- }
- }
-
- getFocusManager().requestFocus(myCancelButton, true);
- }
- }
- });
-
- myPopup.show();
- }
-
- private boolean wasShown() {
- return myWasShown;
- }
-
- private class MyDialogWrapper extends DialogWrapper {
- private final boolean myIsCancellable;
-
- public MyDialogWrapper(Project project, final boolean cancellable) {
- super(project, false);
- init();
- myIsCancellable = cancellable;
- }
-
- public MyDialogWrapper(Component parent, final boolean cancellable) {
- super(parent, false);
- init();
- myIsCancellable = cancellable;
- }
-
- @Override
- public void doCancelAction() {
- if (myIsCancellable) {
- super.doCancelAction();
- }
- }
-
- @NotNull
- @Override
- protected DialogWrapperPeer createPeer(@NotNull final Component parent, final boolean canBeParent) {
- if (System.getProperty("vintage.progress") == null) {
- try {
- return new GlassPaneDialogWrapperPeer(this, parent, canBeParent);
- }
- catch (GlassPaneDialogWrapperPeer.GlasspanePeerUnavailableException e) {
- return super.createPeer(parent, canBeParent);
- }
- }
- else {
- return super.createPeer(parent, canBeParent);
- }
- }
-
- @NotNull
- @Override
- protected DialogWrapperPeer createPeer(final boolean canBeParent, final boolean applicationModalIfPossible) {
- return createPeer(null, canBeParent, applicationModalIfPossible);
- }
-
- @NotNull
- @Override
- protected DialogWrapperPeer createPeer(final Window owner, final boolean canBeParent, final boolean applicationModalIfPossible) {
- if (System.getProperty("vintage.progress") == null) {
- try {
- return new GlassPaneDialogWrapperPeer(this, canBeParent);
- }
- catch (GlassPaneDialogWrapperPeer.GlasspanePeerUnavailableException e) {
- return super.createPeer(WindowManager.getInstance().suggestParentWindow(myProject), canBeParent, applicationModalIfPossible);
- }
- }
- else {
- return super.createPeer(WindowManager.getInstance().suggestParentWindow(myProject), canBeParent, applicationModalIfPossible);
- }
- }
-
- @NotNull
- @Override
- protected DialogWrapperPeer createPeer(final Project project, final boolean canBeParent) {
- if (System.getProperty("vintage.progress") == null) {
- try {
- return new GlassPaneDialogWrapperPeer(this, project, canBeParent);
- }
- catch (GlassPaneDialogWrapperPeer.GlasspanePeerUnavailableException e) {
- return super.createPeer(project, canBeParent);
- }
- }
- else {
- return super.createPeer(project, canBeParent);
- }
- }
-
- @Override
- protected void init() {
- super.init();
- setUndecorated(true);
- myPanel.setBorder(PopupBorder.Factory.create(true, true));
- }
-
- @Override
- protected boolean isProgressDialog() {
- return true;
- }
-
- @Override
- protected JComponent createCenterPanel() {
- return myPanel;
- }
-
- @Override
- @Nullable
- protected JComponent createSouthPanel() {
- return null;
- }
-
- @Override
- @Nullable
- protected Border createContentPaneBorder() {
- return null;
- }
- }
- }
-
public void setBackgroundHandler(@Nullable Runnable backgroundHandler) {
myBackgroundHandler = backgroundHandler;
myDialog.setShouldShowBackground(backgroundHandler != null);
@@ -768,7 +367,7 @@
}
}
- private IdeFocusManager getFocusManager() {
+ IdeFocusManager getFocusManager() {
return IdeFocusManager.getInstance(myProject);
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java
index 88884e8..b02a2e4 100644
--- a/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java
@@ -64,7 +64,7 @@
private final Queue<Runnable> myRunWhenSmartQueue = new Queue<Runnable>(5);
private final Project myProject;
- private ThreadLocal<Boolean> myAlternativeResolution = new ThreadLocal<Boolean>();
+ private ThreadLocal<Integer> myAlternativeResolution = new ThreadLocal<Integer>();
public DumbServiceImpl(Project project) {
myProject = project;
@@ -108,13 +108,15 @@
@Override
public boolean isAlternativeResolveEnabled() {
- return Boolean.TRUE.equals(myAlternativeResolution.get());
+ return myAlternativeResolution.get() != null;
}
@Override
public void setAlternativeResolveEnabled(boolean enabled) {
- assert isAlternativeResolveEnabled() != enabled : "Nested alternative resolution mode is not supported";
- myAlternativeResolution.set(enabled);
+ Integer oldValue = myAlternativeResolution.get();
+ int newValue = (oldValue == null ? 0 : oldValue) + (enabled ? 1 : -1);
+ assert newValue >= 0 : "Non-paired alternative resolution mode";
+ myAlternativeResolution.set(newValue == 0 ? null : newValue);
}
@Override
@@ -306,7 +308,12 @@
semaphore.up();
}
});
- semaphore.waitFor();
+ while (true) {
+ if (semaphore.waitFor(50)) {
+ return;
+ }
+ ProgressManager.checkCanceled();
+ }
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java
index 939eace..187364b 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java
@@ -20,10 +20,7 @@
import com.intellij.ide.plugins.*;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.notification.*;
-import com.intellij.openapi.application.ApplicationInfo;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.ApplicationNamesInfo;
-import com.intellij.openapi.application.PathManager;
+import com.intellij.openapi.application.*;
import com.intellij.openapi.application.ex.ApplicationInfoEx;
import com.intellij.openapi.diagnostic.IdeaLoggingEvent;
import com.intellij.openapi.diagnostic.LogUtil;
@@ -200,7 +197,7 @@
callback.setDone();
}
}
- });
+ }, ModalityState.NON_MODAL);
}
@NotNull
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginAdvertiserEditorNotificationProvider.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginAdvertiserEditorNotificationProvider.java
index 11d69d5..9d7d8d6 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginAdvertiserEditorNotificationProvider.java
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginAdvertiserEditorNotificationProvider.java
@@ -183,6 +183,6 @@
}
private static UnknownFeature createExtensionFeature(String extension) {
- return new UnknownFeature(FileTypeFactory.FILE_TYPE_FACTORY_EP.getName(), extension);
+ return new UnknownFeature(FileTypeFactory.FILE_TYPE_FACTORY_EP.getName(), "File Type", extension);
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java
index 21eede8..0720858 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java
@@ -39,7 +39,10 @@
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.reference.SoftReference;
import com.intellij.ui.EditorNotifications;
+import com.intellij.util.Function;
import com.intellij.util.PlatformUtils;
+import com.intellij.util.containers.LinkedMultiMap;
+import com.intellij.util.containers.MultiMap;
import com.intellij.util.io.HttpRequests;
import com.intellij.util.xmlb.XmlSerializer;
import com.intellij.util.xmlb.annotations.MapAnnotation;
@@ -238,6 +241,7 @@
private final Map<Plugin, IdeaPluginDescriptor> myDisabledPlugins = new HashMap<Plugin, IdeaPluginDescriptor>();
private List<String> myBundledPlugin;
+ private final MultiMap<String, UnknownFeature> myFeatures = new MultiMap<String, UnknownFeature>();
@Override
public void run() {
@@ -256,6 +260,7 @@
if (pluginId != null) {
for (Plugin plugin : pluginId) {
ids.put(plugin.myPluginId, plugin);
+ myFeatures.putValue(plugin.myPluginId, feature);
}
}
}
@@ -299,8 +304,7 @@
private void onSuccess() {
String message = null;
if (!myPlugins.isEmpty() || !myDisabledPlugins.isEmpty()) {
- message = "Features covered by non-bundled plugins are detected.<br>";
-
+ message = getAddressedMessagePresentation();
if (!myDisabledPlugins.isEmpty()) {
message += "<a href=\"enable\">Enable plugins...</a><br>";
}
@@ -308,7 +312,7 @@
message += "<a href=\"configure\">Configure plugins...</a><br>";
}
- message += "<a href=\"ignore\">Ignore All</a>";
+ message += "<a href=\"ignore\">Ignore Unknown Features</a>";
}
else if (myBundledPlugin != null && !PropertiesComponent.getInstance().isTrueValue(IGNORE_ULTIMATE_EDITION)) {
message = "Features covered by " + IDEA_ULTIMATE_EDITION +
@@ -322,6 +326,35 @@
NOTIFICATION_GROUP.createNotification(DISPLAY_ID, message, NotificationType.INFORMATION, notificationListener).notify(project);
}
}
+
+ @NotNull
+ private String getAddressedMessagePresentation() {
+ final MultiMap<String, String> addressedFeatures = MultiMap.createSet();
+ final Set<String> ids = new LinkedHashSet<String>();
+ for (PluginDownloader plugin : myPlugins) {
+ ids.add(plugin.getPluginId());
+ }
+ for (Plugin plugin : myDisabledPlugins.keySet()) {
+ ids.add(plugin.myPluginId);
+ }
+ for (String id : ids) {
+ for (UnknownFeature feature : myFeatures.get(id)) {
+ addressedFeatures.putValue(feature.getFeatureDisplayName(), feature.getImplementationName());
+ }
+ }
+ final String addressedFeaturesPresentation = StringUtil.join(addressedFeatures.entrySet(),
+ new Function<Map.Entry<String, Collection<String>>, String>() {
+ @Override
+ public String fun(Map.Entry<String, Collection<String>> entry) {
+ return entry.getKey() + "[" + StringUtil.join(entry.getValue(), ", ") + "]";
+ }
+ }, ", ");
+ final int addressedFeaturesNumber = addressedFeatures.keySet().size();
+ final int pluginsNumber = ids.size();
+ return "Unknown feature" + (addressedFeaturesNumber == 1 ? "" : "s") +
+ " (" + addressedFeaturesPresentation + ") covered by " + (myPlugins.isEmpty() ? "disabled" : "non-bundled") + " plugin" + (pluginsNumber == 1 ? "" : "s") +
+ " detected.<br>";
+ }
});
}
};
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/UnknownFeature.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/UnknownFeature.java
index 1590733..8b7677c 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/UnknownFeature.java
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/UnknownFeature.java
@@ -22,10 +22,12 @@
*/
public class UnknownFeature {
private final String myFeatureType;
+ private final String myFeatureDisplayName;
private final String myImplementationName;
- public UnknownFeature(@NotNull String featureType, @NotNull String implementationName) {
+ public UnknownFeature(@NotNull String featureType, String featureDisplayName, @NotNull String implementationName) {
myFeatureType = featureType;
+ myFeatureDisplayName = featureDisplayName;
myImplementationName = implementationName;
}
@@ -37,6 +39,10 @@
return myImplementationName;
}
+ public String getFeatureDisplayName() {
+ return myFeatureDisplayName;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/UnknownFeaturesCollector.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/UnknownFeaturesCollector.java
index a7714b1..7195a08 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/UnknownFeaturesCollector.java
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/UnknownFeaturesCollector.java
@@ -46,11 +46,11 @@
}
public void registerUnknownRunConfiguration(String configurationName) {
- registerUnknownFeature("com.intellij.configurationType", configurationName);
+ registerUnknownFeature("com.intellij.configurationType", configurationName, "Run Configuration");
}
- public void registerUnknownFeature(String featureType, String implementationName) {
- final UnknownFeature feature = new UnknownFeature(featureType, implementationName);
+ public void registerUnknownFeature(String featureType, String implementationName, String featureDisplayName) {
+ final UnknownFeature feature = new UnknownFeature(featureType, featureDisplayName, implementationName);
if (!isIgnored(feature)) {
myUnknownFeatures.add(feature);
}
@@ -88,7 +88,7 @@
myIgnoredUnknownFeatures.clear();
for (Element element : state.getChildren()) {
myIgnoredUnknownFeatures.add(
- new UnknownFeature(element.getAttributeValue(FEATURE_ID), element.getAttributeValue(IMPLEMENTATION_NAME)));
+ new UnknownFeature(element.getAttributeValue(FEATURE_ID), null, element.getAttributeValue(IMPLEMENTATION_NAME)));
}
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/util/ZipperUpdater.java b/platform/platform-impl/src/com/intellij/openapi/util/ZipperUpdater.java
index 925fe1a..309dae7 100644
--- a/platform/platform-impl/src/com/intellij/openapi/util/ZipperUpdater.java
+++ b/platform/platform-impl/src/com/intellij/openapi/util/ZipperUpdater.java
@@ -20,6 +20,7 @@
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.progress.SomeQueue;
import com.intellij.util.Alarm;
+import org.jetbrains.annotations.NotNull;
@SomeQueue
public class ZipperUpdater {
@@ -44,11 +45,11 @@
myAlarm = new Alarm(threadToUse, parentDisposable);
}
- public void queue(final Runnable runnable) {
+ public void queue(@NotNull final Runnable runnable) {
queue(runnable, false);
}
- public void queue(final Runnable runnable, final boolean urgent) {
+ public void queue(@NotNull final Runnable runnable, final boolean urgent) {
synchronized (myLock) {
if (myAlarm.isDisposed()) return;
final boolean wasRaised = myRaised;
diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/VfsImplUtil.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/VfsImplUtil.java
index a46a221..77825b1 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/VfsImplUtil.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/VfsImplUtil.java
@@ -23,14 +23,17 @@
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.ZipFileCache;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.*;
+import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.VFileProperty;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.vfs.impl.ArchiveHandler;
import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent;
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
import com.intellij.openapi.vfs.newvfs.events.VFileMoveEvent;
import com.intellij.openapi.vfs.newvfs.events.VFilePropertyChangeEvent;
+import com.intellij.util.Consumer;
import com.intellij.util.Function;
-import com.intellij.util.Processor;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -206,15 +209,14 @@
ourHandlers.put(localPath, record);
final String finalRootPath = localPath;
- forEachDirectoryComponent(localPath, new Processor<String>() {
+ forEachDirectoryComponent(localPath, new Consumer<String>() {
@Override
- public boolean process(String containingDirectoryPath) {
+ public void consume(String containingDirectoryPath) {
Set<String> handlers = ourDominatorsMap.get(containingDirectoryPath);
if (handlers == null) {
ourDominatorsMap.put(containingDirectoryPath, handlers = ContainerUtil.newTroveSet());
}
handlers.add(finalRootPath);
- return true;
}
});
refresh = true;
@@ -236,11 +238,11 @@
return t;
}
- private static void forEachDirectoryComponent(String rootPath, Processor<String> processor) {
+ private static void forEachDirectoryComponent(String rootPath, Consumer<String> consumer) {
int index = rootPath.lastIndexOf('/');
while (index > 0) {
String containingDirectoryPath = rootPath.substring(0, index);
- if (!processor.process(containingDirectoryPath)) return;
+ consumer.consume(containingDirectoryPath);
index = rootPath.lastIndexOf('/', index - 1);
}
}
@@ -301,14 +303,13 @@
public static InvalidationState invalidate(@Nullable InvalidationState state, final String path) {
Pair<ArchiveFileSystem, ArchiveHandler> handlerPair = ourHandlers.remove(path);
if (handlerPair != null) {
- forEachDirectoryComponent(path, new Processor<String>() {
+ forEachDirectoryComponent(path, new Consumer<String>() {
@Override
- public boolean process(String containingDirectoryPath) {
+ public void consume(String containingDirectoryPath) {
Set<String> handlers = ourDominatorsMap.get(containingDirectoryPath);
if (handlers != null && handlers.remove(path) && handlers.size() == 0) {
ourDominatorsMap.remove(containingDirectoryPath);
}
- return true;
}
});
diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java
index 49349c5..ad50174 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java
@@ -489,7 +489,8 @@
private static RuntimeException handleError(final Throwable e) {
if (!ourIsDisposed) {
// No need to forcibly mark VFS corrupted if it is already shut down
- if (!myCorrupted) {
+ if (!myCorrupted && w.tryLock()) { // avoid deadlock if r lock is occupied by current thread
+ w.unlock();
createBrokenMarkerFile(e);
myCorrupted = true;
force();
@@ -1042,7 +1043,7 @@
r.lock();
try {
final int nameId = getRecordInt(id, NAME_OFFSET);
- return nameId != 0 ? getNames().valueOf(nameId) : "";
+ return nameId != 0 ? FileNameCache.getVFileName(nameId).toString() : "";
}
finally {
r.unlock();
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeFrameImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeFrameImpl.java
index a20bca2..f65dfa4 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeFrameImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeFrameImpl.java
@@ -260,7 +260,7 @@
}
public StatusBar getStatusBar() {
- return ((IdeRootPane)getRootPane()).getStatusBar();
+ return myRootPane == null ? null : myRootPane.getStatusBar();
}
public void setTitle(final String title) {
@@ -422,7 +422,7 @@
final LineSeparatorPanel lineSeparatorPanel = new LineSeparatorPanel(project);
statusBar.addWidget(lineSeparatorPanel, "before " + encodingPanel.ID());
- final ToggleReadOnlyAttributePanel readOnlyAttributePanel = new ToggleReadOnlyAttributePanel();
+ final ToggleReadOnlyAttributePanel readOnlyAttributePanel = new ToggleReadOnlyAttributePanel(project);
final InsertOverwritePanel insertOverwritePanel = new InsertOverwritePanel(project);
statusBar.addWidget(insertOverwritePanel, "after Encoding");
@@ -463,7 +463,9 @@
WelcomeFrame.notifyFrameClosed(this);
if (myRootPane != null) {
+ // clear both our and swing hard refs
myRootPane = null;
+ setRootPane(null);
}
if (myFrameDecorator != null) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeader.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeader.java
index f9991839..299ee2f 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeader.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeader.java
@@ -103,6 +103,7 @@
add(westPanel, BorderLayout.CENTER);
westPanel.add(toolWindow.getContentUI().getTabComponent());
+ toolWindow.getContentUI().initMouseListeners(westPanel, toolWindow.getContentUI());
JPanel eastPanel = new JPanel();
eastPanel.setOpaque(false);
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java
index b4d2037..a8d83eb 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java
@@ -143,6 +143,17 @@
return doRegisterToolWindow(id, parentDisposable);
}
+ @NotNull
+ @Override
+ public ToolWindow registerToolWindow(@NotNull String id,
+ boolean canCloseContent,
+ @NotNull ToolWindowAnchor anchor,
+ Disposable parentDisposable,
+ boolean canWorkInDumbMode,
+ boolean secondary) {
+ return doRegisterToolWindow(id, parentDisposable);
+ }
+
@Override
public void unregisterToolWindow(@NotNull String id) {
myToolWindows.remove(id);
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java
index 847d78f..e7240a6 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java
@@ -1146,7 +1146,18 @@
@NotNull final ToolWindowAnchor anchor,
@NotNull final Disposable parentDisposable,
final boolean canWorkInDumbMode) {
- ToolWindow window = registerToolWindow(id, null, anchor, false, canCloseContent, canWorkInDumbMode);
+ return registerToolWindow(id, canCloseContent, anchor, parentDisposable, canWorkInDumbMode, false);
+ }
+
+ @NotNull
+ @Override
+ public ToolWindow registerToolWindow(@NotNull String id,
+ boolean canCloseContent,
+ @NotNull ToolWindowAnchor anchor,
+ Disposable parentDisposable,
+ boolean canWorkInDumbMode,
+ boolean secondary) {
+ ToolWindow window = registerToolWindow(id, null, anchor, secondary, canCloseContent, canWorkInDumbMode);
return registerDisposable(id, parentDisposable, window);
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java
index f96adef..20d6a8f 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java
@@ -286,7 +286,7 @@
return getCurrentLayout().getNextContentActionName();
}
- static void initMouseListeners(final JComponent c, final ToolWindowContentUi ui) {
+ public static void initMouseListeners(final JComponent c, final ToolWindowContentUi ui) {
if (c.getClientProperty(ui) != null) return;
@@ -300,19 +300,18 @@
if (window instanceof IdeFrame) return;
- final Rectangle oldBounds = window.getBounds();
- final Point newPoint = e.getPoint();
- SwingUtilities.convertPointToScreen(newPoint, c);
- final Point offset = new Point(newPoint.x - myLastPoint[0].x, newPoint.y - myLastPoint[0].y);
- window.setLocation(oldBounds.x + offset.x, oldBounds.y + offset.y);
+ final Point windowLocation = window.getLocationOnScreen();
+ final Point newPoint = MouseInfo.getPointerInfo().getLocation();
+ Point p = myLastPoint[0];
+ windowLocation.translate(newPoint.x - p.x, newPoint.y - p.y);
+ window.setLocation(windowLocation);
myLastPoint[0] = newPoint;
}
});
c.addMouseListener(new MouseAdapter() {
public void mousePressed(final MouseEvent e) {
- myLastPoint[0] = e.getPoint();
- SwingUtilities.convertPointToScreen(myLastPoint[0], c);
+ myLastPoint[0] = MouseInfo.getPointerInfo().getLocation();
if (!e.isPopupTrigger()) {
if (!UIUtil.isCloseClick(e)) {
ui.myWindow.fireActivated();
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/MemoryUsagePanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/MemoryUsagePanel.java
index dd879da..d6039a5 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/MemoryUsagePanel.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/MemoryUsagePanel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -138,7 +138,7 @@
final int totalBarLength = size.width - insets.left - insets.right;
final int usedBarLength = (int)(totalBarLength * usedMem / maxMem);
final int unusedBarLength = (int)(totalBarLength * unusedMem / maxMem);
- final int barHeight = HEIGHT;
+ final int barHeight = Math.max(JBUI.scale(HEIGHT), getFont().getSize() + 2);
final int yOffset = (size.height - barHeight) / 2;
final int xOffset = insets.left;
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/ToggleReadOnlyAttributePanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/ToggleReadOnlyAttributePanel.java
index 3b89e81..98c5aee 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/ToggleReadOnlyAttributePanel.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/ToggleReadOnlyAttributePanel.java
@@ -19,7 +19,7 @@
import com.intellij.ide.DataManager;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
+import com.intellij.openapi.fileEditor.*;
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
import com.intellij.openapi.fileEditor.impl.EditorsSplitters;
import com.intellij.openapi.project.Project;
@@ -30,6 +30,7 @@
import com.intellij.ui.UIBundle;
import com.intellij.util.Consumer;
import com.intellij.util.io.ReadOnlyAttributeUtil;
+import com.intellij.util.messages.MessageBusConnection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -37,10 +38,17 @@
import java.awt.event.MouseEvent;
import java.io.IOException;
-public class ToggleReadOnlyAttributePanel implements StatusBarWidget.Multiframe, StatusBarWidget.IconPresentation {
-
+public class ToggleReadOnlyAttributePanel extends FileEditorManagerAdapter implements StatusBarWidget.Multiframe,
+ StatusBarWidget.IconPresentation{
+ private Project myProject;
private StatusBar myStatusBar;
+ public ToggleReadOnlyAttributePanel(@NotNull Project project) {
+ myProject = project;
+ MessageBusConnection connection = project.getMessageBus().connect(this);
+ connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, this);
+ }
+
@NotNull
public Icon getIcon() {
VirtualFile virtualFile = getCurrentFile();
@@ -55,7 +63,7 @@
@Override
public StatusBarWidget copy() {
- return new ToggleReadOnlyAttributePanel();
+ return new ToggleReadOnlyAttributePanel(myProject);
}
public WidgetPresentation getPresentation(@NotNull PlatformType type) {
@@ -64,6 +72,7 @@
public void dispose() {
myStatusBar = null;
+ myProject = null;
}
public void install(@NotNull StatusBar statusBar) {
@@ -119,4 +128,9 @@
EditorsSplitters splitters = FileEditorManagerEx.getInstanceEx(project).getSplittersFor(myStatusBar.getComponent());
return splitters.getCurrentFile();
}
+
+ @Override
+ public void selectionChanged(@NotNull FileEditorManagerEvent event) {
+ myStatusBar.updateWidget(ID());
+ }
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java
index 6594f14..58d0f95 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/RecentProjectPanel.java
@@ -207,7 +207,7 @@
protected Dimension getPreferredScrollableViewportSize() {
return JBUI.size(250, 400);
}
-
+
protected void addMouseMotionListener() {
MouseAdapter mouseAdapter = new MouseAdapter() {
diff --git a/platform/platform-impl/src/com/intellij/remote/VagrantBasedCredentialsHolder.java b/platform/platform-impl/src/com/intellij/remote/VagrantBasedCredentialsHolder.java
index e2b92fe..fd05645 100644
--- a/platform/platform-impl/src/com/intellij/remote/VagrantBasedCredentialsHolder.java
+++ b/platform/platform-impl/src/com/intellij/remote/VagrantBasedCredentialsHolder.java
@@ -98,4 +98,12 @@
result = 31 * result + (myMachineName != null ? myMachineName.hashCode() : 0);
return result;
}
+
+ @Override
+ public String toString() {
+ return "VagrantBasedCredentialsHolder{" +
+ "myVagrantFolder='" + myVagrantFolder + '\'' +
+ ", myMachineName='" + myMachineName + '\'' +
+ '}';
+ }
}
diff --git a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java
index 8febcb2..bd13f27 100644
--- a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java
+++ b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java
@@ -509,6 +509,8 @@
createComponent();
if (!new Rectangle(myLayeredPane.getSize()).contains(new Rectangle(myComp.getSize()))) { // Balloon is bigger than window, don't show it at all.
+ myComp.removeAll();
+ myLayeredPane.remove(myComp);
myLayeredPane = null;
hide();
return;
diff --git a/platform/platform-impl/src/com/intellij/ui/EditorTextField.java b/platform/platform-impl/src/com/intellij/ui/EditorTextField.java
index daa7dcb..4cdc5f5 100644
--- a/platform/platform-impl/src/com/intellij/ui/EditorTextField.java
+++ b/platform/platform-impl/src/com/intellij/ui/EditorTextField.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -617,7 +617,7 @@
return getParent().getBackground();
}
- if (UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) return UIUtil.getTextFieldBackground();
+ if (UIUtil.isUnderDarcula()/* || UIUtil.isUnderIntelliJLaF()*/) return UIUtil.getTextFieldBackground();
return enabled
? colorsScheme.getDefaultBackground()
diff --git a/platform/platform-impl/src/com/intellij/ui/EditorTextFieldCellRenderer.java b/platform/platform-impl/src/com/intellij/ui/EditorTextFieldCellRenderer.java
index cd82980..4fdd374 100644
--- a/platform/platform-impl/src/com/intellij/ui/EditorTextFieldCellRenderer.java
+++ b/platform/platform-impl/src/com/intellij/ui/EditorTextFieldCellRenderer.java
@@ -101,10 +101,8 @@
editor.getColorsScheme().setEditorFontSize(table.getFont().getSize());
String text = getText(table, value, row, column);
TextAttributes textAttributes = getTextAttributes(table, value, selected, focused, row, column);
- panel.setText(text, textAttributes);
+ panel.setText(text, textAttributes, selected);
- ((EditorImpl)editor).setPaintSelection(selected);
- editor.getSelectionModel().setSelection(0, selected ? editor.getDocument().getTextLength() : 0);
editor.getColorsScheme().setColor(EditorColors.SELECTION_BACKGROUND_COLOR, table.getSelectionBackground());
editor.getColorsScheme().setColor(EditorColors.SELECTION_FOREGROUND_COLOR, table.getSelectionForeground());
editor.setBackgroundColor(getCellBackground(table, value, selected, focused, row, column));
@@ -165,6 +163,7 @@
private Dimension myPreferredSize;
private String myRawText;
private TextAttributes myTextAttributes;
+ private boolean mySelected;
public MyPanel(EditorEx editor) {
add(editor.getContentComponent());
@@ -178,9 +177,10 @@
}
}
- public void setText(String text, @Nullable TextAttributes textAttributes) {
+ public void setText(String text, @Nullable TextAttributes textAttributes, boolean selected) {
myRawText = text;
myTextAttributes = textAttributes;
+ mySelected = selected;
recalculatePreferredSize();
}
@@ -277,8 +277,9 @@
((EditorImpl)myEditor).resetSizes();
+ ((EditorImpl)myEditor).setPaintSelection(mySelected);
SelectionModel selectionModel = myEditor.getSelectionModel();
- selectionModel.setSelection(0, selectionModel.hasSelection() ? myEditor.getDocument().getTextLength() : 0);
+ selectionModel.setSelection(0, mySelected ? myEditor.getDocument().getTextLength() : 0);
}
private static void appendAbbreviated(StringBuilder to, String text, int start, int end,
diff --git a/platform/platform-impl/src/com/intellij/util/MergingBackgroundExecutor.java b/platform/platform-impl/src/com/intellij/util/MergingBackgroundExecutor.java
new file mode 100644
index 0000000..d8265f5
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/util/MergingBackgroundExecutor.java
@@ -0,0 +1,93 @@
+package com.intellij.util;
+
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.diagnostic.Logger;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Executes tasks on pooled threads. At any point, at most {@code maxThreads} threads will be active processing tasks.
+ * If additional tasks are submitted when all threads are active, they will wait in the queue until a thread is available.
+ *
+ * Difference to {@link java.util.concurrent.Executors#newFixedThreadPool(int)} is that this utility class
+ * allows to reuse shared thread pool and thus getting rid of extra thread creation and thread pool management.
+ *
+ * @param <T> the type of elements
+ */
+public class MergingBackgroundExecutor<T> {
+
+ private static final Logger LOG = Logger.getInstance(MergingBackgroundExecutor.class);
+
+ private final int myMaxThreads;
+ private final Consumer<T> myConsumer;
+ private final BlockingQueue<T> myQueue = new LinkedBlockingDeque<T>();
+ private final AtomicInteger myRunningThreads = new AtomicInteger(0);
+
+ public MergingBackgroundExecutor(int maxThreads, @NotNull Consumer<T> consumer) {
+ myMaxThreads = maxThreads;
+ myConsumer = consumer;
+ }
+
+ protected void executeOnPooledThread(@NotNull Runnable runnable) {
+ ApplicationManager.getApplication().executeOnPooledThread(runnable);
+ }
+
+ public void queue(@NotNull T t) {
+ if (!myQueue.offer(t)) {
+ LOG.error("Unable to enqueue an element, queue size: " + myQueue.size());
+ return;
+ }
+ if (incrementIfSmaller(myRunningThreads, myMaxThreads)) {
+ executeOnPooledThread(new Runnable() {
+ @Override
+ public void run() {
+ do {
+ try {
+ processQueue();
+ }
+ finally {
+ myRunningThreads.decrementAndGet();
+ }
+ // Defense from unlucky timing:
+ // An element could be enqueued between "processQueue()" and "myRunningThreads.decrementAndGet()".
+ // As a result, "executeOnPooledThread(Runnable)" won't be called.
+ // In this case the queue processing should be started over.
+ }
+ while (!myQueue.isEmpty() && incrementIfSmaller(myRunningThreads, myMaxThreads));
+ }
+ });
+ }
+ }
+
+ private static boolean incrementIfSmaller(@NotNull AtomicInteger i, int max) {
+ int value;
+ do {
+ value = i.get();
+ if (value >= max) {
+ return false;
+ }
+ }
+ while (!i.compareAndSet(value, value + 1));
+ return true;
+ }
+
+ private void processQueue() {
+ T t;
+ while ((t = myQueue.poll()) != null) {
+ myConsumer.consume(t);
+ }
+ }
+
+ @NotNull
+ public static MergingBackgroundExecutor<Runnable> newRunnableExecutor(int maxThreads) {
+ return new MergingBackgroundExecutor<Runnable>(maxThreads, new Consumer<Runnable>() {
+ @Override
+ public void consume(Runnable runnable) {
+ runnable.run();
+ }
+ });
+ }
+}
diff --git a/platform/platform-impl/src/org/jetbrains/io/JsonReaderEx.java b/platform/platform-impl/src/org/jetbrains/io/JsonReaderEx.java
index a8dd682..37cf6bf 100644
--- a/platform/platform-impl/src/org/jetbrains/io/JsonReaderEx.java
+++ b/platform/platform-impl/src/org/jetbrains/io/JsonReaderEx.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2015 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.io;
import com.google.gson.JsonParseException;
@@ -768,6 +783,16 @@
return peek() == JsonToken.STRING ? nextString() : null;
}
+ public String nextNullableString() {
+ if (peek() == JsonToken.NULL) {
+ nextNull();
+ return null;
+ }
+ else {
+ return nextString();
+ }
+ }
+
public String nextString() {
return nextString(false);
}
diff --git a/platform/platform-impl/src/org/jetbrains/io/NettyUtil.java b/platform/platform-impl/src/org/jetbrains/io/NettyUtil.java
index c867071..d68ff5e 100644
--- a/platform/platform-impl/src/org/jetbrains/io/NettyUtil.java
+++ b/platform/platform-impl/src/org/jetbrains/io/NettyUtil.java
@@ -16,6 +16,8 @@
package org.jetbrains.io;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.Conditions;
import com.intellij.util.SystemProperties;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.BootstrapUtil;
@@ -94,8 +96,13 @@
@Nullable
public static Channel connect(@NotNull Bootstrap bootstrap, @NotNull InetSocketAddress remoteAddress, @Nullable AsyncPromise<?> promise, int maxAttemptCount) {
+ return connect(bootstrap, remoteAddress, promise, maxAttemptCount, null);
+ }
+
+ @Nullable
+ public static Channel connect(@NotNull Bootstrap bootstrap, @NotNull InetSocketAddress remoteAddress, @Nullable AsyncPromise<?> promise, int maxAttemptCount, @Nullable Condition<Void> stopCondition) {
try {
- return doConnect(bootstrap, remoteAddress, promise, maxAttemptCount);
+ return doConnect(bootstrap, remoteAddress, promise, maxAttemptCount, stopCondition == null ? Conditions.<Void>alwaysFalse() : stopCondition);
}
catch (Throwable e) {
if (promise != null) {
@@ -106,7 +113,11 @@
}
@Nullable
- private static Channel doConnect(@NotNull Bootstrap bootstrap, @NotNull InetSocketAddress remoteAddress, @Nullable AsyncPromise<?> promise, int maxAttemptCount) throws Throwable {
+ private static Channel doConnect(@NotNull Bootstrap bootstrap,
+ @NotNull InetSocketAddress remoteAddress,
+ @Nullable AsyncPromise<?> promise,
+ int maxAttemptCount,
+ @NotNull Condition<Void> stopCondition) throws Throwable {
int attemptCount = 0;
if (bootstrap.group() instanceof NioEventLoopGroup) {
@@ -115,6 +126,9 @@
if (future.isSuccess()) {
return future.channel();
}
+ else if (stopCondition.value(null) || (promise != null && promise.getState() == Promise.State.REJECTED)) {
+ return null;
+ }
else if (maxAttemptCount == -1) {
//noinspection BusyWait
Thread.sleep(300);
@@ -144,7 +158,10 @@
break;
}
catch (IOException e) {
- if (maxAttemptCount == -1) {
+ if (stopCondition.value(null) || (promise != null && promise.getState() == Promise.State.REJECTED)) {
+ return null;
+ }
+ else if (maxAttemptCount == -1) {
//noinspection BusyWait
Thread.sleep(300);
attemptCount++;
diff --git a/platform/platform-resources-en/src/messages/ExecutionBundle.properties b/platform/platform-resources-en/src/messages/ExecutionBundle.properties
index 6ce5d64..7470671 100644
--- a/platform/platform-resources-en/src/messages/ExecutionBundle.properties
+++ b/platform/platform-resources-en/src/messages/ExecutionBundle.properties
@@ -207,7 +207,8 @@
application.configuration.use.classpath.and.jdk.of.module.label=Use classpath of m&odule:
application.configuration.main.class.label=Main &class:
-jre.path.is.not.valid.jre.home.error.mesage=''{0}'' is not a valid JRE home
+jre.path.is.not.valid.jre.home.error.message=''{0}'' is not a valid JRE home
+jre.path.is.jdk.error.message=Alternative JRE path needs to point to a JRE, not to a complete JDK installation
main.method.not.found.in.class.error.message=Main method not found in class {0}
no.user.process.input.error.message=No process input
fix.run.configuration.problem.button=Fix
diff --git a/platform/platform-resources-en/src/messages/VcsBundle.properties b/platform/platform-resources-en/src/messages/VcsBundle.properties
index b3415ed..9757fa0 100644
--- a/platform/platform-resources-en/src/messages/VcsBundle.properties
+++ b/platform/platform-resources-en/src/messages/VcsBundle.properties
@@ -229,6 +229,9 @@
update.project.scope.name=Project
dialog.title.changes.browser=Changes Browser
code.smells.error.messages.tab.name=Code Analysis
+code.smells.error.indexing=Code analysis is not possible right now
+code.smells.error.indexing.message=Code analysis can''t be performed while {0} updates the indices in background.\n\
+ You can commit the changes without running inspections, or you can wait until indices are built.
searching.for.code.smells.processing.file.progress.text=Processing {0}
checking.code.smells.progress.title=Performing Code Analysis
before.commit.files.contain.code.smells.edit.them.confirm.text=Some files contain problems.\n\
diff --git a/platform/platform-resources/src/DefaultColorSchemesManager.xml b/platform/platform-resources/src/DefaultColorSchemesManager.xml
index 95b4c8c..80c8617 100644
--- a/platform/platform-resources/src/DefaultColorSchemesManager.xml
+++ b/platform/platform-resources/src/DefaultColorSchemesManager.xml
@@ -1157,7 +1157,7 @@
<option name="NOTIFICATION_BACKGROUND" value="5c5c42" />
<option name="READONLY_FRAGMENT_BACKGROUND" value="" />
<option name="RECURSIVE_CALL_ATTRIBUTES" value="574300" />
- <option name="RIGHT_MARGIN_COLOR" value="323232" />
+ <option name="RIGHT_MARGIN_COLOR" value="4d4d4d" />
<option name="SELECTED_INDENT_GUIDE" value="505050" />
<option name="SELECTED_TEARLINE_COLOR" value="787878" />
<option name="SELECTION_BACKGROUND" value="214283" />
@@ -1335,6 +1335,12 @@
<option name="FOREGROUND" value="bbbbbb" />
</value>
</option>
+ <option name="CONSOLE_USER_INPUT">
+ <value>
+ <option name="FOREGROUND" value="007f00"/>
+ <option name="FONT_TYPE" value="2"/>
+ </value>
+ </option>
<option name="CONSOLE_OUTPUT">
<value>
<option name="BACKGROUND" value="454545" />
@@ -2049,6 +2055,14 @@
<option name="FONT_TYPE" value="1" />
</value>
</option>
+ <option name="LIVE_TEMPLATE_ATTRIBUTES">
+ <value>
+ <option name="FOREGROUND"/>
+ <option name="BACKGROUND"/>
+ <option name="EFFECT_COLOR" value="ff0000"/>
+ <option name="EFFECT_TYPE" value="0"/>
+ </value>
+ </option>
<option name="LOG_ERROR_OUTPUT">
<value>
<option name="FOREGROUND" value="ff6b68" />
diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml
index 59b5367..a850d862 100644
--- a/platform/platform-resources/src/META-INF/LangExtensions.xml
+++ b/platform/platform-resources/src/META-INF/LangExtensions.xml
@@ -852,6 +852,7 @@
<pathMacroFilter implementation="com.intellij.execution.configuration.RunConfigurationPathMacroFilter"/>
<pathMacroFilter implementation="com.intellij.openapi.application.StructuralSearchPathMacroFilter"/>
+ <pathMacroFilter implementation="com.intellij.openapi.application.PathMappingsMacroFilter"/>
<postStartupActivity implementation="com.intellij.codeInsight.highlighting.BraceHighlighter"/>
<usageContextPanelProvider implementation="com.intellij.usages.impl.UsagePreviewPanel$Provider"/>
diff --git a/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml b/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml
index a16d032..36ba59e 100644
--- a/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml
+++ b/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml
@@ -242,5 +242,7 @@
<extensionPoint qualifiedName="com.intellij.diff.DiffTool" interface="com.intellij.diff.DiffTool"/>
<extensionPoint name="testStatusListener" interface="com.intellij.execution.testframework.TestStatusListener"/>
+
+ <extensionPoint name="runConfigurationBeforeRunProviderDelegate" interface="com.intellij.execution.impl.RunConfigurationBeforeRunProviderDelegate"/>
</extensionPoints>
</idea-plugin>
diff --git a/platform/platform-resources/src/brokenPlugins.txt b/platform/platform-resources/src/brokenPlugins.txt
index d9fe7ef..5200106 100644
--- a/platform/platform-resources/src/brokenPlugins.txt
+++ b/platform/platform-resources/src/brokenPlugins.txt
@@ -22,4 +22,5 @@
com.jetbrains.chronon 134.1221 134.1414 134.1618 135.1291 135.476 135.666
ArgoUML.Integration 0.1.1 0.1.2
IdeaServerPlugin 1.0 1.0.2 1.0.3 1.0.4 1.0.7 1.0.8
-copy.on.steroids 3.1
\ No newline at end of file
+copy.on.steroids 3.1
+"AWS Elastic Beanstalk" 0.7.7 0.7.6 0.7.5 0.7.4 0.7.3 0.7.2 0.7.1 0.7.0 0.6.1 0.6.0 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0
\ No newline at end of file
diff --git a/platform/platform-resources/src/idea/Keymap_Emacs.xml b/platform/platform-resources/src/idea/Keymap_Emacs.xml
index ef56d94..1278dc7e 100644
--- a/platform/platform-resources/src/idea/Keymap_Emacs.xml
+++ b/platform/platform-resources/src/idea/Keymap_Emacs.xml
@@ -161,7 +161,6 @@
<action id="NextTab">
<keyboard-shortcut first-keystroke="alt RIGHT"/>
<keyboard-shortcut first-keystroke="control X" second-keystroke="N"/>
- <keyboard-shortcut first-keystroke="control X" second-keystroke="O"/>
</action>
<action id="NextEditorTab">
<keyboard-shortcut first-keystroke="alt shift RIGHT"/>
@@ -262,7 +261,7 @@
<keyboard-shortcut first-keystroke="control 5"/>
</action>
<action id="NextSplitter">
- <keyboard-shortcut first-keystroke="control X" second-keystrole="O"/>
+ <keyboard-shortcut first-keystroke="control X" second-keystroke="O"/>
</action>
<action id="Replace">
<keyboard-shortcut first-keystroke="shift alt 5"/>
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretTest.java
index 6820f87..9ac97b0 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretTest.java
@@ -383,6 +383,16 @@
mouse().ctrl().alt().shift().pressAt(0, 7).dragTo(1, 5).release();
checkResultByText("s<selection>om<caret></selection>e <selection><caret>te</selection>xt\nother<selection><caret> t</selection>ext");
}
+
+ public void testCaretPositionUpdateOnFolding() throws Exception {
+ initText("line1\n" +
+ "line2\n" +
+ "l<caret>ine3\n" +
+ "line<caret>4");
+ addCollapsedFoldRegion(0, 6, "...");
+ verifyCaretsAndSelections(1, 1, 1, 1,
+ 2, 4, 4, 4);
+ }
private static void doWithAltClickShortcut(ThrowableRunnable runnable) throws Throwable {
Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/NextPrevWordTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/NextPrevWordTest.java
index c9cea52..89ffe68 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/NextPrevWordTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/NextPrevWordTest.java
@@ -17,6 +17,8 @@
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.editor.FoldRegion;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx;
import com.intellij.testFramework.EditorTestUtil;
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
@@ -94,4 +96,12 @@
assertEquals(1, foldRegions.length);
assertFalse(foldRegions[0].isExpanded());
}
+
+ public void testRegexpCharsAreNotTreatedAsSeparateWords() {
+ FileType regExpFileType = FileTypeManagerEx.getInstanceEx().findFileTypeByName("RegExp");
+ assertNotNull(regExpFileType);
+ myFixture.configureByText(regExpFileType, "<caret>abc");
+ myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD);
+ myFixture.checkResult("abc<caret>");
+ }
}
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java
index 116442c..c621dd6 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java
@@ -229,6 +229,7 @@
myRemoteDeployments.clear();
}
myStatusText = "Cannot obtain deployments: " + errorMessage;
+ myEventDispatcher.queueConnectionStatusChanged(ServerConnectionImpl.this);
myEventDispatcher.queueDeploymentsChanged(ServerConnectionImpl.this);
onFinished.run();
}
@@ -315,14 +316,16 @@
@NotNull
@Override
public Collection<Deployment> getDeployments() {
- Set<Deployment> result = new TreeSet<Deployment>(getServer().getType().getDeploymentComparator());
+ Set<Deployment> result = new LinkedHashSet<Deployment>();
+ Set<Deployment> orderedDeployments = new TreeSet<Deployment>(getServer().getType().getDeploymentComparator());
synchronized (myLocalDeployments) {
- result.addAll(myLocalDeployments.values());
+ orderedDeployments.addAll(myLocalDeployments.values());
}
-
+ result.addAll(orderedDeployments);
synchronized (myRemoteDeployments) {
- result.addAll(myRemoteDeployments.values());
+ orderedDeployments.addAll(myRemoteDeployments.values());
}
+ result.addAll(orderedDeployments);
return result;
}
@@ -345,16 +348,20 @@
@Override
public void errorOccurred(@NotNull String errorMessage) {
- setStatus(ConnectionStatus.DISCONNECTED);
+ setStatus(ConnectionStatus.DISCONNECTED, errorMessage);
myRuntimeInstance = null;
- myStatusText = errorMessage;
callback.errorOccurred(errorMessage);
}
});
}
private void setStatus(final ConnectionStatus status) {
+ setStatus(status, null);
+ }
+
+ private void setStatus(final ConnectionStatus status, String statusText) {
myStatus = status;
+ myStatusText = statusText;
myEventDispatcher.queueConnectionStatusChanged(this);
}
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java
index fd9a892..37ef48e 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/ServersToolWindowContent.java
@@ -166,7 +166,7 @@
private void updateServerDetails(ServersTreeStructure.RemoteServerNode node) {
RemoteServer<?> server = ((ServersTreeStructure.RemoteServerNode)node).getValue();
ServerConnection connection = ServerConnectionManager.getInstance().getConnection(server);
- if (connection == null || connection.getStatus() == ConnectionStatus.DISCONNECTED) {
+ if (connection == null) {
showMessageLabel("Double-click on the server node to connect");
}
else {
@@ -193,13 +193,15 @@
@Override
public void onConnectionCreated(@NotNull ServerConnection<?> connection) {
getBuilder().queueUpdate();
- pollDeployments(connection);
}
@Override
public void onConnectionStatusChanged(@NotNull ServerConnection<?> connection) {
getBuilder().queueUpdate();
updateSelectedServerDetails();
+ if (connection.getStatus() == ConnectionStatus.CONNECTED) {
+ pollDeployments(connection);
+ }
}
@Override
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java
index 8907efc..29c0238 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/ServersTreeStructure.java
@@ -182,17 +182,17 @@
final RemoteServer<?> server = getValue();
final ServerType<? extends ServerConfiguration> serverType = server.getType();
final DeploymentConfigurationManager configurationManager = DeploymentConfigurationManager.getInstance(doGetProject());
- List<RunnerAndConfigurationSettings> list
- = ContainerUtil.filter(configurationManager.getDeploymentConfigurations(serverType),
- new Condition<RunnerAndConfigurationSettings>() {
-
- @Override
- public boolean value(RunnerAndConfigurationSettings settings) {
- DeployToServerRunConfiguration configuration =
- (DeployToServerRunConfiguration)settings.getConfiguration();
- return StringUtil.equals(server.getName(), configuration.getServerName());
- }
- });
+ final List<RunnerAndConfigurationSettings> list = new ArrayList<RunnerAndConfigurationSettings>(ContainerUtil.filter(
+ configurationManager.getDeploymentConfigurations(serverType),
+ new Condition<RunnerAndConfigurationSettings>() {
+ @Override
+ public boolean value(RunnerAndConfigurationSettings settings) {
+ DeployToServerRunConfiguration configuration =
+ (DeployToServerRunConfiguration)settings.getConfiguration();
+ return StringUtil.equals(server.getName(), configuration.getServerName());
+ }
+ }
+ ));
if (canCreate) {
list.add(null);
}
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/RemoteServerConnectAction.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/RemoteServerConnectAction.java
index 8fd5f78..ddaa7ae 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/RemoteServerConnectAction.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/tree/actions/RemoteServerConnectAction.java
@@ -16,6 +16,7 @@
package com.intellij.remoteServer.impl.runtime.ui.tree.actions;
import com.intellij.icons.AllIcons;
+import com.intellij.openapi.util.EmptyRunnable;
import com.intellij.remoteServer.impl.runtime.ui.tree.ServersTreeStructure;
import com.intellij.remoteServer.runtime.ServerConnectionManager;
@@ -37,6 +38,6 @@
@Override
protected void doActionPerformed(ServersTreeStructure.RemoteServerNode node) {
- ServerConnectionManager.getInstance().getOrCreateConnection(node.getValue());
+ ServerConnectionManager.getInstance().getOrCreateConnection(node.getValue()).connect(EmptyRunnable.INSTANCE);
}
}
diff --git a/platform/script-debugger/backend/src/org/jetbrains/debugger/BreakpointManagerBase.java b/platform/script-debugger/backend/src/org/jetbrains/debugger/BreakpointManagerBase.java
index ef975a9..f67096b 100644
--- a/platform/script-debugger/backend/src/org/jetbrains/debugger/BreakpointManagerBase.java
+++ b/platform/script-debugger/backend/src/org/jetbrains/debugger/BreakpointManagerBase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -149,6 +149,7 @@
@NotNull
@Override
public Promise<Void> flush(@NotNull Breakpoint breakpoint) {
+ //noinspection unchecked
return ((T)breakpoint).flush(this);
}
diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/PsiVisitors.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/PsiVisitors.java
index 8933837..c7f107f 100644
--- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/PsiVisitors.java
+++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/PsiVisitors.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2015 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.debugger;
import com.intellij.openapi.application.AccessToken;
@@ -17,9 +32,9 @@
* Read action will be taken automatically
*/
public static <RESULT> RESULT visit(@NotNull XSourcePosition position, @NotNull Project project, @NotNull Visitor<RESULT> visitor, RESULT defaultResult) {
- Document document = FileDocumentManager.getInstance().getDocument(position.getFile());
AccessToken token = ReadAction.start();
try {
+ Document document = FileDocumentManager.getInstance().getDocument(position.getFile());
PsiFile file = document == null || document.getTextLength() == 0 ? null : PsiDocumentManager.getInstance(project).getPsiFile(document);
if (file == null) {
return defaultResult;
diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/RemoteVmConnection.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/RemoteVmConnection.java
index d1feb61..ab4e090 100644
--- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/RemoteVmConnection.java
+++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/connection/RemoteVmConnection.java
@@ -1,8 +1,24 @@
+/*
+ * Copyright 2000-2015 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.debugger.connection;
import com.intellij.ide.browsers.WebBrowser;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.ui.popup.JBPopupFactory;
+import com.intellij.openapi.util.Condition;
import com.intellij.ui.ColoredListCellRenderer;
import com.intellij.ui.components.JBList;
import com.intellij.util.Consumer;
@@ -37,10 +53,10 @@
public abstract Bootstrap createBootstrap(@NotNull InetSocketAddress address, @NotNull AsyncPromise<Vm> promise);
public void open(@NotNull InetSocketAddress address) {
- open(address, false);
+ open(address, null);
}
- public void open(@NotNull final InetSocketAddress address, final boolean waitForever) {
+ public void open(@NotNull final InetSocketAddress address, final Condition<Void> stopCondition) {
setState(ConnectionStatus.WAITING_FOR_CONNECTION, "Connecting to " + address.getHostName() + ":" + address.getPort());
final Future<?> future = ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
@@ -58,7 +74,7 @@
});
AsyncPromise<Void> connectionPromise = new AsyncPromise<Void>();
- NettyUtil.connect(createBootstrap(address, result), address, connectionPromise, waitForever ? -1 : NettyUtil.DEFAULT_CONNECT_ATTEMPT_COUNT);
+ NettyUtil.connect(createBootstrap(address, result), address, connectionPromise, stopCondition == null ? NettyUtil.DEFAULT_CONNECT_ATTEMPT_COUNT : -1, stopCondition);
connectionPromise.rejected(new Consumer<Throwable>() {
@Override
public void consume(Throwable error) {
diff --git a/platform/script-debugger/protocol/protocol-model-generator/protocol-model-generator.iml b/platform/script-debugger/protocol/protocol-model-generator/protocol-model-generator.iml
index f8843ee..ebbedb1 100644
--- a/platform/script-debugger/protocol/protocol-model-generator/protocol-model-generator.iml
+++ b/platform/script-debugger/protocol/protocol-model-generator/protocol-model-generator.iml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
- <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
@@ -13,6 +13,8 @@
<orderEntry type="module" module-name="protocol-reader" />
<orderEntry type="library" name="Trove4j" level="project" />
<orderEntry type="module" module-name="annotations" />
+ <orderEntry type="module" module-name="util-rt" />
+ <orderEntry type="module" module-name="platform-impl" />
+ <orderEntry type="library" name="KotlinJavaRuntime" level="project" />
</component>
-</module>
-
+</module>
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/BoxableType.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/BoxableType.java
deleted file mode 100644
index 3f4b8ea..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/BoxableType.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.jetbrains.protocolReader;
-
-abstract class BoxableType {
- static final BoxableType STRING = new StandaloneType(new NamePath("String"), "writeString");
- static final BoxableType ANY_STRING = new StandaloneType(new NamePath("String"), "writeString");
- static final BoxableType INT = new StandaloneType(new NamePath("int"), "writeInt");
- static final BoxableType LONG = new StandaloneType(new NamePath("long"), "writeLong");
- static final BoxableType NUMBER = new StandaloneType(new NamePath("double"), "writeDouble");
- static final BoxableType BOOLEAN = new StandaloneType(new NamePath("boolean"), "writeBoolean");
- static final BoxableType MAP = new StandaloneType(new NamePath("java.util.Map<String, String>"), "writeMap");
-
- abstract CharSequence getFullText();
-
- abstract String getShortText(NamePath contextNamespace);
-
- abstract String getWriteMethodName();
-}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/BoxableType.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/BoxableType.kt
new file mode 100644
index 0000000..7758ea1
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/BoxableType.kt
@@ -0,0 +1,20 @@
+package org.jetbrains.protocolReader
+
+abstract class BoxableType {
+
+ abstract fun getFullText(): CharSequence
+
+ abstract fun getShortText(contextNamespace: NamePath): String
+
+ abstract fun getWriteMethodName(): String
+
+ default object {
+ val STRING: BoxableType = StandaloneType(NamePath("String"), "writeString")
+ val ANY_STRING: BoxableType = StandaloneType(NamePath("String"), "writeString")
+ val INT: BoxableType = StandaloneType(NamePath("int"), "writeInt")
+ val LONG: BoxableType = StandaloneType(NamePath("long"), "writeLong")
+ val NUMBER: BoxableType = StandaloneType(NamePath("double"), "writeDouble")
+ val BOOLEAN: BoxableType = StandaloneType(NamePath("boolean"), "writeBoolean")
+ val MAP: BoxableType = StandaloneType(NamePath("java.util.Map<String, String>"), "writeMap")
+ }
+}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ClassNameScheme.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ClassNameScheme.java
deleted file mode 100644
index 43fc7d6..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ClassNameScheme.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.annotations.NotNull;
-
-abstract class ClassNameScheme {
- private final String suffix;
- private final String rootPackage;
-
- private ClassNameScheme(@NotNull String suffix, String rootPackage) {
- this.suffix = suffix;
- this.rootPackage = rootPackage;
- }
-
- @NotNull
- NamePath getFullName(@NotNull String domainName, String baseName) {
- return new NamePath(getShortName(baseName), new NamePath(getPackageNameVirtual(domainName)));
- }
-
- @NotNull
- String getShortName(@NotNull String baseName) {
- return baseName.endsWith("Descriptor") ? baseName : new String(getShortNameChars(baseName));
- }
-
- private char[] getShortNameChars(@NotNull String baseName) {
- char[] name = new char[baseName.length() + suffix.length()];
- baseName.getChars(0, baseName.length(), name, 0);
- if (!suffix.isEmpty()) {
- suffix.getChars(0, suffix.length(), name, baseName.length());
- }
- if (Character.isLowerCase(name[0])) {
- name[0] = Character.toUpperCase(name[0]);
- }
- if (baseName.endsWith("breakpoint")) {
- name[baseName.length() - "breakpoint".length()] = 'B';
- }
- else if (baseName.endsWith("breakpoints")) {
- name[baseName.length() - "breakpoints".length()] = 'B';
- }
- return name;
- }
-
- protected String getPackageNameVirtual(String domainName) {
- return getPackageName(rootPackage, domainName);
- }
-
- @NotNull
- public static String getPackageName(@NotNull String rootPackage, @NotNull String domain) {
- if (domain.isEmpty()) {
- return rootPackage;
- }
- return rootPackage + '.' + domain.toLowerCase();
- }
-
- static class Input extends ClassNameScheme {
- Input(@NotNull String suffix, String rootPackage) {
- super(suffix, rootPackage);
- }
-
- String getParseMethodName(String domain, String name) {
- return "read" + Generator.capitalizeFirstChar(domain) + getShortName(name);
- }
- }
-
- static class Output extends ClassNameScheme {
- Output(String suffix, String rootPackage) {
- super(suffix, rootPackage);
- }
- }
-
- static class Common extends ClassNameScheme {
- Common(String suffix, String rootPackage) {
- super(suffix, rootPackage);
- }
- }
-}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ClassNameScheme.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ClassNameScheme.kt
new file mode 100644
index 0000000..19e3170
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ClassNameScheme.kt
@@ -0,0 +1,54 @@
+package org.jetbrains.protocolReader
+
+abstract class ClassNameScheme private(private val suffix: String, private val rootPackage: String) {
+ fun getFullName(domainName: String, baseName: String): NamePath {
+ return NamePath(getShortName(baseName), NamePath(getPackageNameVirtual(domainName)))
+ }
+
+ fun getShortName(baseName: String): String {
+ return if (baseName.endsWith("Descriptor")) baseName else String(getShortNameChars(baseName))
+ }
+
+ private fun getShortNameChars(baseName: String): CharArray {
+ val name = CharArray(baseName.length() + suffix.length())
+ baseName.getChars(0, baseName.length(), name, 0)
+ if (!suffix.isEmpty()) {
+ suffix.getChars(0, suffix.length(), name, baseName.length())
+ }
+ if (Character.isLowerCase(name[0])) {
+ name[0] = Character.toUpperCase(name[0])
+ }
+ if (baseName.endsWith("breakpoint")) {
+ name[baseName.length() - "breakpoint".length()] = 'B'
+ }
+ else if (baseName.endsWith("breakpoints")) {
+ name[baseName.length() - "breakpoints".length()] = 'B'
+ }
+ return name
+ }
+
+ fun getPackageNameVirtual(domainName: String): String {
+ return getPackageName(rootPackage, domainName)
+ }
+
+ class Input(suffix: String, rootPackage: String) : ClassNameScheme(suffix, rootPackage) {
+
+ fun getParseMethodName(domain: String, name: String): String {
+ return "read" + Generator.capitalizeFirstChar(domain) + getShortName(name)
+ }
+ }
+
+ class Output(suffix: String, rootPackage: String) : ClassNameScheme(suffix, rootPackage)
+
+ class Common(suffix: String, rootPackage: String) : ClassNameScheme(suffix, rootPackage)
+
+ default object {
+
+ public fun getPackageName(rootPackage: String, domain: String): String {
+ if (domain.isEmpty()) {
+ return rootPackage
+ }
+ return rootPackage + '.' + domain.toLowerCase()
+ }
+ }
+}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ClassScope.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ClassScope.java
deleted file mode 100644
index ccf0bee..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ClassScope.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jsonProtocol.ItemDescriptor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-abstract class ClassScope {
- private final List<TextOutConsumer> additionalMemberTexts = new ArrayList<>(2);
- private final NamePath contextNamespace;
- final DomainGenerator generator;
-
- ClassScope(@NotNull DomainGenerator generator, @NotNull NamePath classNamespace) {
- contextNamespace = classNamespace;
- this.generator = generator;
- }
-
- protected String getShortClassName() {
- return contextNamespace.getLastComponent();
- }
-
- NamePath getClassContextNamespace() {
- return contextNamespace;
- }
-
- void addMember(@NotNull TextOutConsumer out) {
- additionalMemberTexts.add(out);
- }
-
- void writeAdditionalMembers(@NotNull TextOutput out) {
- if (additionalMemberTexts.isEmpty()) {
- return;
- }
-
- out.newLine();
- for (TextOutConsumer deferredWriter : additionalMemberTexts) {
- deferredWriter.append(out);
- }
- }
-
- protected abstract TypeData.Direction getTypeDirection();
-
- @NotNull
- protected static String getName(@NotNull ItemDescriptor.Named named) {
- return named.shortName() == null ? named.name() : named.shortName();
- }
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ClassScope.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ClassScope.kt
new file mode 100644
index 0000000..2e0c48c
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ClassScope.kt
@@ -0,0 +1,30 @@
+package org.jetbrains.protocolReader
+
+abstract class ClassScope(val generator: DomainGenerator, val classContextNamespace: NamePath) {
+ private val additionalMemberTexts = ArrayList<TextOutConsumer>(2)
+
+ protected fun getShortClassName(): String {
+ return classContextNamespace.lastComponent
+ }
+
+ fun addMember(out: TextOutConsumer) {
+ additionalMemberTexts.add(out)
+ }
+
+ fun writeAdditionalMembers(out: TextOutput) {
+ if (additionalMemberTexts.isEmpty()) {
+ return
+ }
+
+ out.newLine()
+ for (deferredWriter in additionalMemberTexts) {
+ deferredWriter.append(out)
+ }
+ }
+
+ abstract fun getTypeDirection(): TypeData.Direction
+
+ default object {
+ fun getName(named: ItemDescriptor.Named) = named.shortName() ?: named.name()
+ }
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/CreateStandaloneTypeBindingVisitorBase.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/CreateStandaloneTypeBindingVisitorBase.java
deleted file mode 100644
index d065300..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/CreateStandaloneTypeBindingVisitorBase.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.jsonProtocol.ProtocolMetaModel;
-
-abstract class CreateStandaloneTypeBindingVisitorBase implements TypeVisitor<StandaloneTypeBinding> {
- private final ProtocolMetaModel.StandaloneType type;
- private final DomainGenerator generator;
-
- CreateStandaloneTypeBindingVisitorBase(DomainGenerator generator, ProtocolMetaModel.StandaloneType type) {
- this.generator = generator;
- this.type = type;
- }
-
- protected ProtocolMetaModel.StandaloneType getType() {
- return type;
- }
-
- @Override
- public StandaloneTypeBinding visitString() {
- return generator.createTypedefTypeBinding(type, StandaloneTypeBinding.PredefinedTarget.STRING, generator.generator.naming.commonTypedef, null);
- }
-
- @Override
- public StandaloneTypeBinding visitInteger() {
- return generator.createTypedefTypeBinding(type, StandaloneTypeBinding.PredefinedTarget.INT, generator.generator.naming.commonTypedef, null);
- }
-
- @Override
- public StandaloneTypeBinding visitRef(String refName) {
- throw new RuntimeException();
- }
-
- @Override
- public StandaloneTypeBinding visitBoolean() {
- throw new RuntimeException();
- }
-
- @Override
- public StandaloneTypeBinding visitNumber() {
- return generator.createTypedefTypeBinding(type, StandaloneTypeBinding.PredefinedTarget.NUMBER,
- generator.generator.naming.commonTypedef, null);
- }
-
- @Override
- public StandaloneTypeBinding visitMap() {
- return generator.createTypedefTypeBinding(type, StandaloneTypeBinding.PredefinedTarget.MAP,
- generator.generator.naming.commonTypedef, null);
- }
-
- @Override
- public StandaloneTypeBinding visitUnknown() {
- throw new RuntimeException();
- }
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/CreateStandaloneTypeBindingVisitorBase.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/CreateStandaloneTypeBindingVisitorBase.kt
new file mode 100644
index 0000000..dbe0f87
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/CreateStandaloneTypeBindingVisitorBase.kt
@@ -0,0 +1,32 @@
+package org.jetbrains.protocolReader
+
+abstract class CreateStandaloneTypeBindingVisitorBase(private val generator: DomainGenerator, protected val type: ProtocolMetaModel.StandaloneType) : TypeVisitor<StandaloneTypeBinding> {
+
+ override fun visitString(): StandaloneTypeBinding {
+ return generator.createTypedefTypeBinding(type, StandaloneTypeBinding.PredefinedTarget.STRING, generator.generator.naming.commonTypedef, null)
+ }
+
+ override fun visitInteger(): StandaloneTypeBinding {
+ return generator.createTypedefTypeBinding(type, StandaloneTypeBinding.PredefinedTarget.INT, generator.generator.naming.commonTypedef, null)
+ }
+
+ override fun visitRef(refName: String): StandaloneTypeBinding {
+ throw RuntimeException()
+ }
+
+ override fun visitBoolean(): StandaloneTypeBinding {
+ throw RuntimeException()
+ }
+
+ override fun visitNumber(): StandaloneTypeBinding {
+ return generator.createTypedefTypeBinding(type, StandaloneTypeBinding.PredefinedTarget.NUMBER, generator.generator.naming.commonTypedef, null)
+ }
+
+ override fun visitMap(): StandaloneTypeBinding {
+ return generator.createTypedefTypeBinding(type, StandaloneTypeBinding.PredefinedTarget.MAP, generator.generator.naming.commonTypedef, null)
+ }
+
+ override fun visitUnknown(): StandaloneTypeBinding {
+ throw RuntimeException()
+ }
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/DomainGenerator.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/DomainGenerator.java
deleted file mode 100644
index 92775a1..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/DomainGenerator.java
+++ /dev/null
@@ -1,394 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jsonProtocol.ItemDescriptor;
-import org.jetbrains.jsonProtocol.ProtocolMetaModel;
-
-import java.io.IOException;
-import java.util.List;
-
-class DomainGenerator {
- final ProtocolMetaModel.Domain domain;
- final Generator generator;
-
- DomainGenerator(Generator generator, ProtocolMetaModel.Domain domain) {
- this.generator = generator;
- this.domain = domain;
- }
-
- void registerTypes() {
- if (domain.types() != null) {
- for (ProtocolMetaModel.StandaloneType type : domain.types()) {
- generator.typeMap.getTypeData(domain.domain(), type.id()).setType(type);
- }
- }
- }
-
- @NotNull
- static String fixMethodName(@NotNull String name) {
- int i = name.indexOf("breakpoint");
- return i > 0 ? name.substring(0, i) + 'B' + name.substring(i + 1) : name;
- }
-
- void generateCommandsAndEvents() throws IOException {
- FileUpdater requestsFileUpdater = generator.startJavaFile(generator.naming.params.getPackageNameVirtual(domain.domain()), "Requests.java");
- TextOutput out = requestsFileUpdater.out;
- out.append("import org.jetbrains.annotations.NotNull;").newLine();
- out.append("import org.jetbrains.jsonProtocol.Request;").newLine();
- out.newLine().append("public final class ").append("Requests");
- out.openBlock();
-
- boolean isFirst = true;
-
- for (ProtocolMetaModel.Command command : domain.commands()) {
- boolean hasResponse = command.returns() != null;
-
- boolean onlyMandatoryParams = true;
- List<ProtocolMetaModel.Parameter> params = command.parameters();
- boolean hasParams = params != null && !params.isEmpty();
- if (hasParams) {
- for (ProtocolMetaModel.Parameter parameter : params) {
- if (parameter.optional()) {
- onlyMandatoryParams = false;
- }
- }
- }
-
- String returnType = hasResponse ? generator.naming.commandResult.getShortName(command.name()) : "Void";
- if (onlyMandatoryParams) {
- if (isFirst) {
- isFirst = false;
- }
- else {
- out.newLine().newLine();
- }
- out.append("@NotNull").newLine().append("public static Request<");
- out.append(returnType);
- out.append(">").space().append(fixMethodName(command.name())).append("(");
-
- OutputClassScope classScope = new OutputClassScope(this, generator.naming.params.getFullName(domain.domain(), command.name()));
- BoxableType[] parameterTypes = hasParams ? new BoxableType[params.size()] : null;
- if (hasParams) {
- classScope.writeMethodParameters(out, params, parameterTypes);
- }
-
- out.append(')').openBlock();
-
- if (hasParams) {
- out.append("V8SimpleRequest<").append(returnType).append(">").append(" r =");
- }
- else {
- out.append("return");
- }
-
- out.append(" new V8SimpleRequest<").append(returnType).append(">(\"");
- if (!domain.domain().isEmpty()) {
- out.append(domain.domain()).append('.');
- }
- out.append(command.name()).append("\")").semi();
-
- if (hasParams) {
- classScope.writeWriteCalls(out, params, parameterTypes, "r");
- out.newLine().append("return r").semi();
- }
-
- out.closeBlock();
- }
- else {
- generateRequest(command, returnType);
- }
-
- if (hasResponse) {
- FileUpdater fileUpdater = generator.startJavaFile(generator.naming.commandResult, domain, command.name());
- generateJsonProtocolInterface(fileUpdater.out, generator.naming.commandResult.getShortName(command.name()), command.description(), command.returns(), null);
- fileUpdater.update();
- generator.jsonProtocolParserClassNames.add(generator.naming.commandResult.getFullName(domain.domain(), command.name()).getFullText());
- generator.parserRootInterfaceItems.add(new ParserRootInterfaceItem(domain.domain(), command.name(), generator.naming.commandResult));
- }
- }
-
- out.closeBlock();
- requestsFileUpdater.update();
-
- if (domain.events() != null) {
- for (ProtocolMetaModel.Event event : domain.events()) {
- generateEvenData(event);
- generator.jsonProtocolParserClassNames.add(generator.naming.eventData.getFullName(domain.domain(), event.name()).getFullText());
- generator.parserRootInterfaceItems.add(new ParserRootInterfaceItem(domain.domain(), event.name(), generator.naming.eventData));
- }
- }
- }
-
- private void generateRequest(@NotNull final ProtocolMetaModel.Command command, @NotNull final String returnType) throws IOException {
- TextOutConsumer baseTypeBuilder = new TextOutConsumer() {
- @Override
- public void append(TextOutput out) {
- out.space().append("extends ").append(generator.naming.requestClassName).append('<').append(returnType).append('>');
- }
- };
-
- TextOutConsumer memberBuilder = new TextOutConsumer() {
- @Override
- public void append(TextOutput out) {
- out.append("@NotNull").newLine().append("@Override").newLine().append("public String getMethodName()").openBlock();
- out.append("return \"");
- if (!domain.domain().isEmpty()) {
- out.append(domain.domain()).append('.');
- }
- out.append(command.name()).append("\";").closeBlock();
- }
- };
- generateTopLevelOutputClass(generator.naming.params, command.name(), command.description(), baseTypeBuilder,
- memberBuilder, command.parameters());
- }
-
- void generateCommandAdditionalParam(ProtocolMetaModel.StandaloneType type) throws IOException {
- generateTopLevelOutputClass(generator.naming.additionalParam, type.id(), type.description(), null, null, type.properties());
- }
-
- private <P extends ItemDescriptor.Named> void generateTopLevelOutputClass(@NotNull ClassNameScheme nameScheme,
- String baseName,
- String description,
- @Nullable TextOutConsumer baseType,
- @Nullable TextOutConsumer additionalMemberText,
- List<P> properties) throws IOException {
- FileUpdater fileUpdater = generator.startJavaFile(nameScheme, domain, baseName);
- if (nameScheme == generator.naming.params) {
- fileUpdater.out.append("import org.jetbrains.annotations.NotNull;").newLine().newLine();
- }
- generateOutputClass(fileUpdater.out, nameScheme.getFullName(domain.domain(), baseName), description, baseType, additionalMemberText, properties);
- fileUpdater.update();
- }
-
- private <P extends ItemDescriptor.Named> void generateOutputClass(@NotNull TextOutput out,
- NamePath classNamePath,
- String description,
- @Nullable TextOutConsumer baseType,
- TextOutConsumer additionalMemberText,
- List<P> properties) {
- out.doc(description);
- out.append("public final class ").append(classNamePath.getLastComponent());
- if (baseType == null) {
- out.append(" extends ").append("org.jetbrains.jsonProtocol.OutMessage");
- }
- else {
- baseType.append(out);
- }
-
- OutputClassScope classScope = new OutputClassScope(this, classNamePath);
- if (additionalMemberText != null) {
- classScope.addMember(additionalMemberText);
- }
-
- out.openBlock();
- classScope.generate(out, properties);
- classScope.writeAdditionalMembers(out);
- out.closeBlock();
- }
-
- StandaloneTypeBinding createStandaloneOutputTypeBinding(@NotNull ProtocolMetaModel.StandaloneType type, @NotNull String name) {
- return Generator.switchByType(type, new MyCreateStandaloneTypeBindingVisitorBase(this, type, name));
- }
-
- StandaloneTypeBinding createStandaloneInputTypeBinding(ProtocolMetaModel.StandaloneType type) {
- return Generator.switchByType(type, new CreateStandaloneTypeBindingVisitorBase(this, type) {
- @Override
- public StandaloneTypeBinding visitObject(List<ProtocolMetaModel.ObjectProperty> properties) {
- return createStandaloneObjectInputTypeBinding(getType(), properties);
- }
-
- @Override
- public StandaloneTypeBinding visitEnum(List<String> enumConstants) {
- return createStandaloneEnumInputTypeBinding(getType(), enumConstants,
- TypeData.Direction.INPUT);
- }
-
- @Override
- public StandaloneTypeBinding visitArray(ProtocolMetaModel.ArrayItemType items) {
- ResolveAndGenerateScope resolveAndGenerateScope = new ResolveAndGenerateScope() {
- // This class is responsible for generating ad hoc type.
- // If we ever are to do it, we should generate into string buffer and put strings
- // inside TypeDef class.
- @Override
- public String getDomainName() {
- return domain.domain();
- }
-
- @Override
- public TypeData.Direction getTypeDirection() {
- return TypeData.Direction.INPUT;
- }
-
- @Override
- public <T extends ItemDescriptor> TypeDescriptor resolveType(T typedObject) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public BoxableType generateNestedObject(String description, List<ProtocolMetaModel.ObjectProperty> properties) {
- throw new UnsupportedOperationException();
- }
- };
- BoxableType itemBoxableType = generator.resolveType(items, resolveAndGenerateScope).getType();
-
- final BoxableType arrayType = new ListType(itemBoxableType);
- StandaloneTypeBinding.Target target = new StandaloneTypeBinding.Target() {
- @Override
- public BoxableType resolve(ResolveContext context) {
- return arrayType;
- }
- };
-
- return createTypedefTypeBinding(getType(), target, generator.naming.inputTypedef, TypeData.Direction.INPUT);
- }
- });
- }
-
- StandaloneTypeBinding createStandaloneObjectInputTypeBinding(@NotNull final ProtocolMetaModel.StandaloneType type, @Nullable final List<ProtocolMetaModel.ObjectProperty> properties) {
- final String name = type.id();
- final NamePath fullTypeName = generator.naming.inputValue.getFullName(domain.domain(), name);
- generator.jsonProtocolParserClassNames.add(fullTypeName.getFullText());
-
- return new StandaloneTypeBinding() {
- @Override
- public BoxableType getJavaType() {
- return new StandaloneType(fullTypeName, "writeMessage");
- }
-
- @Override
- public void generate() throws IOException {
- NamePath className = generator.naming.inputValue.getFullName(domain.domain(), name);
- FileUpdater fileUpdater = generator.startJavaFile(generator.naming.inputValue, domain, name);
- TextOutput out = fileUpdater.out;
- if (type.description() != null) {
- out.doc(type.description());
- }
-
- out.append("@org.jetbrains.jsonProtocol.JsonType").newLine();
- out.append("public interface ").append(className.getLastComponent()).openBlock();
- InputClassScope classScope = new InputClassScope(DomainGenerator.this, className);
- if (properties != null) {
- classScope.generateDeclarationBody(out, properties);
- }
- classScope.writeAdditionalMembers(out);
- out.closeBlock();
- fileUpdater.update();
- }
-
- @Override public TypeData.Direction getDirection() {
- return TypeData.Direction.INPUT;
- }
- };
- }
-
- StandaloneTypeBinding createStandaloneEnumInputTypeBinding(final ProtocolMetaModel.StandaloneType type,
- final List<String> enumConstants, final TypeData.Direction direction) {
- final String name = type.id();
- return new StandaloneTypeBinding() {
- @Override
- public BoxableType getJavaType() {
- return new StandaloneType(generator.naming.inputEnum.getFullName(domain.domain(), name), "writeEnum");
- }
-
- @Override
- public void generate() throws IOException {
- FileUpdater fileUpdater = generator.startJavaFile(generator.naming.inputEnum, domain, name);
- fileUpdater.out.doc(type.description());
- Enums.appendEnums(enumConstants, generator.naming.inputEnum.getShortName(name), true, fileUpdater.out);
- fileUpdater.update();
- }
-
- @Override
- public TypeData.Direction getDirection() {
- return direction;
- }
- };
- }
-
- /**
- * Typedef is an empty class that just holds description and
- * refers to an actual type (such as String).
- */
- StandaloneTypeBinding createTypedefTypeBinding(final ProtocolMetaModel.StandaloneType type, StandaloneTypeBinding.Target target,
- final ClassNameScheme nameScheme, final TypeData.Direction direction) {
- final String name = type.id();
- final NamePath typedefJavaName = nameScheme.getFullName(domain.domain(), name);
- final BoxableType actualJavaType = target.resolve(new StandaloneTypeBinding.Target.ResolveContext() {
- @Override
- public BoxableType generateNestedObject(String shortName, String description, List<ProtocolMetaModel.ObjectProperty> properties) {
- NamePath classNamePath = new NamePath(shortName, typedefJavaName);
- if (direction == null) {
- throw new RuntimeException("Unsupported");
- }
-
- switch (direction) {
- case INPUT:
- throw new RuntimeException("TODO");
- case OUTPUT:
- TextOutput out = new TextOutput(new StringBuilder());
- generateOutputClass(out, classNamePath, description, null, null, properties);
- break;
- default:
- throw new RuntimeException();
- }
- return new StandaloneType(new NamePath(shortName, typedefJavaName), "writeMessage");
- }
- });
-
- return new StandaloneTypeBinding() {
- @Override
- public BoxableType getJavaType() {
- return actualJavaType;
- }
-
- @Override
- public void generate() {
- }
-
- @Override
- public TypeData.Direction getDirection() {
- return direction;
- }
- };
- }
-
- private void generateEvenData(final ProtocolMetaModel.Event event) throws IOException {
- String className = generator.naming.eventData.getShortName(event.name());
- FileUpdater fileUpdater = generator.startJavaFile(generator.naming.eventData, domain, event.name());
- final String domainName = domain.domain();
- final CharSequence fullName = generator.naming.eventData.getFullName(domainName, event.name()).getFullText();
- generateJsonProtocolInterface(fileUpdater.out, className, event.description(), event.parameters(), new TextOutConsumer() {
- @Override
- public void append(TextOutput out) {
- out.newLine().append("org.jetbrains.wip.protocol.WipEventType<").append(fullName).append("> TYPE").newLine();
- out.append("\t= new org.jetbrains.wip.protocol.WipEventType<").append(fullName).append(">");
- out.append("(\"").append(domainName).append('.').append(event.name()).append("\", ").append(fullName).append(".class)").openBlock();
- {
- out.append("@Override").newLine().append("public ").append(fullName).append(" read(");
- out.append(generator.naming.inputPackage).append('.').append(Generator.READER_INTERFACE_NAME + " protocolReader, ").append(Util.JSON_READER_PARAMETER_DEF).append(")").openBlock();
- out.append("return protocolReader.").append(generator.naming.eventData.getParseMethodName(domainName, event.name())).append("(reader);").closeBlock();
- }
- out.closeBlock();
- out.semi();
- }
- });
- fileUpdater.update();
- }
-
- private void generateJsonProtocolInterface(TextOutput out, String className, String description, List<ProtocolMetaModel.Parameter> parameters, TextOutConsumer additionalMembersText) {
- if (description != null) {
- out.doc(description);
- }
- out.append("@org.jetbrains.jsonProtocol.JsonType").newLine().append("public interface ").append(className).openBlock();
- InputClassScope classScope = new InputClassScope(this, new NamePath(className, new NamePath(ClassNameScheme.getPackageName(generator.naming.inputPackage, domain.domain()))));
- if (additionalMembersText != null) {
- classScope.addMember(additionalMembersText);
- }
- if (parameters != null) {
- classScope.generateDeclarationBody(out, parameters);
- }
- classScope.writeAdditionalMembers(out);
- out.closeBlock();
- }
-}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/DomainGenerator.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/DomainGenerator.kt
new file mode 100644
index 0000000..4b45aa5
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/DomainGenerator.kt
@@ -0,0 +1,348 @@
+package org.jetbrains.protocolReader
+
+class DomainGenerator(val generator: Generator, val domain: ProtocolMetaModel.Domain) {
+
+ fun registerTypes() {
+ if (domain.types() != null) {
+ for (type in domain.types()!!) {
+ generator.typeMap.getTypeData(domain.domain(), type.id()).setType(type)
+ }
+ }
+ }
+
+ throws(javaClass<IOException>())
+ fun generateCommandsAndEvents() {
+ val requestsFileUpdater = generator.startJavaFile(generator.naming.params.getPackageNameVirtual(domain.domain()), "Requests.java")
+ val out = requestsFileUpdater.out
+ out.append("import org.jetbrains.annotations.NotNull;").newLine()
+ out.append("import org.jetbrains.jsonProtocol.Request;").newLine()
+ out.newLine().append("public final class ").append("Requests")
+ out.openBlock()
+
+ var isFirst = true
+
+ for (command in domain.commands()) {
+ val hasResponse = command.returns() != null
+
+ var onlyMandatoryParams = true
+ val params = command.parameters()
+ val hasParams = params != null && !params.isEmpty()
+ if (hasParams) {
+ for (parameter in params!!) {
+ if (parameter.optional()) {
+ onlyMandatoryParams = false
+ }
+ }
+ }
+
+ val returnType = if (hasResponse) generator.naming.commandResult.getShortName(command.name()) else "Void"
+ if (onlyMandatoryParams) {
+ if (isFirst) {
+ isFirst = false
+ }
+ else {
+ out.newLine().newLine()
+ }
+ out.append("@NotNull").newLine().append("public static Request<")
+ out.append(returnType)
+ out.append(">").space().append(fixMethodName(command.name())).append("(")
+
+ val classScope = OutputClassScope(this, generator.naming.params.getFullName(domain.domain(), command.name()))
+ val parameterTypes = if (hasParams) arrayOfNulls<BoxableType>(params!!.size()) else null
+ if (hasParams) {
+ classScope.writeMethodParameters<ProtocolMetaModel.Parameter>(out, params!!, parameterTypes!!)
+ }
+
+ out.append(')').openBlock()
+
+ if (hasParams) {
+ out.append("V8SimpleRequest<").append(returnType).append(">").append(" r =")
+ }
+ else {
+ out.append("return")
+ }
+
+ out.append(" new V8SimpleRequest<").append(returnType).append(">(\"")
+ if (!domain.domain().isEmpty()) {
+ out.append(domain.domain()).append('.')
+ }
+ out.append(command.name()).append("\")").semi()
+
+ if (hasParams) {
+ classScope.writeWriteCalls<ProtocolMetaModel.Parameter>(out, params!!, parameterTypes!!, "r")
+ out.newLine().append("return r").semi()
+ }
+
+ out.closeBlock()
+ }
+ else {
+ generateRequest(command, returnType)
+ }
+
+ if (hasResponse) {
+ val fileUpdater = generator.startJavaFile(generator.naming.commandResult, domain, command.name())
+ generateJsonProtocolInterface(fileUpdater.out, generator.naming.commandResult.getShortName(command.name()), command.description(), command.returns(), null)
+ fileUpdater.update()
+ generator.jsonProtocolParserClassNames.add(generator.naming.commandResult.getFullName(domain.domain(), command.name()).getFullText())
+ generator.parserRootInterfaceItems.add(ParserRootInterfaceItem(domain.domain(), command.name(), generator.naming.commandResult))
+ }
+ }
+
+ out.closeBlock()
+ requestsFileUpdater.update()
+
+ if (domain.events() != null) {
+ for (event in domain.events()!!) {
+ generateEvenData(event)
+ generator.jsonProtocolParserClassNames.add(generator.naming.eventData.getFullName(domain.domain(), event.name()).getFullText())
+ generator.parserRootInterfaceItems.add(ParserRootInterfaceItem(domain.domain(), event.name(), generator.naming.eventData))
+ }
+ }
+ }
+
+ throws(javaClass<IOException>())
+ private fun generateRequest(command: ProtocolMetaModel.Command, returnType: String) {
+ val baseTypeBuilder = object : TextOutConsumer {
+ override fun append(out: TextOutput) {
+ out.space().append("extends ").append(generator.naming.requestClassName).append('<').append(returnType).append('>')
+ }
+ }
+
+ val memberBuilder = object : TextOutConsumer {
+ override fun append(out: TextOutput) {
+ out.append("@NotNull").newLine().append("@Override").newLine().append("public String getMethodName()").openBlock()
+ out.append("return \"")
+ if (!domain.domain().isEmpty()) {
+ out.append(domain.domain()).append('.')
+ }
+ out.append(command.name()).append("\";").closeBlock()
+ }
+ }
+ generateTopLevelOutputClass(generator.naming.params, command.name(), command.description(), baseTypeBuilder, memberBuilder, command.parameters())
+ }
+
+ fun generateCommandAdditionalParam(type: ProtocolMetaModel.StandaloneType) {
+ generateTopLevelOutputClass(generator.naming.additionalParam, type.id(), type.description(), null, null, type.properties())
+ }
+
+ private fun <P : ItemDescriptor.Named> generateTopLevelOutputClass(nameScheme: ClassNameScheme, baseName: String, description: String?, baseType: TextOutConsumer?, additionalMemberText: TextOutConsumer?, properties: List<P>?) {
+ val fileUpdater = generator.startJavaFile(nameScheme, domain, baseName)
+ if (nameScheme == generator.naming.params) {
+ fileUpdater.out.append("import org.jetbrains.annotations.NotNull;").newLine().newLine()
+ }
+ generateOutputClass(fileUpdater.out, nameScheme.getFullName(domain.domain(), baseName), description, baseType, additionalMemberText, properties)
+ fileUpdater.update()
+ }
+
+ private fun <P : ItemDescriptor.Named> generateOutputClass(out: TextOutput, classNamePath: NamePath, description: String?, baseType: TextOutConsumer?, additionalMemberText: TextOutConsumer?, properties: List<P>?) {
+ out.doc(description)
+ out.append("public final class ").append(classNamePath.lastComponent)
+ if (baseType == null) {
+ out.append(" extends ").append("org.jetbrains.jsonProtocol.OutMessage")
+ }
+ else {
+ baseType.append(out)
+ }
+
+ val classScope = OutputClassScope(this, classNamePath)
+ if (additionalMemberText != null) {
+ classScope.addMember(additionalMemberText)
+ }
+
+ out.openBlock()
+ classScope.generate<P>(out, properties)
+ classScope.writeAdditionalMembers(out)
+ out.closeBlock()
+ }
+
+ fun createStandaloneOutputTypeBinding(type: ProtocolMetaModel.StandaloneType, name: String): StandaloneTypeBinding {
+ return Generator.switchByType<StandaloneTypeBinding>(type, MyCreateStandaloneTypeBindingVisitorBase(this, type, name))
+ }
+
+ fun createStandaloneInputTypeBinding(type: ProtocolMetaModel.StandaloneType): StandaloneTypeBinding {
+ return Generator.switchByType<StandaloneTypeBinding>(type, object : CreateStandaloneTypeBindingVisitorBase(this, type) {
+ override fun visitObject(properties: List<ProtocolMetaModel.ObjectProperty>?): StandaloneTypeBinding {
+ return createStandaloneObjectInputTypeBinding(type, properties)
+ }
+
+ override fun visitEnum(enumConstants: List<String>): StandaloneTypeBinding {
+ return createStandaloneEnumInputTypeBinding(type, enumConstants, TypeData.Direction.INPUT)
+ }
+
+ override fun visitArray(items: ProtocolMetaModel.ArrayItemType): StandaloneTypeBinding {
+ val resolveAndGenerateScope = object : ResolveAndGenerateScope {
+ // This class is responsible for generating ad hoc type.
+ // If we ever are to do it, we should generate into string buffer and put strings
+ // inside TypeDef class.
+ override fun getDomainName(): String {
+ return domain.domain()
+ }
+
+ override fun getTypeDirection(): TypeData.Direction {
+ return TypeData.Direction.INPUT
+ }
+
+ override fun <T : ItemDescriptor> resolveType(typedObject: T): TypeDescriptor {
+ throw UnsupportedOperationException()
+ }
+
+ override fun generateNestedObject(description: String?, properties: List<ProtocolMetaModel.ObjectProperty>?) = throw UnsupportedOperationException()
+ }
+ val itemBoxableType = generator.resolveType(items, resolveAndGenerateScope).type
+
+ val arrayType = ListType(itemBoxableType)
+ val target = object : StandaloneTypeBinding.Target {
+ override fun resolve(context: StandaloneTypeBinding.Target.ResolveContext): BoxableType {
+ return arrayType
+ }
+ }
+
+ return createTypedefTypeBinding(type, target, generator.naming.inputTypedef, TypeData.Direction.INPUT)
+ }
+ })
+ }
+
+ fun createStandaloneObjectInputTypeBinding(type: ProtocolMetaModel.StandaloneType, properties: List<ProtocolMetaModel.ObjectProperty>?): StandaloneTypeBinding {
+ val name = type.id()
+ val fullTypeName = generator.naming.inputValue.getFullName(domain.domain(), name)
+ generator.jsonProtocolParserClassNames.add(fullTypeName.getFullText())
+
+ return object : StandaloneTypeBinding {
+ override fun getJavaType(): BoxableType {
+ return StandaloneType(fullTypeName, "writeMessage")
+ }
+
+ throws(javaClass<IOException>())
+ override fun generate() {
+ val className = generator.naming.inputValue.getFullName(domain.domain(), name)
+ val fileUpdater = generator.startJavaFile(generator.naming.inputValue, domain, name)
+ val out = fileUpdater.out
+ if (type.description() != null) {
+ out.doc(type.description())
+ }
+
+ out.append("@org.jetbrains.jsonProtocol.JsonType").newLine()
+ out.append("public interface ").append(className.lastComponent).openBlock()
+ val classScope = InputClassScope(this@DomainGenerator, className)
+ if (properties != null) {
+ classScope.generateDeclarationBody(out, properties)
+ }
+ classScope.writeAdditionalMembers(out)
+ out.closeBlock()
+ fileUpdater.update()
+ }
+
+ override fun getDirection(): TypeData.Direction? {
+ return TypeData.Direction.INPUT
+ }
+ }
+ }
+
+ fun createStandaloneEnumInputTypeBinding(type: ProtocolMetaModel.StandaloneType, enumConstants: List<String>, direction: TypeData.Direction): StandaloneTypeBinding {
+ val name = type.id()
+ return object : StandaloneTypeBinding {
+ override fun getJavaType(): BoxableType {
+ return StandaloneType(generator.naming.inputEnum.getFullName(domain.domain(), name), "writeEnum")
+ }
+
+ throws(javaClass<IOException>())
+ override fun generate() {
+ val fileUpdater = generator.startJavaFile(generator.naming.inputEnum, domain, name)
+ fileUpdater.out.doc(type.description())
+ Enums.appendEnums(enumConstants, generator.naming.inputEnum.getShortName(name), true, fileUpdater.out)
+ fileUpdater.update()
+ }
+
+ override fun getDirection(): TypeData.Direction? {
+ return direction
+ }
+ }
+ }
+
+ /**
+ * Typedef is an empty class that just holds description and
+ * refers to an actual type (such as String).
+ */
+ fun createTypedefTypeBinding(type: ProtocolMetaModel.StandaloneType, target: StandaloneTypeBinding.Target, nameScheme: ClassNameScheme, direction: TypeData.Direction?): StandaloneTypeBinding {
+ val name = type.id()
+ val typedefJavaName = nameScheme.getFullName(domain.domain(), name)
+ val actualJavaType = target.resolve(object : StandaloneTypeBinding.Target.ResolveContext {
+ override fun generateNestedObject(shortName: String, description: String?, properties: List<ProtocolMetaModel.ObjectProperty>?): BoxableType {
+ val classNamePath = NamePath(shortName, typedefJavaName)
+ if (direction == null) {
+ throw RuntimeException("Unsupported")
+ }
+
+ when (direction) {
+ TypeData.Direction.INPUT -> throw RuntimeException("TODO")
+ TypeData.Direction.OUTPUT -> {
+ val out = TextOutput(StringBuilder())
+ generateOutputClass(out, classNamePath, description, null, null, properties)
+ }
+ else -> throw RuntimeException()
+ }
+ return StandaloneType(NamePath(shortName, typedefJavaName), "writeMessage")
+ }
+ })
+
+ return object : StandaloneTypeBinding {
+ override fun getJavaType(): BoxableType {
+ return actualJavaType
+ }
+
+ override fun generate() {
+ }
+
+ override fun getDirection(): TypeData.Direction? {
+ return direction
+ }
+ }
+ }
+
+ throws(javaClass<IOException>())
+ private fun generateEvenData(event: ProtocolMetaModel.Event) {
+ val className = generator.naming.eventData.getShortName(event.name())
+ val fileUpdater = generator.startJavaFile(generator.naming.eventData, domain, event.name())
+ val domainName = domain.domain()
+ val fullName = generator.naming.eventData.getFullName(domainName, event.name()).getFullText()
+ generateJsonProtocolInterface(fileUpdater.out, className, event.description(), event.parameters(), object : TextOutConsumer {
+ override fun append(out: TextOutput) {
+ out.newLine().append("org.jetbrains.wip.protocol.WipEventType<").append(fullName).append("> TYPE").newLine()
+ out.append("\t= new org.jetbrains.wip.protocol.WipEventType<").append(fullName).append(">")
+ out.append("(\"").append(domainName).append('.').append(event.name()).append("\", ").append(fullName).append(".class)").openBlock()
+ run {
+ out.append("@Override").newLine().append("public ").append(fullName).append(" read(")
+ out.append(generator.naming.inputPackage).append('.').append(Generator.READER_INTERFACE_NAME + " protocolReader, ").append(JSON_READER_PARAMETER_DEF).append(")").openBlock()
+ out.append("return protocolReader.").append(generator.naming.eventData.getParseMethodName(domainName, event.name())).append("(reader);").closeBlock()
+ }
+ out.closeBlock()
+ out.semi()
+ }
+ })
+ fileUpdater.update()
+ }
+
+ private fun generateJsonProtocolInterface(out: TextOutput, className: String, description: String?, parameters: List<ProtocolMetaModel.Parameter>?, additionalMembersText: TextOutConsumer?) {
+ if (description != null) {
+ out.doc(description)
+ }
+ out.append("@org.jetbrains.jsonProtocol.JsonType").newLine().append("public interface ").append(className).openBlock()
+ val classScope = InputClassScope(this, NamePath(className, NamePath(ClassNameScheme.getPackageName(generator.naming.inputPackage, domain.domain()))))
+ if (additionalMembersText != null) {
+ classScope.addMember(additionalMembersText)
+ }
+ if (parameters != null) {
+ classScope.generateDeclarationBody(out, parameters)
+ }
+ classScope.writeAdditionalMembers(out)
+ out.closeBlock()
+ }
+
+ default object {
+
+ fun fixMethodName(name: String): String {
+ val i = name.indexOf("breakpoint")
+ return if (i > 0) name.substring(0, i) + 'B' + name.substring(i + 1) else name
+ }
+ }
+}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/FileSet.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/FileSet.java
deleted file mode 100644
index b6a79b6..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/FileSet.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import gnu.trove.THashSet;
-import gnu.trove.TObjectProcedure;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.IOException;
-import java.nio.file.*;
-import java.nio.file.attribute.BasicFileAttributes;
-
-/**
- * Records a list of files in the root directory and deletes files that were not re-generated.
- */
-class FileSet {
- private final Path rootDir;
- @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
- private final THashSet<Path> unusedFiles;
-
- FileSet(Path rootDir) throws IOException {
- this.rootDir = rootDir;
- unusedFiles = new THashSet<Path>();
- Files.walkFileTree(rootDir, new SimpleFileVisitor<Path>() {
- @Override
- public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
- return Files.isHidden(dir) ? FileVisitResult.SKIP_SUBTREE : FileVisitResult.CONTINUE;
- }
-
- @NotNull
- @Override
- public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException {
- if (!Files.isHidden(path)) {
- unusedFiles.add(path);
- }
- return FileVisitResult.CONTINUE;
- }
- });
- }
-
- FileUpdater createFileUpdater(String filePath) {
- Path file = rootDir.resolve(filePath);
- unusedFiles.remove(file);
- return new FileUpdater(file);
- }
-
- void deleteOtherFiles() {
- unusedFiles.forEach(new TObjectProcedure<Path>() {
- @Override
- public boolean execute(Path path) {
- try {
- if (Files.deleteIfExists(path)) {
- Path parent = path.getParent();
- try (DirectoryStream<Path> stream = Files.newDirectoryStream(parent)) {
- if (!stream.iterator().hasNext()) {
- Files.delete(parent);
- }
- }
- }
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
- return true;
- }
- });
- }
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/FileSet.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/FileSet.kt
new file mode 100644
index 0000000..74eb02b
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/FileSet.kt
@@ -0,0 +1,56 @@
+package org.jetbrains.protocolReader
+
+/**
+ * Records a list of files in the root directory and deletes files that were not re-generated.
+ */
+class FileSet [throws(javaClass<IOException>())]
+(private val rootDir: Path) {
+ SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
+ private val unusedFiles: THashSet<Path>
+
+ {
+ unusedFiles = THashSet<Path>()
+ Files.walkFileTree(rootDir, object : SimpleFileVisitor<Path>() {
+ throws(javaClass<IOException>())
+ override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {
+ return if (Files.isHidden(dir)) FileVisitResult.SKIP_SUBTREE else FileVisitResult.CONTINUE
+ }
+
+ throws(javaClass<IOException>())
+ override fun visitFile(path: Path, attrs: BasicFileAttributes): FileVisitResult {
+ if (!Files.isHidden(path)) {
+ unusedFiles.add(path)
+ }
+ return FileVisitResult.CONTINUE
+ }
+ })
+ }
+
+ fun createFileUpdater(filePath: String): FileUpdater {
+ val file = rootDir.resolve(filePath)
+ unusedFiles.remove(file)
+ return FileUpdater(file)
+ }
+
+ fun deleteOtherFiles() {
+ unusedFiles.forEach(object : TObjectProcedure<Path> {
+ override fun execute(path: Path): Boolean {
+ try {
+ if (Files.deleteIfExists(path)) {
+ val parent = path.getParent()
+ Files.newDirectoryStream(parent).use { stream ->
+ if (!stream.iterator().hasNext()) {
+ Files.delete(parent)
+ }
+ }
+ }
+ }
+ catch (e: IOException) {
+ throw RuntimeException(e)
+ }
+
+ return true
+ }
+ })
+ }
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/Generator.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/Generator.java
deleted file mode 100644
index abd58b0..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/Generator.java
+++ /dev/null
@@ -1,314 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jsonProtocol.ItemDescriptor;
-
-import java.io.IOException;
-import java.nio.file.FileSystems;
-import java.util.*;
-
-import static org.jetbrains.jsonProtocol.ProtocolMetaModel.*;
-
-/**
- * Read metamodel and generates set of files with Java classes/interfaces for the protocol.
- */
-class Generator {
- private static final String PARSER_INTERFACE_LIST_CLASS_NAME = "GeneratedReaderInterfaceList";
- static final String READER_INTERFACE_NAME = "ProtocolResponseReader";
-
- final List<String> jsonProtocolParserClassNames = new ArrayList<>();
- final List<ParserRootInterfaceItem> parserRootInterfaceItems = new ArrayList<>();
- final TypeMap typeMap = new TypeMap();
-
- private final FileSet fileSet;
- final Naming naming;
-
- Generator(String outputDir, String rootPackage, String requestClassName) throws IOException {
- fileSet = new FileSet(FileSystems.getDefault().getPath(outputDir));
- naming = new Naming(rootPackage, requestClassName);
- }
-
- public static final class Naming {
- public final ClassNameScheme params;
- public final ClassNameScheme additionalParam;
- public final ClassNameScheme outputTypedef;
-
- public final ClassNameScheme.Input commandResult;
- public final ClassNameScheme.Input eventData;
- public final ClassNameScheme inputValue;
- public final ClassNameScheme inputEnum;
- public final ClassNameScheme inputTypedef;
-
- public final ClassNameScheme commonTypedef;
-
- public final String inputPackage;
- public final String requestClassName;
-
- private Naming(String rootPackage, String requestClassName) {
- this.requestClassName = requestClassName;
-
- params = new ClassNameScheme.Output("", rootPackage);
- additionalParam = new ClassNameScheme.Output("", rootPackage);
- outputTypedef = new ClassNameScheme.Output("Typedef", rootPackage);
- commonTypedef = new ClassNameScheme.Common("Typedef", rootPackage);
-
- inputPackage = rootPackage;
- commandResult = new ClassNameScheme.Input("Result", inputPackage);
- eventData = new ClassNameScheme.Input("EventData", inputPackage);
- inputValue = new ClassNameScheme.Input("Value", inputPackage);
- inputEnum = new ClassNameScheme.Input("", inputPackage);
- inputTypedef = new ClassNameScheme.Input("Typedef", inputPackage);
- }
- }
-
- private static boolean isDomainSkipped(Domain domain) {
- if (domain.domain().equals("CSS") || domain.domain().equals("Inspector")) {
- return false;
- }
-
- // todo DOMDebugger
- return domain.hidden() ||
- domain.domain().equals("DOMDebugger") ||
- domain.domain().equals("Timeline") ||
- domain.domain().equals("Input");
- }
-
- void go(Root metamodel) throws IOException {
- initializeKnownTypes();
-
- List<Domain> domainList = metamodel.domains();
- Map<String, DomainGenerator> domainGeneratorMap = new HashMap<>();
- for (Domain domain : domainList) {
- if (isDomainSkipped(domain)) {
- System.out.println("Domain skipped: " + domain.domain());
- continue;
- }
- DomainGenerator domainGenerator = new DomainGenerator(this, domain);
- domainGeneratorMap.put(domain.domain(), domainGenerator);
- domainGenerator.registerTypes();
- }
-
- for (Domain domain : domainList) {
- if (!isDomainSkipped(domain)) {
- System.out.println("Domain generated: " + domain.domain());
- }
- }
-
- typeMap.setDomainGeneratorMap(domainGeneratorMap);
-
- for (DomainGenerator domainGenerator : domainGeneratorMap.values()) {
- domainGenerator.generateCommandsAndEvents();
- }
-
- typeMap.generateRequestedTypes();
- generateParserInterfaceList();
- generateParserRoot(parserRootInterfaceItems);
- fileSet.deleteOtherFiles();
- }
-
- TypeDescriptor resolveType(@NotNull final ItemDescriptor typedObject, @NotNull final ResolveAndGenerateScope scope) {
- final boolean optional = typedObject instanceof ItemDescriptor.Named && ((ItemDescriptor.Named)typedObject).optional();
- return switchByType(typedObject, new TypeVisitor<TypeDescriptor>() {
- @Override
- public TypeDescriptor visitRef(String refName) {
- return new TypeDescriptor(resolveRefType(scope.getDomainName(), refName, scope.getTypeDirection()), optional);
- }
-
- @Override
- public TypeDescriptor visitBoolean() {
- return new TypeDescriptor(BoxableType.BOOLEAN, optional);
- }
-
- @Override
- public TypeDescriptor visitEnum(List<String> enumConstants) {
- assert scope instanceof MemberScope;
- return new TypeDescriptor(((MemberScope)scope).generateEnum(typedObject.description(), enumConstants), optional);
- }
-
- @Override
- public TypeDescriptor visitString() {
- return new TypeDescriptor(BoxableType.STRING, optional);
- }
-
- @Override
- public TypeDescriptor visitInteger() {
- return new TypeDescriptor(BoxableType.INT, optional);
- }
-
- @Override
- public TypeDescriptor visitNumber() {
- return new TypeDescriptor(BoxableType.NUMBER, optional);
- }
-
- @Override
- public TypeDescriptor visitMap() {
- return new TypeDescriptor(BoxableType.MAP, optional);
- }
-
- @Override
- public TypeDescriptor visitArray(ArrayItemType items) {
- BoxableType type = scope.resolveType(items).getType();
- return new TypeDescriptor(new ListType(type), optional, false, type == BoxableType.ANY_STRING);
- }
-
- @Override
- public TypeDescriptor visitObject(List<ObjectProperty> properties) {
- return new TypeDescriptor(scope.generateNestedObject(typedObject.description(), properties), optional);
- }
-
- @Override
- public TypeDescriptor visitUnknown() {
- return new TypeDescriptor(BoxableType.STRING, optional, false, true);
- }
- });
- }
-
- private void generateParserInterfaceList() throws IOException {
- FileUpdater fileUpdater = startJavaFile(naming.inputPackage, PARSER_INTERFACE_LIST_CLASS_NAME + ".java");
- // Write classes in stable order.
- Collections.sort(jsonProtocolParserClassNames);
-
- TextOutput out = fileUpdater.out;
- out.append("public class ").append(PARSER_INTERFACE_LIST_CLASS_NAME).openBlock();
- out.append("public static final Class<?>[] LIST =").openBlock();
- for (String name : jsonProtocolParserClassNames) {
- out.append(name).append(".class,").newLine();
- }
- out.closeBlock();
- out.semi();
- out.closeBlock();
- fileUpdater.update();
- }
-
- private void generateParserRoot(List<ParserRootInterfaceItem> parserRootInterfaceItems) throws IOException {
- FileUpdater fileUpdater = startJavaFile(naming.inputPackage, READER_INTERFACE_NAME + ".java");
- // Write classes in stable order.
- Collections.sort(parserRootInterfaceItems);
-
- TextOutput out = fileUpdater.out;
- out.append("public abstract class ").append(READER_INTERFACE_NAME).space().append("implements org.jetbrains.jsonProtocol.ResponseResultReader").openBlock();
- for (ParserRootInterfaceItem item : parserRootInterfaceItems) {
- item.writeCode(out);
- }
- out.newLine().newLine().append("@Override").newLine().append("public Object readResult(String methodName, org.jetbrains.io.JsonReaderEx reader)");
- out.openBlock();
-
- boolean isNotFirst = false;
- for (ParserRootInterfaceItem item : parserRootInterfaceItems) {
- if (isNotFirst) {
- out.append("else ");
- }
- else {
- isNotFirst = true;
- }
- out.append("if (methodName.equals(\"");
- if (!item.domain.isEmpty()) {
- out.append(item.domain).append('.');
- }
- out.append(item.name).append('"').append(")) return ");
- item.appendReadMethodName(out);
- out.append("(reader)").semi().newLine();
- }
- out.append("else return null").semi();
- out.closeBlock();
-
- out.closeBlock();
- fileUpdater.update();
- }
-
- /**
- * Resolve absolute (DOMAIN.TYPE) or relative (TYPE) type name
- */
- private BoxableType resolveRefType(String scopeDomainName, String refName,
- TypeData.Direction direction) {
- int pos = refName.indexOf('.');
- String domainName;
- String shortName;
- if (pos == -1) {
- domainName = scopeDomainName;
- shortName = refName;
- }
- else {
- domainName = refName.substring(0, pos);
- shortName = refName.substring(pos + 1);
- }
- return typeMap.resolve(domainName, shortName, direction);
- }
-
- static String generateMethodNameSubstitute(@NotNull String originalName, @NotNull TextOutput out) {
- if (!BAD_METHOD_NAMES.contains(originalName)) {
- return originalName;
- }
- out.append("@org.jetbrains.jsonProtocol.JsonField(jsonLiteralName=\"").append(originalName).append("\")").newLine();
- return "get" + Character.toUpperCase(originalName.charAt(0)) + originalName.substring(1);
- }
-
- static String capitalizeFirstChar(String s) {
- if (!s.isEmpty() && Character.isLowerCase(s.charAt(0))) {
- s = Character.toUpperCase(s.charAt(0)) + s.substring(1);
- }
- return s;
- }
-
- FileUpdater startJavaFile(@NotNull ClassNameScheme nameScheme, Domain domain, String baseName) throws IOException {
- return startJavaFile(nameScheme.getPackageNameVirtual(domain.domain()), nameScheme.getShortName(baseName) + ".java");
- }
-
- public FileUpdater startJavaFile(@NotNull String packageName, @NotNull String filename) {
- FileUpdater fileUpdater = fileSet.createFileUpdater(packageName.replace('.', '/') + '/' + filename);
- fileUpdater.out.append("// Generated source").newLine().append("package ").append(packageName).semi().newLine().newLine();
- return fileUpdater;
- }
-
- static <R> R switchByType(@NotNull ItemDescriptor typedObject, @NotNull TypeVisitor<R> visitor) {
- String refName = typedObject instanceof ItemDescriptor.Referenceable ? ((ItemDescriptor.Referenceable)typedObject).ref() : null;
- if (refName != null) {
- return visitor.visitRef(refName);
- }
- String typeName = typedObject.type();
- switch (typeName) {
- case BOOLEAN_TYPE:
- return visitor.visitBoolean();
- case STRING_TYPE:
- if (typedObject.getEnum() != null) {
- return visitor.visitEnum(typedObject.getEnum());
- }
- return visitor.visitString();
- case INTEGER_TYPE:
- case "int":
- return visitor.visitInteger();
- case NUMBER_TYPE:
- return visitor.visitNumber();
- case ARRAY_TYPE:
- return visitor.visitArray(typedObject.items());
- case OBJECT_TYPE:
- if (!(typedObject instanceof ItemDescriptor.Type)) {
- return visitor.visitObject(null);
- }
-
- List<ObjectProperty> properties = ((ItemDescriptor.Type)typedObject).properties();
- if (properties == null || properties.isEmpty()) {
- return visitor.visitMap();
- }
- else {
- return visitor.visitObject(properties);
- }
- case ANY_TYPE:
- return visitor.visitUnknown();
- case UNKNOWN_TYPE:
- return visitor.visitUnknown();
- }
- throw new RuntimeException("Unrecognized type " + typeName);
- }
-
- private static void initializeKnownTypes() {
- // Code example:
- // typeMap.getTypeData("Page", "Cookie").getInput().setJavaTypeName("Object");
- }
-
- private static final Set<String> BAD_METHOD_NAMES = new HashSet<>(Collections.singletonList("this"));
-}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/Generator.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/Generator.kt
new file mode 100644
index 0000000..bac057c
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/Generator.kt
@@ -0,0 +1,288 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.jetbrains.protocolReader
+
+/**
+ * Read metamodel and generates set of files with Java classes/interfaces for the protocol.
+ */
+class Generator [throws(javaClass<IOException>())]
+(outputDir: String, rootPackage: String, requestClassName: String) {
+
+ val jsonProtocolParserClassNames = ArrayList<String>()
+ val parserRootInterfaceItems = ArrayList<ParserRootInterfaceItem>()
+ val typeMap = TypeMap()
+
+ private val fileSet: FileSet
+ val naming: Naming
+
+ init {
+ fileSet = FileSet(FileSystems.getDefault().getPath(outputDir))
+ naming = Naming(rootPackage, requestClassName)
+ }
+
+ public class Naming(public val inputPackage: String, public val requestClassName: String) {
+ public val params: ClassNameScheme
+ public val additionalParam: ClassNameScheme
+ public val outputTypedef: ClassNameScheme
+
+ public val commandResult: ClassNameScheme.Input
+ public val eventData: ClassNameScheme.Input
+ public val inputValue: ClassNameScheme
+ public val inputEnum: ClassNameScheme
+ public val inputTypedef: ClassNameScheme
+
+ public val commonTypedef: ClassNameScheme
+
+ init {
+ params = ClassNameScheme.Output("", inputPackage)
+ additionalParam = ClassNameScheme.Output("", inputPackage)
+ outputTypedef = ClassNameScheme.Output("Typedef", inputPackage)
+ commonTypedef = ClassNameScheme.Common("Typedef", inputPackage)
+ commandResult = ClassNameScheme.Input("Result", inputPackage)
+ eventData = ClassNameScheme.Input("EventData", inputPackage)
+ inputValue = ClassNameScheme.Input("Value", inputPackage)
+ inputEnum = ClassNameScheme.Input("", inputPackage)
+ inputTypedef = ClassNameScheme.Input("Typedef", inputPackage)
+ }
+ }
+
+ throws(javaClass<IOException>())
+ fun go(metamodel: Root) {
+ initializeKnownTypes()
+
+ val domainList = metamodel.domains()
+ val domainGeneratorMap = HashMap<String, DomainGenerator>()
+ for (domain in domainList) {
+ if (isDomainSkipped(domain)) {
+ System.out.println("Domain skipped: " + domain.domain())
+ continue
+ }
+ val domainGenerator = DomainGenerator(this, domain)
+ domainGeneratorMap.put(domain.domain(), domainGenerator)
+ domainGenerator.registerTypes()
+ }
+
+ for (domain in domainList) {
+ if (!isDomainSkipped(domain)) {
+ System.out.println("Domain generated: " + domain.domain())
+ }
+ }
+
+ typeMap.setDomainGeneratorMap(domainGeneratorMap)
+
+ for (domainGenerator in domainGeneratorMap.values()) {
+ domainGenerator.generateCommandsAndEvents()
+ }
+
+ typeMap.generateRequestedTypes()
+ generateParserInterfaceList()
+ generateParserRoot(parserRootInterfaceItems)
+ fileSet.deleteOtherFiles()
+ }
+
+ fun resolveType(typedObject: ItemDescriptor, scope: ResolveAndGenerateScope): TypeDescriptor {
+ val optional = typedObject is ItemDescriptor.Named && (typedObject : ItemDescriptor.Named).optional()
+ return switchByType(typedObject, object : TypeVisitor<TypeDescriptor> {
+ override fun visitRef(refName: String): TypeDescriptor {
+ return TypeDescriptor(resolveRefType(scope.getDomainName(), refName, scope.getTypeDirection()), optional)
+ }
+
+ override fun visitBoolean(): TypeDescriptor {
+ return TypeDescriptor(BoxableType.BOOLEAN, optional)
+ }
+
+ override fun visitEnum(enumConstants: List<String>): TypeDescriptor {
+ assert(scope is MemberScope)
+ return TypeDescriptor((scope as MemberScope).generateEnum(typedObject.description(), enumConstants), optional)
+ }
+
+ override fun visitString(): TypeDescriptor {
+ return TypeDescriptor(BoxableType.STRING, optional)
+ }
+
+ override fun visitInteger(): TypeDescriptor {
+ return TypeDescriptor(BoxableType.INT, optional)
+ }
+
+ override fun visitNumber(): TypeDescriptor {
+ return TypeDescriptor(BoxableType.NUMBER, optional)
+ }
+
+ override fun visitMap(): TypeDescriptor {
+ return TypeDescriptor(BoxableType.MAP, optional)
+ }
+
+ override fun visitArray(items: ArrayItemType): TypeDescriptor {
+ val type = scope.resolveType<ArrayItemType>(items).type
+ return TypeDescriptor(ListType(type), optional, false, type == BoxableType.ANY_STRING)
+ }
+
+ override fun visitObject(properties: List<ObjectProperty>?): TypeDescriptor {
+ return TypeDescriptor(scope.generateNestedObject(typedObject.description(), properties!!), optional)
+ }
+
+ override fun visitUnknown(): TypeDescriptor {
+ return TypeDescriptor(BoxableType.STRING, optional, false, true)
+ }
+ })
+ }
+
+ throws(javaClass<IOException>())
+ private fun generateParserInterfaceList() {
+ val fileUpdater = startJavaFile(naming.inputPackage, PARSER_INTERFACE_LIST_CLASS_NAME + ".java")
+ // Write classes in stable order.
+ Collections.sort<String>(jsonProtocolParserClassNames)
+
+ val out = fileUpdater.out
+ out.append("public class ").append(PARSER_INTERFACE_LIST_CLASS_NAME).openBlock()
+ out.append("public static final Class<?>[] LIST =").openBlock()
+ for (name in jsonProtocolParserClassNames) {
+ out.append(name).append(".class,").newLine()
+ }
+ out.closeBlock()
+ out.semi()
+ out.closeBlock()
+ fileUpdater.update()
+ }
+
+ throws(javaClass<IOException>())
+ private fun generateParserRoot(parserRootInterfaceItems: List<ParserRootInterfaceItem>) {
+ val fileUpdater = startJavaFile(naming.inputPackage, READER_INTERFACE_NAME + ".java")
+ // Write classes in stable order.
+ Collections.sort<ParserRootInterfaceItem>(parserRootInterfaceItems)
+
+ val out = fileUpdater.out
+ out.append("public abstract class ").append(READER_INTERFACE_NAME).space().append("implements org.jetbrains.jsonProtocol.ResponseResultReader").openBlock()
+ for (item in parserRootInterfaceItems) {
+ item.writeCode(out)
+ }
+ out.newLine().newLine().append("@Override").newLine().append("public Object readResult(String methodName, org.jetbrains.io.JsonReaderEx reader)")
+ out.openBlock()
+
+ var isNotFirst = false
+ for (item in parserRootInterfaceItems) {
+ if (isNotFirst) {
+ out.append("else ")
+ }
+ else {
+ isNotFirst = true
+ }
+ out.append("if (methodName.equals(\"")
+ if (!item.domain.isEmpty()) {
+ out.append(item.domain).append('.')
+ }
+ out.append(item.name).append('"').append(")) return ")
+ item.appendReadMethodName(out)
+ out.append("(reader)").semi().newLine()
+ }
+ out.append("else return null").semi()
+ out.closeBlock()
+
+ out.closeBlock()
+ fileUpdater.update()
+ }
+
+ /**
+ * Resolve absolute (DOMAIN.TYPE) or relative (TYPE) type name
+ */
+ private fun resolveRefType(scopeDomainName: String, refName: String, direction: TypeData.Direction): BoxableType {
+ val pos = refName.indexOf('.')
+ val domainName: String
+ val shortName: String
+ if (pos == -1) {
+ domainName = scopeDomainName
+ shortName = refName
+ }
+ else {
+ domainName = refName.substring(0, pos)
+ shortName = refName.substring(pos + 1)
+ }
+ return typeMap.resolve(domainName, shortName, direction)!!
+ }
+
+ throws(javaClass<IOException>())
+ fun startJavaFile(nameScheme: ClassNameScheme, domain: Domain, baseName: String): FileUpdater {
+ return startJavaFile(nameScheme.getPackageNameVirtual(domain.domain()), nameScheme.getShortName(baseName) + ".java")
+ }
+
+ public fun startJavaFile(packageName: String, filename: String): FileUpdater {
+ val fileUpdater = fileSet.createFileUpdater(packageName.replace('.', '/') + '/' + filename)
+ fileUpdater.out.append("// Generated source").newLine().append("package ").append(packageName).semi().newLine().newLine()
+ return fileUpdater
+ }
+
+ default object {
+ private val PARSER_INTERFACE_LIST_CLASS_NAME = "GeneratedReaderInterfaceList"
+ val READER_INTERFACE_NAME = "ProtocolResponseReader"
+
+ private fun isDomainSkipped(domain: Domain): Boolean {
+ if (domain.domain() == "CSS" || domain.domain() == "Inspector") {
+ return false
+ }
+
+ // todo DOMDebugger
+ return domain.hidden() || domain.domain() == "DOMDebugger" || domain.domain() == "Timeline" || domain.domain() == "Input"
+ }
+
+ fun generateMethodNameSubstitute(originalName: String, out: TextOutput): String {
+ if (!BAD_METHOD_NAMES.contains(originalName)) {
+ return originalName
+ }
+ out.append("@org.jetbrains.jsonProtocol.JsonField(jsonLiteralName=\"").append(originalName).append("\")").newLine()
+ return "get" + Character.toUpperCase(originalName.charAt(0)) + originalName.substring(1)
+ }
+
+ fun capitalizeFirstChar(s: String): String {
+ if (!s.isEmpty() && Character.isLowerCase(s.charAt(0))) {
+ return Character.toUpperCase(s.charAt(0)) + s.substring(1)
+ }
+ return s
+ }
+
+ fun <R> switchByType(typedObject: ItemDescriptor, visitor: TypeVisitor<R>): R {
+ val refName = if (typedObject is ItemDescriptor.Referenceable) (typedObject : ItemDescriptor.Referenceable).ref() else null
+ if (refName != null) {
+ return visitor.visitRef(refName)
+ }
+ val typeName = typedObject.type()
+ when (typeName) {
+ ProtocolMetaModel.BOOLEAN_TYPE -> return visitor.visitBoolean()
+ ProtocolMetaModel.STRING_TYPE -> {
+ if (typedObject.getEnum() != null) {
+ return visitor.visitEnum(typedObject.getEnum()!!)
+ }
+ return visitor.visitString()
+ }
+ ProtocolMetaModel.INTEGER_TYPE, "int" -> return visitor.visitInteger()
+ ProtocolMetaModel.NUMBER_TYPE -> return visitor.visitNumber()
+ ProtocolMetaModel.ARRAY_TYPE -> return visitor.visitArray(typedObject.items())
+ ProtocolMetaModel.OBJECT_TYPE -> {
+ if (typedObject !is ItemDescriptor.Type) {
+ return visitor.visitObject(null)
+ }
+
+ val properties = (typedObject : ItemDescriptor.Type).properties()
+ if (properties == null || properties.isEmpty()) {
+ return visitor.visitMap()
+ }
+ else {
+ return visitor.visitObject(properties)
+ }
+ return visitor.visitUnknown()
+ }
+ ProtocolMetaModel.ANY_TYPE -> return visitor.visitUnknown()
+ ProtocolMetaModel.UNKNOWN_TYPE -> return visitor.visitUnknown()
+ }
+ throw RuntimeException("Unrecognized type " + typeName)
+ }
+
+ private fun initializeKnownTypes() {
+ // Code example:
+ // typeMap.getTypeData("Page", "Cookie").getInput().setJavaTypeName("Object");
+ }
+
+ private val BAD_METHOD_NAMES = HashSet(listOf("this"))
+ }
+}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/InputClassScope.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/InputClassScope.java
deleted file mode 100644
index 99c95d8..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/InputClassScope.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jsonProtocol.ItemDescriptor.Named;
-import org.jetbrains.jsonProtocol.ProtocolMetaModel.ObjectProperty;
-
-import java.util.List;
-
-class InputClassScope extends ClassScope {
- InputClassScope(DomainGenerator generator, NamePath namePath) {
- super(generator, namePath);
- }
-
- void generateDeclarationBody(@NotNull TextOutput out, @NotNull List<? extends Named> list) {
- for (int i = 0, n = list.size(); i < n; i++) {
- Named named = list.get(i);
- if (named.description() != null) {
- out.doc(named.description());
- }
-
- String name = getName(named);
- String declarationName = Generator.generateMethodNameSubstitute(name, out);
- TypeDescriptor typeDescriptor = new InputMemberScope(name).resolveType(named);
- typeDescriptor.writeAnnotations(out);
- out.append(typeDescriptor.getType().getShortText(getClassContextNamespace())).space().append(declarationName).append("();");
- if (i != (n - 1)) {
- out.newLine().newLine();
- }
- }
- }
-
- @Override
- protected TypeData.Direction getTypeDirection() {
- return TypeData.Direction.INPUT;
- }
-
- class InputMemberScope extends MemberScope {
- InputMemberScope(String memberName) {
- super(InputClassScope.this, memberName);
- }
-
- @Override
- public BoxableType generateEnum(final String description, final List<String> enumConstants) {
- final String enumName = Generator.capitalizeFirstChar(getMemberName());
- addMember(new TextOutConsumer() {
- @Override
- public void append(TextOutput out) {
- out.newLine().doc(description);
- Enums.appendEnums(enumConstants, enumName, true, out);
- }
- });
- return new StandaloneType(new NamePath(enumName, getClassContextNamespace()), "writeEnum");
- }
-
- @Override
- public BoxableType generateNestedObject(final String description, final List<ObjectProperty> propertyList) {
- final String objectName = Generator.capitalizeFirstChar(getMemberName());
- addMember(new TextOutConsumer() {
- @Override
- public void append(TextOutput out) {
- out.newLine().doc(description);
- if (propertyList == null) {
- out.append("@org.jetbrains.jsonProtocol.JsonType(allowsOtherProperties=true)").newLine();
- out.append("public interface ").append(objectName).append(" extends org.jetbrains.jsonProtocol.JsonObjectBased").openBlock();
- }
- else {
- out.append("@org.jetbrains.jsonProtocol.JsonType").newLine();
- out.append("public interface ").append(objectName).openBlock();
- for (ObjectProperty property : propertyList) {
- out.doc(property.description());
-
- String methodName = Generator.generateMethodNameSubstitute(getName(property), out);
- MemberScope memberScope = new InputMemberScope(getName(property));
- TypeDescriptor propertyTypeData = memberScope.resolveType(property);
- propertyTypeData.writeAnnotations(out);
-
- out.append(propertyTypeData.getType().getShortText(getClassContextNamespace()) + ' ' + methodName + "();").newLine();
- }
- }
- out.closeBlock();
- }
- });
- return new StandaloneType(new NamePath(objectName, getClassContextNamespace()), "writeMessage");
- }
- }
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/InputClassScope.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/InputClassScope.kt
new file mode 100644
index 0000000..bbbce17
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/InputClassScope.kt
@@ -0,0 +1,73 @@
+package org.jetbrains.protocolReader
+
+class InputClassScope(generator: DomainGenerator, namePath: NamePath) : ClassScope(generator, namePath) {
+
+ fun generateDeclarationBody(out: TextOutput, list: List<Named>) {
+ run {
+ var i = 0
+ val n = list.size()
+ while (i < n) {
+ val named = list.get(i)
+ if (named.description() != null) {
+ out.doc(named.description())
+ }
+
+ val name = ClassScope.getName(named)
+ val declarationName = Generator.generateMethodNameSubstitute(name, out)
+ val typeDescriptor = InputMemberScope(name).resolveType<Named>(named)
+ typeDescriptor.writeAnnotations(out)
+ out.append(typeDescriptor.type.getShortText(classContextNamespace)).space().append(declarationName).append("();")
+ if (i != (n - 1)) {
+ out.newLine().newLine()
+ }
+ i++
+ }
+ }
+ }
+
+ override fun getTypeDirection(): TypeData.Direction {
+ return TypeData.Direction.INPUT
+ }
+
+ inner class InputMemberScope(memberName: String) : MemberScope(this@InputClassScope, memberName) {
+ override fun generateEnum(description: String?, enumConstants: List<String>): BoxableType {
+ val enumName = Generator.capitalizeFirstChar(memberName)
+ addMember(object : TextOutConsumer {
+ override fun append(out: TextOutput) {
+ out.newLine().doc(description)
+ Enums.appendEnums(enumConstants, enumName, true, out)
+ }
+ })
+ return StandaloneType(NamePath(enumName, classContextNamespace), "writeEnum")
+ }
+
+ override fun generateNestedObject(description: String?, properties: List<ObjectProperty>?): BoxableType {
+ val objectName = Generator.capitalizeFirstChar(memberName)
+ addMember(object : TextOutConsumer {
+ override fun append(out: TextOutput) {
+ out.newLine().doc(description)
+ if (properties == null) {
+ out.append("@org.jetbrains.jsonProtocol.JsonType(allowsOtherProperties=true)").newLine()
+ out.append("public interface ").append(objectName).append(" extends org.jetbrains.jsonProtocol.JsonObjectBased").openBlock()
+ }
+ else {
+ out.append("@org.jetbrains.jsonProtocol.JsonType").newLine()
+ out.append("public interface ").append(objectName).openBlock()
+ for (property in properties) {
+ out.doc(property.description())
+
+ val methodName = Generator.generateMethodNameSubstitute(ClassScope.getName(property), out)
+ val memberScope = InputMemberScope(ClassScope.getName(property))
+ val propertyTypeData = memberScope.resolveType<ObjectProperty>(property)
+ propertyTypeData.writeAnnotations(out)
+
+ out.append(propertyTypeData.type.getShortText(classContextNamespace) + ' ' + methodName + "();").newLine()
+ }
+ }
+ out.closeBlock()
+ }
+ })
+ return StandaloneType(NamePath(objectName, classContextNamespace), "writeMessage")
+ }
+ }
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ListType.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ListType.java
deleted file mode 100644
index f41769a..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ListType.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.annotations.NotNull;
-
-class ListType extends BoxableType {
- private final BoxableType itemType;
-
- public ListType(@NotNull BoxableType itemType) {
- this.itemType = itemType;
- }
-
- @Override
- String getWriteMethodName() {
- if (itemType == STRING) {
- return "writeStringList";
- }
- else if (itemType == LONG) {
- return "writeLongArray";
- }
- else if (itemType == INT) {
- return "writeIntArray";
- }
- else if (itemType == NUMBER) {
- return "writeDoubleArray";
- }
- return "writeList";
- }
-
- @Override
- String getFullText() {
- if (itemType == LONG || itemType == INT || itemType == NUMBER) {
- return itemType.getFullText() + "[]";
- }
- return "java.util.List<" + itemType.getFullText() + '>';
- }
-
- @Override
- String getShortText(NamePath contextNamespace) {
- if (itemType == LONG || itemType == INT || itemType == NUMBER) {
- return itemType.getFullText() + "[]";
- }
- return "java.util.List<" + itemType.getShortText(contextNamespace) + '>';
- }
-}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ListType.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ListType.kt
new file mode 100644
index 0000000..737fc1d
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ListType.kt
@@ -0,0 +1,34 @@
+package org.jetbrains.protocolReader
+
+open class ListType(private val itemType: BoxableType) : BoxableType() {
+
+ override fun getWriteMethodName(): String {
+ if (itemType == BoxableType.STRING) {
+ return "writeStringList"
+ }
+ else if (itemType == BoxableType.LONG) {
+ return "writeLongArray"
+ }
+ else if (itemType == BoxableType.INT) {
+ return "writeIntArray"
+ }
+ else if (itemType == BoxableType.NUMBER) {
+ return "writeDoubleArray"
+ }
+ return "writeList"
+ }
+
+ override fun getFullText(): String {
+ if (itemType == BoxableType.LONG || itemType == BoxableType.INT || itemType == BoxableType.NUMBER) {
+ return "${itemType.getFullText()}[]"
+ }
+ return "java.util.List<" + itemType.getFullText() + '>'
+ }
+
+ override fun getShortText(contextNamespace: NamePath): String {
+ if (itemType == BoxableType.LONG || itemType == BoxableType.INT || itemType == BoxableType.NUMBER) {
+ return "${itemType.getFullText()}[]"
+ }
+ return "java.util.List<" + itemType.getShortText(contextNamespace) + '>'
+ }
+}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/MemberScope.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/MemberScope.java
deleted file mode 100644
index 78a83a9..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/MemberScope.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.jsonProtocol.ItemDescriptor;
-import org.jetbrains.jsonProtocol.ProtocolMetaModel;
-
-import java.util.List;
-
-/**
- * Member scope is used to generate additional types that are used only from method.
- * These types will be named after this method.
- */
-abstract class MemberScope implements ResolveAndGenerateScope {
- private final String memberName;
- private final ClassScope classScope;
-
- MemberScope(ClassScope classScope, String memberName) {
- this.classScope = classScope;
- this.memberName = memberName;
- }
-
- @Override
- public <T extends ItemDescriptor> TypeDescriptor resolveType(T typedObject) {
- return classScope.generator.generator.resolveType(typedObject, this);
- }
-
- protected String getMemberName() {
- return memberName;
- }
-
- public abstract BoxableType generateEnum(String description, List<String> enumConstants);
- public abstract BoxableType generateNestedObject(String description, List<ProtocolMetaModel.ObjectProperty> propertyList);
-
- @Override
- public String getDomainName() {
- return classScope.generator.domain.domain();
- }
-
- @Override
- public TypeData.Direction getTypeDirection() {
- return classScope.getTypeDirection();
- }
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/MemberScope.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/MemberScope.kt
new file mode 100644
index 0000000..65442ed
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/MemberScope.kt
@@ -0,0 +1,17 @@
+package org.jetbrains.protocolReader
+
+/**
+ * Member scope is used to generate additional types that are used only from method.
+ * These types will be named after this method.
+ */
+abstract class MemberScope(private val classScope: ClassScope, protected val memberName: String) : ResolveAndGenerateScope {
+ override fun <T : ItemDescriptor> resolveType(typedObject: T): TypeDescriptor {
+ return classScope.generator.generator.resolveType(typedObject, this)
+ }
+
+ public abstract fun generateEnum(description: String?, enumConstants: List<String>): BoxableType
+
+ override fun getDomainName() = classScope.generator.domain.domain()
+
+ override fun getTypeDirection() = classScope.getTypeDirection()
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/MyCreateStandaloneTypeBindingVisitorBase.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/MyCreateStandaloneTypeBindingVisitorBase.java
deleted file mode 100644
index 180a8fc..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/MyCreateStandaloneTypeBindingVisitorBase.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.jsonProtocol.ItemDescriptor;
-import org.jetbrains.jsonProtocol.ProtocolMetaModel;
-
-import java.io.IOException;
-import java.util.List;
-
-class MyCreateStandaloneTypeBindingVisitorBase extends CreateStandaloneTypeBindingVisitorBase {
- private final String name;
- private final DomainGenerator generator;
-
- public MyCreateStandaloneTypeBindingVisitorBase(DomainGenerator generator, ProtocolMetaModel.StandaloneType type, String name) {
- super(generator, type);
- this.generator = generator;
- this.name = name;
- }
-
- @Override
- public StandaloneTypeBinding visitObject(List<ProtocolMetaModel.ObjectProperty> properties) {
- return new StandaloneTypeBinding() {
- @Override
- public BoxableType getJavaType() {
- return new StandaloneType(generator.generator.naming.additionalParam.getFullName(generator.domain.domain(), name), "writeMessage");
- }
-
- @Override
- public void generate() throws IOException {
- generator.generateCommandAdditionalParam(getType());
- }
-
- @Override
- public TypeData.Direction getDirection() {
- return TypeData.Direction.OUTPUT;
- }
- };
- }
-
- @Override
- public StandaloneTypeBinding visitEnum(List<String> enumConstants) {
- throw new RuntimeException();
- }
-
- @Override
- public StandaloneTypeBinding visitArray(final ProtocolMetaModel.ArrayItemType items) {
- return generator.createTypedefTypeBinding(getType(), new StandaloneTypeBinding.Target() {
- @Override
- public BoxableType resolve(final ResolveContext context) {
- return new ListType(generator.generator.resolveType(items, new ResolveAndGenerateScope() {
- // This class is responsible for generating ad hoc type.
- // If we ever are to do it, we should generate into string buffer and put strings inside TypeDef class
- @Override
- public String getDomainName() {
- return generator.domain.domain();
- }
-
- @Override
- public TypeData.Direction getTypeDirection() {
- return TypeData.Direction.OUTPUT;
- }
-
- @Override
- public <T extends ItemDescriptor> TypeDescriptor resolveType(T typedObject) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public BoxableType generateNestedObject(String description, List<ProtocolMetaModel.ObjectProperty> properties) {
- return context.generateNestedObject("Item", description, properties);
- }
- }).getType());
- }
- }, generator.generator.naming.outputTypedef, TypeData.Direction.OUTPUT);
- }
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/MyCreateStandaloneTypeBindingVisitorBase.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/MyCreateStandaloneTypeBindingVisitorBase.kt
new file mode 100644
index 0000000..560c412
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/MyCreateStandaloneTypeBindingVisitorBase.kt
@@ -0,0 +1,44 @@
+package org.jetbrains.protocolReader
+
+class MyCreateStandaloneTypeBindingVisitorBase(private val generator: DomainGenerator, type: ProtocolMetaModel.StandaloneType, private val name: String) : CreateStandaloneTypeBindingVisitorBase(generator, type) {
+
+ override fun visitObject(properties: List<ProtocolMetaModel.ObjectProperty>?): StandaloneTypeBinding {
+ return object : StandaloneTypeBinding {
+ override fun getJavaType(): BoxableType {
+ return StandaloneType(generator.generator.naming.additionalParam.getFullName(generator.domain.domain(), name), "writeMessage")
+ }
+
+ override fun generate() {
+ generator.generateCommandAdditionalParam(type)
+ }
+
+ override fun getDirection(): TypeData.Direction? {
+ return TypeData.Direction.OUTPUT
+ }
+ }
+ }
+
+ override fun visitEnum(enumConstants: List<String>): StandaloneTypeBinding {
+ throw RuntimeException()
+ }
+
+ override fun visitArray(items: ProtocolMetaModel.ArrayItemType): StandaloneTypeBinding {
+ return generator.createTypedefTypeBinding(type, object : StandaloneTypeBinding.Target {
+ override fun resolve(context: StandaloneTypeBinding.Target.ResolveContext): BoxableType {
+ return ListType(generator.generator.resolveType(items, object : ResolveAndGenerateScope {
+ // This class is responsible for generating ad hoc type.
+ // If we ever are to do it, we should generate into string buffer and put strings inside TypeDef class
+ override fun getDomainName() = generator.domain.domain()
+
+ override fun getTypeDirection() = TypeData.Direction.OUTPUT
+
+ override fun <T : ItemDescriptor> resolveType(typedObject: T) = throw UnsupportedOperationException()
+
+ override fun generateNestedObject(description: String?, properties: List<ProtocolMetaModel.ObjectProperty>?): BoxableType {
+ return context.generateNestedObject("Item", description, properties)
+ }
+ }).type)
+ }
+ }, generator.generator.naming.outputTypedef, TypeData.Direction.OUTPUT)
+ }
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/NamePath.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/NamePath.java
deleted file mode 100644
index b516d77..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/NamePath.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.jetbrains.protocolReader;
-
-class NamePath {
- private final String lastComponent;
- private final NamePath parent;
-
- NamePath(String component) {
- this(component, null);
- }
-
- NamePath(String component, NamePath parent) {
- lastComponent = component;
- this.parent = parent;
- }
-
- NamePath getParent() {
- return parent;
- }
-
- String getLastComponent() {
- return lastComponent;
- }
-
- int getLength() {
- int res = 1;
- for (NamePath current = this; current != null; current = current.getParent()) {
- res++;
- }
- return res;
- }
-
- String getFullText() {
- StringBuilder result = new StringBuilder();
- fillFullPath(result);
- return result.toString();
- }
-
- private void fillFullPath(StringBuilder result) {
- if (parent != null) {
- parent.fillFullPath(result);
- result.append('.');
- }
- result.append(lastComponent);
- }
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/NamePath.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/NamePath.kt
new file mode 100644
index 0000000..2f1ded3
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/NamePath.kt
@@ -0,0 +1,30 @@
+package org.jetbrains.protocolReader
+
+class NamePath(val lastComponent: String, val parent: NamePath? = null) {
+
+ fun getLength(): Int {
+ var res = 1
+ run {
+ var current: NamePath? = this
+ while (current != null) {
+ res++
+ current = current!!.parent
+ }
+ }
+ return res
+ }
+
+ fun getFullText(): String {
+ val result = StringBuilder()
+ fillFullPath(result)
+ return result.toString()
+ }
+
+ private fun fillFullPath(result: StringBuilder) {
+ if (parent != null) {
+ parent.fillFullPath(result)
+ result.append('.')
+ }
+ result.append(lastComponent)
+ }
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/OutputClassScope.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/OutputClassScope.java
deleted file mode 100644
index 76a3093..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/OutputClassScope.java
+++ /dev/null
@@ -1,245 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.io.JsonReaderEx;
-import org.jetbrains.jsonProtocol.ItemDescriptor;
-import org.jetbrains.jsonProtocol.ProtocolMetaModel;
-
-import java.util.ArrayList;
-import java.util.List;
-
-class OutputClassScope extends ClassScope {
- OutputClassScope(@NotNull DomainGenerator generator, @NotNull NamePath classNamePath) {
- super(generator, classNamePath);
- }
-
- <P extends ItemDescriptor.Named> void generate(@NotNull TextOutput out, @Nullable List<P> parameters) {
- if (parameters == null) {
- return;
- }
-
- List<P> mandatoryParameters = new ArrayList<>();
- List<P> optionalParameters = new ArrayList<>();
- for (P parameter : parameters) {
- if (parameter.optional()) {
- optionalParameters.add(parameter);
- }
- else {
- mandatoryParameters.add(parameter);
- }
- }
-
- if (!mandatoryParameters.isEmpty()) {
- generateConstructor(out, mandatoryParameters, null);
- if (mandatoryParameters.size() == 1) {
- P parameter = mandatoryParameters.get(0);
- TypeDescriptor typeData = new OutputMemberScope(getName(parameter)).resolveType(parameter);
- if (typeData.getType().getFullText().equals("int[]")) {
- BoxableType[] types = new BoxableType[mandatoryParameters.size()];
- types[0] = new ListType(BoxableType.INT) {
- @Override
- String getShortText(NamePath contextNamespace) {
- return getFullText();
- }
-
- @Override
- String getFullText() {
- return "gnu.trove.TIntArrayList";
- }
-
- @Override
- String getWriteMethodName() {
- return "writeIntList";
- }
- };
-
- out.newLine().newLine();
- generateConstructor(out, mandatoryParameters, types);
-
- types[0] = new ListType(BoxableType.INT) {
- @Override
- String getShortText(NamePath contextNamespace) {
- return getFullText();
- }
-
- @Override
- String getFullText() {
- return "int";
- }
-
- @Override
- String getWriteMethodName() {
- return "writeSingletonIntArray";
- }
- };
-
- out.newLine().newLine();
- generateConstructor(out, mandatoryParameters, types);
- }
- }
- }
-
- // generate enum classes after constructor
- for (P parameter : parameters) {
- if (parameter.getEnum() != null) {
- out.newLine().newLine();
- appendEnumClass(out, parameter.description(), parameter.getEnum(), Generator.capitalizeFirstChar((parameter.name())));
- }
- }
-
- for (P parameter : optionalParameters) {
- out.newLine().newLine();
- if (parameter.description() != null) {
- out.append("/**").newLine().append(" * @param v ").append(parameter.description()).newLine().append(" */").newLine();
- }
-
- CharSequence type = new OutputMemberScope(parameter.name()).resolveType(parameter).getType().getShortText(getClassContextNamespace());
- if (type.equals(JsonReaderEx.class.getCanonicalName())) {
- type = "String";
- }
-
- out.append("public ").append(getShortClassName());
- out.space().append(parameter.name()).append("(").append(type);
- out.space().append("v").append(")").openBlock();
- appendWriteValueInvocation(out, parameter, "v", null);
- out.newLine().append("return this;");
- out.closeBlock();
- }
- }
-
- private <P extends ItemDescriptor.Named> void generateConstructor(@NotNull TextOutput out, @NotNull List<P> parameters, @Nullable BoxableType[] parameterTypes) {
- boolean hasDoc = false;
- for (P parameter : parameters) {
- if (parameter.description() != null) {
- hasDoc = true;
- break;
- }
- }
- if (hasDoc) {
- out.append("/**").newLine();
- for (P parameter : parameters) {
- if (parameter.description() != null) {
- out.append(" * @param " + parameter.name() + ' ' + parameter.description()).newLine();
- }
- }
- out.append(" */").newLine();
- }
- out.append("public " + getShortClassName() + '(');
-
- if (parameterTypes == null) {
- parameterTypes = new BoxableType[parameters.size()];
- }
- writeMethodParameters(out, parameters, parameterTypes);
- out.append(')');
-
- out.openBlock(false);
- writeWriteCalls(out, parameters, parameterTypes, null);
- out.closeBlock();
- }
-
- <P extends ItemDescriptor.Named> void writeWriteCalls(@NotNull TextOutput out, @NotNull List<P> parameters, @NotNull BoxableType[] parameterTypes, @Nullable String qualifier) {
- for (int i = 0, size = parameters.size(); i < size; i++) {
- out.newLine();
-
- if (qualifier != null) {
- out.append(qualifier).append('.');
- }
-
- P parameter = parameters.get(i);
- appendWriteValueInvocation(out, parameter, parameter.name(), parameterTypes[i]);
- }
- }
-
- <P extends ItemDescriptor.Named> void writeMethodParameters(@NotNull TextOutput out, @NotNull List<P> parameters, @NotNull BoxableType[] parameterTypes) {
- for (int i = 0, length = parameterTypes.length; i < length; i++) {
- if (parameterTypes[i] == null) {
- P parameter = parameters.get(i);
- parameterTypes[i] = new OutputMemberScope(parameter.name()).resolveType(parameter).getType();
- }
- }
-
- boolean needComa = false;
- for (int i = 0, size = parameters.size(); i < size; i++) {
- if (needComa) {
- out.comma();
- }
- else {
- needComa = true;
- }
-
- out.append(parameterTypes[i].getShortText(getClassContextNamespace()));
- out.space().append(parameters.get(i).name());
- }
- }
-
- private void appendWriteValueInvocation(TextOutput out, ItemDescriptor.Named parameter, String valueRefName, @Nullable BoxableType type) {
- if (type == null) {
- type = new OutputMemberScope(parameter.name()).resolveType(parameter).getType();
- }
-
- boolean blockOpened = false;
- if (parameter.optional()) {
- String nullValue;
- if (parameter.name().equals("columnNumber") || parameter.name().equals("column")) {
- // todo generic solution
- nullValue = "-1";
- }
- else {
- nullValue = null;
- }
-
- if (nullValue != null) {
- blockOpened = true;
- out.append("if (v != ").append(nullValue).append(")").openBlock();
- }
- else if (parameter.name().equals("enabled")) {
- blockOpened = true;
- out.append("if (!v)").openBlock();
- }
- else if (parameter.name().equals("ignoreCount")) {
- blockOpened = true;
- out.append("if (v > 0)").openBlock();
- }
- }
- // todo CallArgument (we should allow write null as value)
- out.append(parameter.name().equals("value") && type.getWriteMethodName().equals("writeString") ? "writeNullableString" : type.getWriteMethodName()).append("(");
- out.quote(parameter.name()).comma().append(valueRefName).append(");");
- if (blockOpened) {
- out.closeBlock();
- }
- }
-
- @Override
- protected TypeData.Direction getTypeDirection() {
- return TypeData.Direction.OUTPUT;
- }
-
- class OutputMemberScope extends MemberScope {
- protected OutputMemberScope(String memberName) {
- super(OutputClassScope.this, memberName);
- }
-
- @Override
- public BoxableType generateEnum(final String description, final List<String> enumConstants) {
- return new StandaloneType(new NamePath(Generator.capitalizeFirstChar(getMemberName()), getClassContextNamespace()), "writeEnum");
- }
-
- @Override
- public BoxableType generateNestedObject(String description, List<ProtocolMetaModel.ObjectProperty> propertyList) {
- throw new UnsupportedOperationException();
- }
- }
-
- private static void appendEnumClass(TextOutput out, String description, List<String> enumConstants, String enumName) {
- out.doc(description);
- Enums.appendEnums(enumConstants, enumName, false, out);
- out.newLine().append("private final String protocolValue;").newLine();
- out.newLine().append(enumName).append("(String protocolValue)").openBlock();
- out.append("this.protocolValue = protocolValue;").closeBlock();
-
- out.newLine().newLine().append("public String toString()").openBlock();
- out.append("return protocolValue;").closeBlock();
- out.closeBlock();
- }
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/OutputClassScope.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/OutputClassScope.kt
new file mode 100644
index 0000000..b0e93d5
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/OutputClassScope.kt
@@ -0,0 +1,225 @@
+package org.jetbrains.protocolReader
+
+class OutputClassScope(generator: DomainGenerator, classNamePath: NamePath) : ClassScope(generator, classNamePath) {
+ fun <P : ItemDescriptor.Named> generate(out: TextOutput, parameters: List<P>?) {
+ if (parameters == null) {
+ return
+ }
+
+ val mandatoryParameters = ArrayList<P>()
+ val optionalParameters = ArrayList<P>()
+ for (parameter in parameters) {
+ if (parameter.optional()) {
+ optionalParameters.add(parameter)
+ }
+ else {
+ mandatoryParameters.add(parameter)
+ }
+ }
+
+ if (!mandatoryParameters.isEmpty()) {
+ generateConstructor(out, mandatoryParameters)
+ if (mandatoryParameters.size() == 1) {
+ val parameter = mandatoryParameters.get(0)
+ val typeData = OutputMemberScope(ClassScope.getName(parameter)).resolveType<P>(parameter)
+ if (typeData.type.getFullText() == "int[]") {
+ val types = arrayOfNulls<BoxableType>(mandatoryParameters.size())
+ types[0] = object : ListType(BoxableType.INT) {
+ override fun getShortText(contextNamespace: NamePath): String {
+ return getFullText()
+ }
+
+ override fun getFullText(): String {
+ return "gnu.trove.TIntArrayList"
+ }
+
+ override fun getWriteMethodName(): String {
+ return "writeIntList"
+ }
+ }
+
+ out.newLine().newLine()
+ generateConstructor(out, mandatoryParameters, types)
+
+ types[0] = object : ListType(BoxableType.INT) {
+ override fun getShortText(contextNamespace: NamePath): String {
+ return getFullText()
+ }
+
+ override fun getFullText(): String {
+ return "int"
+ }
+
+ override fun getWriteMethodName(): String {
+ return "writeSingletonIntArray"
+ }
+ }
+
+ out.newLine().newLine()
+ generateConstructor(out, mandatoryParameters, types)
+ }
+ }
+ }
+
+ // generate enum classes after constructor
+ for (parameter in parameters) {
+ if (parameter.getEnum() != null) {
+ out.newLine().newLine()
+ appendEnumClass(out, parameter.description(), parameter.getEnum()!!, Generator.capitalizeFirstChar((parameter.name())))
+ }
+ }
+
+ for (parameter in optionalParameters) {
+ out.newLine().newLine()
+ if (parameter.description() != null) {
+ out.append("/**").newLine().append(" * @param v ").append(parameter.description()!!).newLine().append(" */").newLine()
+ }
+
+ var type: CharSequence = OutputMemberScope(parameter.name()).resolveType<P>(parameter).type.getShortText(classContextNamespace)
+ if (type == javaClass<JsonReaderEx>().getCanonicalName()) {
+ type = "String"
+ }
+
+ out.append("public ").append(getShortClassName())
+ out.space().append(parameter.name()).append("(").append(type)
+ out.space().append("v").append(")").openBlock()
+ appendWriteValueInvocation(out, parameter, "v")
+ out.newLine().append("return this;")
+ out.closeBlock()
+ }
+ }
+
+ private fun <P : ItemDescriptor.Named> generateConstructor(out: TextOutput, parameters: List<P>, parameterTypes: Array<BoxableType?> = arrayOfNulls<BoxableType>(parameters.size())) {
+ var hasDoc = false
+ for (parameter in parameters) {
+ if (parameter.description() != null) {
+ hasDoc = true
+ break
+ }
+ }
+ if (hasDoc) {
+ out.append("/**").newLine()
+ for (parameter in parameters) {
+ if (parameter.description() != null) {
+ out.append(" * @param " + parameter.name() + ' ' + parameter.description()).newLine()
+ }
+ }
+ out.append(" */").newLine()
+ }
+ out.append("public " + getShortClassName() + '(')
+
+ writeMethodParameters(out, parameters, parameterTypes)
+ out.append(')')
+
+ out.openBlock(false)
+ writeWriteCalls(out, parameters, parameterTypes, null)
+ out.closeBlock()
+ }
+
+ fun <P : ItemDescriptor.Named> writeWriteCalls(out: TextOutput, parameters: List<P>, parameterTypes: Array<BoxableType?>, qualifier: String?) {
+ run {
+ var i = 0
+ val size = parameters.size()
+ while (i < size) {
+ out.newLine()
+
+ if (qualifier != null) {
+ out.append(qualifier).append('.')
+ }
+
+ val parameter = parameters.get(i)
+ appendWriteValueInvocation(out, parameter, parameter.name(), parameterTypes[i]!!)
+ i++
+ }
+ }
+ }
+
+ fun <P : ItemDescriptor.Named> writeMethodParameters(out: TextOutput, parameters: List<P>, parameterTypes: Array<BoxableType?>) {
+ run {
+ var i = 0
+ val length = parameterTypes.size()
+ while (i < length) {
+ if (parameterTypes[i] == null) {
+ val parameter = parameters.get(i)
+ parameterTypes[i] = OutputMemberScope(parameter.name()).resolveType<P>(parameter).type
+ }
+ i++
+ }
+ }
+
+ var needComa = false
+ run {
+ var i = 0
+ val size = parameters.size()
+ while (i < size) {
+ if (needComa) {
+ out.comma()
+ }
+ else {
+ needComa = true
+ }
+
+ out.append(parameterTypes[i]!!.getShortText(classContextNamespace))
+ out.space().append(parameters.get(i).name())
+ i++
+ }
+ }
+ }
+
+ private fun appendWriteValueInvocation(out: TextOutput, parameter: ItemDescriptor.Named, valueRefName: String, type: BoxableType = OutputMemberScope(parameter.name()).resolveType<ItemDescriptor.Named>(parameter).type) {
+ var blockOpened = false
+ if (parameter.optional()) {
+ val nullValue: String?
+ if (parameter.name() == "columnNumber" || parameter.name() == "column") {
+ // todo generic solution
+ nullValue = "-1"
+ }
+ else {
+ nullValue = null
+ }
+
+ if (nullValue != null) {
+ blockOpened = true
+ out.append("if (v != ").append(nullValue).append(")").openBlock()
+ }
+ else if (parameter.name() == "enabled") {
+ blockOpened = true
+ out.append("if (!v)").openBlock()
+ }
+ else if (parameter.name() == "ignoreCount") {
+ blockOpened = true
+ out.append("if (v > 0)").openBlock()
+ }
+ }
+ // todo CallArgument (we should allow write null as value)
+ out.append(if (parameter.name() == "value" && type.getWriteMethodName() == "writeString") "writeNullableString" else type.getWriteMethodName()).append("(")
+ out.quote(parameter.name()).comma().append(valueRefName).append(");")
+ if (blockOpened) {
+ out.closeBlock()
+ }
+ }
+
+ override fun getTypeDirection(): TypeData.Direction {
+ return TypeData.Direction.OUTPUT
+ }
+
+ inner class OutputMemberScope(memberName: String) : MemberScope(this@OutputClassScope, memberName) {
+ override fun generateEnum(description: String?, enumConstants: List<String>): BoxableType {
+ return StandaloneType(NamePath(Generator.capitalizeFirstChar(memberName), classContextNamespace), "writeEnum")
+ }
+
+ override fun generateNestedObject(description: String?, properties: List<ProtocolMetaModel.ObjectProperty>?) = throw UnsupportedOperationException()
+ }
+
+ private fun appendEnumClass(out: TextOutput, description: String?, enumConstants: List<String>, enumName: String) {
+ out.doc(description)
+ Enums.appendEnums(enumConstants, enumName, false, out)
+ out.newLine().append("private final String protocolValue;").newLine()
+ out.newLine().append(enumName).append("(String protocolValue)").openBlock()
+ out.append("this.protocolValue = protocolValue;").closeBlock()
+
+ out.newLine().newLine().append("public String toString()").openBlock()
+ out.append("return protocolValue;").closeBlock()
+ out.closeBlock()
+ }
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ParserRootInterfaceItem.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ParserRootInterfaceItem.java
deleted file mode 100644
index e84c641..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ParserRootInterfaceItem.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.annotations.NotNull;
-
-import java.io.IOException;
-
-class ParserRootInterfaceItem implements Comparable<ParserRootInterfaceItem> {
- final String domain;
- final String name;
- private final ClassNameScheme.Input nameScheme;
- final String fullName;
-
- public ParserRootInterfaceItem(String domain, String name, ClassNameScheme.Input nameScheme) {
- this.domain = domain;
- this.name = name;
- this.nameScheme = nameScheme;
- fullName = nameScheme.getFullName(domain, name).getFullText();
- }
-
- void writeCode(TextOutput out) throws IOException {
- out.append("@org.jetbrains.jsonProtocol.JsonParseMethod").newLine();
- out.append("public abstract ").append(fullName).space();
- appendReadMethodName(out);
- out.append("(").append(Util.JSON_READER_PARAMETER_DEF).append(")").semi().newLine();
- }
-
- void appendReadMethodName(TextOutput out) {
- out.append(nameScheme.getParseMethodName(domain, name));
- }
-
- @Override
- public int compareTo(@NotNull ParserRootInterfaceItem o) {
- return fullName.compareTo(o.fullName);
- }
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ParserRootInterfaceItem.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ParserRootInterfaceItem.kt
new file mode 100644
index 0000000..eb0cc1e
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ParserRootInterfaceItem.kt
@@ -0,0 +1,26 @@
+package org.jetbrains.protocolReader
+
+import org.jetbrains.protocolReader.ParserRootInterfaceItem
+
+class ParserRootInterfaceItem(val domain: String, val name: String, private val nameScheme: ClassNameScheme.Input) : Comparable<ParserRootInterfaceItem> {
+ val fullName: String
+
+ init {
+ fullName = nameScheme.getFullName(domain, name).getFullText()
+ }
+
+ fun writeCode(out: TextOutput) {
+ out.append("@org.jetbrains.jsonProtocol.JsonParseMethod").newLine()
+ out.append("public abstract ").append(fullName).space()
+ appendReadMethodName(out)
+ out.append("(").append(JSON_READER_PARAMETER_DEF).append(")").semi().newLine()
+ }
+
+ fun appendReadMethodName(out: TextOutput) {
+ out.append(nameScheme.getParseMethodName(domain, name))
+ }
+
+ override fun compareTo(other: ParserRootInterfaceItem): Int {
+ return fullName.compareTo(other.fullName)
+ }
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ProtocolModelGenerator.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ProtocolModelGenerator.java
deleted file mode 100644
index 7866e74..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ProtocolModelGenerator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.io.JsonReaderEx;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jsonProtocol.ProtocolSchemaReaderImpl;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.FileSystems;
-import java.nio.file.Files;
-
-public class ProtocolModelGenerator {
- public static void main(String[] args) throws IOException {
- String outputDir = args[0];
- String schemaUrl = args[1];
- byte[] bytes;
- if (schemaUrl.startsWith("http")) {
- bytes = loadBytes(new URL(schemaUrl).openStream());
- }
- else {
- bytes = Files.readAllBytes(FileSystems.getDefault().getPath(schemaUrl));
- }
- JsonReaderEx reader = new JsonReaderEx(new String(bytes, StandardCharsets.UTF_8));
- reader.setLenient(true);
- new Generator(outputDir, args[2], args[3]).go(new ProtocolSchemaReaderImpl().parseRoot(reader));
- }
-
- @NotNull
- public static byte[] loadBytes(@NotNull InputStream stream) throws IOException {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream(Math.max(stream.available(), 16 * 1024));
- byte[] bytes = new byte[1024 * 20];
- while (true) {
- int n = stream.read(bytes, 0, bytes.length);
- if (n <= 0) {
- break;
- }
- buffer.write(bytes, 0, n);
- }
- buffer.close();
- return buffer.toByteArray();
- }
-}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ProtocolModelGenerator.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ProtocolModelGenerator.kt
new file mode 100644
index 0000000..9ebbe79
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ProtocolModelGenerator.kt
@@ -0,0 +1,40 @@
+package org.jetbrains.protocolReader
+
+import org.jetbrains.protocolReader.ProtocolModelGenerator
+
+public class ProtocolModelGenerator {
+ default object {
+ throws(javaClass<IOException>())
+ public fun main(args: Array<String>) {
+ val outputDir = args[0]
+ val schemaUrl = args[1]
+ val bytes: ByteArray
+ if (schemaUrl.startsWith("http")) {
+ bytes = loadBytes(URL(schemaUrl).openStream())
+ }
+ else {
+ bytes = Files.readAllBytes(FileSystems.getDefault().getPath(schemaUrl))
+ }
+ val reader = JsonReaderEx(String(bytes, StandardCharsets.UTF_8))
+ reader.setLenient(true)
+ Generator(outputDir, args[2], args[3]).go(ProtocolSchemaReaderImpl().parseRoot(reader))
+ }
+
+ throws(javaClass<IOException>())
+ public fun loadBytes(stream: InputStream): ByteArray {
+ val buffer = ByteArrayOutputStream(Math.max(stream.available(), 16 * 1024))
+ val bytes = ByteArray(1024 * 20)
+ while (true) {
+ val n = stream.read(bytes, 0, bytes.size())
+ if (n <= 0) {
+ break
+ }
+ buffer.write(bytes, 0, n)
+ }
+ buffer.close()
+ return buffer.toByteArray()
+ }
+ }
+}
+
+fun main(args: Array<String>) = ProtocolModelGenerator.main(args)
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ResolveAndGenerateScope.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ResolveAndGenerateScope.java
deleted file mode 100644
index c43c9ff..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ResolveAndGenerateScope.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.jsonProtocol.ItemDescriptor;
-import org.jetbrains.jsonProtocol.ProtocolMetaModel;
-
-import java.util.List;
-
-interface ResolveAndGenerateScope {
- String getDomainName();
- TypeData.Direction getTypeDirection();
-
- <T extends ItemDescriptor> TypeDescriptor resolveType(T typedObject);
-
- BoxableType generateNestedObject(String description,
- List<ProtocolMetaModel.ObjectProperty> properties);
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ResolveAndGenerateScope.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ResolveAndGenerateScope.kt
new file mode 100644
index 0000000..28dea57
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/ResolveAndGenerateScope.kt
@@ -0,0 +1,10 @@
+package org.jetbrains.protocolReader
+
+trait ResolveAndGenerateScope {
+ public fun getDomainName(): String
+ public fun getTypeDirection(): TypeData.Direction
+
+ public fun <T : ItemDescriptor> resolveType(typedObject: T): TypeDescriptor
+
+ public fun generateNestedObject(description: String?, properties: List<ProtocolMetaModel.ObjectProperty>?): BoxableType
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/StandaloneType.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/StandaloneType.java
deleted file mode 100644
index 540b205..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/StandaloneType.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.jetbrains.protocolReader;
-
-class StandaloneType extends BoxableType {
- private final NamePath namePath;
- private final String writeMethodName;
-
- StandaloneType(NamePath namePath, String writeMethodName) {
- this.namePath = namePath;
- this.writeMethodName = writeMethodName;
- }
-
- @Override
- String getWriteMethodName() {
- return writeMethodName;
- }
-
- @Override
- CharSequence getFullText() {
- return namePath.getFullText();
- }
-
- @Override
- String getShortText(NamePath contextNamespace) {
- int nameLength = namePath.getLength();
- int contextLength = contextNamespace.getLength();
- if (nameLength > contextLength) {
- StringBuilder builder = subtractContextRecursively(namePath, nameLength - contextLength, contextNamespace);
- if (builder != null) {
- return builder.toString();
- }
- }
- return namePath.getFullText();
- }
-
- private static StringBuilder subtractContextRecursively(NamePath namePos, int count, NamePath prefix) {
- if (count > 1) {
- StringBuilder result = subtractContextRecursively(namePos.getParent(), count - 1, prefix);
- if (result == null) {
- return null;
- }
- result.append('.');
- result.append(namePos.getLastComponent());
- return result;
- }
- else {
- String nameComponent = namePos.getLastComponent();
- namePos = namePos.getParent();
- do {
- if (!namePos.getLastComponent().equals(prefix.getLastComponent())) {
- return null;
- }
- namePos = namePos.getParent();
- prefix = prefix.getParent();
- }
- while (namePos != null);
-
- StringBuilder result = new StringBuilder();
- result.append(nameComponent);
- return result;
- }
- }
-}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/StandaloneType.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/StandaloneType.kt
new file mode 100644
index 0000000..e93b18b
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/StandaloneType.kt
@@ -0,0 +1,53 @@
+package org.jetbrains.protocolReader
+
+class StandaloneType(private val namePath: NamePath, private val writeMethodName: String) : BoxableType() {
+ override fun getWriteMethodName(): String {
+ return writeMethodName
+ }
+
+ override fun getFullText(): CharSequence {
+ return namePath.getFullText()
+ }
+
+ override fun getShortText(contextNamespace: NamePath): String {
+ val nameLength = namePath.getLength()
+ val contextLength = contextNamespace.getLength()
+ if (nameLength > contextLength) {
+ val builder = subtractContextRecursively(namePath, nameLength - contextLength, contextNamespace)
+ if (builder != null) {
+ return builder.toString()
+ }
+ }
+ return namePath.getFullText()
+ }
+
+ private fun subtractContextRecursively(namePos: NamePath?, count: Int, prefix: NamePath): StringBuilder? {
+ var namePos = namePos
+ var prefix = prefix
+ if (count > 1) {
+ val result = subtractContextRecursively(namePos!!.parent, count - 1, prefix)
+ if (result == null) {
+ return null
+ }
+ result.append('.')
+ result.append(namePos!!.lastComponent)
+ return result
+ }
+ else {
+ val nameComponent = namePos!!.lastComponent
+ namePos = namePos!!.parent
+ do {
+ if (namePos!!.lastComponent != prefix.lastComponent) {
+ return null
+ }
+ namePos = namePos!!.parent
+ prefix = prefix.parent!!
+ }
+ while (namePos != null)
+
+ val result = StringBuilder()
+ result.append(nameComponent)
+ return result
+ }
+ }
+}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/StandaloneTypeBinding.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/StandaloneTypeBinding.java
deleted file mode 100644
index 40fd24f..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/StandaloneTypeBinding.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jsonProtocol.ProtocolMetaModel;
-
-import java.io.IOException;
-import java.util.List;
-
-interface StandaloneTypeBinding {
- BoxableType getJavaType();
-
- void generate() throws IOException;
-
- /**
- * @return null if not direction-specific
- */
- @Nullable
- TypeData.Direction getDirection();
-
- interface Target {
- BoxableType resolve(ResolveContext context);
-
- interface ResolveContext {
- BoxableType generateNestedObject(String shortName, String description, List<ProtocolMetaModel.ObjectProperty> properties);
- }
- }
-
- class PredefinedTarget implements Target {
- private final BoxableType resolvedType;
-
- PredefinedTarget(BoxableType resolvedType) {
- this.resolvedType = resolvedType;
- }
-
- @Override
- public BoxableType resolve(ResolveContext context) {
- return resolvedType;
- }
-
- public static final PredefinedTarget STRING = new PredefinedTarget(BoxableType.STRING);
- public static final PredefinedTarget INT = new PredefinedTarget(BoxableType.INT);
- public static final PredefinedTarget NUMBER = new PredefinedTarget(BoxableType.NUMBER);
- public static final PredefinedTarget MAP = new PredefinedTarget(BoxableType.MAP);
- }
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/StandaloneTypeBinding.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/StandaloneTypeBinding.kt
new file mode 100644
index 0000000..ba0273a
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/StandaloneTypeBinding.kt
@@ -0,0 +1,35 @@
+package org.jetbrains.protocolReader
+
+trait StandaloneTypeBinding {
+ public fun getJavaType(): BoxableType
+
+ public fun generate()
+
+ /**
+ * @return null if not direction-specific
+ */
+ public fun getDirection(): TypeData.Direction?
+
+ public trait Target {
+ public fun resolve(context: ResolveContext): BoxableType
+
+ public trait ResolveContext {
+ public fun generateNestedObject(shortName: String, description: String?, properties: List<ProtocolMetaModel.ObjectProperty>?): BoxableType
+ }
+ }
+
+ public class PredefinedTarget(private val resolvedType: BoxableType) : Target {
+
+ override fun resolve(context: Target.ResolveContext): BoxableType {
+ return resolvedType
+ }
+
+ default object {
+
+ public val STRING: PredefinedTarget = PredefinedTarget(BoxableType.STRING)
+ public val INT: PredefinedTarget = PredefinedTarget(BoxableType.INT)
+ public val NUMBER: PredefinedTarget = PredefinedTarget(BoxableType.NUMBER)
+ public val MAP: PredefinedTarget = PredefinedTarget(BoxableType.MAP)
+ }
+ }
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TextOutConsumer.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TextOutConsumer.java
deleted file mode 100644
index 44404ad..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TextOutConsumer.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.jetbrains.protocolReader;
-
-public interface TextOutConsumer {
- void append(TextOutput out);
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TextOutConsumer.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TextOutConsumer.kt
new file mode 100644
index 0000000..2ef0ecc
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TextOutConsumer.kt
@@ -0,0 +1,5 @@
+package org.jetbrains.protocolReader
+
+public trait TextOutConsumer {
+ public fun append(out: TextOutput)
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeData.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeData.java
deleted file mode 100644
index 7fbc5f6..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeData.java
+++ /dev/null
@@ -1,176 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jsonProtocol.ProtocolMetaModel;
-
-class TypeData {
- public static final StandaloneTypeBinding ANY = new StandaloneTypeBinding() {
- @Override
- public BoxableType getJavaType() {
- return BoxableType.ANY_STRING;
- }
-
- @Override
- public void generate() {
- }
-
- @Override
- public Direction getDirection() {
- return null;
- }
- };
- private final String name;
-
- private Input input;
- private Output output;
-
- private ProtocolMetaModel.StandaloneType type;
- private StandaloneTypeBinding commonBinding;
-
- TypeData(String name) {
- this.name = name;
- }
-
- void setType(@NotNull ProtocolMetaModel.StandaloneType type) {
- this.type = type;
- }
-
- Input getInput() {
- if (input == null) {
- input = new Input();
- }
- return input;
- }
-
- Output getOutput() {
- if (output == null) {
- output = new Output();
- }
- return output;
- }
-
- TypeRef get(Direction direction) {
- return direction.get(this);
- }
-
- void checkComplete() {
- if (input != null) {
- input.checkResolved();
- }
- if (output != null) {
- output.checkResolved();
- }
- }
-
- enum Direction {
- INPUT() {
- @Override
- TypeRef get(TypeData typeData) {
- return typeData.getInput();
- }
- },
- OUTPUT() {
- @Override
- TypeRef get(TypeData typeData) {
- return typeData.getOutput();
- }
- };
- abstract TypeRef get(TypeData typeData);
- }
-
- abstract class TypeRef {
- private StandaloneTypeBinding oneDirectionBinding;
-
- BoxableType resolve(@NotNull TypeMap typeMap, @NotNull DomainGenerator domainGenerator) {
- if (commonBinding != null) {
- return commonBinding.getJavaType();
- }
- if (oneDirectionBinding != null) {
- return oneDirectionBinding.getJavaType();
- }
- StandaloneTypeBinding binding = resolveImpl(domainGenerator);
- if (binding == null) {
- return null;
- }
-
- if (binding.getDirection() == null) {
- commonBinding = binding;
- }
- else {
- oneDirectionBinding = binding;
- }
- typeMap.addTypeToGenerate(binding);
- return binding.getJavaType();
- }
-
- abstract StandaloneTypeBinding resolveImpl(DomainGenerator domainGenerator);
-
- void checkResolved() {
- if (type == null && !(name.equals("int") || name.equals("any"))) {
- throw new RuntimeException();
- }
- }
- }
-
- class Output extends TypeRef {
- @Override
- StandaloneTypeBinding resolveImpl(@NotNull DomainGenerator domainGenerator) {
- if (type == null) {
- if (name.equals("int")) {
- return new StandaloneTypeBinding() {
- @Override
- public BoxableType getJavaType() {
- return BoxableType.INT;
- }
-
- @Override
- public void generate() {
- }
-
- @Override
- public Direction getDirection() {
- return null;
- }
- };
- }
- else if (name.equals("any")) {
- return ANY;
- }
-
- throw new RuntimeException();
- }
- return domainGenerator.createStandaloneOutputTypeBinding(type, name);
- }
- }
-
- class Input extends TypeRef {
- @Override
- StandaloneTypeBinding resolveImpl(@NotNull DomainGenerator domainGenerator) {
- if (type == null) {
- if (name.equals("int")) {
- return new StandaloneTypeBinding() {
- @Override
- public BoxableType getJavaType() {
- return BoxableType.INT;
- }
-
- @Override
- public void generate() {
- }
-
- @Override
- public Direction getDirection() {
- return null;
- }
- };
- }
- else if (name.equals("any")) {
- return ANY;
- }
-
- throw new RuntimeException();
- }
- return domainGenerator.createStandaloneInputTypeBinding(type);
- }
- }
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeData.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeData.kt
new file mode 100644
index 0000000..e971e91
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeData.kt
@@ -0,0 +1,159 @@
+package org.jetbrains.protocolReader
+
+import org.jetbrains.protocolReader.TypeData
+
+class TypeData(private val name: String) {
+ private var input: Input? = null
+ private var output: Output? = null
+
+ private var type: ProtocolMetaModel.StandaloneType? = null
+ private var commonBinding: StandaloneTypeBinding? = null
+
+ fun setType(type: ProtocolMetaModel.StandaloneType) {
+ this.type = type
+ }
+
+ fun getInput(): Input {
+ if (input == null) {
+ input = Input()
+ }
+ return input!!
+ }
+
+ fun getOutput(): Output {
+ if (output == null) {
+ output = Output()
+ }
+ return output!!
+ }
+
+ fun get(direction: Direction): TypeRef {
+ return direction.get(this)
+ }
+
+ fun checkComplete() {
+ if (input != null) {
+ input!!.checkResolved()
+ }
+ if (output != null) {
+ output!!.checkResolved()
+ }
+ }
+
+ abstract class Direction {
+ default object {
+ val INPUT = object : Direction() {
+ override fun get(typeData: TypeData) = typeData.getInput()
+ }
+
+ val OUTPUT = object : Direction() {
+ override fun get(typeData: TypeData) = typeData.getOutput()
+ }
+ }
+
+ abstract fun get(typeData: TypeData): TypeRef
+ }
+
+ abstract inner class TypeRef {
+ private var oneDirectionBinding: StandaloneTypeBinding? = null
+
+ fun resolve(typeMap: TypeMap, domainGenerator: DomainGenerator): BoxableType? {
+ if (commonBinding != null) {
+ return commonBinding!!.getJavaType()
+ }
+ if (oneDirectionBinding != null) {
+ return oneDirectionBinding!!.getJavaType()
+ }
+ val binding = resolveImpl(domainGenerator)
+ if (binding == null) {
+ return null
+ }
+
+ if (binding.getDirection() == null) {
+ commonBinding = binding
+ }
+ else {
+ oneDirectionBinding = binding
+ }
+ typeMap.addTypeToGenerate(binding)
+ return binding.getJavaType()
+ }
+
+ abstract fun resolveImpl(domainGenerator: DomainGenerator): StandaloneTypeBinding?
+
+ fun checkResolved() {
+ if (type == null && !(name == "int" || name == "any")) {
+ throw RuntimeException()
+ }
+ }
+ }
+
+ inner class Output : TypeRef() {
+ override fun resolveImpl(domainGenerator: DomainGenerator): StandaloneTypeBinding? {
+ if (type == null) {
+ if (name == "int") {
+ return object : StandaloneTypeBinding {
+ override fun getJavaType(): BoxableType {
+ return BoxableType.INT
+ }
+
+ override fun generate() {
+ }
+
+ override fun getDirection(): Direction? {
+ return null
+ }
+ }
+ }
+ else if (name == "any") {
+ return ANY
+ }
+
+ throw RuntimeException()
+ }
+ return domainGenerator.createStandaloneOutputTypeBinding(type!!, name)
+ }
+ }
+
+ inner class Input : TypeRef() {
+ override fun resolveImpl(domainGenerator: DomainGenerator): StandaloneTypeBinding? {
+ if (type == null) {
+ if (name == "int") {
+ return object : StandaloneTypeBinding {
+ override fun getJavaType(): BoxableType {
+ return BoxableType.INT
+ }
+
+ override fun generate() {
+ }
+
+ override fun getDirection(): Direction? {
+ return null
+ }
+ }
+ }
+ else if (name == "any") {
+ return ANY
+ }
+
+ throw RuntimeException()
+ }
+ return domainGenerator.createStandaloneInputTypeBinding(type!!)
+ }
+ }
+
+ default object {
+ public val ANY: StandaloneTypeBinding = object : StandaloneTypeBinding {
+ override fun getJavaType(): BoxableType {
+ return BoxableType.ANY_STRING
+ }
+
+ override fun generate() {
+ }
+
+ override fun getDirection(): Direction? {
+ return null
+ }
+ }
+ }
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeDescriptor.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeDescriptor.java
deleted file mode 100644
index d142e8b..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeDescriptor.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.annotations.NotNull;
-
-class TypeDescriptor {
- private final BoxableType type;
- private final boolean optional;
- private final boolean nullable;
- private final boolean asRawString;
-
- TypeDescriptor(@NotNull BoxableType type, boolean optional) {
- this(type, optional, false, false);
- }
-
- TypeDescriptor(@NotNull BoxableType type, boolean optional, boolean nullable, boolean asRawString) {
- this.type = type;
- this.optional = optional;
- this.nullable = nullable;
- this.asRawString = asRawString;
- }
-
- boolean isNullable() {
- return nullable;
- }
-
- @NotNull
- BoxableType getType() {
- return type;
- }
-
- void writeAnnotations(@NotNull TextOutput out) {
- if (optional || asRawString) {
- out.append("@org.jetbrains.jsonProtocol.JsonField(");
- if (optional) {
- out.append("optional=true");
- }
- if (asRawString) {
- if (optional) {
- out.append(", ");
- }
- out.append("allowAnyPrimitiveValue=true");
- }
- out.append(")").newLine();
- }
-
- if (isNullable()) {
- out.append("@org.jetbrains.jsonProtocol.JsonNullable").newLine();
- }
- }
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeDescriptor.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeDescriptor.kt
new file mode 100644
index 0000000..7c64e34
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeDescriptor.kt
@@ -0,0 +1,28 @@
+package org.jetbrains.protocolReader
+
+class TypeDescriptor(val type: BoxableType, private val optional: Boolean, private val nullable: Boolean = false, private val asRawString: Boolean = false) {
+
+ fun isNullable(): Boolean {
+ return nullable
+ }
+
+ fun writeAnnotations(out: TextOutput) {
+ if (optional || asRawString) {
+ out.append("@org.jetbrains.jsonProtocol.JsonField(")
+ if (optional) {
+ out.append("optional=true")
+ }
+ if (asRawString) {
+ if (optional) {
+ out.append(", ")
+ }
+ out.append("allowAnyPrimitiveValue=true")
+ }
+ out.append(")").newLine()
+ }
+
+ if (isNullable()) {
+ out.append("@org.jetbrains.jsonProtocol.JsonNullable").newLine()
+ }
+ }
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeMap.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeMap.java
deleted file mode 100644
index a1d35b5..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeMap.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import com.intellij.openapi.util.Pair;
-import gnu.trove.THashMap;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Keeps track of all referenced types.
- * A type may be used and resolved (generated or hard-coded).
- */
-class TypeMap {
- private final Map<Pair<String, String>, TypeData> map = new THashMap<>();
- private Map<String, DomainGenerator> domainGeneratorMap;
- private final List<StandaloneTypeBinding> typesToGenerate = new ArrayList<>();
-
- void setDomainGeneratorMap(Map<String, DomainGenerator> domainGeneratorMap) {
- this.domainGeneratorMap = domainGeneratorMap;
- }
-
- @Nullable
- BoxableType resolve(String domainName, String typeName, TypeData.Direction direction) {
- DomainGenerator domainGenerator = domainGeneratorMap.get(domainName);
- if (domainGenerator == null) {
- throw new RuntimeException("Failed to find domain generator: " + domainName);
- }
- return getTypeData(domainName, typeName).get(direction).resolve(this, domainGenerator);
- }
-
- void addTypeToGenerate(@NotNull StandaloneTypeBinding binding) {
- typesToGenerate.add(binding);
- }
-
- public void generateRequestedTypes() throws IOException {
- // Size may grow during iteration.
- //noinspection ForLoopReplaceableByForEach
- for (int i = 0; i < typesToGenerate.size(); i++) {
- typesToGenerate.get(i).generate();
- }
-
- for (TypeData typeData : map.values()) {
- typeData.checkComplete();
- }
- }
-
- @NotNull
- TypeData getTypeData(@NotNull String domainName, @NotNull String typeName) {
- Pair<String, String> key = Pair.create(domainName, typeName);
- TypeData result = map.get(key);
- if (result == null) {
- result = new TypeData(typeName);
- map.put(key, result);
- }
- return result;
- }
-}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeMap.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeMap.kt
new file mode 100644
index 0000000..2c31174
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeMap.kt
@@ -0,0 +1,50 @@
+package org.jetbrains.protocolReader
+
+/**
+ * Keeps track of all referenced types.
+ * A type may be used and resolved (generated or hard-coded).
+ */
+class TypeMap {
+ private val map = THashMap<Pair<String, String>, TypeData>()
+ private var domainGeneratorMap: Map<String, DomainGenerator>? = null
+ private val typesToGenerate = ArrayList<StandaloneTypeBinding>()
+
+ fun setDomainGeneratorMap(domainGeneratorMap: Map<String, DomainGenerator>) {
+ this.domainGeneratorMap = domainGeneratorMap
+ }
+
+ fun resolve(domainName: String, typeName: String, direction: TypeData.Direction): BoxableType? {
+ val domainGenerator = domainGeneratorMap!!.get(domainName)
+ if (domainGenerator == null) {
+ throw RuntimeException("Failed to find domain generator: " + domainName)
+ }
+ return getTypeData(domainName, typeName).get(direction).resolve(this, domainGenerator)
+ }
+
+ fun addTypeToGenerate(binding: StandaloneTypeBinding) {
+ typesToGenerate.add(binding)
+ }
+
+ throws(javaClass<IOException>())
+ public fun generateRequestedTypes() {
+ // Size may grow during iteration.
+ //noinspection ForLoopReplaceableByForEach
+ for (i in typesToGenerate.indices) {
+ typesToGenerate.get(i).generate()
+ }
+
+ for (typeData in map.values()) {
+ typeData.checkComplete()
+ }
+ }
+
+ fun getTypeData(domainName: String, typeName: String): TypeData {
+ val key = Pair.create<String, String>(domainName, typeName)
+ var result: TypeData? = map.get(key)
+ if (result == null) {
+ result = TypeData(typeName)
+ map.put(key, result)
+ }
+ return result!!
+ }
+}
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeVisitor.java b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeVisitor.java
deleted file mode 100644
index 0aae6cc..0000000
--- a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeVisitor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.jetbrains.protocolReader;
-
-import org.jetbrains.jsonProtocol.ProtocolMetaModel;
-
-import java.util.List;
-
-interface TypeVisitor<R> {
- R visitRef(String refName);
-
- R visitBoolean();
-
- R visitEnum(List<String> enumConstants);
-
- R visitString();
-
- R visitInteger();
-
- R visitNumber();
-
- R visitArray(ProtocolMetaModel.ArrayItemType items);
-
- R visitObject(List<ProtocolMetaModel.ObjectProperty> properties);
-
- R visitMap();
-
- R visitUnknown();
-}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeVisitor.kt b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeVisitor.kt
new file mode 100644
index 0000000..ca53230
--- /dev/null
+++ b/platform/script-debugger/protocol/protocol-model-generator/src/org/jetbrains/protocolReader/TypeVisitor.kt
@@ -0,0 +1,23 @@
+package org.jetbrains.protocolReader
+
+trait TypeVisitor<R> {
+ public fun visitRef(refName: String): R
+
+ public fun visitBoolean(): R
+
+ public fun visitEnum(enumConstants: List<String>): R
+
+ public fun visitString(): R
+
+ public fun visitInteger(): R
+
+ public fun visitNumber(): R
+
+ public fun visitArray(items: ProtocolMetaModel.ArrayItemType): R
+
+ public fun visitObject(properties: List<ProtocolMetaModel.ObjectProperty>?): R
+
+ public fun visitMap(): R
+
+ public fun visitUnknown(): R
+}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/JsonOptionalField.java b/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/JsonOptionalField.java
index 92c9cd9..545037e 100644
--- a/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/JsonOptionalField.java
+++ b/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/JsonOptionalField.java
@@ -1,7 +1,6 @@
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
package org.jetbrains.jsonProtocol;
import java.lang.annotation.ElementType;
diff --git a/platform/script-debugger/protocol/protocol-reader/protocol-reader.iml b/platform/script-debugger/protocol/protocol-reader/protocol-reader.iml
index 1eded93..7c6275f 100644
--- a/platform/script-debugger/protocol/protocol-reader/protocol-reader.iml
+++ b/platform/script-debugger/protocol/protocol-reader/protocol-reader.iml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
- <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
diff --git a/platform/script-debugger/protocol/protocol-reader/src/FieldProcessor.kt b/platform/script-debugger/protocol/protocol-reader/src/FieldProcessor.kt
index 2b813ed..8fd8f04 100644
--- a/platform/script-debugger/protocol/protocol-reader/src/FieldProcessor.kt
+++ b/platform/script-debugger/protocol/protocol-reader/src/FieldProcessor.kt
@@ -1,24 +1,15 @@
package org.jetbrains.protocolReader
-import gnu.trove.THashSet
-import org.jetbrains.jsonProtocol.JsonField
-import org.jetbrains.jsonProtocol.JsonOptionalField
-import org.jetbrains.jsonProtocol.JsonSubtypeCasting
-
-import java.lang.reflect.Method
-import java.lang.reflect.ParameterizedType
-import java.util.*
-
class FieldProcessor(private val reader: InterfaceReader, typeClass: Class<*>) {
val fieldLoaders = ArrayList<FieldLoader>()
val methodHandlerMap = LinkedHashMap<Method, MethodHandler>()
val volatileFields = ArrayList<VolatileFieldBinding>()
var lazyRead: Boolean = false
- {
+ init {
val methods = typeClass.getMethods()
// todo sort by source location
- Arrays.sort(methods, {(o1, o2) -> o1.getName().compareTo(o2.getName())})
+ Arrays.sort(methods, {(o1, o2) -> o1.getName().compareTo(o2.getName()) })
val skippedNames = THashSet<String>()
for (method in methods) {
diff --git a/platform/script-debugger/protocol/protocol-reader/src/GlobalScope.kt b/platform/script-debugger/protocol/protocol-reader/src/GlobalScope.kt
index 733e5ec..9751535 100644
--- a/platform/script-debugger/protocol/protocol-reader/src/GlobalScope.kt
+++ b/platform/script-debugger/protocol/protocol-reader/src/GlobalScope.kt
@@ -1,9 +1,7 @@
package org.jetbrains.protocolReader
-import gnu.trove.THashMap
-import gnu.trove.THashSet
-
-import java.util.ArrayList
+import org.jetbrains.protocolReader.GlobalScope
+import org.jetbrains.protocolReader.State
public fun GlobalScope(typeWriters: Collection<TypeWriter<*>>, basePackages: Collection<Map<Class<*>, String>>): GlobalScope {
return GlobalScope(State(typeWriters, basePackages))
@@ -40,7 +38,7 @@
private val typesWithFactories = THashSet<TypeWriter<*>>()
val typesWithFactoriesList = ArrayList<TypeWriter<*>>();
- {
+ init {
var uniqueCode = 0
val result = THashMap<TypeWriter<*>, String>(typeWriters.size())
for (handler in typeWriters) {
diff --git a/platform/script-debugger/protocol/protocol-reader/src/InterfaceReader.kt b/platform/script-debugger/protocol/protocol-reader/src/InterfaceReader.kt
index 053c68b..aa88655 100644
--- a/platform/script-debugger/protocol/protocol-reader/src/InterfaceReader.kt
+++ b/platform/script-debugger/protocol/protocol-reader/src/InterfaceReader.kt
@@ -1,16 +1,6 @@
package org.jetbrains.protocolReader
-import org.jetbrains.io.JsonReaderEx
-import org.jetbrains.jsonProtocol.JsonField
-import org.jetbrains.jsonProtocol.JsonSubtype
-import org.jetbrains.jsonProtocol.StringIntPair
-
-import java.lang.reflect.Method
-import java.lang.reflect.ParameterizedType
-import java.lang.reflect.Type
-import java.lang.reflect.WildcardType
-import java.util.*
-import gnu.trove.*
+import org.jetbrains.protocolReader.InterfaceReader
fun InterfaceReader(protocolInterfaces: Array<Class<*>>): InterfaceReader {
val __ = InterfaceReader(LinkedHashMap<Class<*>, TypeWriter<*>>(protocolInterfaces.size()))
@@ -130,6 +120,9 @@
if (jsonField != null && jsonField.allowAnyPrimitiveValue()) {
return RAW_STRING_PARSER
}
+ else if ((jsonField != null && jsonField.optional()) || method.getAnnotation<JsonOptionalField>(javaClass<JsonOptionalField>()) != null) {
+ return NULLABLE_STRING_PARSER
+ }
}
return STRING_PARSER
}
@@ -220,6 +213,7 @@
private val NUMBER_PARSER = PrimitiveValueReader("double")
private val STRING_PARSER = PrimitiveValueReader("String")
+ private val NULLABLE_STRING_PARSER = PrimitiveValueReader(className = "String", nullable = true)
private val RAW_STRING_PARSER = PrimitiveValueReader("String", null, true)
private val RAW_STRING_OR_MAP_PARSER = object : PrimitiveValueReader("Object", null, true) {
diff --git a/platform/script-debugger/protocol/protocol-reader/src/PrimitiveValueReader.kt b/platform/script-debugger/protocol/protocol-reader/src/PrimitiveValueReader.kt
index f091e1c..7f36b0f 100644
--- a/platform/script-debugger/protocol/protocol-reader/src/PrimitiveValueReader.kt
+++ b/platform/script-debugger/protocol/protocol-reader/src/PrimitiveValueReader.kt
@@ -1,18 +1,9 @@
package org.jetbrains.protocolReader
-
-fun PrimitiveValueReader(name: String): PrimitiveValueReader {
- return PrimitiveValueReader(name, null, false)
-}
-
-fun PrimitiveValueReader(name: String, defaultValue: String): PrimitiveValueReader {
- return PrimitiveValueReader(name, defaultValue, false)
-}
-
-open class PrimitiveValueReader(private val className: String, val defaultValue: String?, private val asRawString: Boolean) : ValueReader() {
+open class PrimitiveValueReader(private val className: String, val defaultValue: String? = null, private val asRawString: Boolean = false, private val nullable: Boolean = false) : ValueReader() {
private val readPostfix: String
- {
+ init {
if (Character.isLowerCase(className.charAt(0))) {
readPostfix = Character.toUpperCase(className.charAt(0)) + className.substring(1)
}
@@ -29,7 +20,11 @@
}
else {
addReaderParameter(subtyping, out)
- out.append(".next").append(readPostfix).append("()")
+ out.append(".next");
+ if (nullable) {
+ out.append("Nullable");
+ }
+ out.append(readPostfix).append("()")
//beginReadCall(readPostfix, subtyping, out, name);
}
}
diff --git a/platform/script-debugger/protocol/protocol-reader/src/ReaderGenerator.kt b/platform/script-debugger/protocol/protocol-reader/src/ReaderGenerator.kt
index ca030a5..4d65696 100644
--- a/platform/script-debugger/protocol/protocol-reader/src/ReaderGenerator.kt
+++ b/platform/script-debugger/protocol/protocol-reader/src/ReaderGenerator.kt
@@ -1,13 +1,6 @@
package org.jetbrains.protocolReader
-import gnu.trove.THashMap
-
-import java.io.File
-import java.nio.file.FileSystems
-import java.util.*
-
public class ReaderGenerator {
-
public class GenerateConfiguration<ROOT>(val packageName: String, val className: String, readerRootClass: Class<ROOT>, protocolInterfaces: Array<Class<*>>, basePackagesMap: Map<Class<*>, String>? = null) {
val basePackagesMap: Collection<Map<Class<*>, String>>
diff --git a/platform/script-debugger/protocol/schema-reader-generator/schema-reader-generator.iml b/platform/script-debugger/protocol/schema-reader-generator/schema-reader-generator.iml
index 7c859fb..a2a9f75 100644
--- a/platform/script-debugger/protocol/schema-reader-generator/schema-reader-generator.iml
+++ b/platform/script-debugger/protocol/schema-reader-generator/schema-reader-generator.iml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
- <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
@@ -9,6 +9,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="gson" level="project" />
<orderEntry type="module" module-name="protocol-reader" />
+ <orderEntry type="library" name="KotlinJavaRuntime" level="project" />
+ <orderEntry type="module" module-name="platform-impl" />
</component>
-</module>
-
+</module>
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ItemDescriptor.java b/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ItemDescriptor.java
deleted file mode 100644
index d6f5afc..0000000
--- a/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ItemDescriptor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.jetbrains.jsonProtocol;
-
-import java.util.List;
-
-public interface ItemDescriptor {
- String description();
-
- String type();
-
- List<String> getEnum();
-
- ProtocolMetaModel.ArrayItemType items();
-
- interface Named extends Referenceable {
- String name();
-
- @JsonOptionalField
- String shortName();
-
- boolean optional();
- }
-
- interface Referenceable extends ItemDescriptor {
- String ref();
- }
-
- interface Type extends ItemDescriptor {
- List<ProtocolMetaModel.ObjectProperty> properties();
- }
-}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ItemDescriptor.kt b/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ItemDescriptor.kt
new file mode 100644
index 0000000..c32c392
--- /dev/null
+++ b/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ItemDescriptor.kt
@@ -0,0 +1,28 @@
+package org.jetbrains.jsonProtocol
+
+public trait ItemDescriptor {
+ public fun description(): String?
+
+ public fun type(): String
+
+ public fun getEnum(): List<String>?
+
+ public fun items(): ProtocolMetaModel.ArrayItemType
+
+ public trait Named : Referenceable {
+ public fun name(): String
+
+ JsonOptionalField
+ public fun shortName(): String?
+
+ public fun optional(): Boolean
+ }
+
+ public trait Referenceable : ItemDescriptor {
+ public fun ref(): String
+ }
+
+ public trait Type : ItemDescriptor {
+ public fun properties(): List<ProtocolMetaModel.ObjectProperty>?
+ }
+}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ProtocolMetaModel.java b/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ProtocolMetaModel.java
deleted file mode 100644
index a4aeeec..0000000
--- a/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ProtocolMetaModel.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package org.jetbrains.jsonProtocol;
-
-import java.util.List;
-
-/**
- * Defines schema of WIP metamodel defined in http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/inspector/Inspector.json
- */
-public interface ProtocolMetaModel {
- @JsonType
- interface Root {
- @JsonOptionalField
- Version version();
-
- List<Domain> domains();
- }
-
- @JsonType
- interface Version {
- String major();
- String minor();
- }
-
- @JsonType
- interface Domain {
- String domain();
-
- @JsonOptionalField
- List<StandaloneType> types();
-
- List<Command> commands();
-
- @JsonOptionalField
- List<Event> events();
-
- @JsonOptionalField
- String description();
-
- @JsonOptionalField
- boolean hidden();
- }
-
- @JsonType
- interface Command {
- String name();
-
- @JsonOptionalField
- List<Parameter> parameters();
-
- @JsonOptionalField
- List<Parameter> returns();
-
- @JsonOptionalField
- String description();
-
- @JsonOptionalField
- boolean hidden();
-
- @JsonOptionalField
- boolean async();
- }
-
- @JsonType
- interface Parameter extends ItemDescriptor.Named {
- @Override
- String name();
-
- @Override
- @JsonOptionalField
- String shortName();
-
- @Override
- @JsonOptionalField
- String type();
-
- @Override
- @JsonOptionalField
- ArrayItemType items();
-
- @Override
- @JsonField(jsonLiteralName = "enum")
- @JsonOptionalField
- List<String> getEnum();
-
- @Override
- @JsonOptionalField
- @JsonField(jsonLiteralName = "$ref")
- String ref();
-
- @Override
- @JsonOptionalField
- boolean optional();
-
- @Override
- @JsonOptionalField
- String description();
-
- @JsonOptionalField
- boolean hidden();
- }
-
- @JsonType
- interface Event {
- String name();
-
- @JsonOptionalField
- List<Parameter> parameters();
-
- @JsonOptionalField
- String description();
-
- @JsonOptionalField
- boolean hidden();
- }
-
- @JsonType
- interface StandaloneType extends ItemDescriptor.Type {
- String id();
-
- @Override
- @JsonOptionalField
- String description();
-
- @Override
- String type();
-
- @JsonOptionalField
- boolean hidden();
-
- @Override
- @JsonOptionalField
- List<ObjectProperty> properties();
-
- @Override
- @JsonField(jsonLiteralName = "enum")
- @JsonOptionalField
- List<String> getEnum();
-
- @Override
- @JsonOptionalField
- ArrayItemType items();
- }
-
-
- @JsonType
- interface ArrayItemType extends ItemDescriptor.Type, ItemDescriptor.Referenceable {
- @Override
- @JsonOptionalField
- String description();
-
- @JsonOptionalField
- boolean optional();
-
- @Override
- @JsonOptionalField
- String type();
-
- @Override
- @JsonOptionalField
- ArrayItemType items();
-
- @Override
- @JsonField(jsonLiteralName = "$ref")
- @JsonOptionalField
- String ref();
-
- @Override
- @JsonField(jsonLiteralName = "enum")
- @JsonOptionalField
- List<String> getEnum();
-
- @Override
- @JsonOptionalField
- List<ObjectProperty> properties();
- }
-
- @JsonType
- interface ObjectProperty extends ItemDescriptor.Named {
- @Override
- String name();
-
- @Override
- @JsonOptionalField
- String shortName();
-
- @Override
- @JsonOptionalField
- String description();
-
- @Override
- @JsonOptionalField
- boolean optional();
-
- @Override
- @JsonOptionalField
- String type();
-
- @Override
- @JsonOptionalField
- ArrayItemType items();
-
- @Override
- @JsonField(jsonLiteralName = "$ref")
- @JsonOptionalField
- String ref();
-
- @Override
- @JsonField(jsonLiteralName = "enum")
- @JsonOptionalField
- List<String> getEnum();
-
- @JsonOptionalField
- boolean hidden();
- }
-
- String STRING_TYPE = "string";
- String INTEGER_TYPE = "integer";
- String NUMBER_TYPE = "number";
- String BOOLEAN_TYPE = "boolean";
- String OBJECT_TYPE = "object";
- String ARRAY_TYPE = "array";
- String UNKNOWN_TYPE = "unknown";
- String ANY_TYPE = "any";
-}
diff --git a/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ProtocolMetaModel.kt b/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ProtocolMetaModel.kt
new file mode 100644
index 0000000..6377aff
--- /dev/null
+++ b/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ProtocolMetaModel.kt
@@ -0,0 +1,196 @@
+package org.jetbrains.jsonProtocol
+
+/**
+ * Defines schema of WIP metamodel defined in http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/inspector/Inspector.json
+ */
+public trait ProtocolMetaModel {
+ JsonType
+ public trait Root {
+ JsonOptionalField
+ public fun version(): Version
+
+ public fun domains(): List<Domain>
+ }
+
+ JsonType
+ public trait Version {
+ public fun major(): String
+ public fun minor(): String
+ }
+
+ JsonType
+ public trait Domain {
+ public fun domain(): String
+
+ JsonOptionalField
+ public fun types(): List<StandaloneType>?
+
+ public fun commands(): List<Command>
+
+ JsonOptionalField
+ public fun events(): List<Event>?
+
+ JsonOptionalField
+ public fun description(): String
+
+ JsonOptionalField
+ public fun hidden(): Boolean
+ }
+
+ JsonType
+ public trait Command {
+ public fun name(): String
+
+ JsonOptionalField
+ public fun parameters(): List<Parameter>?
+
+ JsonOptionalField
+ public fun returns(): List<Parameter>?
+
+ JsonOptionalField
+ public fun description(): String
+
+ JsonOptionalField
+ public fun hidden(): Boolean
+
+ JsonOptionalField
+ public fun async(): Boolean
+ }
+
+ JsonType
+ public trait Parameter : ItemDescriptor.Named {
+ override fun name(): String
+
+ JsonOptionalField
+ override fun shortName(): String
+
+ JsonOptionalField
+ override fun type(): String
+
+ JsonOptionalField
+ override fun items(): ArrayItemType
+
+ JsonField(name = "enum")
+ JsonOptionalField
+ override fun getEnum(): List<String>
+
+ JsonOptionalField
+ JsonField(name = "\$ref")
+ override fun ref(): String
+
+ JsonOptionalField
+ override fun optional(): Boolean
+
+ JsonOptionalField
+ override fun description(): String
+
+ JsonOptionalField
+ public fun hidden(): Boolean
+ }
+
+ JsonType
+ public trait Event {
+ public fun name(): String
+
+ JsonOptionalField
+ public fun parameters(): List<Parameter>
+
+ JsonOptionalField
+ public fun description(): String
+
+ JsonOptionalField
+ public fun hidden(): Boolean
+ }
+
+ JsonType
+ public trait StandaloneType : ItemDescriptor.Type {
+ public fun id(): String
+
+ JsonOptionalField
+ override fun description(): String?
+
+ override fun type(): String
+
+ JsonOptionalField
+ public fun hidden(): Boolean
+
+ JsonOptionalField
+ override fun properties(): List<ObjectProperty>
+
+ JsonField(name = "enum")
+ JsonOptionalField
+ override fun getEnum(): List<String>
+
+ JsonOptionalField
+ override fun items(): ArrayItemType
+ }
+
+
+ JsonType
+ public trait ArrayItemType : ItemDescriptor.Type, ItemDescriptor.Referenceable {
+ JsonOptionalField
+ override fun description(): String
+
+ JsonOptionalField
+ public fun optional(): Boolean
+
+ JsonOptionalField
+ override fun type(): String
+
+ JsonOptionalField
+ override fun items(): ArrayItemType
+
+ JsonField(name = "\$ref")
+ JsonOptionalField
+ override fun ref(): String
+
+ JsonField(name = "enum")
+ JsonOptionalField
+ override fun getEnum(): List<String>
+
+ JsonOptionalField
+ override fun properties(): List<ObjectProperty>
+ }
+
+ JsonType
+ public trait ObjectProperty : ItemDescriptor.Named {
+ override fun name(): String
+
+ JsonOptionalField
+ override fun shortName(): String
+
+ JsonOptionalField
+ override fun description(): String
+
+ JsonOptionalField
+ override fun optional(): Boolean
+
+ JsonOptionalField
+ override fun type(): String
+
+ JsonOptionalField
+ override fun items(): ArrayItemType
+
+ JsonField(name = "\$ref")
+ JsonOptionalField
+ override fun ref(): String
+
+ JsonField(name = "enum")
+ JsonOptionalField
+ override fun getEnum(): List<String>
+
+ JsonOptionalField
+ public fun hidden(): Boolean
+ }
+
+ default object {
+ public val STRING_TYPE: String = "string"
+ public val INTEGER_TYPE: String = "integer"
+ public val NUMBER_TYPE: String = "number"
+ public val BOOLEAN_TYPE: String = "boolean"
+ public val OBJECT_TYPE: String = "object"
+ public val ARRAY_TYPE: String = "array"
+ public val UNKNOWN_TYPE: String = "unknown"
+ public val ANY_TYPE: String = "any"
+ }
+}
diff --git a/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ProtocolSchemaReader.java b/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ProtocolSchemaReader.java
deleted file mode 100644
index aafe735..0000000
--- a/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ProtocolSchemaReader.java
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.jetbrains.jsonProtocol;
-
-import org.jetbrains.io.JsonReaderEx;
-import org.jetbrains.jsonProtocol.ProtocolMetaModel.Root;
-
-import java.io.IOException;
-
-public interface ProtocolSchemaReader {
- @JsonParseMethod
- Root parseRoot(JsonReaderEx reader) throws IOException;
-}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ProtocolSchemaReader.kt b/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ProtocolSchemaReader.kt
new file mode 100644
index 0000000..60a624e
--- /dev/null
+++ b/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/ProtocolSchemaReader.kt
@@ -0,0 +1,7 @@
+package org.jetbrains.jsonProtocol
+
+public trait ProtocolSchemaReader {
+ JsonParseMethod
+ throws(javaClass<IOException>())
+ public fun parseRoot(reader: JsonReaderEx): Root
+}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/SchemaReaderGenerator.java b/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/SchemaReaderGenerator.java
deleted file mode 100644
index 1220ffa..0000000
--- a/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/SchemaReaderGenerator.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.jetbrains.jsonProtocol;
-
-import org.jetbrains.protocolReader.ReaderGenerator;
-
-import java.io.IOException;
-
-public class SchemaReaderGenerator {
- public static void main(String[] args) throws IOException {
- ReaderGenerator.generate(args, new ReaderGenerator.GenerateConfiguration<>("org.jetbrains.jsonProtocol", "ProtocolSchemaReaderImpl", ProtocolSchemaReader.class, ProtocolMetaModel.class.getDeclaredClasses()));
- }
-}
\ No newline at end of file
diff --git a/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/SchemaReaderGenerator.kt b/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/SchemaReaderGenerator.kt
new file mode 100644
index 0000000..89d1db3
--- /dev/null
+++ b/platform/script-debugger/protocol/schema-reader-generator/src/org/jetbrains/jsonProtocol/SchemaReaderGenerator.kt
@@ -0,0 +1,5 @@
+package org.jetbrains.jsonProtocol
+
+import org.jetbrains.protocolReader.ReaderGenerator
+
+fun main(args: Array<String>) = ReaderGenerator.generate(args, ReaderGenerator.GenerateConfiguration("org.jetbrains.jsonProtocol", "ProtocolSchemaReaderImpl", javaClass<ProtocolSchemaReader>(), javaClass<ProtocolMetaModel>().getDeclaredClasses()))
\ No newline at end of file
diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/MatchOptions.java b/platform/structuralsearch/source/com/intellij/structuralsearch/MatchOptions.java
index be7277b..8f96e62 100644
--- a/platform/structuralsearch/source/com/intellij/structuralsearch/MatchOptions.java
+++ b/platform/structuralsearch/source/com/intellij/structuralsearch/MatchOptions.java
@@ -158,7 +158,9 @@
//@TODO serialize scope!
- element.setAttribute(FILE_TYPE_ATTR_NAME, myFileType.getName());
+ if (myFileType != null) {
+ element.setAttribute(FILE_TYPE_ATTR_NAME, myFileType.getName());
+ }
if (myDialect != null) {
element.setAttribute(DIALECT_ATTR_NAME, myDialect.getID());
diff --git a/platform/testFramework/src/com/intellij/mock/Mock.java b/platform/testFramework/src/com/intellij/mock/Mock.java
index 4ee338a..cae264c 100644
--- a/platform/testFramework/src/com/intellij/mock/Mock.java
+++ b/platform/testFramework/src/com/intellij/mock/Mock.java
@@ -601,6 +601,17 @@
@NotNull
@Override
+ public ToolWindow registerToolWindow(@NotNull String id,
+ boolean canCloseContent,
+ @NotNull ToolWindowAnchor anchor,
+ Disposable parentDisposable,
+ boolean canWorkInDumbMode,
+ boolean secondary) {
+ throw new RuntimeException();
+ }
+
+ @NotNull
+ @Override
public ToolWindow registerToolWindow(@NotNull final String id, final boolean canCloseContent, @NotNull final ToolWindowAnchor anchor, final boolean secondary) {
throw new RuntimeException();
}
diff --git a/platform/testRunner/src/com/intellij/execution/testframework/actions/TestDiffRequestProcessor.java b/platform/testRunner/src/com/intellij/execution/testframework/actions/TestDiffRequestProcessor.java
index b87bdb3..4c99bcd 100644
--- a/platform/testRunner/src/com/intellij/execution/testframework/actions/TestDiffRequestProcessor.java
+++ b/platform/testRunner/src/com/intellij/execution/testframework/actions/TestDiffRequestProcessor.java
@@ -45,7 +45,7 @@
@NotNull
private DiffRequest loadRequest() {
- if (myIndex < 0 || myIndex >= myRequests.size()) return new NoDiffRequest();
+ if (myIndex < 0 || myIndex >= myRequests.size()) return NoDiffRequest.INSTANCE;
DiffHyperlink hyperlink = myRequests.get(myIndex);
try {
String title = hyperlink.getDiffTitle();
diff --git a/platform/usageView/src/com/intellij/usages/impl/UsagePreviewPanel.java b/platform/usageView/src/com/intellij/usages/impl/UsagePreviewPanel.java
index 326bbec..fe589ca 100644
--- a/platform/usageView/src/com/intellij/usages/impl/UsagePreviewPanel.java
+++ b/platform/usageView/src/com/intellij/usages/impl/UsagePreviewPanel.java
@@ -126,7 +126,7 @@
TextRange elementRange = psiElement.getTextRange();
TextRange infoRange = info.getRangeInElement();
- TextRange textRange = infoRange == null ? null : elementRange.cutOut(infoRange);
+ TextRange textRange = infoRange == null || infoRange.getStartOffset() > elementRange.getLength() ? null : elementRange.cutOut(infoRange);
if (textRange == null) textRange = elementRange;
// hack to determine element range to highlight
if (psiElement instanceof PsiNamedElement && !(psiElement instanceof PsiFile)) {
diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java b/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java
index 3109fad..001d37b 100644
--- a/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java
+++ b/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java
@@ -309,7 +309,8 @@
private int getVisibleRowCount() {
// myTree.getVisibleRowCount returns 20
- int rowHeight = myTree.getRowBounds(0).height;
+ Rectangle bounds = myTree.getRowBounds(0);
+ int rowHeight = bounds == null ? 0 : bounds.height;
return rowHeight == 0 ? myTree.getVisibleRowCount() : myTree.getVisibleRect().height / rowHeight;
}
diff --git a/platform/util-rt/src/com/intellij/util/containers/ContainerUtilRt.java b/platform/util-rt/src/com/intellij/util/containers/ContainerUtilRt.java
index 70519c0..bc7dc78 100644
--- a/platform/util-rt/src/com/intellij/util/containers/ContainerUtilRt.java
+++ b/platform/util-rt/src/com/intellij/util/containers/ContainerUtilRt.java
@@ -48,7 +48,7 @@
@NotNull
@Contract(pure=true)
- public static <K, V> HashMap<K, V> newHashMap(@NotNull Map<K, V> map) {
+ public static <K, V> HashMap<K, V> newHashMap(@NotNull Map<? extends K, ? extends V> map) {
return new com.intellij.util.containers.HashMap<K, V>(map);
}
diff --git a/platform/util-rt/src/com/intellij/util/containers/HashMap.java b/platform/util-rt/src/com/intellij/util/containers/HashMap.java
index fa8608f..44091d4 100644
--- a/platform/util-rt/src/com/intellij/util/containers/HashMap.java
+++ b/platform/util-rt/src/com/intellij/util/containers/HashMap.java
@@ -29,7 +29,7 @@
super(initialCapacity);
}
- public <K1 extends K, V1 extends V> HashMap(Map<K1, V1> map) {
+ public <K1 extends K, V1 extends V> HashMap(Map<? extends K1, ? extends V1> map) {
super(map);
}
diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties
index c83186b..5d1ead8 100644
--- a/platform/util/resources/misc/registry.properties
+++ b/platform/util/resources/misc/registry.properties
@@ -216,7 +216,7 @@
vcs.show.colored.annotations=true
vcs.showConsole=true
-vcs.log.bek.sort=false
+vcs.log.bek.sort=true
vcs.log.bek.sort.disabled=false
vcs.log.linear.bek.sort=false
@@ -558,3 +558,4 @@
darcula.fix.native.flickering.description=Fixes white flash on first window appearance
search.everywhere.pattern.checking=true
search.everywhere.pattern.checking.description=Avoid searching classes and symbols if pattern contains only one dot
+rubymine.use.vagrant.credential.cache=true
diff --git a/platform/util/src/com/intellij/openapi/util/AtomicNotNullLazyValue.java b/platform/util/src/com/intellij/openapi/util/AtomicNotNullLazyValue.java
index e8e8583..194ae29 100644
--- a/platform/util/src/com/intellij/openapi/util/AtomicNotNullLazyValue.java
+++ b/platform/util/src/com/intellij/openapi/util/AtomicNotNullLazyValue.java
@@ -22,7 +22,7 @@
* @author peter
*/
public abstract class AtomicNotNullLazyValue<T> extends NotNullLazyValue<T> {
-
+ private static final RecursionGuard ourGuard = RecursionManager.createGuard("AtomicNotNullLazyValue");
private volatile T myValue;
@Override
@@ -32,10 +32,15 @@
if (value != null) {
return value;
}
+ //noinspection SynchronizeOnThis
synchronized (this) {
value = myValue;
if (value == null) {
- myValue = value = compute();
+ RecursionGuard.StackStamp stamp = ourGuard.markStack();
+ value = compute();
+ if (stamp.mayCacheNow()) {
+ myValue = value;
+ }
}
}
return value;
diff --git a/platform/util/src/com/intellij/openapi/util/AtomicNullableLazyValue.java b/platform/util/src/com/intellij/openapi/util/AtomicNullableLazyValue.java
index cc9c894..e17de25 100644
--- a/platform/util/src/com/intellij/openapi/util/AtomicNullableLazyValue.java
+++ b/platform/util/src/com/intellij/openapi/util/AtomicNullableLazyValue.java
@@ -20,6 +20,7 @@
* @author peter
*/
public abstract class AtomicNullableLazyValue<T> extends NullableLazyValue<T> {
+ private static final RecursionGuard ourGuard = RecursionManager.createGuard("AtomicNullableLazyValue");
private volatile T myValue;
private volatile boolean myComputed;
@@ -30,12 +31,17 @@
if (computed) {
return value;
}
+ //noinspection SynchronizeOnThis
synchronized (this) {
computed = myComputed;
value = myValue;
if (!computed) {
- myValue = value = compute();
- myComputed = true;
+ RecursionGuard.StackStamp stamp = ourGuard.markStack();
+ value = compute();
+ if (stamp.mayCacheNow()) {
+ myValue = value;
+ myComputed = true;
+ }
}
}
return value;
diff --git a/platform/util/src/com/intellij/openapi/util/ClearableLazyValue.java b/platform/util/src/com/intellij/openapi/util/ClearableLazyValue.java
index e58acb3..098a68b 100644
--- a/platform/util/src/com/intellij/openapi/util/ClearableLazyValue.java
+++ b/platform/util/src/com/intellij/openapi/util/ClearableLazyValue.java
@@ -22,6 +22,7 @@
* Thread-safe version: {@link AtomicClearableLazyValue}.
*/
public abstract class ClearableLazyValue<T> {
+ private static final RecursionGuard ourGuard = RecursionManager.createGuard("ClearableLazyValue");
private T myValue;
@NotNull
@@ -29,10 +30,15 @@
@NotNull
public T getValue() {
- if (myValue == null) {
- myValue = compute();
+ T result = myValue;
+ if (result == null) {
+ RecursionGuard.StackStamp stamp = ourGuard.markStack();
+ result = compute();
+ if (stamp.mayCacheNow()) {
+ myValue = result;
+ }
}
- return myValue;
+ return result;
}
public void drop() {
diff --git a/platform/util/src/com/intellij/openapi/util/JDOMExternalizerUtil.java b/platform/util/src/com/intellij/openapi/util/JDOMExternalizerUtil.java
index 9a9fc7b..99c1147 100644
--- a/platform/util/src/com/intellij/openapi/util/JDOMExternalizerUtil.java
+++ b/platform/util/src/com/intellij/openapi/util/JDOMExternalizerUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -21,6 +21,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -113,6 +114,7 @@
return values;
}
+ @SuppressWarnings("Duplicates")
public static void addChildrenWithValueAttribute(@NotNull Element parent,
@NotNull String childTagName,
@NotNull List<String> attrValues) {
@@ -124,4 +126,17 @@
}
}
}
+
+ @SuppressWarnings({"deprecation", "Duplicates"})
+ public static void addChildren(@NotNull Element parent,
+ @NotNull String childElementName,
+ @NotNull Collection<? extends JDOMExternalizable> children) throws WriteExternalException {
+ for (JDOMExternalizable child : children) {
+ if (child != null) {
+ Element element = new Element(childElementName);
+ child.writeExternal(element);
+ parent.addContent(element);
+ }
+ }
+ }
}
diff --git a/platform/util/src/com/intellij/openapi/util/NotNullLazyKey.java b/platform/util/src/com/intellij/openapi/util/NotNullLazyKey.java
index 3462a9e..36dae48 100644
--- a/platform/util/src/com/intellij/openapi/util/NotNullLazyKey.java
+++ b/platform/util/src/com/intellij/openapi/util/NotNullLazyKey.java
@@ -23,6 +23,7 @@
* @author peter
*/
public class NotNullLazyKey<T,H extends UserDataHolder> extends Key<T>{
+ private static final RecursionGuard ourGuard = RecursionManager.createGuard("NotNullLazyKey");
private final NotNullFunction<H,T> myFunction;
private NotNullLazyKey(@NotNull @NonNls String name, @NotNull NotNullFunction<H, T> function) {
@@ -34,7 +35,11 @@
public final T getValue(@NotNull H h) {
T data = h.getUserData(this);
if (data == null) {
- h.putUserData(this, data = myFunction.fun(h));
+ RecursionGuard.StackStamp stamp = ourGuard.markStack();
+ data = myFunction.fun(h);
+ if (stamp.mayCacheNow()) {
+ h.putUserData(this, data);
+ }
}
return data;
}
diff --git a/platform/util/src/com/intellij/openapi/util/NotNullLazyValue.java b/platform/util/src/com/intellij/openapi/util/NotNullLazyValue.java
index d604d5f..da07f83 100644
--- a/platform/util/src/com/intellij/openapi/util/NotNullLazyValue.java
+++ b/platform/util/src/com/intellij/openapi/util/NotNullLazyValue.java
@@ -25,6 +25,7 @@
* @author peter
*/
public abstract class NotNullLazyValue<T> {
+ private static final RecursionGuard ourGuard = RecursionManager.createGuard("NotNullLazyValue");
private T myValue;
@NotNull
@@ -32,10 +33,15 @@
@NotNull
public T getValue() {
- if (myValue == null) {
- myValue = compute();
+ T result = myValue;
+ if (result == null) {
+ RecursionGuard.StackStamp stamp = ourGuard.markStack();
+ result = compute();
+ if (stamp.mayCacheNow()) {
+ myValue = result;
+ }
}
- return myValue;
+ return result;
}
@NotNull
diff --git a/platform/util/src/com/intellij/openapi/util/NullableLazyKey.java b/platform/util/src/com/intellij/openapi/util/NullableLazyKey.java
index a4e4924..f187d3f 100644
--- a/platform/util/src/com/intellij/openapi/util/NullableLazyKey.java
+++ b/platform/util/src/com/intellij/openapi/util/NullableLazyKey.java
@@ -24,6 +24,7 @@
* @author peter
*/
public class NullableLazyKey<T,H extends UserDataHolder> extends Key<T>{
+ private static final RecursionGuard ourGuard = RecursionManager.createGuard("NullableLazyKey");
private final NullableFunction<H,T> myFunction;
private NullableLazyKey(@NonNls String name, final NullableFunction<H, T> function) {
@@ -35,8 +36,12 @@
public final T getValue(H h) {
T data = h.getUserData(this);
if (data == null) {
+ RecursionGuard.StackStamp stamp = ourGuard.markStack();
data = myFunction.fun(h);
- h.putUserData(this, data == null ? (T)ObjectUtils.NULL : data);
+ if (stamp.mayCacheNow()) {
+ //noinspection unchecked
+ h.putUserData(this, data == null ? (T)ObjectUtils.NULL : data);
+ }
}
return data == ObjectUtils.NULL ? null : data;
}
diff --git a/platform/util/src/com/intellij/openapi/util/NullableLazyValue.java b/platform/util/src/com/intellij/openapi/util/NullableLazyValue.java
index fd75c04..de25e1c 100644
--- a/platform/util/src/com/intellij/openapi/util/NullableLazyValue.java
+++ b/platform/util/src/com/intellij/openapi/util/NullableLazyValue.java
@@ -21,6 +21,7 @@
* @author peter
*/
public abstract class NullableLazyValue<T> {
+ private static final RecursionGuard ourGuard = RecursionManager.createGuard("NullableLazyValue");
private boolean myComputed;
@Nullable private T myValue;
@@ -29,10 +30,15 @@
@Nullable
public T getValue() {
+ T value = myValue;
if (!myComputed) {
- myValue = compute();
- myComputed = true;
+ RecursionGuard.StackStamp stamp = ourGuard.markStack();
+ value = compute();
+ if (stamp.mayCacheNow()) {
+ myValue = value;
+ myComputed = true;
+ }
}
- return myValue;
+ return value;
}
}
diff --git a/platform/util/src/com/intellij/openapi/util/VolatileNotNullLazyValue.java b/platform/util/src/com/intellij/openapi/util/VolatileNotNullLazyValue.java
index 70ec1c8..42facfe 100644
--- a/platform/util/src/com/intellij/openapi/util/VolatileNotNullLazyValue.java
+++ b/platform/util/src/com/intellij/openapi/util/VolatileNotNullLazyValue.java
@@ -22,17 +22,20 @@
* @author peter
*/
public abstract class VolatileNotNullLazyValue<T> extends NotNullLazyValue<T> {
-
+ private static final RecursionGuard ourGuard = RecursionManager.createGuard("VolatileNotNullLazyValue");
private volatile T myValue;
@Override
@NotNull
public final T getValue() {
T value = myValue;
- if (value != null) {
- return value;
+ if (value == null) {
+ RecursionGuard.StackStamp stamp = ourGuard.markStack();
+ value = compute();
+ if (stamp.mayCacheNow()) {
+ myValue = value;
+ }
}
- value = myValue = compute();
return value;
}
}
\ No newline at end of file
diff --git a/platform/util/src/com/intellij/openapi/util/VolatileNullableLazyValue.java b/platform/util/src/com/intellij/openapi/util/VolatileNullableLazyValue.java
index 3604d0b..907626e 100644
--- a/platform/util/src/com/intellij/openapi/util/VolatileNullableLazyValue.java
+++ b/platform/util/src/com/intellij/openapi/util/VolatileNullableLazyValue.java
@@ -21,6 +21,7 @@
* @author peter
*/
public abstract class VolatileNullableLazyValue<T> extends NullableLazyValue<T> {
+ private static final RecursionGuard ourGuard = RecursionManager.createGuard("VolatileNullableLazyValue");
private volatile boolean myComputed;
@Nullable private volatile T myValue;
@@ -28,13 +29,17 @@
@Nullable
protected abstract T compute();
- @Override
@Nullable
- public final T getValue() {
+ public T getValue() {
+ T value = myValue;
if (!myComputed) {
- myValue = compute();
- myComputed = true;
+ RecursionGuard.StackStamp stamp = ourGuard.markStack();
+ value = compute();
+ if (stamp.mayCacheNow()) {
+ myValue = value;
+ myComputed = true;
+ }
}
- return myValue;
+ return value;
}
}
diff --git a/platform/util/src/com/intellij/util/containers/ContainerUtil.java b/platform/util/src/com/intellij/util/containers/ContainerUtil.java
index 7a49d8e..46955dc 100644
--- a/platform/util/src/com/intellij/util/containers/ContainerUtil.java
+++ b/platform/util/src/com/intellij/util/containers/ContainerUtil.java
@@ -52,7 +52,7 @@
@NotNull
@Contract(pure=true)
- public static <K, V> HashMap<K, V> newHashMap(@NotNull Map<K, V> map) {
+ public static <K, V> HashMap<K, V> newHashMap(@NotNull Map<? extends K, ? extends V> map) {
return ContainerUtilRt.newHashMap(map);
}
diff --git a/platform/util/src/com/intellij/util/containers/FactoryMap.java b/platform/util/src/com/intellij/util/containers/FactoryMap.java
index 3eea4d3..07378c3 100644
--- a/platform/util/src/com/intellij/util/containers/FactoryMap.java
+++ b/platform/util/src/com/intellij/util/containers/FactoryMap.java
@@ -15,6 +15,8 @@
*/
package com.intellij.util.containers;
+import com.intellij.openapi.util.RecursionGuard;
+import com.intellij.openapi.util.RecursionManager;
import com.intellij.util.ObjectUtils;
import gnu.trove.THashMap;
import org.jetbrains.annotations.NotNull;
@@ -28,7 +30,8 @@
* @author peter
*/
public abstract class FactoryMap<K,V> implements Map<K, V> {
- protected Map<K,V> myMap;
+ private static final RecursionGuard ourGuard = RecursionManager.createGuard("factoryMap");
+ protected Map<K, V> myMap;
protected Map<K, V> createMap() {
return new THashMap<K, V>();
@@ -49,8 +52,11 @@
final Map<K, V> map = getMap();
V value = map.get(getKey(key));
if (value == null) {
+ RecursionGuard.StackStamp stamp = ourGuard.markStack();
value = create((K)key);
- map.put((K)getKey(key), value == null ? (V)NULL : value);
+ if (stamp.mayCacheNow()) {
+ map.put((K)getKey(key), value == null ? (V)NULL : value);
+ }
}
return value == NULL ? null : value;
}
@@ -82,8 +88,10 @@
public Set<K> keySet() {
if (myMap == null) return Collections.emptySet();
final Set<K> ts = myMap.keySet();
+ //noinspection SuspiciousMethodCalls
if (ts.contains(NULL)) {
final HashSet<K> hashSet = new HashSet<K>(ts);
+ //noinspection SuspiciousMethodCalls
hashSet.remove(NULL);
hashSet.add(null);
return hashSet;
@@ -105,6 +113,7 @@
public boolean removeValue(Object value) {
if (myMap == null) return false;
Object t = ObjectUtils.notNull(value, NULL);
+ //noinspection SuspiciousMethodCalls
return myMap.values().remove(t);
}
diff --git a/platform/util/src/com/intellij/util/xmlb/SkipDefaultValuesSerializationFilters.java b/platform/util/src/com/intellij/util/xmlb/SkipDefaultValuesSerializationFilters.java
index 559ad12..b4c24c6 100644
--- a/platform/util/src/com/intellij/util/xmlb/SkipDefaultValuesSerializationFilters.java
+++ b/platform/util/src/com/intellij/util/xmlb/SkipDefaultValuesSerializationFilters.java
@@ -28,6 +28,14 @@
public class SkipDefaultValuesSerializationFilters extends SerializationFilterBase {
private final Map<Class<?>, Object> myDefaultBeans = new THashMap<Class<?>, Object>();
+ public SkipDefaultValuesSerializationFilters() { }
+
+ public SkipDefaultValuesSerializationFilters(Object... defaultBeans) {
+ for (Object defaultBean : defaultBeans) {
+ myDefaultBeans.put(defaultBean.getClass(), defaultBean);
+ }
+ }
+
@Override
protected boolean accepts(@NotNull Accessor accessor, @NotNull Object bean, @Nullable Object beanValue) {
Object defValue = accessor.read(getDefaultBean(bean));
@@ -43,12 +51,13 @@
Object getDefaultBean(@NotNull Object bean) {
Class<?> c = bean.getClass();
Object o = myDefaultBeans.get(c);
+
if (o == null) {
o = ReflectionUtil.newInstance(c);
configure(o);
-
myDefaultBeans.put(c, o);
}
+
return o;
}
diff --git a/platform/util/src/com/intellij/util/xmlb/SkipEmptySerializationFilter.java b/platform/util/src/com/intellij/util/xmlb/SkipEmptySerializationFilter.java
index aec1ab6..a45c351 100644
--- a/platform/util/src/com/intellij/util/xmlb/SkipEmptySerializationFilter.java
+++ b/platform/util/src/com/intellij/util/xmlb/SkipEmptySerializationFilter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -35,9 +35,9 @@
}
if (Boolean.FALSE.equals(beanValue) ||
- (beanValue instanceof String && ((String)beanValue).isEmpty()) ||
+ beanValue instanceof String && ((String)beanValue).isEmpty() ||
beanValue instanceof Collection && ((Collection)beanValue).isEmpty() ||
- (beanValue instanceof Map && ((Map)beanValue).isEmpty())) {
+ beanValue instanceof Map && ((Map)beanValue).isEmpty()) {
return false;
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/CacheChangeProcessor.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/CacheChangeProcessor.java
index 10a70ea..3e117f6 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/CacheChangeProcessor.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/CacheChangeProcessor.java
@@ -108,7 +108,7 @@
@Nullable
@Contract("null -> !null")
protected DiffRequest loadRequestFast(@Nullable Change change) {
- if (change == null) return new NoDiffRequest();
+ if (change == null) return NoDiffRequest.INSTANCE;
Pair<Change, DiffRequest> pair = myRequestCache.get(change);
if (pair != null) {
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/checkin/CodeAnalysisBeforeCheckinHandler.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/checkin/CodeAnalysisBeforeCheckinHandler.java
index 00f5970..d3630fb 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/checkin/CodeAnalysisBeforeCheckinHandler.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/checkin/CodeAnalysisBeforeCheckinHandler.java
@@ -19,6 +19,7 @@
import com.intellij.CommonBundle;
import com.intellij.codeInsight.CodeSmellInfo;
import com.intellij.lang.annotation.HighlightSeverity;
+import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.DumbService;
@@ -32,11 +33,13 @@
import com.intellij.openapi.vcs.ui.RefreshableOnComponent;
import com.intellij.ui.NonFocusableCheckBox;
import com.intellij.util.PairConsumer;
+import com.intellij.util.PlatformUtils;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
+import java.text.MessageFormat;
import java.util.List;
/**
@@ -126,10 +129,9 @@
public ReturnResult beforeCheckin(CommitExecutor executor, PairConsumer<Object, Object> additionalDataConsumer) {
if (getSettings().CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT) {
if (DumbService.getInstance(myProject).isDumb()) {
- if (Messages.showOkCancelDialog(myProject,
- "Code analysis can't be performed while IntelliJ IDEA updates the indices in background.\n" +
- "You can commit the changes without running inspections, or you can wait until indices are built.",
- "Code analysis is not possible right now",
+ if (Messages.showOkCancelDialog(myProject, VcsBundle.message("code.smells.error.indexing.message",
+ ApplicationNamesInfo.getInstance().getProductName()),
+ VcsBundle.message("code.smells.error.indexing"),
"&Wait", "&Commit", null) == Messages.OK) {
return ReturnResult.CANCEL;
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java
index 2636c0a..cc9d049 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java
@@ -1078,6 +1078,7 @@
private class MyAnnotateAction extends AnnotateRevisionActionBase implements DumbAware {
public MyAnnotateAction() {
super(VcsBundle.message("annotate.action.name"), VcsBundle.message("annotate.action.description"), AllIcons.Actions.Annotate);
+ setShortcutSet(ActionManager.getInstance().getAction("Annotate").getShortcutSet());
}
@Nullable
diff --git a/platform/vcs-log/graph-api/src/com/intellij/vcs/log/graph/PermanentGraph.java b/platform/vcs-log/graph-api/src/com/intellij/vcs/log/graph/PermanentGraph.java
index 5a8b164..9b1088e 100644
--- a/platform/vcs-log/graph-api/src/com/intellij/vcs/log/graph/PermanentGraph.java
+++ b/platform/vcs-log/graph-api/src/com/intellij/vcs/log/graph/PermanentGraph.java
@@ -45,9 +45,9 @@
Set<CommitId> getContainingBranches(@NotNull CommitId commit);
enum SortType {
- Normal("Off", "Sort commits topologically and by date."),
- Bek("Standard", "In case of merge show incoming commits first (directly below merge commit)."),
- LinearBek("Linear", "In case of merge show incoming commits on top of main branch commits as if they were rebased.");
+ Normal("Off", "Sort commits topologically and by date"),
+ Bek("Standard", "In case of merge show incoming commits first (directly below merge commit)"),
+ LinearBek("Linear", "In case of merge show incoming commits on top of main branch commits as if they were rebased");
@NotNull private final String myPresentation;
@NotNull private final String myDescription;
diff --git a/platform/vcs-log/impl/gen/icons/VcsLogIcons.java b/platform/vcs-log/impl/gen/icons/VcsLogIcons.java
index c73d580..cd100c9 100644
--- a/platform/vcs-log/impl/gen/icons/VcsLogIcons.java
+++ b/platform/vcs-log/impl/gen/icons/VcsLogIcons.java
@@ -1,18 +1,3 @@
-/*
- * Copyright 2000-2015 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 icons;
import com.intellij.openapi.util.IconLoader;
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFiltererImpl.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFiltererImpl.java
index b33c7b3..3953a96 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFiltererImpl.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFiltererImpl.java
@@ -17,6 +17,7 @@
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.Task;
@@ -98,7 +99,7 @@
private class MyTask extends Task.Backgroundable {
public MyTask(@Nullable Project project, @NotNull String title) {
- super(project, title);
+ super(project, title, false);
}
@Override
@@ -109,6 +110,9 @@
try {
visiblePack = getVisiblePack(visiblePack, requests);
}
+ catch (ProcessCanceledException ignored) {
+ return;
+ }
catch (Throwable t) {
LOG.error("Error while filtering log", t);
}
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/IntelliSortChooserPopupAction.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/IntelliSortChooserPopupAction.java
index adbf604..2e034c6 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/IntelliSortChooserPopupAction.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/IntelliSortChooserPopupAction.java
@@ -79,7 +79,7 @@
private final VcsLogUi myUI;
public SelectIntelliSortTypeAction(VcsLogUi logUi, PermanentGraph.SortType sortType) {
- super(sortType.getName(), sortType.getDescription(), null);
+ super(sortType.getName(), sortType.getDescription() + ".", null);
myUI = logUi;
mySortType = sortType;
}
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/IntelliSortChooserToggleAction.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/IntelliSortChooserToggleAction.java
index f9fefc8..b03e5ea 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/IntelliSortChooserToggleAction.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/IntelliSortChooserToggleAction.java
@@ -18,6 +18,7 @@
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ToggleAction;
import com.intellij.openapi.project.DumbAware;
+import com.intellij.util.IconUtil;
import com.intellij.vcs.log.VcsLogDataKeys;
import com.intellij.vcs.log.VcsLogUi;
import com.intellij.vcs.log.graph.PermanentGraph;
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsStructureChooser.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsStructureChooser.java
index 09efdeb..14de1339 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsStructureChooser.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsStructureChooser.java
@@ -43,6 +43,7 @@
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.Convertor;
import com.intellij.util.treeWithCheckedNodes.SelectionManager;
+import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -69,6 +70,7 @@
public static final Border BORDER = IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.LEFT);
public static final String CAN_NOT_ADD_TEXT =
"<html>Selected: <font color=red>(You have added " + MAX_FOLDERS + " elements. No more is allowed.)</font></html>";
+ private static final String VCS_STRUCTURE_CHOOSER_KEY = "git4idea.history.wholeTree.VcsStructureChooser";
@NotNull private final Project myProject;
@NotNull private final List<VirtualFile> myInitialRoots;
@@ -135,7 +137,7 @@
@Override
protected String getDimensionServiceKey() {
- return "git4idea.history.wholeTree.VcsStructureChooser";
+ return VCS_STRUCTURE_CHOOSER_KEY;
}
@Override
@@ -164,7 +166,6 @@
};
descriptor.setRoots(list);
myTree = new Tree();
- myTree.setMinimumSize(new Dimension(200, 200));
myTree.setBorder(BORDER);
myTree.setShowsRootHandles(true);
myTree.setRootVisible(true);
@@ -273,6 +274,7 @@
recalculateErrorText();
}
});
+ panel.setPreferredSize(JBUI.size(400, 300));
return panel;
}
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java
index b73285b..38ca2a2 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java
@@ -15,7 +15,12 @@
*/
package com.intellij.vcs.log.ui.frame;
+import com.intellij.openapi.Disposable;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.editor.colors.EditorColorsAdapter;
+import com.intellij.openapi.editor.colors.EditorColorsManager;
+import com.intellij.openapi.editor.colors.EditorColorsScheme;
+import com.intellij.openapi.editor.colors.EditorFontType;
import com.intellij.openapi.progress.util.ProgressWindow;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
@@ -60,7 +65,10 @@
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.parser.ParserDelegator;
import java.awt.*;
-import java.io.*;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -100,7 +108,7 @@
myDataPack = initialDataPack;
myRefsPanel = new RefsPanel(myColorManager);
- myCommitDetailsPanel = new DataPanel(logDataHolder.getProject(), logDataHolder.isMultiRoot());
+ myCommitDetailsPanel = new DataPanel(logDataHolder.getProject(), logDataHolder.isMultiRoot(), logDataHolder);
myScrollPane = new JBScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
myMainContentPanel = new JPanel(new MigLayout("flowy, ins 0, hidemode 3, gapy 0")) {
@@ -239,7 +247,7 @@
@Nullable private List<String> myBranches;
private boolean myExpanded = false;
- DataPanel(@NotNull Project project, boolean multiRoot) {
+ DataPanel(@NotNull Project project, boolean multiRoot, @NotNull Disposable disposable) {
super(UIUtil.HTML_MIME, "");
myProject = project;
myMultiRoot = multiRoot;
@@ -247,6 +255,13 @@
setOpaque(false);
putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
+ EditorColorsManager.getInstance().addEditorColorsListener(new EditorColorsAdapter() {
+ @Override
+ public void globalSchemeChange(EditorColorsScheme scheme) {
+ update();
+ }
+ }, disposable);
+
DefaultCaret caret = (DefaultCaret)getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
@@ -293,7 +308,7 @@
}
else {
setText("<html><head>" +
- UIUtil.getCssFontDeclaration(UIUtil.getLabelFont()) +
+ UIUtil.getCssFontDeclaration(EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN)) +
"</head><body>" +
myMainText +
"<br/>" +
@@ -312,14 +327,15 @@
}
if (myBranches.isEmpty()) return "<i>Not in any branch</i>";
if (myExpanded) {
- int rowCount = (int) Math.ceil((double)myBranches.size() / BRANCHES_TABLE_COLUMN_COUNT);
+ int rowCount = (int)Math.ceil((double)myBranches.size() / BRANCHES_TABLE_COLUMN_COUNT);
HtmlTableBuilder builder = new HtmlTableBuilder();
for (int i = 0; i < rowCount; i++) {
builder.startRow();
if (i == 0) {
builder.append("<i>In " + myBranches.size() + " branches, </i><a href=\"" + SHOW_OR_HIDE_BRANCHES + "\"><i>hide</i></a>: ");
- } else {
+ }
+ else {
builder.append("");
}
@@ -327,9 +343,11 @@
int index = rowCount * j + i;
if (index >= myBranches.size()) {
builder.append("");
- } else if (index != myBranches.size() - 1) {
+ }
+ else if (index != myBranches.size() - 1) {
builder.append(myBranches.get(index) + "," + StringUtil.repeat(" ", 20), LEFT_ALIGN);
- } else {
+ }
+ else {
builder.append(myBranches.get(index), LEFT_ALIGN);
}
}
@@ -389,23 +407,31 @@
}
private static String getAuthorText(VcsFullCommitDetails commit) {
- String authorText = commit.getAuthor().getName() + " at " + DateFormatUtil.formatDateTime(commit.getAuthorTime());
+ long authorTime = commit.getAuthorTime();
+ long commitTime = commit.getCommitTime();
+
+ String authorText = commit.getAuthor().getName() + formatDateTime(authorTime);
if (!commit.getAuthor().equals(commit.getCommitter())) {
- String commitTime;
- if (commit.getAuthorTime() != commit.getCommitTime()) {
- commitTime = " at " + DateFormatUtil.formatDateTime(commit.getCommitTime());
+ String commitTimeText;
+ if (authorTime != commitTime) {
+ commitTimeText = formatDateTime(commitTime);
}
else {
- commitTime = "";
+ commitTimeText = "";
}
- authorText += " (committed by " + commit.getCommitter().getName() + commitTime + ")";
+ authorText += " (committed by " + commit.getCommitter().getName() + commitTimeText + ")";
}
- else if (commit.getAuthorTime() != commit.getCommitTime()) {
- authorText += " (committed at " + DateFormatUtil.formatDateTime(commit.getCommitTime()) + ")";
+ else if (authorTime != commitTime) {
+ authorText += " (committed " + formatDateTime(commitTime) + ")";
}
return authorText;
}
+ @NotNull
+ private static String formatDateTime(long time) {
+ return " on " + DateFormatUtil.formatDate(time) + " at " + DateFormatUtil.formatTime(time);
+ }
+
@Override
public String getSelectedText() {
Document doc = getDocument();
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerSessionTabBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerSessionTabBase.java
index 0898125..da75913 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerSessionTabBase.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerSessionTabBase.java
@@ -96,14 +96,16 @@
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
- ToolWindow toolWindow = ExecutionManager.getInstance(myProject).getContentManager()
- .getToolWindowByDescriptor(myRunContentDescriptor);
- if (toolWindow != null) {
- if (!toolWindow.isVisible()) {
- toolWindow.show(onShowCallback);
+ if (myRunContentDescriptor != null) {
+ ToolWindow toolWindow = ExecutionManager.getInstance(myProject).getContentManager()
+ .getToolWindowByDescriptor(myRunContentDescriptor);
+ if (toolWindow != null) {
+ if (!toolWindow.isVisible()) {
+ toolWindow.show(onShowCallback);
+ }
+ //noinspection ConstantConditions
+ toolWindow.getContentManager().setSelectedContent(myRunContentDescriptor.getAttachedContent());
}
- //noinspection ConstantConditions
- toolWindow.getContentManager().setSelectedContent(myRunContentDescriptor.getAttachedContent());
}
}
});
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspectionBase.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspectionBase.java
index 0bc8716..015e049 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspectionBase.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspectionBase.java
@@ -160,14 +160,27 @@
return false;
}
- if (!initialization.hasModifierProperty(PsiModifier.FINAL) && variable.hasModifierProperty(PsiModifier.FINAL) ||
- PsiUtil.isLanguageLevel8OrHigher(initialization) && !HighlightControlFlowUtil.isEffectivelyFinal(initialization, containingScope, null) && HighlightControlFlowUtil.isEffectivelyFinal(variable, containingScope, null)) {
- for (PsiReference ref : ReferencesSearch.search(variable, new LocalSearchScope(containingScope))) {
- final PsiElement element = PsiTreeUtil.getParentOfType(ref.getElement(), PsiClass.class, PsiLambdaExpression.class);
+ final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(containingScope.getProject()).getResolveHelper();
+ final String initializationName = initialization.getName();
+
+ final boolean finalVariableIntroduction =
+ !initialization.hasModifierProperty(PsiModifier.FINAL) && variable.hasModifierProperty(PsiModifier.FINAL) ||
+ PsiUtil.isLanguageLevel8OrHigher(initialization) &&
+ !HighlightControlFlowUtil.isEffectivelyFinal(initialization, containingScope, null) &&
+ HighlightControlFlowUtil.isEffectivelyFinal(variable, containingScope, null);
+
+ for (PsiReference ref : ReferencesSearch.search(variable, new LocalSearchScope(containingScope))) {
+ final PsiElement refElement = ref.getElement();
+ if (finalVariableIntroduction) {
+ final PsiElement element = PsiTreeUtil.getParentOfType(refElement, PsiClass.class, PsiLambdaExpression.class);
if (element != null && PsiTreeUtil.isAncestor(containingScope, element, true)) {
return false;
}
}
+
+ if (resolveHelper.resolveReferencedVariable(initializationName, refElement) != initialization) {
+ return false;
+ }
}
return !TypeConversionUtil.boxingConversionApplicable(variable.getType(), initialization.getType());
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/TypeUtils.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/TypeUtils.java
index 1a16063..cf5a31d 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/TypeUtils.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/TypeUtils.java
@@ -189,7 +189,7 @@
final PsiType[] parameters1 = classType1.getParameters();
final PsiType[] parameters2 = classType2.getParameters();
if (parameters1.length != parameters2.length) {
- return false;
+ return ((PsiClassType)type1).isRaw() || ((PsiClassType)type2).isRaw();
}
for (int i = 0; i < parameters1.length; i++) {
if (!areConvertible(parameters1[i], parameters2[i])) {
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/SystemRunFinalizersOnExit.html b/plugins/InspectionGadgets/src/inspectionDescriptions/SystemRunFinalizersOnExit.html
index 973829c..6bf49471 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/SystemRunFinalizersOnExit.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/SystemRunFinalizersOnExit.html
@@ -2,7 +2,7 @@
<body>
Reports any calls to <b>System.runFinalizersOnExit()</b>.
This call is one of the most dangerous in the Java language. It is inherently non-thread-safe,
-may result in data corruption, deadlock, and may effect parts of the program far removed from its call point.
+may result in data corruption, deadlock, and may affect parts of the program far removed from its call point.
It is deprecated, and its use strongly discouraged.
<!-- tooltip end -->
<p>
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/dataflow/unnecessary_local_vars/C.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/dataflow/unnecessary_local_vars/C.java
index c316742..b188ba7 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/dataflow/unnecessary_local_vars/C.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/dataflow/unnecessary_local_vars/C.java
@@ -125,5 +125,18 @@
}
}
}
- }
+ }
+
+ void nameShadow(final String name) {
+ final String child = name;
+ class A {
+ void foo(String s){}
+ }
+
+ A a = new A() {
+ void foo(String name) {
+ System.out.println(child);
+ }
+ };
+ }
}
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/EqualsBetweenInconvertibleTypesInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/EqualsBetweenInconvertibleTypesInspectionTest.java
index bcd68ef..d3b2f81 100644
--- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/EqualsBetweenInconvertibleTypesInspectionTest.java
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/EqualsBetweenInconvertibleTypesInspectionTest.java
@@ -62,6 +62,17 @@
" }" +
"}");
}
+
+ public void testRaw() {
+ doTest(
+ "import java.util.Collection;" +
+ "class XXX {" +
+ " interface A {}" +
+ " boolean m(Collection c1, Collection<A> c2) {" +
+ " return c2.equals(c1);" +
+ " }" +
+ "}");
+ }
@Override
protected String[] getEnvironmentClasses() {
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/conditional/ReplaceConditionalWithIfIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/conditional/ReplaceConditionalWithIfIntention.java
index ba88524..4aac975 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/conditional/ReplaceConditionalWithIfIntention.java
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/conditional/ReplaceConditionalWithIfIntention.java
@@ -48,6 +48,15 @@
}
private static void replaceConditionalWithIf(PsiConditionalExpression expression) throws IncorrectOperationException {
+ final PsiElement expressionParent = expression.getParent();
+ if (expressionParent instanceof PsiLambdaExpression) {
+ final PsiElement codeBlock =
+ ((PsiLambdaExpression)RefactoringUtil.expandExpressionLambdaToCodeBlock(expression)).getBody();
+ LOG.assertTrue(codeBlock instanceof PsiCodeBlock, codeBlock);
+ final PsiStatement statement = ((PsiCodeBlock)codeBlock).getStatements()[0];
+ expression = (PsiConditionalExpression)(statement instanceof PsiReturnStatement ? ((PsiReturnStatement)statement).getReturnValue()
+ : ((PsiExpressionStatement)statement).getExpression());
+ }
final PsiStatement statement = PsiTreeUtil.getParentOfType(expression, PsiStatement.class);
if (statement == null) {
return;
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/types/ExpandOneLineLambda2CodeBlockIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/types/ExpandOneLineLambda2CodeBlockIntention.java
index 0a3a0be..62feddf 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/types/ExpandOneLineLambda2CodeBlockIntention.java
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/types/ExpandOneLineLambda2CodeBlockIntention.java
@@ -17,8 +17,8 @@
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.refactoring.util.RefactoringUtil;
import com.intellij.util.IncorrectOperationException;
import com.siyeh.ipp.base.Intention;
import com.siyeh.ipp.base.PsiElementPredicate;
@@ -40,21 +40,9 @@
@Override
protected void processIntention(@NotNull PsiElement element) throws IncorrectOperationException {
- final PsiLambdaExpression lambdaExpression = PsiTreeUtil.getParentOfType(element, PsiLambdaExpression.class);
- LOG.assertTrue(lambdaExpression != null);
- final PsiElement body = lambdaExpression.getBody();
- LOG.assertTrue(body instanceof PsiExpression);
- String blockText = "{";
- blockText += PsiType.VOID.equals(LambdaUtil.getFunctionalInterfaceReturnType(lambdaExpression)) ? "" : "return ";
- blockText += body.getText() + ";}";
-
- final String resultedLambdaText = lambdaExpression.getParameterList().getText() + "->" + blockText;
- final PsiExpression expressionFromText =
- JavaPsiFacade.getElementFactory(element.getProject()).createExpressionFromText(resultedLambdaText, lambdaExpression);
- CodeStyleManager.getInstance(element.getProject()).reformat(lambdaExpression.replace(expressionFromText));
+ RefactoringUtil.expandExpressionLambdaToCodeBlock(element);
}
-
private static class LambdaExpressionPredicate implements PsiElementPredicate {
@Override
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/conditional/withIf/InsideExprLambda.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/conditional/withIf/InsideExprLambda.java
new file mode 100644
index 0000000..56984a6
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/conditional/withIf/InsideExprLambda.java
@@ -0,0 +1,5 @@
+class Test {
+ {
+ Runnable r = () -> true <caret>? "a" : "b";
+ }
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/conditional/withIf/InsideExprLambdaWithParams.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/conditional/withIf/InsideExprLambdaWithParams.java
new file mode 100644
index 0000000..148d2fc
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/conditional/withIf/InsideExprLambdaWithParams.java
@@ -0,0 +1,8 @@
+class Test {
+ {
+ I r = (i) -> i > 0 <caret>? "a" : "b";
+ }
+ interface I {
+ String f(int i);
+ }
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/conditional/withIf/InsideExprLambdaWithParams_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/conditional/withIf/InsideExprLambdaWithParams_after.java
new file mode 100644
index 0000000..08e8135
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/conditional/withIf/InsideExprLambdaWithParams_after.java
@@ -0,0 +1,11 @@
+class Test {
+ {
+ I r = (i) -> {
+ if (i > 0) return "a";
+ else return "b";
+ };
+ }
+ interface I {
+ String f(int i);
+ }
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/conditional/withIf/InsideExprLambda_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/conditional/withIf/InsideExprLambda_after.java
new file mode 100644
index 0000000..0b2bb2d
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/conditional/withIf/InsideExprLambda_after.java
@@ -0,0 +1,8 @@
+class Test {
+ {
+ Runnable r = () -> {
+ if (true) "a";
+ else "b";
+ };
+ }
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/conditional/ReplaceConditionalWithIfTest.java b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/conditional/ReplaceConditionalWithIfTest.java
index 8ba24fd..a1b66d2 100644
--- a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/conditional/ReplaceConditionalWithIfTest.java
+++ b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/conditional/ReplaceConditionalWithIfTest.java
@@ -29,6 +29,8 @@
public void testConditionalInIf() { doTest(); }
public void testConditionalInBinaryExpression() { doTest(); }
public void testArrayInitializer() { doTest(); }
+ public void testInsideExprLambda() { doTest(); }
+ public void testInsideExprLambdaWithParams() { doTest(); }
@Override
protected String getIntentionName() {
diff --git a/plugins/ant/src/com/intellij/lang/ant/dom/AntDomDirSet.java b/plugins/ant/src/com/intellij/lang/ant/dom/AntDomDirSet.java
index b9ff094..5c6ff02 100644
--- a/plugins/ant/src/com/intellij/lang/ant/dom/AntDomDirSet.java
+++ b/plugins/ant/src/com/intellij/lang/ant/dom/AntDomDirSet.java
@@ -62,7 +62,7 @@
}
if (singleFile != null && singleFile.isDirectory()) {
- Collections.singletonList(singleFile);
+ return Collections.singletonList(singleFile);
}
return Collections.emptyList();
diff --git a/plugins/coverage-common/src/com/intellij/coverage/SrcFileAnnotator.java b/plugins/coverage-common/src/com/intellij/coverage/SrcFileAnnotator.java
index 3be1079f..57519be 100644
--- a/plugins/coverage-common/src/com/intellij/coverage/SrcFileAnnotator.java
+++ b/plugins/coverage-common/src/com/intellij/coverage/SrcFileAnnotator.java
@@ -138,24 +138,21 @@
}
}
- private static
@NotNull
- String[] getCoveredLines(@NotNull byte[] oldContent, VirtualFile vFile) {
+ private static String[] getCoveredLines(@NotNull byte[] oldContent, VirtualFile vFile) {
final String text = LoadTextUtil.getTextByBinaryPresentation(oldContent, vFile, false, false).toString();
return LineTokenizer.tokenize(text, false);
}
- private
- @NotNull
- String[] getUpToDateLines() {
+ @NotNull private static String[] getUpToDateLines(final Document document) {
final Ref<String[]> linesRef = new Ref<String[]>();
final Runnable runnable = new Runnable() {
public void run() {
- final int lineCount = myDocument.getLineCount();
+ final int lineCount = document.getLineCount();
final String[] lines = new String[lineCount];
- final CharSequence chars = myDocument.getCharsSequence();
+ final CharSequence chars = document.getCharsSequence();
for (int i = 0; i < lineCount; i++) {
- lines[i] = chars.subSequence(myDocument.getLineStartOffset(i), myDocument.getLineEndOffset(i)).toString();
+ lines[i] = chars.subSequence(document.getLineStartOffset(i), document.getLineEndOffset(i)).toString();
}
linesRef.set(lines);
}
@@ -230,7 +227,9 @@
if (oldContent == null) return null;
String[] coveredLines = getCoveredLines(oldContent, f);
- String[] currentLines = getUpToDateLines();
+ final Document document = myDocument;
+ if (document == null) return null;
+ String[] currentLines = getUpToDateLines(document);
String[] oldLines = oldToNew ? coveredLines : currentLines;
String[] newLines = oldToNew ? currentLines : coveredLines;
@@ -285,8 +284,9 @@
// Store the values of myFile and myEditor in local variables to avoid an NPE after dispose() has been called in the EDT.
final PsiFile psiFile = myFile;
final Editor editor = myEditor;
- if (editor == null || psiFile == null) return;
- final MarkupModel markupModel = DocumentMarkupModel.forDocument(myDocument, myProject, true);
+ final Document document = myDocument;
+ if (editor == null || psiFile == null || document == null) return;
+ final MarkupModel markupModel = DocumentMarkupModel.forDocument(document, myProject, true);
final List<RangeHighlighter> highlighters = new ArrayList<RangeHighlighter>();
final ProjectData data = suite.getCoverageData();
if (data == null) {
@@ -386,7 +386,7 @@
// use id mapping
lineNumberInCurrent = line;
}
- LOG.assertTrue(lineNumberInCurrent < myDocument.getLineCount());
+ LOG.assertTrue(lineNumberInCurrent < document.getLineCount());
executableLines.put(line, (LineData)lineData);
classLines.put(line, postProcessedLines);
@@ -394,7 +394,7 @@
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
- if (myDocument == null || lineNumberInCurrent >= myDocument.getLineCount()) return;
+ if (lineNumberInCurrent >= document.getLineCount()) return;
final RangeHighlighter highlighter =
createRangeHighlighter(suite.getLastCoverageTimeStamp(), markupModel, coverageByTestApplicable, executableLines,
qualifiedName, line, lineNumberInCurrent, suite, postProcessedLines);
@@ -443,10 +443,10 @@
List<RangeHighlighter> rangeHighlighters = editor.getUserData(COVERAGE_HIGHLIGHTERS);
if (rangeHighlighters == null) rangeHighlighters = new ArrayList<RangeHighlighter>();
int offset = e.getOffset();
- final int lineNumber = myDocument.getLineNumber(offset);
- final int lastLineNumber = myDocument.getLineNumber(offset + e.getNewLength());
+ final int lineNumber = document.getLineNumber(offset);
+ final int lastLineNumber = document.getLineNumber(offset + e.getNewLength());
final TextRange changeRange =
- new TextRange(myDocument.getLineStartOffset(lineNumber), myDocument.getLineEndOffset(lastLineNumber));
+ new TextRange(document.getLineStartOffset(lineNumber), document.getLineEndOffset(lastLineNumber));
for (Iterator<RangeHighlighter> it = rangeHighlighters.iterator(); it.hasNext(); ) {
final RangeHighlighter highlighter = it.next();
if (!highlighter.isValid() || TextRange.create(highlighter).intersects(changeRange)) {
@@ -464,7 +464,7 @@
if (newToOldLineMapping != null) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
- if (myEditor == null) return;
+ if (editor.isDisposed()) return;
for (int line = lineNumber; line <= lastLineNumber; line++) {
final int oldLineNumber = newToOldLineMapping.get(line);
final LineData lineData = executableLines.get(oldLineNumber);
@@ -485,7 +485,7 @@
}
}
};
- myDocument.addDocumentListener(documentListener);
+ document.addDocumentListener(documentListener);
editor.putUserData(COVERAGE_DOCUMENT_LISTENER, documentListener);
}
diff --git a/plugins/coverage/src/com/intellij/coverage/JavaCoverageEngine.java b/plugins/coverage/src/com/intellij/coverage/JavaCoverageEngine.java
index 3366fa1..e7ae2b2 100644
--- a/plugins/coverage/src/com/intellij/coverage/JavaCoverageEngine.java
+++ b/plugins/coverage/src/com/intellij/coverage/JavaCoverageEngine.java
@@ -26,6 +26,7 @@
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.Task;
+import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.CompilerModuleExtension;
@@ -593,8 +594,9 @@
builder.setReportDir(new File(settings.OUTPUT_DIRECTORY));
final SourceCodeProvider sourceCodeProvider = new SourceCodeProvider() {
public String getSourceCode(@NotNull final String classname) throws IOException {
- return ApplicationManager.getApplication().runReadAction(new Computable<String>() {
+ return DumbService.getInstance(project).runReadActionInSmartMode(new Computable<String>() {
public String compute() {
+ if (project.isDisposed()) return "";
final PsiClass psiClass = ClassUtil.findPsiClassByJVMName(PsiManager.getInstance(project), classname);
return psiClass != null ? psiClass.getNavigationElement().getContainingFile().getText() : "";
}
@@ -611,8 +613,9 @@
final GlobalSearchScope productionScope = GlobalSearchScopes.projectProductionScope(project);
for (Iterator<ClassInfo> iterator = classes.iterator(); iterator.hasNext();) {
final ClassInfo aClass = iterator.next();
- final PsiClass psiClass = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass>() {
+ final PsiClass psiClass = DumbService.getInstance(project).runReadActionInSmartMode(new Computable<PsiClass>() {
public PsiClass compute() {
+ if (project.isDisposed()) return null;
return psiFacade.findClass(aClass.getFQName(), productionScope);
}
});
diff --git a/plugins/coverage/src/com/intellij/coverage/PackageAnnotator.java b/plugins/coverage/src/com/intellij/coverage/PackageAnnotator.java
index e707330..8a55a8c 100644
--- a/plugins/coverage/src/com/intellij/coverage/PackageAnnotator.java
+++ b/plugins/coverage/src/com/intellij/coverage/PackageAnnotator.java
@@ -20,6 +20,7 @@
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.ModuleUtil;
+import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.util.Computable;
@@ -309,8 +310,9 @@
final String toplevelClassSrcFQName = getSourceToplevelFQName(classFqVMName);
final Ref<VirtualFile> containingFileRef = new Ref<VirtualFile>();
final Ref<PsiClass> psiClassRef = new Ref<PsiClass>();
- final Boolean isInSource = myCoverageManager.doInReadActionIfProjectOpen(new Computable<Boolean>() {
+ final Boolean isInSource = DumbService.getInstance(myProject).runReadActionInSmartMode(new Computable<Boolean>() {
public Boolean compute() {
+ if (myProject.isDisposed()) return null;
final PsiClass aClass =
JavaPsiFacade.getInstance(myManager.getProject()).findClass(toplevelClassSrcFQName, GlobalSearchScope.moduleScope(module));
if (aClass == null || !aClass.isValid()) return Boolean.FALSE;
diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EPathUtil.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EPathUtil.java
index 1cd54ba..4b827b5 100644
--- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EPathUtil.java
+++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EPathUtil.java
@@ -58,7 +58,7 @@
}
else {
final String relativeToModulePath = EPathCommonUtil.getRelativeToModulePath(path);
- final int relativeIdx = ideaUrl.indexOf(relativeToModulePath);
+ final int relativeIdx = relativeToModulePath != null ? ideaUrl.indexOf(relativeToModulePath) : -1;
if (relativeIdx != -1) {
final String pathToProjectFile = VfsUtilCore.urlToPath(ideaUrl.substring(0, relativeIdx));
if (Comparing.strEqual(EPathCommonUtil.getRelativeModuleName(path),
diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathWriter.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathWriter.java
index d76a7c9..4b65a21 100644
--- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathWriter.java
+++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathWriter.java
@@ -252,7 +252,7 @@
if (path != null) {
orderEntry.setAttribute(EclipseXml.PATH_ATTR, path);
}
- if (index == -1) {
+ if (index == -1 || index >= classpathRoot.getContentSize()) {
classpathRoot.addContent(orderEntry);
}
else {
diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/IdeaSpecificSettings.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/IdeaSpecificSettings.java
index bf2389a..ec5139b 100644
--- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/IdeaSpecificSettings.java
+++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/IdeaSpecificSettings.java
@@ -42,6 +42,7 @@
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.eclipse.AbstractEclipseClasspathReader;
import org.jetbrains.idea.eclipse.IdeaXml;
import org.jetbrains.idea.eclipse.config.EclipseModuleManagerImpl;
@@ -328,8 +329,25 @@
if (!(entry instanceof LibraryOrderEntry)) continue;
Element element = new Element("lib");
- element.setAttribute("name", entry.getPresentableName());
LibraryOrderEntry libraryEntry = (LibraryOrderEntry)entry;
+
+ String libraryName = ((LibraryOrderEntry)entry).getLibraryName();
+ if (libraryName == null) {
+ final String[] urls = libraryEntry.getRootUrls(OrderRootType.CLASSES);
+ if (urls.length > 0) {
+ VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(urls[0]);
+ final VirtualFile fileForJar = JarFileSystem.getInstance().getVirtualFileForJar(file);
+ if (fileForJar != null) {
+ file = fileForJar;
+ }
+ libraryName = file != null ? file.getName() : null;
+ }
+ if (libraryName == null) {
+ libraryName = libraryEntry.getPresentableName();
+ }
+ }
+
+ element.setAttribute("name", libraryName);
DependencyScope scope = libraryEntry.getScope();
element.setAttribute("scope", scope.name());
if (libraryEntry.isModuleLevel()) {
diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/export/ExportEclipseProjectsAction.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/export/ExportEclipseProjectsAction.java
index 4324bcf..d0369ed 100644
--- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/export/ExportEclipseProjectsAction.java
+++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/export/ExportEclipseProjectsAction.java
@@ -34,6 +34,7 @@
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Function;
import com.intellij.util.SmartList;
+import com.intellij.util.containers.hash.LinkedHashMap;
import org.jdom.Element;
import org.jdom.output.EclipseJDOMUtil;
import org.jetbrains.annotations.NotNull;
@@ -118,10 +119,22 @@
}
}
else {
+ LinkedHashMap<Module, String> module2StorageRoot = new LinkedHashMap<Module, String>();
for (Module module : dialog.getSelectedModules()) {
- ModuleRootModel model = ModuleRootManager.getInstance(module);
- VirtualFile[] contentRoots = model.getContentRoots();
+ VirtualFile[] contentRoots = ModuleRootManager.getInstance(module).getContentRoots();
String storageRoot = contentRoots.length == 1 ? contentRoots[0].getPath() : ClasspathStorage.getStorageRootFromOptions(module);
+ module2StorageRoot.put(module, storageRoot);
+ try {
+ DotProjectFileHelper.saveDotProjectFile(module, storageRoot);
+ }
+ catch (Exception e1) {
+ LOG.error(e1);
+ }
+ }
+
+ for (Module module : module2StorageRoot.keySet()) {
+ ModuleRootModel model = ModuleRootManager.getInstance(module);
+ String storageRoot = module2StorageRoot.get(module);
try {
Element classpathElement = new EclipseClasspathWriter().writeClasspath(null, model);
File classpathFile = new File(storageRoot, EclipseXml.CLASSPATH_FILE);
@@ -139,7 +152,6 @@
EclipseJDOMUtil.output(ideaSpecific, emlFile, project);
}
- DotProjectFileHelper.saveDotProjectFile(module, storageRoot);
}
catch (Exception e1) {
LOG.error(e1);
diff --git a/plugins/generate-tostring/src/org/jetbrains/java/generate/view/TemplatesPanel.java b/plugins/generate-tostring/src/org/jetbrains/java/generate/view/TemplatesPanel.java
index 0387a48..d2e564a 100644
--- a/plugins/generate-tostring/src/org/jetbrains/java/generate/view/TemplatesPanel.java
+++ b/plugins/generate-tostring/src/org/jetbrains/java/generate/view/TemplatesPanel.java
@@ -109,7 +109,7 @@
@Nullable
@NonNls
public String getHelpTopic() {
- return null;
+ return "Templates Dialog";
}
@Override
diff --git a/plugins/git4idea/src/git4idea/config/GitVersionSpecialty.java b/plugins/git4idea/src/git4idea/config/GitVersionSpecialty.java
index ddf8f1e..54325fd 100644
--- a/plugins/git4idea/src/git4idea/config/GitVersionSpecialty.java
+++ b/plugins/git4idea/src/git4idea/config/GitVersionSpecialty.java
@@ -133,6 +133,13 @@
public boolean existsIn(@NotNull GitVersion version) {
return version.isOlderOrEqual(new GitVersion(1, 7, 2, 0));
}
+ },
+
+ FULL_HISTORY_SIMPLIFY_MERGES_WORKS_CORRECTLY { // for some reason, even with "simplify-merges", it used to show a lot of merges in history
+ @Override
+ public boolean existsIn(@NotNull GitVersion version) {
+ return version.isLaterOrEqual(new GitVersion(1, 9, 0, 0));
+ }
};
public abstract boolean existsIn(@NotNull GitVersion version);
diff --git a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java
index 4c2766d..517bb19 100644
--- a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java
+++ b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java
@@ -43,6 +43,7 @@
import git4idea.*;
import git4idea.branch.GitBranchUtil;
import git4idea.commands.*;
+import git4idea.config.GitVersion;
import git4idea.config.GitVersionSpecialty;
import git4idea.history.browser.GitHeavyCommit;
import git4idea.history.browser.SHAHash;
@@ -285,9 +286,11 @@
}
};
+ GitVcs vcs = GitVcs.getInstance(project);
+ GitVersion version = vcs != null ? vcs.getVersion() : GitVersion.NULL;
final AtomicBoolean criticalFailure = new AtomicBoolean();
while (currentPath.get() != null && firstCommitParent.get() != null) {
- logHandler.set(getLogHandler(project, finalRoot, logParser, currentPath.get(), firstCommitParent.get(), parameters));
+ logHandler.set(getLogHandler(project, version, finalRoot, logParser, currentPath.get(), firstCommitParent.get(), parameters));
final MyTokenAccumulator accumulator = new MyTokenAccumulator(logParser);
final Semaphore semaphore = new Semaphore();
@@ -339,7 +342,7 @@
try {
Pair<String, FilePath> firstCommitParentAndPath = getFirstCommitParentAndPathIfRename(project, finalRoot, firstCommit.get(),
- currentPath.get());
+ currentPath.get(), version);
currentPath.set(firstCommitParentAndPath == null ? null : firstCommitParentAndPath.second);
firstCommitParent.set(firstCommitParentAndPath == null ? null : firstCommitParentAndPath.first);
skipFurtherOutput.set(false);
@@ -353,10 +356,19 @@
}
- private static GitLineHandler getLogHandler(Project project, VirtualFile root, GitLogParser parser, FilePath path, String lastCommit, String... parameters) {
+ private static GitLineHandler getLogHandler(Project project,
+ @NotNull GitVersion version,
+ VirtualFile root,
+ GitLogParser parser,
+ FilePath path,
+ String lastCommit,
+ String... parameters) {
final GitLineHandler h = new GitLineHandler(project, root, GitCommand.LOG);
h.setStdoutSuppressed(true);
- h.addParameters("--name-status", parser.getPretty(), "--encoding=UTF-8", "--full-history", "--simplify-merges", lastCommit);
+ h.addParameters("--name-status", parser.getPretty(), "--encoding=UTF-8", lastCommit);
+ if (GitVersionSpecialty.FULL_HISTORY_SIMPLIFY_MERGES_WORKS_CORRECTLY.existsIn(version)) {
+ h.addParameters("--full-history", "--simplify-merges");
+ }
if (parameters != null && parameters.length > 0) {
h.addParameters(parameters);
}
@@ -374,15 +386,15 @@
private static Pair<String, FilePath> getFirstCommitParentAndPathIfRename(Project project,
VirtualFile root,
String commit,
- FilePath filePath) throws VcsException {
+ FilePath filePath,
+ @NotNull GitVersion version) throws VcsException {
// 'git show -M --name-status <commit hash>' returns the information about commit and detects renames.
// NB: we can't specify the filepath, because then rename detection will work only with the '--follow' option, which we don't wanna use.
final GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.SHOW);
final GitLogParser parser = new GitLogParser(project, GitLogParser.NameStatus.STATUS, HASH, COMMIT_TIME, PARENTS);
h.setStdoutSuppressed(true);
h.addParameters("-M", "--name-status", parser.getPretty(), "--encoding=UTF-8", commit);
- GitVcs vcs = GitVcs.getInstance(project);
- if (vcs != null && !GitVersionSpecialty.FOLLOW_IS_BUGGY_IN_THE_LOG.existsIn(vcs.getVersion())) {
+ if (!GitVersionSpecialty.FOLLOW_IS_BUGGY_IN_THE_LOG.existsIn(version)) {
h.addParameters("--follow");
h.endOptions();
h.addRelativePaths(filePath);
diff --git a/plugins/git4idea/src/git4idea/push/GitPushTargetPanel.java b/plugins/git4idea/src/git4idea/push/GitPushTargetPanel.java
index b33ed23..88547c6 100644
--- a/plugins/git4idea/src/git4idea/push/GitPushTargetPanel.java
+++ b/plugins/git4idea/src/git4idea/push/GitPushTargetPanel.java
@@ -255,8 +255,7 @@
if (!remotes.isEmpty()) {
renderer.append(SEPARATOR, targetTextAttributes);
if (forceRenderedText != null) {
- //if sync typing available we need to emulate editor changes
- myTargetEditor.setText(forceRenderedText);
+ // update only appearance; do not update model in rendering!!!!
renderer.append(forceRenderedText);
return;
}
@@ -358,9 +357,19 @@
myTargetEditor.addDocumentListener(new DocumentAdapter() {
@Override
public void documentChanged(DocumentEvent e) {
- super.documentChanged(e);
- listener.onTargetInEditModeChanged(myTargetEditor.getText());
+ //fire only about user's changes
+ if (myTargetEditor.isShowing()) {
+ listener.onTargetInEditModeChanged(myTargetEditor.getText());
+ }
}
});
}
+
+ @Override
+ public void forceUpdateEditableUiModel(@NotNull String forcedText) {
+ //if targetEditor is now editing by user, it shouldn't be force updated
+ if (!myTargetEditor.isShowing()) {
+ myTargetEditor.setText(forcedText);
+ }
+ }
}
diff --git a/plugins/gradle/gradle.iml b/plugins/gradle/gradle.iml
index eb7b491..52c1b3a 100644
--- a/plugins/gradle/gradle.iml
+++ b/plugins/gradle/gradle.iml
@@ -27,6 +27,7 @@
<orderEntry type="module" module-name="maven" />
<orderEntry type="module" module-name="junit" />
<orderEntry type="library" name="swingx" level="project" />
+ <orderEntry type="library" exported="" name="Slf4j" level="project" />
<orderEntry type="module-library" exported="">
<library name="Gradle">
<CLASSES>
@@ -59,17 +60,6 @@
</library>
</orderEntry>
<orderEntry type="module-library" exported="">
- <library name="Slf4j">
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/slf4j-api-1.7.7.jar!/" />
- <root url="jar://$MODULE_DIR$/lib/logback-classic-1.0.13.jar!/" />
- <root url="jar://$MODULE_DIR$/lib/logback-core-1.0.13.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library" exported="">
<library name="GradleGuava">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/guava-jdk5-17.0.jar!/" />
@@ -118,4 +108,4 @@
<orderEntry type="library" name="Ant" level="project" />
<orderEntry type="library" name="gson" level="project" />
</component>
-</module>
+</module>
\ No newline at end of file
diff --git a/plugins/gradle/lib/logback-classic-1.0.13.jar b/plugins/gradle/lib/logback-classic-1.0.13.jar
deleted file mode 100644
index 80bf5d1..0000000
--- a/plugins/gradle/lib/logback-classic-1.0.13.jar
+++ /dev/null
Binary files differ
diff --git a/plugins/gradle/lib/logback-core-1.0.13.jar b/plugins/gradle/lib/logback-core-1.0.13.jar
deleted file mode 100644
index 568ccfa..0000000
--- a/plugins/gradle/lib/logback-core-1.0.13.jar
+++ /dev/null
Binary files differ
diff --git a/plugins/gradle/lib/slf4j-api-1.7.7.jar b/plugins/gradle/lib/slf4j-api-1.7.7.jar
deleted file mode 100644
index bebabd9..0000000
--- a/plugins/gradle/lib/slf4j-api-1.7.7.jar
+++ /dev/null
Binary files differ
diff --git a/plugins/gradle/resources/logback.groovy b/plugins/gradle/resources/logback.groovy
deleted file mode 100644
index 84f92d5..0000000
--- a/plugins/gradle/resources/logback.groovy
+++ /dev/null
@@ -1,25 +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.
- */
-
-/**
- * @author Vladislav.Soroka
- * @since 9/15/2014
- */
-import org.jetbrains.plugins.gradle.util.GradleLog
-import static ch.qos.logback.classic.Level.DEBUG
-
-appender("GradleToolingLog", GradleLog.GradleLogbackAppender)
-logger("org.gradle", DEBUG, ["GradleToolingLog"])
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/GradleManager.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/GradleManager.java
index 30c8e07..84840da 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/GradleManager.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/GradleManager.java
@@ -17,27 +17,20 @@
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.SimpleJavaParameters;
-import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.externalSystem.ExternalSystemAutoImportAware;
import com.intellij.openapi.externalSystem.ExternalSystemConfigurableAware;
import com.intellij.openapi.externalSystem.ExternalSystemManager;
import com.intellij.openapi.externalSystem.ExternalSystemUiAware;
-import com.intellij.openapi.externalSystem.model.DataNode;
import com.intellij.openapi.externalSystem.model.ProjectSystemId;
import com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings;
import com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo;
import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo;
import com.intellij.openapi.externalSystem.model.project.ExternalProjectPojo;
-import com.intellij.openapi.externalSystem.model.project.ProjectData;
-import com.intellij.openapi.externalSystem.service.execution.ProgressExecutionMode;
-import com.intellij.openapi.externalSystem.service.project.ExternalProjectRefreshCallback;
import com.intellij.openapi.externalSystem.service.project.ExternalSystemProjectResolver;
import com.intellij.openapi.externalSystem.service.project.autoimport.CachingExternalSystemAutoImportAware;
-import com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager;
import com.intellij.openapi.externalSystem.service.ui.DefaultExternalSystemUiAware;
import com.intellij.openapi.externalSystem.task.ExternalSystemTaskManager;
-import com.intellij.openapi.externalSystem.util.DisposeAwareProjectChange;
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
import com.intellij.openapi.externalSystem.util.ExternalSystemConstants;
import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
@@ -45,7 +38,6 @@
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
import com.intellij.openapi.startup.StartupActivity;
import com.intellij.openapi.util.AtomicNotNullLazyValue;
import com.intellij.openapi.util.NotNullLazyValue;
@@ -291,38 +283,6 @@
ensureProjectsRefresh();
}
- @Override
- public void onProjectsLinked(@NotNull Collection<GradleProjectSettings> settings) {
- final ProjectDataManager projectDataManager = ServiceManager.getService(ProjectDataManager.class);
- for (GradleProjectSettings gradleProjectSettings : settings) {
- ExternalSystemUtil.refreshProject(
- project, GradleConstants.SYSTEM_ID, gradleProjectSettings.getExternalProjectPath(),
- new ExternalProjectRefreshCallback() {
- @Override
- public void onSuccess(@Nullable final DataNode<ProjectData> externalProject) {
- if (externalProject == null) {
- return;
- }
- ExternalSystemApiUtil.executeProjectChangeAction(true, new DisposeAwareProjectChange(project) {
- @Override
- public void execute() {
- ProjectRootManagerEx.getInstanceEx(project).mergeRootsChangesDuring(new Runnable() {
- @Override
- public void run() {
- projectDataManager.importData(externalProject.getKey(), Collections.singleton(externalProject), project, true);
- }
- });
- }
- });
- }
-
- @Override
- public void onFailure(@NotNull String errorMessage, @Nullable String errorDetails) {
- }
- }, false, ProgressExecutionMode.MODAL_SYNC);
- }
- }
-
private void ensureProjectsRefresh() {
ExternalSystemUtil.refreshProjects(project, GradleConstants.SYSTEM_ID, true);
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleExecuteTaskAction.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleExecuteTaskAction.java
index e0a61b4..666241b 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleExecuteTaskAction.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleExecuteTaskAction.java
@@ -17,11 +17,10 @@
import com.intellij.execution.RunManagerEx;
import com.intellij.execution.RunnerAndConfigurationSettings;
-import com.intellij.execution.actions.ConfigurationContext;
import com.intellij.execution.executors.DefaultRunExecutor;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.externalSystem.action.ExternalSystemAction;
import com.intellij.openapi.externalSystem.action.ExternalSystemActionUtil;
import com.intellij.openapi.externalSystem.model.ExternalSystemDataKeys;
import com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings;
@@ -35,7 +34,6 @@
import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
import com.intellij.openapi.externalSystem.view.ExternalSystemNode;
import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Function;
@@ -56,7 +54,14 @@
* @author Vladislav.Soroka
* @since 11/25/2014
*/
-public class GradleExecuteTaskAction extends DumbAwareAction {
+public class GradleExecuteTaskAction extends ExternalSystemAction {
+
+ @Override
+ protected boolean isVisible(AnActionEvent e) {
+ if (!super.isVisible(e)) return false;
+ return GradleConstants.SYSTEM_ID.equals(getSystemId(e));
+ }
+
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/action/ToggleOfflineAction.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/action/ToggleOfflineAction.java
index 63203a2..1733ca3a 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/action/ToggleOfflineAction.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/action/ToggleOfflineAction.java
@@ -18,6 +18,7 @@
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.externalSystem.action.ExternalSystemToggleAction;
import org.jetbrains.plugins.gradle.settings.GradleSettings;
+import org.jetbrains.plugins.gradle.util.GradleConstants;
/**
* @author Vladislav.Soroka
@@ -26,6 +27,12 @@
public class ToggleOfflineAction extends ExternalSystemToggleAction {
@Override
+ protected boolean isVisible(AnActionEvent e) {
+ if (!super.isVisible(e)) return false;
+ return GradleConstants.SYSTEM_ID.equals(getSystemId(e));
+ }
+
+ @Override
protected boolean doIsSelected(AnActionEvent e) {
return GradleSettings.getInstance(getProject(e)).isOfflineWork();
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/compiler/GradleBuildProcessParametersProvider.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/compiler/GradleBuildProcessParametersProvider.java
index c8ac2eb..b93e8f4 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/compiler/GradleBuildProcessParametersProvider.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/compiler/GradleBuildProcessParametersProvider.java
@@ -30,6 +30,8 @@
import org.gradle.tooling.ProjectConnection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.gradle.util.GradleConstants;
+import org.slf4j.Logger;
+import org.slf4j.impl.Log4jLoggerFactory;
import java.io.File;
import java.util.List;
@@ -80,7 +82,7 @@
File[] children = FileUtil.notNullize(gradleLibDir.listFiles());
for (File child : children) {
final String fileName = child.getName();
- if (fileName.endsWith(".jar") && !fileName.startsWith("logback-") && child.isFile()) {
+ if (fileName.endsWith(".jar") && child.isFile()) {
classpath.add(child.getAbsolutePath());
}
}
@@ -90,5 +92,7 @@
classpath.add(PathUtil.getJarPathForClass(Ant.class));
classpath.add(PathUtil.getJarPathForClass(GroovyObject.class));
classpath.add(PathUtil.getJarPathForClass(Gson.class));
+ classpath.add(PathUtil.getJarPathForClass(Logger.class));
+ classpath.add(PathUtil.getJarPathForClass(Log4jLoggerFactory.class));
}
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradlePositionManager.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradlePositionManager.java
index 48c5f3c..29bfbb9 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradlePositionManager.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradlePositionManager.java
@@ -25,7 +25,6 @@
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
@@ -144,7 +143,7 @@
assert libDir != null;
for (final VirtualFile child : libDir.getChildren()) {
if ("jar".equals(child.getExtension())) {
- urls.add(VfsUtil.convertToURL(child.getUrl()));
+ urls.add(VfsUtilCore.convertToURL(child.getUrl()));
}
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/GradleUrlProvider.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/GradleUrlProvider.java
index 1d073f9..3bf502b 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/GradleUrlProvider.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/GradleUrlProvider.java
@@ -17,13 +17,13 @@
import com.intellij.execution.Location;
import com.intellij.execution.PsiLocation;
+import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.testIntegration.TestLocationProvider;
-import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -43,6 +43,7 @@
@NotNull
public List<Location> getLocation(@NotNull String protocolId, @NotNull String locationData, Project project) {
if (!PROTOCOL_ID.equals(protocolId)) return Collections.emptyList();
+ if (DumbService.isDumb(project)) return Collections.emptyList();
final String className = extractFullClassName(locationData);
if (className == null) return Collections.emptyList();
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/UnsupportedCancellationToken.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/UnsupportedCancellationToken.java
new file mode 100644
index 0000000..06588f9
--- /dev/null
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/UnsupportedCancellationToken.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2015 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.gradle.service.execution;
+
+import com.intellij.openapi.externalSystem.service.execution.NotSupportedException;
+import org.gradle.tooling.CancellationToken;
+import org.gradle.tooling.CancellationTokenSource;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 3/25/2015
+ */
+public class UnsupportedCancellationToken implements CancellationTokenSource {
+ @Override
+ public void cancel() {
+ throw new NotSupportedException("Configured version of Gradle does not support cancellation. \nPlease, use Gradle 2.1 or newer.");
+ }
+
+ @Override
+ public CancellationToken token() {
+ return null;
+ }
+}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java
index 7de88fe..73c3f4b 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java
@@ -67,6 +67,9 @@
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
import java.net.URL;
import java.util.*;
import java.util.regex.Matcher;
@@ -370,8 +373,11 @@
@NotNull
@Override
public Set<Class> getExtraProjectModelClasses() {
- return ContainerUtil.<Class>set(
- GradleBuild.class, ExternalProject.class, ModuleExtendedModel.class, BuildScriptClasspathModel.class);
+ Set<Class> result = ContainerUtil.<Class>set(GradleBuild.class, ExternalProject.class, ModuleExtendedModel.class);
+ if (!resolverCtx.isPreviewMode()) {
+ result.add(BuildScriptClasspathModel.class);
+ }
+ return result;
}
@NotNull
@@ -442,7 +448,9 @@
final String[] lines = {
"gradle.taskGraph.beforeTask { Task task ->",
" if (task instanceof JavaForkOptions) {",
- " task.jvmArgs '" + debuggerSetup.trim() + '\'',
+ " def jvmArgs = task.jvmArgs.findAll{!it?.startsWith('-agentlib') && !it?.startsWith('-Xrunjdwp')}",
+ " jvmArgs << '" + debuggerSetup.trim() + '\'',
+ " task.jvmArgs jvmArgs",
" }" +
"}",
};
@@ -568,19 +576,60 @@
ExternalSystemSourceType dirSourceType = type;
try {
if (dir.isGenerated() && !dirSourceType.isGenerated()) {
- final ExternalSystemSourceType generatedType =
- ExternalSystemSourceType.from(dirSourceType.isTest(), dir.isGenerated(), dirSourceType.isResource(), dirSourceType.isExcluded());
+ final ExternalSystemSourceType generatedType = ExternalSystemSourceType.from(
+ dirSourceType.isTest(), dir.isGenerated(), dirSourceType.isResource(), dirSourceType.isExcluded()
+ );
dirSourceType = generatedType != null ? generatedType : dirSourceType;
}
}
catch (UnsupportedMethodException e) {
// org.gradle.tooling.model.idea.IdeaSourceDirectory.isGenerated method supported only since Gradle 2.2
LOG.warn(e.getMessage());
+ printToolingProxyDiagnosticInfo(dir);
+ }
+ catch (Throwable e) {
+ LOG.debug(e);
+ printToolingProxyDiagnosticInfo(dir);
}
contentRoot.storePath(dirSourceType, dir.getDirectory().getAbsolutePath());
}
}
+ private static void printToolingProxyDiagnosticInfo(@Nullable Object obj) {
+ if (!LOG.isDebugEnabled() || obj == null) return;
+
+ LOG.debug(String.format("obj: %s", obj));
+ final Class<?> aClass = obj.getClass();
+ LOG.debug(String.format("obj class: %s", aClass));
+ LOG.debug(String.format("classloader: %s", aClass.getClassLoader()));
+ for (Method m : aClass.getDeclaredMethods()) {
+ LOG.debug(String.format("obj m: %s", m));
+ }
+
+ if (obj instanceof Proxy) {
+ try {
+ final Field hField = ReflectionUtil.findField(obj.getClass(), null, "h");
+ hField.setAccessible(true);
+ final Object h = hField.get(obj);
+ final Field delegateField = ReflectionUtil.findField(h.getClass(), null, "delegate");
+ delegateField.setAccessible(true);
+ final Object delegate = delegateField.get(h);
+ LOG.debug(String.format("delegate: %s", delegate));
+ LOG.debug(String.format("delegate class: %s", delegate.getClass()));
+ LOG.debug(String.format("delegate classloader: %s", delegate.getClass().getClassLoader()));
+ for (Method m : delegate.getClass().getDeclaredMethods()) {
+ LOG.debug(String.format("delegate m: %s", m));
+ }
+ }
+ catch (NoSuchFieldException e) {
+ LOG.debug(e);
+ }
+ catch (IllegalAccessException e) {
+ LOG.debug(e);
+ }
+ }
+ }
+
@Nullable
private static DependencyScope parseScope(@Nullable IdeaDependencyScope scope) {
if (scope == null) {
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleExecutionHelper.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleExecutionHelper.java
index 19337a3..9693ae6 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleExecutionHelper.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleExecutionHelper.java
@@ -35,6 +35,7 @@
import org.gradle.tooling.internal.consumer.DefaultGradleConnector;
import org.gradle.tooling.internal.consumer.Distribution;
import org.gradle.tooling.model.build.BuildEnvironment;
+import org.gradle.util.GradleVersion;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.gradle.settings.DistributionType;
@@ -443,9 +444,31 @@
}
@Nullable
- private static BuildEnvironment getBuildEnvironment(@NotNull ProjectConnection connection) {
+ public static GradleVersion getGradleVersion(@NotNull ProjectConnection connection) {
+ final BuildEnvironment buildEnvironment = getBuildEnvironment(connection);
+
+ GradleVersion gradleVersion = null;
+ if (buildEnvironment != null) {
+ gradleVersion = GradleVersion.version(buildEnvironment.getGradle().getGradleVersion());
+ }
+ return gradleVersion;
+ }
+
+ @Nullable
+ public static BuildEnvironment getBuildEnvironment(@NotNull ProjectConnection connection) {
try {
- return connection.getModel(BuildEnvironment.class);
+ final BuildEnvironment buildEnvironment = connection.getModel(BuildEnvironment.class);
+ if (LOG.isDebugEnabled()) {
+ try {
+ LOG.debug("Gradle version: " + buildEnvironment.getGradle().getGradleVersion());
+ LOG.debug("Gradle java home: " + buildEnvironment.getJava().getJavaHome());
+ LOG.debug("Gradle jvm arguments: " + buildEnvironment.getJava().getJvmArguments());
+ }
+ catch (Throwable t) {
+ LOG.debug(t);
+ }
+ }
+ return buildEnvironment;
}
catch (Exception e) {
LOG.warn("can not get BuildEnvironment model", e);
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java
index 4f966f7..83de04c 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java
@@ -44,10 +44,12 @@
import org.gradle.tooling.model.idea.BasicIdeaProject;
import org.gradle.tooling.model.idea.IdeaModule;
import org.gradle.tooling.model.idea.IdeaProject;
+import org.gradle.util.GradleVersion;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.gradle.model.ProjectImportAction;
import org.jetbrains.plugins.gradle.remote.impl.GradleLibraryNamesMixer;
+import org.jetbrains.plugins.gradle.service.execution.UnsupportedCancellationToken;
import org.jetbrains.plugins.gradle.settings.ClassHolder;
import org.jetbrains.plugins.gradle.settings.GradleExecutionSettings;
import org.jetbrains.plugins.gradle.util.GradleConstants;
@@ -150,6 +152,11 @@
parametersList.addProperty(jvmArg.getKey(), jvmArg.getValue());
}
+ final BuildEnvironment buildEnvironment = GradleExecutionHelper.getBuildEnvironment(resolverCtx.getConnection());
+ GradleVersion gradleVersion = null;
+ if (buildEnvironment != null) {
+ gradleVersion = GradleVersion.version(buildEnvironment.getGradle().getGradleVersion());
+ }
BuildActionExecuter<ProjectImportAction.AllModels> buildActionExecutor = resolverCtx.getConnection().action(projectImportAction);
@@ -169,6 +176,9 @@
buildActionExecutor.withCancellationToken(cancellationTokenSource.token());
synchronized (myCancellationMap) {
myCancellationMap.putValue(resolverCtx.getExternalSystemTaskId(), cancellationTokenSource);
+ if (gradleVersion != null && gradleVersion.compareTo(GradleVersion.version("2.1")) < 0) {
+ myCancellationMap.putValue(resolverCtx.getExternalSystemTaskId(), new UnsupportedCancellationToken());
+ }
}
allModels = buildActionExecutor.run();
if (allModels == null) {
@@ -196,7 +206,6 @@
}
}
- final BuildEnvironment buildEnvironment = getBuildEnvironment(resolverCtx);
allModels.setBuildEnvironment(buildEnvironment);
resolverCtx.setModels(allModels);
@@ -280,16 +289,6 @@
return projectDataNode;
}
- @Nullable
- private static BuildEnvironment getBuildEnvironment(@NotNull ProjectResolverContext resolverCtx) {
- try {
- return resolverCtx.getConnection().getModel(BuildEnvironment.class);
- }
- catch (Exception e) {
- return null;
- }
- }
-
private void handleBuildSrcProject(@NotNull final DataNode<ProjectData> resultProjectDataNode,
@NotNull final ProjectConnectionDataNodeFunction projectConnectionDataNodeFunction) {
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java
index 3df7537..2120f77 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java
@@ -32,11 +32,13 @@
import org.gradle.tooling.CancellationTokenSource;
import org.gradle.tooling.GradleConnector;
import org.gradle.tooling.ProjectConnection;
+import org.gradle.util.GradleVersion;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper;
import org.jetbrains.plugins.gradle.service.project.GradleProjectResolver;
import org.jetbrains.plugins.gradle.service.project.GradleProjectResolverExtension;
+import org.jetbrains.plugins.gradle.service.execution.UnsupportedCancellationToken;
import org.jetbrains.plugins.gradle.settings.GradleExecutionSettings;
import org.jetbrains.plugins.gradle.util.GradleConstants;
@@ -118,11 +120,17 @@
}
}
+ GradleVersion gradleVersion = GradleExecutionHelper.getGradleVersion(connection);
BuildLauncher launcher = myHelper.getBuildLauncher(id, connection, settings, listener, vmOptions, scriptParameters);
launcher.forTasks(ArrayUtil.toStringArray(taskNames));
- final CancellationTokenSource cancellationTokenSource = GradleConnector.newCancellationTokenSource();
- launcher.withCancellationToken(cancellationTokenSource.token());
- myCancellationMap.put(id, cancellationTokenSource);
+
+ if (gradleVersion != null && gradleVersion.compareTo(GradleVersion.version("2.1")) < 0) {
+ myCancellationMap.put(id, new UnsupportedCancellationToken());
+ } else {
+ final CancellationTokenSource cancellationTokenSource = GradleConnector.newCancellationTokenSource();
+ launcher.withCancellationToken(cancellationTokenSource.token());
+ myCancellationMap.put(id, cancellationTokenSource);
+ }
try {
launcher.run();
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleLog.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleLog.java
index 290be23..e2020c3 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleLog.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleLog.java
@@ -1,23 +1,6 @@
package org.jetbrains.plugins.gradle.util;
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.classic.spi.ThrowableProxy;
-import ch.qos.logback.core.AppenderBase;
-import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.externalSystem.model.task.ExternalSystemTask;
-import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskState;
-import com.intellij.openapi.externalSystem.service.internal.ExternalSystemProcessingManager;
-import com.intellij.openapi.externalSystem.service.notification.ExternalSystemNotificationManager;
-import com.intellij.openapi.externalSystem.service.notification.NotificationCategory;
-import com.intellij.openapi.externalSystem.service.notification.NotificationData;
-import com.intellij.openapi.externalSystem.service.notification.NotificationSource;
-import com.intellij.openapi.project.Project;
-import org.gradle.tooling.internal.consumer.connection.NonCancellableConsumerConnectionAdapter;
-import org.jetbrains.plugins.gradle.service.notification.OpenGradleSettingsCallback;
-
-import java.util.List;
/**
* @author Denis Zhdanov
@@ -27,65 +10,6 @@
public static final Logger LOG = Logger.getInstance(GradleLog.class);
- private static final String GRADLE_PROVIDER_DOES_NOT_SUPPORT_CANCELLATION_MESSAGE =
- "Note: Version of Gradle provider does not support cancellation. Upgrade your Gradle build.";
-
private GradleLog() {
}
-
- public static class GradleLogbackAppender extends AppenderBase<ILoggingEvent> {
-
- @Override
- protected void append(ILoggingEvent event) {
- ThrowableProxy throwableProxy =
- event.getThrowableProxy() instanceof ThrowableProxy ? (ThrowableProxy)event.getThrowableProxy() : null;
- Throwable throwable = throwableProxy == null ? null : throwableProxy.getThrowable();
-
- switch (event.getLevel().toInt()) {
- case Level.ALL_INT:
- case Level.TRACE_INT:
- case Level.DEBUG_INT:
- LOG.debug(event.getFormattedMessage(), throwable);
- break;
- case Level.INFO_INT:
- LOG.info(event.getFormattedMessage(), throwable);
- break;
- case Level.WARN_INT:
- LOG.warn(event.getFormattedMessage(), throwable);
- break;
- case Level.ERROR_INT:
- LOG.error(event.getFormattedMessage(), throwable);
- break;
- case Level.OFF_INT:
- break;
- default:
- LOG.debug(event.getFormattedMessage(), throwable);
- break;
- }
-
- if (NonCancellableConsumerConnectionAdapter.class.getName().equals(event.getLoggerName()) &&
- GRADLE_PROVIDER_DOES_NOT_SUPPORT_CANCELLATION_MESSAGE.equals(event.getMessage())) {
- // see org.gradle.tooling.internal.consumer.connection.NonCancellableConsumerConnectionAdapter#handleCancellationPreOperation
-
- ExternalSystemProcessingManager processingManager = ServiceManager.getService(ExternalSystemProcessingManager.class);
- final List<ExternalSystemTask> canceledTasks =
- processingManager
- .findTasksOfState(GradleConstants.SYSTEM_ID, ExternalSystemTaskState.CANCELING, ExternalSystemTaskState.CANCELED);
- for (ExternalSystemTask canceledTask : canceledTasks) {
- final Project project = canceledTask.getId().findProject();
- if (project != null) {
- String errorMessage = String.format("%s <a href=\"%s\">Open Gradle settings</a>",
- "Configured version of Gradle does not support cancellation. Please, use Gradle 2.1 or newer.\n",
- OpenGradleSettingsCallback.ID);
- NotificationData notification = new NotificationData(
- "Gradle supports cancellation since 2.1 version", errorMessage, NotificationCategory.WARNING,
- NotificationSource.PROJECT_SYNC);
- notification.setListener(OpenGradleSettingsCallback.ID, new OpenGradleSettingsCallback(project));
- notification.setBalloonNotification(true);
- ExternalSystemNotificationManager.getInstance(project).showNotification(GradleConstants.SYSTEM_ID, notification);
- }
- }
- }
- }
- }
}
diff --git a/plugins/gradle/tooling-extension-api/gradle-tooling-extension-api.iml b/plugins/gradle/tooling-extension-api/gradle-tooling-extension-api.iml
index 3738943..b761b69 100644
--- a/plugins/gradle/tooling-extension-api/gradle-tooling-extension-api.iml
+++ b/plugins/gradle/tooling-extension-api/gradle-tooling-extension-api.iml
@@ -11,6 +11,7 @@
<orderEntry type="module" module-name="annotations" />
<orderEntry type="module" module-name="testFramework" scope="TEST" />
<orderEntry type="module" module-name="testFramework-java" scope="TEST" />
+ <orderEntry type="library" exported="" name="Slf4j" level="project" />
<orderEntry type="module-library" exported="">
<library name="Gradle">
<CLASSES>
@@ -45,4 +46,4 @@
</orderEntry>
<orderEntry type="library" scope="PROVIDED" name="Groovy" level="project" />
</component>
-</module>
+</module>
\ No newline at end of file
diff --git a/plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/ProjectImportAction.java b/plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/ProjectImportAction.java
index 5b20894..37b20de 100644
--- a/plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/ProjectImportAction.java
+++ b/plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/ProjectImportAction.java
@@ -55,10 +55,6 @@
}
AllModels allModels = new AllModels(ideaProject);
-
- // TODO ask gradle guys why there is always null got for BuildEnvironment model
- //allModels.setBuildEnvironment(controller.findModel(BuildEnvironment.class));
-
addExtraProject(controller, allModels, null);
for (IdeaModule module : ideaProject.getModules()) {
addExtraProject(controller, allModels, module);
diff --git a/plugins/gradle/tooling-extension-impl/gradle-tooling-extension-impl.iml b/plugins/gradle/tooling-extension-impl/gradle-tooling-extension-impl.iml
index 411170b..b8bb34c 100644
--- a/plugins/gradle/tooling-extension-impl/gradle-tooling-extension-impl.iml
+++ b/plugins/gradle/tooling-extension-impl/gradle-tooling-extension-impl.iml
@@ -64,15 +64,6 @@
</library>
</orderEntry>
<orderEntry type="library" name="Groovy" level="project" />
- <orderEntry type="module-library" exported="">
- <library name="Slf4j">
- <CLASSES>
- <root url="jar://$MODULE_DIR$/../lib/slf4j-api-1.7.7.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
<orderEntry type="library" name="gson" level="project" />
</component>
-</module>
+</module>
\ No newline at end of file
diff --git a/plugins/groovy/groovy-psi/gen/icons/JetgroovyIcons.java b/plugins/groovy/groovy-psi/gen/icons/JetgroovyIcons.java
index 622af34..845b18e 100644
--- a/plugins/groovy/groovy-psi/gen/icons/JetgroovyIcons.java
+++ b/plugins/groovy/groovy-psi/gen/icons/JetgroovyIcons.java
@@ -52,6 +52,7 @@
public static final Icon Groovy_13x13 = load("/icons/groovy/groovy_13x13.png"); // 13x13
public static final Icon Groovy_16x16 = load("/icons/groovy/groovy_16x16.png"); // 16x16
public static final Icon Groovy_32x32 = load("/icons/groovy/groovy_32x32.png"); // 32x32
+ public static final Icon Groovy_outsideSources = load("/icons/groovy/groovy_outsideSources.png"); // 16x16
public static final Icon GroovyDoc = load("/icons/groovy/GroovyDoc.png"); // 16x16
public static final Icon GroovyModule = load("/icons/groovy/groovyModule.png"); // 24x24
public static final Icon Interface = load("/icons/groovy/interface.png"); // 16x16
diff --git a/plugins/groovy/groovy-psi/resources/icons/groovy/groovy_outsideSources.png b/plugins/groovy/groovy-psi/resources/icons/groovy/groovy_outsideSources.png
new file mode 100644
index 0000000..3addfef
--- /dev/null
+++ b/plugins/groovy/groovy-psi/resources/icons/groovy/groovy_outsideSources.png
Binary files differ
diff --git a/plugins/groovy/groovy-psi/resources/icons/groovy/groovy_outsideSources@2x.png b/plugins/groovy/groovy-psi/resources/icons/groovy/groovy_outsideSources@2x.png
new file mode 100644
index 0000000..3b4e126
--- /dev/null
+++ b/plugins/groovy/groovy-psi/resources/icons/groovy/groovy_outsideSources@2x.png
Binary files differ
diff --git a/plugins/groovy/groovy-psi/resources/inspectionDescriptions/GroovySystemRunFinalizersOnExit.html b/plugins/groovy/groovy-psi/resources/inspectionDescriptions/GroovySystemRunFinalizersOnExit.html
index 33a8f23..4fb83c3 100644
--- a/plugins/groovy/groovy-psi/resources/inspectionDescriptions/GroovySystemRunFinalizersOnExit.html
+++ b/plugins/groovy/groovy-psi/resources/inspectionDescriptions/GroovySystemRunFinalizersOnExit.html
@@ -3,7 +3,7 @@
This inspection reports any calls to <b><font color="#000080">System.runFinalizersOnExity()</font></b> from
Groovy code. This call is one of the most dangerous in the Java language. It is inherently non-thread-safe,
-may result in data corruption, deadlock, and may effect parts of the program far removed from it's call point.
+may result in data corruption, deadlock, and may affect parts of the program far removed from it's call point.
It is deprecated, and it's use strongly discouraged.
<br>
<small>Powered by InspectorGroovy</small>
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileIconProvider.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileIconProvider.java
new file mode 100644
index 0000000..ea72a4c
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileIconProvider.java
@@ -0,0 +1,59 @@
+/*
+ * 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;
+
+import com.intellij.ide.FileIconProvider;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Iconable;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiManager;
+import com.intellij.psi.impl.ElementBase;
+import icons.JetgroovyIcons;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.groovy.extensions.GroovyScriptTypeDetector;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
+import org.jetbrains.plugins.groovy.util.GrFileIndexUtil;
+
+import javax.swing.*;
+
+public class GroovyFileIconProvider implements FileIconProvider {
+
+ @Nullable
+ @Override
+ public Icon getIcon(@NotNull VirtualFile virtualFile, @Iconable.IconFlags int flags, @Nullable Project project) {
+ if (project == null || virtualFile.getFileType() != GroovyFileType.GROOVY_FILE_TYPE) return null;
+ final PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
+ if (!(psiFile instanceof GroovyFile)) return null;
+ final GroovyFile file = (GroovyFile)psiFile;
+ final Icon icon;
+ if (file.isScript()) {
+ icon = GroovyScriptTypeDetector.getIcon(file);
+ }
+ else if (GrFileIndexUtil.isGroovySourceFile(file)) {
+ final GrTypeDefinition[] typeDefinitions = file.getTypeDefinitions();
+ icon = typeDefinitions.length > 0
+ ? typeDefinitions[0].getIcon(flags)
+ : JetgroovyIcons.Groovy.Groovy_16x16;
+ }
+ else {
+ icon = JetgroovyIcons.Groovy.Groovy_outsideSources;
+ }
+ return ElementBase.createLayeredIcon(psiFile, icon, ElementBase.transformFlags(psiFile, flags));
+ }
+}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyIconProvider.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyIconProvider.java
deleted file mode 100644
index 1449adf..0000000
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyIconProvider.java
+++ /dev/null
@@ -1,53 +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;
-
-import com.intellij.ide.IconProvider;
-import com.intellij.psi.PsiElement;
-import icons.JetgroovyIcons;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.groovy.extensions.GroovyScriptTypeDetector;
-import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
-
-import javax.swing.*;
-
-/**
- * @author peter
- */
-public class GroovyIconProvider extends IconProvider {
-
- @Override
- @Nullable
- public Icon getIcon(@NotNull PsiElement element, int flags) {
- if (element instanceof GroovyFile) {
- GroovyFile file = (GroovyFile)element;
- if (!file.isScript()) {
- GrTypeDefinition[] typeDefinitions = file.getTypeDefinitions();
- if (typeDefinitions.length > 0) {
- return typeDefinitions[0].getIcon(flags);
- }
- return JetgroovyIcons.Groovy.Groovy_16x16;
- }
-
- return GroovyScriptTypeDetector.getIcon(file);
- }
-
- return null;
- }
-
-}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/GrReferenceHighlighterFactory.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/GrReferenceHighlighterFactory.java
index 457522f..ad10112 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/GrReferenceHighlighterFactory.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/GrReferenceHighlighterFactory.java
@@ -24,6 +24,7 @@
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
+import org.jetbrains.plugins.groovy.util.GrFileIndexUtil;
/**
* @author Max Medvedev
@@ -36,7 +37,7 @@
@Override
public TextEditorHighlightingPass createHighlightingPass(@NotNull PsiFile file, @NotNull Editor editor) {
- if (!(file instanceof GroovyFileBase)) return null;
+ if (!GrFileIndexUtil.isGroovySourceFile(file)) return null;
return new GrReferenceHighlighter(editor.getDocument(), (GroovyFileBase)file);
}
}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/ResolveHighlightingVisitor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/ResolveHighlightingVisitor.java
index 88bbefd..e36e621 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/ResolveHighlightingVisitor.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/ResolveHighlightingVisitor.java
@@ -17,6 +17,7 @@
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.intellij.openapi.project.Project;
+import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GrUnresolvedAccessChecker;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
@@ -45,7 +46,7 @@
if (size == myInfos.size()) {
List<HighlightInfo> infos = myReferenceChecker.checkReferenceExpression(referenceExpression);
if (infos != null) {
- myInfos.addAll(infos);
+ ContainerUtil.addAllNotNull(myInfos, infos);
}
}
}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/dataflow/WritesCounterDFAInstance.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/dataflow/WritesCounterDFAInstance.java
index fd9e7bf..b0c78f385 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/dataflow/WritesCounterDFAInstance.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/dataflow/WritesCounterDFAInstance.java
@@ -36,13 +36,7 @@
final GrVariable variable;
if (instructionElement instanceof GrReferenceExpression) {
final PsiElement resolved = ((GrReferenceExpression)instructionElement).resolve();
- if (resolved == null) {
- variable = null;
- }
- else {
- assert resolved instanceof GrVariable;
- variable = (GrVariable)resolved;
- }
+ variable = resolved instanceof GrVariable ? (GrVariable)resolved : null;
}
else if (instructionElement instanceof GrVariable) {
variable = (GrVariable)instructionElement;
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitorHelper.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitorHelper.java
index 99a9820..b6d4f27 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitorHelper.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitorHelper.java
@@ -38,6 +38,7 @@
import org.jetbrains.plugins.groovy.lang.psi.api.signatures.GrSignature;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentList;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArgument;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrSpreadArgument;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrAssignmentExpression;
@@ -53,7 +54,6 @@
import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil;
import org.jetbrains.plugins.groovy.lang.psi.impl.signatures.GrClosureSignatureUtil;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
-import org.jetbrains.plugins.groovy.lang.psi.util.ErrorUtil;
import org.jetbrains.plugins.groovy.lang.psi.util.GdkMethodUtil;
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
import org.jetbrains.plugins.groovy.spock.SpockUtils;
@@ -62,10 +62,11 @@
import java.util.Collections;
import java.util.List;
-import static com.intellij.psi.util.PsiUtil.extractIterableTypeParameter;
-
public class GroovyTypeCheckVisitorHelper {
-
+
+ @SuppressWarnings("unchecked")
+ private static final Function<PsiType, PsiType> id = (Function<PsiType, PsiType>)Function.ID;
+
@Nullable
@Contract("null -> null")
protected static GrListOrMap getTupleInitializer(@Nullable GrExpression initializer) {
@@ -170,17 +171,13 @@
@Nullable GrArgumentList argumentList) {
if (argumentList == null) return LocalQuickFix.EMPTY_ARRAY;
final List<GrExpression> args = getExpressionArgumentsOfCall(argumentList);
-
- if (args == null) {
- return LocalQuickFix.EMPTY_ARRAY;
- }
-
+ if (args == null) return LocalQuickFix.EMPTY_ARRAY;
+
+ final List<Pair<Integer, PsiType>> allErrors = new ArrayList<Pair<Integer, PsiType>>();
final List<GrClosureSignature> signatures = GrClosureSignatureUtil.generateSimpleSignatures(signature);
-
- List<Pair<Integer, PsiType>> allErrors = new ArrayList<Pair<Integer, PsiType>>();
for (GrClosureSignature closureSignature : signatures) {
- final GrClosureSignatureUtil.MapResultWithError<PsiType> map = GrClosureSignatureUtil.<PsiType>mapSimpleSignatureWithErrors(
- closureSignature, argumentTypes, Function.ID, argumentList, 1
+ final GrClosureSignatureUtil.MapResultWithError<PsiType> map = GrClosureSignatureUtil.mapSimpleSignatureWithErrors(
+ closureSignature, argumentTypes, id, argumentList, 1
);
if (map != null) {
final List<Pair<Integer, PsiType>> errors = map.getErrors();
@@ -196,7 +193,6 @@
for (Pair<Integer, PsiType> error : allErrors) {
fixes.add(new ParameterCastFix(error.first, error.second, args.get(error.first)));
}
-
return fixes.toArray(new LocalQuickFix[fixes.size()]);
}
@@ -269,10 +265,9 @@
@Nullable
public static List<GrExpression> getExpressionArgumentsOfCall(@NotNull GrArgumentList argumentList) {
- final GrExpression[] argArray = argumentList.getExpressionArguments();
final ArrayList<GrExpression> args = ContainerUtil.newArrayList();
- for (GrExpression arg : argArray) {
+ for (GroovyPsiElement arg : argumentList.getAllArguments()) {
if (arg instanceof GrSpreadArgument) {
GrExpression spreaded = ((GrSpreadArgument)arg).getArgument();
if (spreaded instanceof GrListOrMap && !((GrListOrMap)spreaded).isMap()) {
@@ -282,8 +277,11 @@
return null;
}
}
- else {
- args.add(arg);
+ else if (arg instanceof GrExpression) {
+ args.add((GrExpression)arg);
+ }
+ else if (arg instanceof GrNamedArgument) {
+ args.add(((GrNamedArgument)arg).getExpression());
}
}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java
index 7fa143f..54493a3 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java
@@ -79,6 +79,9 @@
private static final Key<Pair<GroovyDslExecutor, Long>> CACHED_EXECUTOR = Key.create("CachedGdslExecutor");
private static final Logger LOG = Logger.getInstance(GroovyDslFileIndex.class);
+ private static final Collection<VirtualFile> BUNDLED_GDSLs = Collections.unmodifiableSet(
+ ContainerUtil.newHashSet(getBundledGdslFiles())
+ );
@NonNls public static final ID<String, Void> NAME = ID.create("GroovyDslFileIndex");
@NonNls private static final String OUR_KEY = "ourKey";
public static final String MODIFIED = "Modified";
@@ -100,7 +103,8 @@
@Override
public void contentsChanged(@NotNull VirtualFileEvent event) {
- if (event.getFileName().endsWith(".gdsl")) {
+ if (event.isFromRefresh()) return;
+ if (event.getFileName().endsWith(".gdsl") && !BUNDLED_GDSLs.contains(event.getFile())) {
disableFile(event.getFile(), MODIFIED);
}
}
@@ -148,7 +152,7 @@
}
public static boolean isActivated(VirtualFile file) {
- return DslActivationStatus.getInstance().isActivated(file);
+ return BUNDLED_GDSLs.contains(file) || DslActivationStatus.getInstance().isActivated(file);
}
public static void activateUntilModification(final VirtualFile vfile) {
@@ -299,8 +303,14 @@
private static final Key<CachedValue<List<GroovyDslScript>>> SCRIPTS_CACHE = Key.create("GdslScriptCache");
private static List<VirtualFile> getGdslFiles(final Project project) {
- List<VirtualFile> result = ContainerUtil.newArrayList();
+ final List<VirtualFile> result = ContainerUtil.newArrayList();
+ result.addAll(BUNDLED_GDSLs);
+ result.addAll(getProjectGdslFiles(project));
+ return result;
+ }
+ private static List<VirtualFile> getBundledGdslFiles() {
+ final List<VirtualFile> result = ContainerUtil.newArrayList();
for (File file : getBundledScriptFolders()) {
if (file.exists()) {
File[] children = file.listFiles();
@@ -316,7 +326,11 @@
}
}
}
+ return result;
+ }
+ private static List<VirtualFile> getProjectGdslFiles(Project project) {
+ final List<VirtualFile> result = ContainerUtil.newArrayList();
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
final GlobalSearchScope scope = GlobalSearchScope.allScope(project);
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyCoreEnvironment.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyCoreEnvironment.java
index d8b7f97..5157c8e 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyCoreEnvironment.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyCoreEnvironment.java
@@ -21,7 +21,7 @@
import com.intellij.codeInspection.unused.ImplicitPropertyUsageProvider;
import com.intellij.core.CoreApplicationEnvironment;
import com.intellij.core.CoreProjectEnvironment;
-import com.intellij.ide.IconProvider;
+import com.intellij.ide.FileIconProvider;
import com.intellij.javaee.CoreExternalResourceManager;
import com.intellij.javaee.ExternalResourceManagerEx;
import com.intellij.lang.LanguageAnnotators;
@@ -136,7 +136,8 @@
appEnvironment.addExtension(NonCodeMembersContributor.EP_NAME, new DGMMemberContributor());
appEnvironment.addExtension(NonCodeMembersContributor.EP_NAME, new SwingBuilderNonCodeMemberContributor());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), DefaultImportContributor.EP_NAME, DefaultImportContributor.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), DefaultImportContributor.EP_NAME,
+ DefaultImportContributor.class);
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), AstTransformContributor.EP_NAME, AstTransformContributor.class);
appEnvironment.addExtension(AstTransformContributor.EP_NAME, new AutoCloneContributor());
@@ -146,7 +147,8 @@
appEnvironment.addExtension(AstTransformContributor.EP_NAME, new GrInheritConstructorContributor());
appEnvironment.addExtension(AstTransformContributor.EP_NAME, new LoggingContributor());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClosureMissingMethodContributor.EP_NAME, ClosureMissingMethodContributor.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClosureMissingMethodContributor.EP_NAME,
+ ClosureMissingMethodContributor.class);
appEnvironment.addExtension(ClosureMissingMethodContributor.EP_NAME, new PluginXmlClosureMemberContributor());
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GrVariableEnhancer.EP_NAME, GrVariableEnhancer.class);
@@ -155,7 +157,8 @@
appEnvironment.addExtension(GrVariableEnhancer.EP_NAME, new ClosureParamsEnhancer());
appEnvironment.addExtension(GrVariableEnhancer.EP_NAME, new GppClosureParameterTypeProvider());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GrReferenceTypeEnhancer.EP_NAME, GrReferenceTypeEnhancer.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GrReferenceTypeEnhancer.EP_NAME,
+ GrReferenceTypeEnhancer.class);
appEnvironment.addExtension(GrReferenceTypeEnhancer.EP_NAME, new GroovyMapValueTypeEnhancer());
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GrTypeConverter.EP_NAME, GrTypeConverter.class);
@@ -172,23 +175,28 @@
appEnvironment.addExtension(GrTypeConverter.EP_NAME, new GrContainerConverter());
appEnvironment.addExtension(GrTypeConverter.EP_NAME, new GppTypeConverter());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyExpectedTypesContributor.EP_NAME, GroovyExpectedTypesContributor.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyExpectedTypesContributor.EP_NAME,
+ GroovyExpectedTypesContributor.class);
appEnvironment.addExtension(GroovyExpectedTypesContributor.EP_NAME, new GppExpectedTypesContributor());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyScriptTypeDetector.EP_NAME, GroovyScriptTypeDetector.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyScriptTypeDetector.EP_NAME,
+ GroovyScriptTypeDetector.class);
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyNamedArgumentProvider.EP_NAME, GroovyNamedArgumentProvider.class);
appEnvironment.addExtension(GroovyNamedArgumentProvider.EP_NAME, new GroovyConstructorNamedArgumentProvider());
appEnvironment.addExtension(GroovyNamedArgumentProvider.EP_NAME, new GroovyMethodReturnNamedArgumentProvider());
appEnvironment.addExtension(GroovyNamedArgumentProvider.EP_NAME, new GroovySourceCodeNamedArgumentProvider());
appEnvironment.addExtension(GroovyNamedArgumentProvider.EP_NAME, new SwingBuilderNamedArgumentProvider());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyMapContentProvider.EP_NAME, GroovyMapContentProvider.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyMapContentProvider.EP_NAME,
+ GroovyMapContentProvider.class);
appEnvironment.addExtension(GroovyMapContentProvider.EP_NAME, new ConfigSlurperMapContentProvider());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyUnresolvedHighlightFilter.EP_NAME, GroovyUnresolvedHighlightFilter.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyUnresolvedHighlightFilter.EP_NAME,
+ GroovyUnresolvedHighlightFilter.class);
appEnvironment.addExtension(GroovyUnresolvedHighlightFilter.EP_NAME, new GroovyUnresolvedReferenceFilterByFile());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyUnresolvedHighlightFileFilter.EP_NAME, GroovyUnresolvedHighlightFileFilter.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyUnresolvedHighlightFileFilter.EP_NAME,
+ GroovyUnresolvedHighlightFileFilter.class);
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GrCallExpressionTypeCalculator.EP_NAME, GrCallExpressionTypeCalculator.class);
appEnvironment.addExtension(GrCallExpressionTypeCalculator.EP_NAME, new DefaultCallExpressionTypeCalculator());
appEnvironment.addExtension(GrCallExpressionTypeCalculator.EP_NAME, new GrDescriptorReturnTypeCalculator());
@@ -211,7 +219,8 @@
appEnvironment.addExtension(GdslMembersProvider.EP_NAME, new GdkMethodDslProvider());
appEnvironment.addExtension(GdslMembersProvider.EP_NAME, new GroovyDslDefaultMembers());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyFrameworkConfigNotification.EP_NAME, GroovyFrameworkConfigNotification.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyFrameworkConfigNotification.EP_NAME,
+ GroovyFrameworkConfigNotification.class);
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GrMethodMayBeStaticInspectionFilter.EP_NAME, GrMethodMayBeStaticInspectionFilter.class);
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), CustomAnnotationChecker.EP_NAME, CustomAnnotationChecker.class);
appEnvironment.addExtension(CustomAnnotationChecker.EP_NAME, new AnnotationCollectorChecker());
@@ -223,24 +232,30 @@
appEnvironment.addExtension(CustomAnnotationChecker.EP_NAME, new NewifyAnnotationChecker());
appEnvironment.addExtension(CustomAnnotationChecker.EP_NAME, new TypeCheckedAnnotationChecker());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ImplicitPropertyUsageProvider.EP_NAME, ImplicitPropertyUsageProvider.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ImplicitPropertyUsageProvider.EP_NAME,
+ ImplicitPropertyUsageProvider.class);
appEnvironment.addExtension(ImplicitPropertyUsageProvider.EP_NAME, new DGMImplicitPropertyUsageProvider());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ImplicitUsageProvider.EP_NAME, ImplicitUsageProvider.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ImplicitUsageProvider.EP_NAME,
+ ImplicitUsageProvider.class);
appEnvironment.addExtension(ImplicitUsageProvider.EP_NAME, new GppImplicitUsageProvider());
appEnvironment.addExtension(ImplicitUsageProvider.EP_NAME, new GrImplicitUsageProvider());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), FileTypeRegistry.FileTypeDetector.EP_NAME, FileTypeRegistry.FileTypeDetector.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), FileTypeRegistry.FileTypeDetector.EP_NAME,
+ FileTypeRegistry.FileTypeDetector.class);
appEnvironment.addExtension(FileTypeRegistry.FileTypeDetector.EP_NAME, new GroovyHashBangFileTypeDetector());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClsCustomNavigationPolicy.EP_NAME, ClsCustomNavigationPolicy.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClsCustomNavigationPolicy.EP_NAME,
+ ClsCustomNavigationPolicy.class);
appEnvironment.addExtension(ClsCustomNavigationPolicy.EP_NAME, new GroovyClsCustomNavigationPolicy());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), PomDeclarationSearcher.EP_NAME, PomDeclarationSearcher.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), PomDeclarationSearcher.EP_NAME,
+ PomDeclarationSearcher.class);
appEnvironment.addExtension(PomDeclarationSearcher.EP_NAME, new GebContentDeclarationSearcher());
appEnvironment.addExtension(PomDeclarationSearcher.EP_NAME, new SpockPomDeclarationSearcher());
- appEnvironment.addExplicitExtension(LanguageConstantExpressionEvaluator.INSTANCE, GroovyLanguage.INSTANCE, new GroovyConstantExpressionEvaluator());
+ appEnvironment.addExplicitExtension(LanguageConstantExpressionEvaluator.INSTANCE, GroovyLanguage.INSTANCE,
+ new GroovyConstantExpressionEvaluator());
appEnvironment.addExplicitExtension(ExpressionConverter.EP, GroovyLanguage.INSTANCE, new GroovyExpressionConverter());
appEnvironment.addExplicitExtension(LanguageAnnotators.INSTANCE, GroovyLanguage.INSTANCE, new GrAnnotatorImpl());
@@ -282,7 +297,8 @@
appEnvironment.addExtension(StubIndexExtension.EP_NAME, new GrScriptClassNameIndex());
appEnvironment.addExtension(StubIndexExtension.EP_NAME, new GrScriptClassNameIndex());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), FileBasedIndexExtension.EXTENSION_POINT_NAME, FileBasedIndexExtension.class);
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), FileBasedIndexExtension.EXTENSION_POINT_NAME,
+ FileBasedIndexExtension.class);
appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new GroovyDslFileIndex());
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ReferencesSearch.EP_NAME, QueryExecutor.class);
@@ -291,8 +307,8 @@
appEnvironment.addExtension(ReferencesSearch.EP_NAME, new AccessorReferencesSearcher());
appEnvironment.addExtension(ReferencesSearch.EP_NAME, new GroovyTraitFieldSearcher());
- CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), IconProvider.EXTENSION_POINT_NAME, IconProvider.class);
- appEnvironment.addExtension(IconProvider.EXTENSION_POINT_NAME, new GroovyIconProvider());
+ CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), FileIconProvider.EP_NAME, FileIconProvider.class);
+ appEnvironment.addExtension(FileIconProvider.EP_NAME, new GroovyFileIconProvider());
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ResolveScopeProvider.EP_NAME, ResolveScopeProvider.class);
appEnvironment.addExtension(ResolveScopeProvider.EP_NAME, new GroovyResolveScopeProvider());
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrStubElementBase.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrStubElementBase.java
index a89fcf50..1807590 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrStubElementBase.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrStubElementBase.java
@@ -18,13 +18,17 @@
import com.intellij.extapi.psi.StubBasedPsiElementBase;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.stubs.StubElement;
import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinitionBody;
+import org.jetbrains.plugins.groovy.util.GrFileIndexUtil;
/**
* @author ilyas
@@ -65,4 +69,14 @@
return getParentByTree();
}
+
+ @NotNull
+ @Override
+ public GlobalSearchScope getResolveScope() {
+ final PsiFile containingFile = getContainingFile();
+ final GlobalSearchScope elementScope = super.getResolveScope();
+ return GrFileIndexUtil.isGroovySourceFile(containingFile)
+ ? elementScope
+ : GlobalSearchScope.fileScope(containingFile).union(elementScope);
+ }
}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileImpl.java
index 825431b..5974da6 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileImpl.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileImpl.java
@@ -20,7 +20,6 @@
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.*;
-import com.intellij.psi.impl.ElementBase;
import com.intellij.psi.scope.NameHint;
import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.psi.stubs.StubElement;
@@ -31,11 +30,9 @@
import com.intellij.util.ConcurrencyUtil;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
-import icons.JetgroovyIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyLanguage;
-import org.jetbrains.plugins.groovy.extensions.GroovyScriptTypeDetector;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
@@ -58,7 +55,6 @@
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
-import javax.swing.*;
import java.util.concurrent.ConcurrentMap;
/**
@@ -306,13 +302,6 @@
}
@Override
- @Nullable
- public Icon getIcon(int flags) {
- final Icon baseIcon = isScript() ? GroovyScriptTypeDetector.getIcon(this) : JetgroovyIcons.Groovy.Groovy_16x16;
- return ElementBase.createLayeredIcon(this, baseIcon, ElementBase.transformFlags(this, flags));
- }
-
- @Override
public GrImportStatement addImportForClass(@NotNull PsiClass aClass) {
try {
// Calculating position
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/GrFileIndexUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/GrFileIndexUtil.java
new file mode 100644
index 0000000..6eeba6e
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/GrFileIndexUtil.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2015 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.util;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.FileIndexFacade;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiFile;
+import com.intellij.testFramework.LightVirtualFile;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
+
+public class GrFileIndexUtil {
+
+ public static boolean isGroovySourceFile(@NotNull PsiFile file) {
+ return file instanceof GroovyFileBase && isGroovySourceFile((GroovyFileBase)file);
+ }
+
+ public static boolean isGroovySourceFile(@NotNull GroovyFileBase file) {
+ return isInSourceFiles(file.getVirtualFile(), file.getProject());
+ }
+
+ private static boolean isInSourceFiles(@Nullable VirtualFile file, @NotNull Project project) {
+ if (file != null && !(file instanceof LightVirtualFile)) {
+ final FileIndexFacade index = FileIndexFacade.getInstance(project);
+ if (index.isInSource(file) || index.isInLibraryClasses(file)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/ForkedGroovyc.java b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/ForkedGroovyc.java
index d9ec0bb..694b9df 100644
--- a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/ForkedGroovyc.java
+++ b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/ForkedGroovyc.java
@@ -60,7 +60,7 @@
throws Exception {
List<String> classpath = new ArrayList<String>();
if (myOptimizeClassLoading) {
- classpath.add(GroovyBuilder.getGroovyRtRoot().getPath());
+ classpath.addAll(GroovyBuilder.getGroovyRtRoots());
classpath.add(ClasspathBootstrap.getResourcePath(Function.class));
classpath.add(ClasspathBootstrap.getResourcePath(UrlClassLoader.class));
classpath.add(ClasspathBootstrap.getResourceFile(THashMap.class).getPath());
@@ -69,9 +69,17 @@
}
List<String> vmParams = ContainerUtilRt.newArrayList();
- vmParams.add("-Xmx" + settings.heapSize + "m");
+ vmParams.add("-Xmx" + System.getProperty("groovyc.heap.size", settings.heapSize) + "m");
vmParams.add("-Dfile.encoding=" + System.getProperty("file.encoding"));
//vmParams.add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5239");
+
+ if ("false".equals(System.getProperty(GroovyRtConstants.GROOVYC_ASM_RESOLVING_ONLY))) {
+ vmParams.add("-D" + GroovyRtConstants.GROOVYC_ASM_RESOLVING_ONLY + "=false");
+ }
+ String configScript = System.getProperty(GroovyRtConstants.GROOVYC_CONFIG_SCRIPT);
+ if (configScript != null) {
+ vmParams.add("-D" + GroovyRtConstants.GROOVYC_CONFIG_SCRIPT + "=" + configScript);
+ }
String grapeRoot = System.getProperty(GroovycOutputParser.GRAPE_ROOT);
if (grapeRoot != null) {
diff --git a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java
index 810d79a..cfaef7d 100644
--- a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java
+++ b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java
@@ -26,6 +26,7 @@
import gnu.trove.THashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.groovy.compiler.rt.GroovyRtConstants;
import org.jetbrains.jps.ModuleChunk;
import org.jetbrains.jps.ProjectPaths;
import org.jetbrains.jps.builders.BuildRootIndex;
@@ -485,7 +486,7 @@
final Set<String> cp = new LinkedHashSet<String>();
//groovy_rt.jar
// IMPORTANT! must be the first in classpath
- cp.add(getGroovyRtRoot().getPath());
+ cp.addAll(getGroovyRtRoots());
for (File file : ProjectPaths.getCompilationClasspathFiles(chunk, chunk.containsTests(), false, false)) {
cp.add(FileUtil.toCanonicalPath(file.getPath()));
@@ -498,12 +499,11 @@
return cp;
}
- static File getGroovyRtRoot() {
- File root = ClasspathBootstrap.getResourceFile(GroovyBuilder.class);
- if (root.isFile()) {
- return new File(root.getParentFile(), "groovy_rt.jar");
- }
- return new File(root.getParentFile(), "groovy_rt");
+ static List<String> getGroovyRtRoots() {
+ File rt = ClasspathBootstrap.getResourceFile(GroovyBuilder.class);
+ File constants = ClasspathBootstrap.getResourceFile(GroovyRtConstants.class);
+ return Arrays.asList(new File(rt.getParentFile(), rt.isFile() ? "groovy_rt.jar" : "groovy_rt").getPath(),
+ new File(constants.getParentFile(), constants.isFile() ? "groovy-rt-constants.jar" : "groovy-rt-constants").getPath());
}
public static boolean isGroovyFile(String path) {
diff --git a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/InProcessGroovyc.java b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/InProcessGroovyc.java
index 566ffcb..59b365a 100644
--- a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/InProcessGroovyc.java
+++ b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/InProcessGroovyc.java
@@ -30,6 +30,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.groovy.compiler.rt.GroovyRtConstants;
+import org.jetbrains.groovy.compiler.rt.ClassDependencyLoader;
import java.io.*;
import java.lang.reflect.Method;
@@ -37,10 +38,7 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Queue;
+import java.util.*;
import java.util.concurrent.*;
import java.util.regex.Pattern;
@@ -209,20 +207,50 @@
return pair.second;
}
- UrlClassLoader groovyAllLoader = UrlClassLoader.build().
- urls(toUrls(Arrays.asList(GroovyBuilder.getGroovyRtRoot().getPath(), groovyAll))).allowLock().
- useCache(ourLoaderCachePool, new UrlClassLoader.CachingCondition() {
- @Override
- public boolean shouldCacheData(
- @NotNull URL url) {
+ final ClassDependencyLoader checkWellFormed = new ClassDependencyLoader() {
+ @Override
+ protected void loadClassDependencies(Class aClass) throws ClassNotFoundException {
+ if (!isCompilerCoreClass(aClass.getName()) || !(aClass.getClassLoader() instanceof UrlClassLoader)) {
+ super.loadClassDependencies(aClass);
+ }
+ }
+
+ private boolean isCompilerCoreClass(String name) {
+ if (name.startsWith("groovyjarjar")) {
return true;
}
- }).get();
+ if (name.startsWith("org.codehaus.groovy.")) {
+ String tail = name.substring("org.codehaus.groovy.".length());
+ if (tail.startsWith("ast") ||
+ tail.startsWith("classgen") ||
+ tail.startsWith("tools.javac") ||
+ tail.startsWith("antlr") ||
+ tail.startsWith("vmplugin") ||
+ tail.startsWith("reflection") ||
+ tail.startsWith("control")) {
+ return true;
+ }
+ if (tail.startsWith("runtime") && name.contains("GroovyMethods")) {
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+ UrlClassLoader groovyAllLoader = UrlClassLoader.build().
+ urls(toUrls(ContainerUtil.concat(GroovyBuilder.getGroovyRtRoots(), Collections.singletonList(groovyAll)))).allowLock().
+ useCache(ourLoaderCachePool, new UrlClassLoader.CachingCondition() {
+ @Override
+ public boolean shouldCacheData(
+ @NotNull URL url) {
+ return true;
+ }
+ }).get();
ClassLoader wrapper = new URLClassLoader(new URL[0], groovyAllLoader) {
@Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
try {
- return super.loadClass(name, resolve);
+ return checkWellFormed.loadDependencies(super.loadClass(name, resolve));
}
catch (NoClassDefFoundError e) {
// We might attempt to load some class in groovy-all.jar that depends on a class from another library
@@ -239,6 +267,9 @@
return wrapper;
}
+
+
+
@NotNull
private static List<URL> toUrls(Collection<String> paths) throws MalformedURLException {
List<URL> urls = ContainerUtil.newArrayList();
diff --git a/plugins/groovy/rt-constants/src/org/jetbrains/groovy/compiler/rt/ClassDependencyLoader.java b/plugins/groovy/rt-constants/src/org/jetbrains/groovy/compiler/rt/ClassDependencyLoader.java
new file mode 100644
index 0000000..bbe739a
--- /dev/null
+++ b/plugins/groovy/rt-constants/src/org/jetbrains/groovy/compiler/rt/ClassDependencyLoader.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2000-2015 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.groovy.compiler.rt;
+
+import java.lang.reflect.*;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author peter
+ */
+public class ClassDependencyLoader {
+ private final Set<Class> myVisited = new HashSet<Class>();
+
+ /**
+ * @param aClass
+ * @return aClass
+ * @throws ClassNotFoundException when any of the classes can't be loaded, that's referenced in aClass' fields, methods etc. recursively
+ */
+ public Class loadDependencies(Class aClass) throws ClassNotFoundException {
+ loadClassDependencies(aClass);
+ return aClass;
+ }
+
+ private void loadTypeDependencies(Type aClass) throws ClassNotFoundException {
+ if (aClass instanceof Class) {
+ loadClassDependencies((Class)aClass);
+ }
+ else if (aClass instanceof ParameterizedType) {
+ loadTypeDependencies(((ParameterizedType)aClass).getOwnerType());
+ for (Type type : ((ParameterizedType)aClass).getActualTypeArguments()) {
+ loadTypeDependencies(type);
+ }
+ }
+ else if (aClass instanceof WildcardType) {
+ for (Type type : ((WildcardType)aClass).getLowerBounds()) {
+ loadTypeDependencies(type);
+ }
+ for (Type type : ((WildcardType)aClass).getUpperBounds()) {
+ loadTypeDependencies(type);
+ }
+ }
+ else if (aClass instanceof GenericArrayType) {
+ loadTypeDependencies(((GenericArrayType)aClass).getGenericComponentType());
+ }
+ }
+
+ protected void loadClassDependencies(Class aClass) throws ClassNotFoundException {
+ String name = aClass.getName();
+ if (myVisited.add(aClass)) {
+ try {
+ for (Method method : aClass.getDeclaredMethods()) {
+ loadTypeDependencies(method.getGenericReturnType());
+ for (Type type : method.getGenericExceptionTypes()) {
+ loadTypeDependencies(type);
+ }
+ for (Type type : method.getGenericParameterTypes()) {
+ loadTypeDependencies(type);
+ }
+ }
+ for (Constructor method : aClass.getDeclaredConstructors()) {
+ for (Type type : method.getGenericExceptionTypes()) {
+ loadTypeDependencies(type);
+ }
+ for (Type type : method.getGenericParameterTypes()) {
+ loadTypeDependencies(type);
+ }
+ }
+
+ for (Field field : aClass.getDeclaredFields()) {
+ loadTypeDependencies(field.getGenericType());
+ }
+
+ Type superclass = aClass.getGenericSuperclass();
+ if (superclass != null) {
+ loadClassDependencies(aClass);
+ }
+
+ for (Type intf : aClass.getGenericInterfaces()) {
+ loadTypeDependencies(intf);
+ }
+
+ aClass.getAnnotations();
+ Package aPackage = aClass.getPackage();
+ if (aPackage != null) {
+ aPackage.getAnnotations();
+ }
+ }
+ catch (LinkageError e) {
+ throw new ClassNotFoundException(name);
+ }
+ catch (TypeNotPresentException e) {
+ throw new ClassNotFoundException(name);
+ }
+ }
+ }
+
+}
diff --git a/plugins/groovy/rt-constants/src/org/jetbrains/groovy/compiler/rt/GroovyRtConstants.java b/plugins/groovy/rt-constants/src/org/jetbrains/groovy/compiler/rt/GroovyRtConstants.java
index 1ef9332..2727045 100644
--- a/plugins/groovy/rt-constants/src/org/jetbrains/groovy/compiler/rt/GroovyRtConstants.java
+++ b/plugins/groovy/rt-constants/src/org/jetbrains/groovy/compiler/rt/GroovyRtConstants.java
@@ -36,7 +36,11 @@
public static final String NO_GROOVY = "Cannot compile Groovy files: no Groovy library is defined";
public static final String OPTIMIZE = "optimize";
public static final String GROOVYC_STUB_GENERATION_FAILED = "Groovyc stub generation failed";
+
public static final String STUBS_GENERATED = "Stubs generated";
public static final String JAVAC_COMPLETED = "Javac completed";
public static final String BUILD_ABORTED = "Build aborted";
+
+ public static final String GROOVYC_ASM_RESOLVING_ONLY = "groovyc.asm.resolving.only";
+ public static final String GROOVYC_CONFIG_SCRIPT = "groovyc.config.script";
}
diff --git a/plugins/groovy/rt/src/org/jetbrains/groovy/compiler/rt/DependentGroovycRunner.java b/plugins/groovy/rt/src/org/jetbrains/groovy/compiler/rt/DependentGroovycRunner.java
index 1533147..65bfe9e 100644
--- a/plugins/groovy/rt/src/org/jetbrains/groovy/compiler/rt/DependentGroovycRunner.java
+++ b/plugins/groovy/rt/src/org/jetbrains/groovy/compiler/rt/DependentGroovycRunner.java
@@ -15,7 +15,9 @@
*/
package org.jetbrains.groovy.compiler.rt;
+import groovy.lang.Binding;
import groovy.lang.GroovyClassLoader;
+import groovy.lang.GroovyShell;
import groovyjarjarasm.asm.Opcodes;
import org.codehaus.groovy.ast.*;
import org.codehaus.groovy.ast.expr.ConstantExpression;
@@ -24,13 +26,13 @@
import org.codehaus.groovy.ast.expr.MethodCallExpression;
import org.codehaus.groovy.classgen.GeneratorContext;
import org.codehaus.groovy.control.*;
+import org.codehaus.groovy.control.customizers.ImportCustomizer;
import org.codehaus.groovy.control.messages.WarningMessage;
import org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit;
import org.codehaus.groovy.tools.javac.JavaCompiler;
import org.codehaus.groovy.tools.javac.JavaCompilerFactory;
import java.io.*;
-import java.lang.reflect.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.*;
@@ -72,6 +74,24 @@
}
}
+ try {
+ if (!"false".equals(System.getProperty(GroovyRtConstants.GROOVYC_ASM_RESOLVING_ONLY))) {
+ config.getOptimizationOptions().put("asmResolving", true);
+ config.getOptimizationOptions().put("classLoaderResolving", false);
+ }
+ }
+ catch (NoSuchMethodError ignored) { // old groovyc's don't have optimization options
+ }
+
+ String configScript = System.getProperty(GroovyRtConstants.GROOVYC_CONFIG_SCRIPT);
+ if (configScript != null) {
+ try {
+ applyConfigurationScript(new File(configScript), config);
+ }
+ catch (LinkageError ignored) {
+ }
+ }
+
System.out.println(GroovyRtConstants.PRESENTABLE_MESSAGE + "Groovyc: loading sources...");
renameResources(finalOutputs, "", TEMP_RESOURCE_SUFFIX);
@@ -117,6 +137,24 @@
return false;
}
+ // adapted from https://github.com/gradle/gradle/blob/c4fdfb57d336b1a0f1b27354c758c61c0a586942/subprojects/language-groovy/src/main/java/org/gradle/api/internal/tasks/compile/ApiGroovyCompiler.java
+ private static void applyConfigurationScript(File configScript, CompilerConfiguration configuration) {
+ Binding binding = new Binding();
+ binding.setVariable("configuration", configuration);
+
+ CompilerConfiguration configuratorConfig = new CompilerConfiguration();
+ ImportCustomizer customizer = new ImportCustomizer();
+ customizer.addStaticStars("org.codehaus.groovy.control.customizers.builder.CompilerCustomizationBuilder");
+ configuratorConfig.addCompilationCustomizers(customizer);
+
+ try {
+ new GroovyShell(binding, configuratorConfig).evaluate(configScript);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
private static void renameResources(String[] finalOutputs, String removeSuffix, String addSuffix) {
for (String output : finalOutputs) {
for (String res : RESOURCES_TO_MASK) {
@@ -428,6 +466,14 @@
}
static GroovyClassLoader buildClassLoaderFor(final CompilerConfiguration compilerConfiguration, final AstAwareResourceLoader resourceLoader) {
+ final ClassDependencyLoader checkWellFormed = new ClassDependencyLoader() {
+ @Override
+ protected void loadClassDependencies(Class aClass) throws ClassNotFoundException {
+ if (resourceLoader.getSourceFile(aClass.getName()) == null) return;
+ super.loadClassDependencies(aClass);
+ }
+ };
+
GroovyClassLoader classLoader = AccessController.doPrivileged(new PrivilegedAction<GroovyClassLoader>() {
public GroovyClassLoader run() {
return new GroovyClassLoader(Thread.currentThread().getContextClassLoader(), compilerConfiguration) {
@@ -443,83 +489,7 @@
catch (LinkageError e) {
throw new RuntimeException("Problem loading class " + name, e);
}
-
- ensureWellFormed(aClass, new HashSet<Class>());
-
- return aClass;
- }
-
- private void ensureWellFormed(Type aClass, Set<Class> visited) throws ClassNotFoundException {
- if (aClass instanceof Class) {
- ensureWellFormed((Class)aClass, visited);
- }
- else if (aClass instanceof ParameterizedType) {
- ensureWellFormed(((ParameterizedType)aClass).getOwnerType(), visited);
- for (Type type : ((ParameterizedType)aClass).getActualTypeArguments()) {
- ensureWellFormed(type, visited);
- }
- }
- else if (aClass instanceof WildcardType) {
- for (Type type : ((WildcardType)aClass).getLowerBounds()) {
- ensureWellFormed(type, visited);
- }
- for (Type type : ((WildcardType)aClass).getUpperBounds()) {
- ensureWellFormed(type, visited);
- }
- }
- else if (aClass instanceof GenericArrayType) {
- ensureWellFormed(((GenericArrayType)aClass).getGenericComponentType(), visited);
- }
- }
-
- private void ensureWellFormed(Class aClass, Set<Class> visited) throws ClassNotFoundException {
- String name = aClass.getName();
- if (resourceLoader.getSourceFile(name) != null && visited.add(aClass)) {
- try {
- for (Method method : aClass.getDeclaredMethods()) {
- ensureWellFormed(method.getGenericReturnType(), visited);
- for (Type type : method.getGenericExceptionTypes()) {
- ensureWellFormed(type, visited);
- }
- for (Type type : method.getGenericParameterTypes()) {
- ensureWellFormed(type, visited);
- }
- }
- for (Constructor method : aClass.getDeclaredConstructors()) {
- for (Type type : method.getGenericExceptionTypes()) {
- ensureWellFormed(type, visited);
- }
- for (Type type : method.getGenericParameterTypes()) {
- ensureWellFormed(type, visited);
- }
- }
-
- for (Field field : aClass.getDeclaredFields()) {
- ensureWellFormed(field.getGenericType(), visited);
- }
-
- Type superclass = aClass.getGenericSuperclass();
- if (superclass != null) {
- ensureWellFormed(aClass, visited);
- }
-
- for (Type intf : aClass.getGenericInterfaces()) {
- ensureWellFormed(intf, visited);
- }
-
- aClass.getAnnotations();
- Package aPackage = aClass.getPackage();
- if (aPackage != null) {
- aPackage.getAnnotations();
- }
- }
- catch (LinkageError e) {
- throw new ClassNotFoundException(name);
- }
- catch (TypeNotPresentException e) {
- throw new ClassNotFoundException(name);
- }
- }
+ return checkWellFormed.loadDependencies(aClass);
}
};
}
diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml
index 21e305f..ec5c228 100644
--- a/plugins/groovy/src/META-INF/plugin.xml
+++ b/plugins/groovy/src/META-INF/plugin.xml
@@ -230,7 +230,6 @@
<fileTypeDetector implementation="org.jetbrains.plugins.groovy.GroovyHashBangFileTypeDetector"/>
-
<declarationRangeHandler key="org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod"
implementationClass="org.jetbrains.plugins.groovy.codeInsight.hint.GrMethodDeclarationRangeHandler"/>
<declarationRangeHandler key="org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition"
@@ -490,7 +489,7 @@
<quoteHandler fileType="Groovy" className="org.jetbrains.plugins.groovy.editor.GroovyQuoteHandler"/>
- <compileServer.plugin classpath="groovy-jps-plugin.jar"/>
+ <compileServer.plugin classpath="groovy-jps-plugin.jar;groovy-rt-constants.jar"/>
<indexPatternBuilder implementation="org.jetbrains.plugins.groovy.util.GroovyIndexPatternBuilder"/>
<todoIndexer filetype="Groovy" implementationClass="org.jetbrains.plugins.groovy.highlighter.GroovyTodoIndexer"/>
@@ -556,7 +555,7 @@
<project.converterProvider implementation="org.jetbrains.plugins.groovy.config.GroovyModuleConverterProvider"/>
<project.converterProvider implementation="org.jetbrains.plugins.groovy.config.GroovyRunConfigurationConverterProvider"/>
- <iconProvider implementation="org.jetbrains.plugins.groovy.GroovyIconProvider"/>
+ <fileIconProvider implementation="org.jetbrains.plugins.groovy.GroovyFileIconProvider"/>
<projectService serviceInterface="org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory"
serviceImplementation="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementFactoryImpl"/>
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateFieldFromUsageFix.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateFieldFromUsageFix.java
index ef19899..ee921457 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateFieldFromUsageFix.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateFieldFromUsageFix.java
@@ -20,7 +20,6 @@
import com.intellij.psi.PsiModifier;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
import org.jetbrains.plugins.groovy.lang.psi.expectedTypes.GroovyExpectedTypesProvider;
@@ -32,19 +31,11 @@
*/
public class CreateFieldFromUsageFix extends GrCreateFromUsageBaseFix {
- public CreateFieldFromUsageFix(GrReferenceExpression refExpression) {
+ private final @NotNull String myReferenceName;
+
+ public CreateFieldFromUsageFix(GrReferenceExpression refExpression, @NotNull String referenceName) {
super(refExpression);
- }
-
- @Override
- @NotNull
- public String getFamilyName() {
- return GroovyBundle.message("create.from.usage.family.name");
- }
-
- @Nullable
- private String getFieldName() {
- return getRefExpr().getReferenceName();
+ myReferenceName = referenceName;
}
private String[] generateModifiers(@NotNull PsiClass targetClass) {
@@ -62,13 +53,13 @@
@Override
@NotNull
public String getText() {
- return GroovyBundle.message("create.field.from.usage", getFieldName());
+ return GroovyBundle.message("create.field.from.usage", myReferenceName);
}
@Override
protected void invokeImpl(Project project, @NotNull PsiClass targetClass) {
final CreateFieldFix fix = new CreateFieldFix(targetClass);
- fix.doFix(targetClass.getProject(), generateModifiers(targetClass), getFieldName(), calculateTypeConstrains(), getRefExpr());
+ fix.doFix(targetClass.getProject(), generateModifiers(targetClass), myReferenceName, calculateTypeConstrains(), getRefExpr());
}
@Override
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyQuickFixFactoryImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyQuickFixFactoryImpl.java
index 8bb4149..1e1789f 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyQuickFixFactoryImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyQuickFixFactoryImpl.java
@@ -67,7 +67,8 @@
@Override
public IntentionAction createCreateFieldFromUsageFix(GrReferenceExpression expr) {
- return new CreateFieldFromUsageFix(expr);
+ final String referenceName = expr.getReferenceName();
+ return referenceName == null ? null : new CreateFieldFromUsageFix(expr, referenceName);
}
@Override
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.form b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.form
index 0fc52a4..5dd2805 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.form
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.form
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.plugins.groovy.compiler.GroovyCompilerConfigurable">
- <grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="643" height="167"/>
@@ -8,7 +8,7 @@
<properties/>
<border type="none"/>
<children>
- <grid id="838f2" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <grid id="838f2" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -25,6 +25,7 @@
</constraints>
<properties>
<text resource-bundle="messages/CompilerBundle" key="javac.option.max.heap.size"/>
+ <visible value="false"/>
</properties>
</component>
<component id="22ced" class="javax.swing.JTextField" binding="myHeapSize">
@@ -33,18 +34,28 @@
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
- <properties/>
+ <properties>
+ <visible value="false"/>
+ </properties>
</component>
<hspacer id="5e141">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
+ <component id="52aeb" class="com.intellij.ui.components.JBCheckBox" binding="myInvokeDynamicSupportCB">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Invoke &dynamic support"/>
+ </properties>
+ </component>
</children>
</grid>
<grid id="4e3dc" binding="myExcludesPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
- <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
@@ -53,14 +64,6 @@
<border type="etched" title="Exclude from stub generation"/>
<children/>
</grid>
- <component id="52aeb" class="com.intellij.ui.components.JBCheckBox" binding="myInvokeDynamicSupportCB">
- <constraints>
- <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties>
- <text value="Invoke &dynamic support"/>
- </properties>
- </component>
</children>
</grid>
</form>
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/gant/AntTasksProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/gant/AntTasksProvider.java
index 3be407e..84e50e7 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/gant/AntTasksProvider.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/gant/AntTasksProvider.java
@@ -26,7 +26,7 @@
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.impl.light.LightMethodBuilder;
@@ -125,7 +125,7 @@
for (VirtualFile jar : jars) {
VirtualFile localFile = PathUtil.getLocalFile(jar);
if (localFile.getFileSystem() instanceof LocalFileSystem) {
- urls.add(VfsUtil.convertToURL(localFile.getUrl()));
+ urls.add(VfsUtilCore.convertToURL(localFile.getUrl()));
}
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/documentation/GroovyDocumentationProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/documentation/GroovyDocumentationProvider.java
index be2e831..98d15e7 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/documentation/GroovyDocumentationProvider.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/documentation/GroovyDocumentationProvider.java
@@ -393,7 +393,7 @@
@Override
public boolean hasDocumentationFor(PsiElement element, PsiElement originalElement) {
- return CompositeDocumentationProvider.hasUrlsFor(this, element, originalElement);
+ return CompositeDocumentationProvider.hasBrowsableUrlsFor(this, element, originalElement);
}
@Override
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringBundle.properties b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringBundle.properties
index dd8b9cc..1a4703f 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringBundle.properties
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringBundle.properties
@@ -139,7 +139,7 @@
target.class.must.not.be.script=Target class must not be a script
rename.is.not.applicable.to.implicit.elements=Implicit elements cannot be renamed
rename.member=Rename {0}
-rename.property=Rename property {0}
+rename.property=Rename property ''{0}''
cannot.introduce.field.in.script=There is no class in the scope
cannot.introduce.field.in.interface=Cannot introduce field in interface
expression.contains.errors=Expression contains errors
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringSupportProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringSupportProvider.java
index adae76e..4bb5044 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringSupportProvider.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringSupportProvider.java
@@ -29,6 +29,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrLabeledStatement;
@@ -105,7 +106,7 @@
@Override
public boolean isMemberInplaceRenameAvailable(@NotNull PsiElement element, @Nullable PsiElement context) {
- if (context == null) return false;
+ if (context == null || context.getContainingFile() instanceof GroovyFile) return false;
PsiElement parent = context.getParent();
//don't try to inplace rename aliased imported references
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/rename/RenamePropertyUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/rename/RenamePropertyUtil.java
index 64352851..949d382 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/rename/RenamePropertyUtil.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/rename/RenamePropertyUtil.java
@@ -79,7 +79,7 @@
ContainerUtil.addAll(property, GroovyPropertyUtils.getAllGetters(containingClass, name, isStatic, false));
ContainerUtil.addAll(property, GroovyPropertyUtils.getAllSetters(containingClass, name, isStatic, false));
- for (Iterator<PsiElement> iterator = property.iterator(); iterator.hasNext();) {
+ for (Iterator<PsiElement> iterator = property.iterator(); iterator.hasNext(); ) {
if (iterator.next() instanceof GrAccessorMethod) iterator.remove();
}
@@ -169,7 +169,7 @@
}
private String getDescription() {
- return (UsageViewUtil.getType(myMember) + " " + myMember.getName()).trim();
+ return String.format("%s '%s'", UsageViewUtil.getType(myMember), myMember.getName());
}
public boolean renameProperty() {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/rename/inplace/GrMethodInplaceRenameHandler.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/rename/inplace/GrMethodInplaceRenameHandler.java
index 2bad314..a7b7fe1 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/rename/inplace/GrMethodInplaceRenameHandler.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/rename/inplace/GrMethodInplaceRenameHandler.java
@@ -22,6 +22,7 @@
import com.intellij.refactoring.rename.inplace.MemberInplaceRenameHandler;
import com.intellij.refactoring.rename.inplace.MemberInplaceRenamer;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
/**
@@ -31,8 +32,7 @@
@Override
protected boolean isAvailable(PsiElement element, Editor editor, PsiFile file) {
if (!editor.getSettings().isVariableInplaceRenameEnabled()) return false;
-
- return element instanceof GrMethod;
+ return element instanceof GrMethod && file instanceof GroovyFile;
}
@NotNull
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy
index 4564d78..bd9aff7 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy
@@ -17,6 +17,7 @@
package org.jetbrains.plugins.groovy.compiler
import com.intellij.compiler.CompilerConfiguration
import com.intellij.compiler.CompilerConfigurationImpl
+import com.intellij.compiler.CompilerWorkspaceConfiguration
import com.intellij.compiler.server.BuildManager
import com.intellij.execution.executors.DefaultRunExecutor
import com.intellij.execution.impl.DefaultJavaProgramRunner
@@ -94,7 +95,7 @@
assertOutput("Foo", "239");
}
- private void shouldFail(Closure action) {
+ protected static void shouldFail(Closure action) {
List<CompilerMessage> messages = action()
assert messages.find { it.category == CompilerMessageCategory.ERROR }
}
@@ -883,10 +884,12 @@
assertTrue(exceptionFound.get());
}
- public void "test extend GroovyTestCase"() {
+ public void "test extend groovy classes with additional dependencies"() {
PsiTestUtil.addLibrary(myModule, "junit", GroovyFacetUtil.libDirectory, "junit.jar");
+ PsiTestUtil.addLibrary(myModule, "cli", FileUtil.toCanonicalPath(PluginPathManager.getPluginHomePath("groovy") + "/../../build/lib"), "commons-cli-1.2.jar");
myFixture.addFileToProject("a.groovy", "class Foo extends GroovyTestCase {}")
+ myFixture.addFileToProject("b.groovy", "class Bar extends CliBuilder {}")
assertEmpty(make())
}
@@ -905,6 +908,17 @@
assert error?.virtualFile
assert groovyFile.classes[0] == GroovyCompilerLoader.findClassByStub(project, error.virtualFile)
}
+
+ public void "test config script"() {
+ def script = FileUtil.createTempFile("configScriptTest", ".groovy", true)
+ FileUtil.writeToFile(script, "import groovy.transform.*; withConfig(configuration) { ast(CompileStatic) }")
+
+ CompilerWorkspaceConfiguration.getInstance(project).COMPILER_PROCESS_ADDITIONAL_VM_OPTIONS = "-Dgroovyc.config.script=" + script.path
+
+ myFixture.addFileToProject("a.groovy", "class A { int s = 'foo' }")
+ shouldFail { make() }
+ }
+
}
static class EclipseTest extends GroovyCompilerTest {
diff --git a/plugins/javaFX/javaFX-CE/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXHighlightingTest.java b/plugins/javaFX/javaFX-CE/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXHighlightingTest.java
index e2f2947c..ca2df73 100644
--- a/plugins/javaFX/javaFX-CE/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXHighlightingTest.java
+++ b/plugins/javaFX/javaFX-CE/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXHighlightingTest.java
@@ -228,6 +228,18 @@
doTest();
}
+ public void testInstantiationAcceptanceWithNameArg() throws Exception {
+ myFixture.addClass("package p;\n" +
+ "public class Root extends javafx.scene.layout.GridPane{\n" +
+ " public Root(@javafx.beans.NamedArg(\"axis\") javafx.scene.Node node ) {\n" +
+ " super(node)\n" +
+ " }\n" +
+ " public javafx.beans.property.Property<javafx.scene.Node> axis;" +
+ " public void setAxis() {}" +
+ "} ");
+ doTest(getTestName(true) + ".fxml");
+ }
+
public void testFqnTagNames() throws Exception {
doTest();
}
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxCommonClassNames.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxCommonClassNames.java
index d90b961..bb1f62d 100644
--- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxCommonClassNames.java
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxCommonClassNames.java
@@ -44,7 +44,8 @@
@NonNls public static final String JAVAFX_BEANS_VALUE_OBSERVABLE_VALUE = "javafx.beans.value.ObservableValue";
@NonNls public static final String JAVAFX_BEANS_VALUE_WRITABLE_VALUE = "javafx.beans.value.WritableValue";
@NonNls public static final String JAVAFX_SCENE_LAYOUT_PANE = "javafx.scene.layout.Pane";
-
+ @NonNls public static final String JAVAFX_BEANS_NAMED_ARG = "javafx.beans.NamedArg";
+
public static final Map<String, PsiType> ourWritableMap = new HashMap<String, PsiType>();
static {
ourWritableMap.put("javafx.beans.value.WritableBooleanValue", PsiType.BOOLEAN);
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxPsiUtil.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxPsiUtil.java
index 3bfc162..c72b032 100644
--- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxPsiUtil.java
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxPsiUtil.java
@@ -423,7 +423,16 @@
public static String isAbleToInstantiate(final PsiClass psiClass) {
if(psiClass.getConstructors().length > 0) {
for (PsiMethod constr : psiClass.getConstructors()) {
- if (constr.getParameterList().getParametersCount() == 0) return null;
+ final PsiParameter[] parameters = constr.getParameterList().getParameters();
+ if (parameters.length == 0) return null;
+ boolean annotated = true;
+ for (PsiParameter parameter : parameters) {
+ if (!AnnotationUtil.isAnnotated(parameter, JavaFxCommonClassNames.JAVAFX_BEANS_NAMED_ARG, false)) {
+ annotated = false;
+ break;
+ }
+ }
+ if (annotated) return null;
}
final PsiMethod valueOf = findValueOfMethod(psiClass);
if (valueOf == null) {
@@ -527,15 +536,15 @@
return false;
}
- public static PsiType getWrappedPropertyType(PsiField field, final Project project, final Map<String, PsiType> typeMap) {
- final PsiType fieldType = field.getType();
- final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(fieldType);
- final PsiClass fieldClass = resolveResult.getElement();
- if (fieldClass == null) return fieldType;
- return CachedValuesManager.getManager(project).getCachedValue(field, new CachedValueProvider<PsiType>() {
+ public static PsiType getWrappedPropertyType(final PsiField field, final Project project, final Map<String, PsiType> typeMap) {
+ return CachedValuesManager.getCachedValue(field, new CachedValueProvider<PsiType>() {
@Nullable
@Override
public Result<PsiType> compute() {
+ final PsiType fieldType = field.getType();
+ final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(fieldType);
+ final PsiClass fieldClass = resolveResult.getElement();
+ if (fieldClass == null) return Result.create(fieldType, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
PsiType substitute = null;
for (String typeName : typeMap.keySet()) {
if (InheritanceUtil.isInheritor(fieldType, typeName)) {
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxScopeEnlarger.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxScopeEnlarger.java
index ea83911..315eb41 100644
--- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxScopeEnlarger.java
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxScopeEnlarger.java
@@ -15,6 +15,7 @@
*/
package org.jetbrains.plugins.javaFX.fxml.refs;
+import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
@@ -26,6 +27,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.javaFX.JavaFxControllerClassIndex;
+import org.jetbrains.plugins.javaFX.fxml.JavaFxCommonClassNames;
import org.jetbrains.plugins.javaFX.fxml.JavaFxFileTypeFactory;
/**
@@ -47,7 +49,9 @@
}
if (containingClass != null) {
- if (element instanceof PsiField && ((PsiField)element).hasModifierProperty(PsiModifier.PRIVATE) || element instanceof PsiParameter) {
+ if (element instanceof PsiField &&
+ !((PsiField)element).hasModifierProperty(PsiModifier.PUBLIC) &&
+ AnnotationUtil.isAnnotated((PsiField)element, JavaFxCommonClassNames.JAVAFX_FXML_ANNOTATION, false) || element instanceof PsiParameter) {
final Project project = element.getProject();
final String qualifiedName = containingClass.getQualifiedName();
if (qualifiedName != null && !JavaFxControllerClassIndex.findFxmlWithController(project, qualifiedName).isEmpty()) {
diff --git a/plugins/javaFX/testData/highlighting/instantiationAcceptanceWithNameArg.fxml b/plugins/javaFX/testData/highlighting/instantiationAcceptanceWithNameArg.fxml
new file mode 100644
index 0000000..b316250
--- /dev/null
+++ b/plugins/javaFX/testData/highlighting/instantiationAcceptanceWithNameArg.fxml
@@ -0,0 +1,4 @@
+<?import p.Root?>
+<Root xmlns:fx="http://javafx.com/fxml">
+ <axis/>
+</Root>
diff --git a/plugins/junit/src/com/intellij/execution/junit/TestPackage.java b/plugins/junit/src/com/intellij/execution/junit/TestPackage.java
index 3cbf41a..c6d2fe4 100644
--- a/plugins/junit/src/com/intellij/execution/junit/TestPackage.java
+++ b/plugins/junit/src/com/intellij/execution/junit/TestPackage.java
@@ -388,7 +388,7 @@
public void run(@NotNull ProgressIndicator indicator) {
try {
mySocket = myServerSocket.accept();
- DumbService.getInstance(myProject).repeatUntilPassesInSmartMode(new Runnable() {
+ DumbService.getInstance(getProject()).repeatUntilPassesInSmartMode(new Runnable() {
@Override
public void run() {
myClasses.clear();
@@ -410,8 +410,13 @@
@Override
public void onSuccess() {
- myCallback.found(myClasses, myJunit4[0]);
- finish();
+ DumbService.getInstance(getProject()).runWhenSmart(new Runnable() {
+ @Override
+ public void run() {
+ myCallback.found(myClasses, myJunit4[0]);
+ finish();
+ }
+ });
}
}
diff --git a/plugins/junit/src/com/intellij/execution/junit2/inspection/JUnitEntryPoint.java b/plugins/junit/src/com/intellij/execution/junit2/inspection/JUnitEntryPoint.java
index aeac44a..6af45ca 100644
--- a/plugins/junit/src/com/intellij/execution/junit2/inspection/JUnitEntryPoint.java
+++ b/plugins/junit/src/com/intellij/execution/junit2/inspection/JUnitEntryPoint.java
@@ -33,6 +33,7 @@
import com.intellij.psi.PsiModifier;
import com.intellij.psi.search.searches.ClassInheritorsSearch;
import com.intellij.psi.util.PsiClassUtil;
+import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.CommonProcessors;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
@@ -56,6 +57,10 @@
final PsiClass aClass = (PsiClass)psiElement;
if (JUnitUtil.isTestClass(aClass, false, true)) {
if (!PsiClassUtil.isRunnableClass(aClass, true, true)) {
+ final PsiClass topLevelClass = PsiTreeUtil.getTopmostParentOfType(aClass, PsiClass.class);
+ if (topLevelClass != null && PsiClassUtil.isRunnableClass(topLevelClass, true, true)) {
+ return true;
+ }
final CommonProcessors.FindProcessor<PsiClass> findProcessor = new CommonProcessors.FindProcessor<PsiClass>() {
@Override
protected boolean accept(PsiClass psiClass) {
diff --git a/plugins/junit/src/com/intellij/execution/junit2/ui/TestsPacketsReceiver.java b/plugins/junit/src/com/intellij/execution/junit2/ui/TestsPacketsReceiver.java
index c92b980..9970bce 100644
--- a/plugins/junit/src/com/intellij/execution/junit2/ui/TestsPacketsReceiver.java
+++ b/plugins/junit/src/com/intellij/execution/junit2/ui/TestsPacketsReceiver.java
@@ -153,8 +153,8 @@
final String parentClass = currentTest.getInfo().getComment();
TestProxy dynamicParent = myKnownDynamicParents.get(parentClass);
if (dynamicParent == null) {
- final TestProxy root = model.getRoot();
- if (Comparing.strEqual(parentClass, StringUtil.getQualifiedName(root.getInfo().getComment(), root.getName()))) {
+ final TestProxy root = findParent(parentClass, model.getRoot());
+ if (root != null) {
dynamicParent = root;
}
else {
@@ -167,13 +167,31 @@
public void readFrom(ObjectReader reader) {
}
});
- root.addChild(dynamicParent);
+ model.getRoot().addChild(dynamicParent);
}
myKnownDynamicParents.put(parentClass, dynamicParent);
}
return dynamicParent;
}
+ private static TestProxy findParent(String parentClass, TestProxy root) {
+ if (isAccepted(root, parentClass)) {
+ return root;
+ }
+
+ for (TestProxy proxy : root.getChildren()) {
+ if (isAccepted(proxy, parentClass)) {
+ return proxy;
+ }
+ }
+
+ return null;
+ }
+
+ private static boolean isAccepted(TestProxy root, String parentClass) {
+ return Comparing.strEqual(parentClass, StringUtil.getQualifiedName(root.getInfo().getComment(), root.getName()));
+ }
+
public void notifyTestResult(ObjectReader reader) {
final TestProxy testProxy = reader.readObject();
diff --git a/plugins/junit/src/fileTemplates/code/JUnit3 Test Class.java.html b/plugins/junit/src/fileTemplates/code/JUnit3 Test Class.java.html
index a015267..fa8f461 100644
--- a/plugins/junit/src/fileTemplates/code/JUnit3 Test Class.java.html
+++ b/plugins/junit/src/fileTemplates/code/JUnit3 Test Class.java.html
@@ -17,6 +17,11 @@
<td valign="top"><font face="verdana" size="-1">name of the created class.</font></td>
</tr>
<tr>
+ <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${CLASS_NAME}</b></font></nobr></td>
+ <td width="10"> </td>
+ <td valign="top"><font face="verdana" size="-1">name of the tested class.</font></td>
+ </tr>
+ <tr>
<td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
<td width="10"> </td>
<td valign="top"><font face="verdana" size="-1">generated class body.</font></td>
diff --git a/plugins/junit/src/fileTemplates/code/JUnit4 Test Class.java.html b/plugins/junit/src/fileTemplates/code/JUnit4 Test Class.java.html
index c2ff42e..17c69de 100644
--- a/plugins/junit/src/fileTemplates/code/JUnit4 Test Class.java.html
+++ b/plugins/junit/src/fileTemplates/code/JUnit4 Test Class.java.html
@@ -17,6 +17,11 @@
<td valign="top"><font face="verdana" size="-1">name of the created class.</font></td>
</tr>
<tr>
+ <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${CLASS_NAME}</b></font></nobr></td>
+ <td width="10"> </td>
+ <td valign="top"><font face="verdana" size="-1">name of the tested class.</font></td>
+ </tr>
+ <tr>
<td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
<td width="10"> </td>
<td valign="top"><font face="verdana" size="-1">generated class body.</font></td>
diff --git a/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestResultsSender.java b/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestResultsSender.java
index c8a6890..1efc060 100644
--- a/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestResultsSender.java
+++ b/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestResultsSender.java
@@ -81,6 +81,7 @@
testStarted(description);
stopMeter(description);
prepareIgnoredPacket(description, val).addLimitedString("").addLimitedString("").send();
+ myRegistry.forget(description);
}
private void doAddFailure(final Description test, final Throwable assertion) {
diff --git a/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestRunnerUtil.java b/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestRunnerUtil.java
index 1bab2d6..9dd2001 100644
--- a/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestRunnerUtil.java
+++ b/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestRunnerUtil.java
@@ -28,6 +28,7 @@
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.Parameterized;
+import org.junit.runners.Suite;
import org.junit.runners.model.FrameworkMethod;
import java.io.BufferedReader;
@@ -324,13 +325,14 @@
}
}
- private static class SelectedParameterizedRunner extends Parameterized {
+ private static class SelectedParameterizedRunner extends Suite {
+ public static final List NO_RUNNERS = new ArrayList();
private final String myName;
private final String myMethodName;
private Parameterized myRunnerClass;
public SelectedParameterizedRunner(Class clazz, String name, String methodName, Class runnerClass) throws Throwable {
- super(clazz);
+ super(clazz, NO_RUNNERS);
myName = name;
myMethodName = methodName;
myRunnerClass = (Parameterized)runnerClass.getConstructor(new Class[] {Class.class}).newInstance(new Object[]{clazz});
@@ -341,7 +343,7 @@
try {
Method getChildren = Parameterized.class.getDeclaredMethod("getChildren", new Class[0]);
getChildren.setAccessible(true);
- children = (List)getChildren.invoke(myRunnerClass, new Object[0]);
+ children = new ArrayList((List)getChildren.invoke(myRunnerClass, new Object[0]));
}
catch (Throwable e) {
children = super.getChildren();
@@ -388,7 +390,7 @@
final BlockJUnit4ClassRunner child = (BlockJUnit4ClassRunner)children.get(i);
final Method getChildrenMethod = BlockJUnit4ClassRunner.class.getDeclaredMethod("getChildren", new Class[0]);
getChildrenMethod.setAccessible(true);
- final List list = (List)getChildrenMethod.invoke(child, new Object[0]);
+ final List list = new ArrayList ((List)getChildrenMethod.invoke(child, new Object[0]));
for (Iterator iterator = list.iterator(); iterator.hasNext(); ) {
final FrameworkMethod description = (FrameworkMethod)iterator.next();
if (!description.getName().equals(myMethodName)) {
diff --git a/plugins/maven/maven32-server-impl/src/org/jetbrains/idea/maven/server/Maven32ServerEmbedderImpl.java b/plugins/maven/maven32-server-impl/src/org/jetbrains/idea/maven/server/Maven32ServerEmbedderImpl.java
index fedbc69..6c5cd37 100644
--- a/plugins/maven/maven32-server-impl/src/org/jetbrains/idea/maven/server/Maven32ServerEmbedderImpl.java
+++ b/plugins/maven/maven32-server-impl/src/org/jetbrains/idea/maven/server/Maven32ServerEmbedderImpl.java
@@ -16,6 +16,7 @@
package org.jetbrains.idea.maven.server;
import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.ReflectionUtil;
import com.intellij.util.SystemProperties;
import gnu.trove.THashMap;
@@ -632,6 +633,9 @@
ReflectionUtil.findMethod(ReflectionUtil.getClassDeclaredMethods(result.getClass()), "setMultiModuleProjectDirectory", File.class);
if (setMultiModuleProjectDirectoryMethod != null) {
try {
+ if (file == null) {
+ file = new File(FileUtil.getTempDirectory());
+ }
setMultiModuleProjectDirectoryMethod.invoke(result, MavenServerUtil.findMavenBasedir(file));
}
catch (Exception e) {
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/configurers/MavenCompilerConfigurer.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/configurers/MavenCompilerConfigurer.java
index e65e6f0..54f0463 100644
--- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/configurers/MavenCompilerConfigurer.java
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/configurers/MavenCompilerConfigurer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -16,13 +16,14 @@
package org.jetbrains.idea.maven.importing.configurers;
import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.CompilerConfigurationImpl;
import com.intellij.openapi.compiler.options.ExcludeEntryDescription;
import com.intellij.openapi.compiler.options.ExcludesConfiguration;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Key;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.util.ObjectUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.maven.project.MavenProject;
@@ -31,32 +32,27 @@
* @author Sergey Evdokimov
*/
public class MavenCompilerConfigurer extends MavenModuleConfigurer {
+
+ public static final Key<Boolean> IGNORE_MAVEN_COMPILER_TARGET_KEY = Key.create("idea.maven.skip.compiler.target.level");
+
@Override
public void configure(@NotNull MavenProject mavenProject, @NotNull Project project, @Nullable Module module) {
if (module == null) return;
- String targetLevel = mavenProject.getTargetLevel();
- // default source and target settings of maven-compiler-plugin is 1.5, see details at http://maven.apache.org/plugins/maven-compiler-plugin
- if (targetLevel == null) {
- targetLevel = "1.5";
+ CompilerConfiguration configuration = CompilerConfiguration.getInstance(project);
+ Boolean ignoreMavenCompilerTargetOption = module.getUserData(IGNORE_MAVEN_COMPILER_TARGET_KEY);
+ if (ignoreMavenCompilerTargetOption == null || !ignoreMavenCompilerTargetOption.booleanValue()) {
+ String targetLevel = mavenProject.getTargetLevel();
+ // default source and target settings of maven-compiler-plugin is 1.5, see details at http://maven.apache.org/plugins/maven-compiler-plugin
+ configuration.setBytecodeTargetLevel(module, ObjectUtils.notNull(targetLevel, "1.5"));
}
-
- CompilerConfigurationImpl configuration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(project);
- configuration.setBytecodeTargetLevel(module, targetLevel);
-
- VirtualFile directoryFile = mavenProject.getDirectoryFile();
+ module.putUserData(IGNORE_MAVEN_COMPILER_TARGET_KEY, Boolean.FALSE);
// Exclude src/main/archetype-resources
- VirtualFile archetypeResourcesDir = VfsUtil.findRelativeFile(directoryFile, "src", "main", "resources", "archetype-resources");
-
- if (archetypeResourcesDir != null) {
- CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(project);
-
- if (!compilerConfiguration.isExcludedFromCompilation(archetypeResourcesDir)) {
- ExcludesConfiguration cfg = compilerConfiguration.getExcludedEntriesConfiguration();
-
- cfg.addExcludeEntryDescription(new ExcludeEntryDescription(archetypeResourcesDir, true, false, project));
- }
+ VirtualFile dir = VfsUtil.findRelativeFile(mavenProject.getDirectoryFile(), "src", "main", "resources", "archetype-resources");
+ if (dir != null && !configuration.isExcludedFromCompilation(dir)) {
+ ExcludesConfiguration cfg = configuration.getExcludedEntriesConfiguration();
+ cfg.addExcludeEntryDescription(new ExcludeEntryDescription(dir, true, false, project));
}
}
}
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/MavenProjectsNavigator.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/MavenProjectsNavigator.java
index 807971b..e25cdd6 100644
--- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/MavenProjectsNavigator.java
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/MavenProjectsNavigator.java
@@ -26,10 +26,7 @@
import com.intellij.openapi.actionSystem.CommonShortcuts;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.components.PersistentStateComponent;
-import com.intellij.openapi.components.State;
-import com.intellij.openapi.components.Storage;
-import com.intellij.openapi.components.StoragePathMacros;
+import com.intellij.openapi.components.*;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
@@ -40,6 +37,9 @@
import com.intellij.openapi.wm.ex.ToolWindowEx;
import com.intellij.openapi.wm.ex.ToolWindowManagerAdapter;
import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
+import com.intellij.ui.content.Content;
+import com.intellij.ui.content.ContentFactory;
+import com.intellij.ui.content.ContentManager;
import com.intellij.ui.treeStructure.SimpleTree;
import com.intellij.util.containers.ContainerUtil;
import icons.MavenIcons;
@@ -278,8 +278,13 @@
editSource.registerCustomShortcutSet(CommonShortcuts.getEditSource(), myTree, myProject);
final ToolWindowManagerEx manager = ToolWindowManagerEx.getInstanceEx(myProject);
- myToolWindow = (ToolWindowEx)manager.registerToolWindow(TOOL_WINDOW_ID, panel, ToolWindowAnchor.RIGHT, myProject, true);
+ myToolWindow = (ToolWindowEx)manager.registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.RIGHT, myProject, true);
myToolWindow.setIcon(MavenIcons.ToolWindowMaven);
+ final ContentFactory contentFactory = ServiceManager.getService(ContentFactory.class);
+ final Content content = contentFactory.createContent(panel, "", false);
+ ContentManager contentManager = myToolWindow.getContentManager();
+ contentManager.addContent(content);
+ contentManager.setSelectedContent(content, false);
final ToolWindowManagerAdapter listener = new ToolWindowManagerAdapter() {
boolean wasVisible = false;
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProject.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProject.java
index 01fc838..eebaa71 100644
--- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProject.java
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProject.java
@@ -61,6 +61,7 @@
.put("1.5", "1.5")
.put("5", "1.5")
.put("1.6", "1.6")
+ .put("6", "1.6")
.put("1.7", "1.7")
.put("7", "1.7")
.put("1.8", "1.8")
diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/ReimportingTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/ReimportingTest.java
index 48a4981..7f52b7d 100644
--- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/ReimportingTest.java
+++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/ReimportingTest.java
@@ -15,6 +15,7 @@
*/
package org.jetbrains.idea.maven.importing;
+import com.intellij.compiler.CompilerConfiguration;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.module.ModifiableModuleModel;
import com.intellij.openapi.module.Module;
@@ -252,6 +253,54 @@
}
+ public void testSettingTargetLevel() throws Exception {
+ createModulePom("m1", "<groupId>test</groupId>" +
+ "<artifactId>project</artifactId>" +
+ "<version>1</version>");
+ importProject();
+ assertEquals("1.5", CompilerConfiguration.getInstance(myProject).getBytecodeTargetLevel(getModule("m1")));
+
+ createModulePom("m1", "<groupId>test</groupId>" +
+ "<artifactId>m1</artifactId>" +
+ "<version>1</version>" +
+ "<build>" +
+ " <plugins>" +
+ " <plugin>" +
+ " <artifactId>maven-compiler-plugin</artifactId>" +
+ " <configuration>" +
+ " <target>1.3</target>" +
+ " </configuration>" +
+ " </plugin>" +
+ " </plugins>" +
+ "</build>");
+ importProject();
+ assertEquals("1.3", CompilerConfiguration.getInstance(myProject).getBytecodeTargetLevel(getModule("m1")));
+
+ createModulePom("m1", "<groupId>test</groupId>" +
+ "<artifactId>m1</artifactId>" +
+ "<version>1</version>" +
+ "<build>" +
+ " <plugins>" +
+ " <plugin>" +
+ " <artifactId>maven-compiler-plugin</artifactId>" +
+ " <configuration>" +
+ " <target>1.6</target>" +
+ " </configuration>" +
+ " </plugin>" +
+ " </plugins>" +
+ "</build>");
+
+ importProject();
+ assertEquals("1.6", CompilerConfiguration.getInstance(myProject).getBytecodeTargetLevel(getModule("m1")));
+
+ // after configuration/target element delete in maven-compiler-plugin CompilerConfiguration#getBytecodeTargetLevel should be also updated
+ createModulePom("m1", "<groupId>test</groupId>" +
+ "<artifactId>project</artifactId>" +
+ "<version>1</version>");
+ importProject();
+ assertEquals("1.5", CompilerConfiguration.getInstance(myProject).getBytecodeTargetLevel(getModule("m1")));
+ }
+
private static String createPomXmlWithModuleDependency(final String dependencyType) {
return "<groupId>test</groupId>" +
"<artifactId>m1</artifactId>" +
diff --git a/plugins/tasks/tasks-api/src/com/intellij/tasks/CustomTaskState.java b/plugins/tasks/tasks-api/src/com/intellij/tasks/CustomTaskState.java
index e065315..7954b08 100644
--- a/plugins/tasks/tasks-api/src/com/intellij/tasks/CustomTaskState.java
+++ b/plugins/tasks/tasks-api/src/com/intellij/tasks/CustomTaskState.java
@@ -1,5 +1,6 @@
package com.intellij.tasks;
+import com.intellij.util.xmlb.annotations.Attribute;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -28,6 +29,7 @@
*
* @see TaskRepository#setTaskState(Task, CustomTaskState)
*/
+ @Attribute("id")
@NotNull
public String getId() {
return myId;
@@ -43,6 +45,7 @@
/**
* Text that describes this state and will be shown to user in UI (unlike ID it's not necessarily unique).
*/
+ @Attribute("name")
@NotNull
public String getPresentableName() {
return myPresentableName;
@@ -112,7 +115,8 @@
*
* @see #asPredefined()
*/
- private boolean isPredefined() {
+ @Attribute("predefined")
+ public boolean isPredefined() {
return myPredefined;
}
diff --git a/plugins/tasks/tasks-api/src/com/intellij/tasks/TaskRepository.java b/plugins/tasks/tasks-api/src/com/intellij/tasks/TaskRepository.java
index c6e270f..5dfc12d 100644
--- a/plugins/tasks/tasks-api/src/com/intellij/tasks/TaskRepository.java
+++ b/plugins/tasks/tasks-api/src/com/intellij/tasks/TaskRepository.java
@@ -247,14 +247,9 @@
* @see TaskRepository#getFeatures()
*/
public void setTaskState(@NotNull Task task, @NotNull CustomTaskState state) throws Exception {
- TaskState predefinedState = null;
- try {
- predefinedState = TaskState.valueOf(state.getId());
- }
- catch (IllegalArgumentException ignored) {
- }
- if (predefinedState != null) {
- setTaskState(task, predefinedState);
+ if (state.isPredefined()) {
+ //noinspection ConstantConditions
+ setTaskState(task, state.asPredefined());
}
}
diff --git a/plugins/tasks/tasks-api/src/com/intellij/tasks/config/BaseRepositoryEditor.java b/plugins/tasks/tasks-api/src/com/intellij/tasks/config/BaseRepositoryEditor.java
index 0fdca7a..98729c9 100644
--- a/plugins/tasks/tasks-api/src/com/intellij/tasks/config/BaseRepositoryEditor.java
+++ b/plugins/tasks/tasks-api/src/com/intellij/tasks/config/BaseRepositoryEditor.java
@@ -19,6 +19,7 @@
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorFactory;
+import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.tasks.TaskManager;
@@ -32,6 +33,7 @@
import com.intellij.ui.components.JBTabbedPane;
import com.intellij.util.Consumer;
import com.intellij.util.net.HttpConfigurable;
+import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -117,6 +119,7 @@
myAddCommitMessage.setSelected(repository.isShouldFormatCommitMessage());
myDocument = EditorFactory.getInstance().createDocument(repository.getCommitMessageFormat());
myEditor = EditorFactory.getInstance().createEditor(myDocument);
+ myEditor.getSettings().setCaretRowShown(false);
myEditorPanel.add(myEditor.getComponent(), BorderLayout.CENTER);
myComment.setText("Available placeholders: " + repository.getComment());
String advertiser = repository.getRepositoryType().getAdvertiser();
@@ -141,6 +144,7 @@
installListener(myLoginAnonymouslyJBCheckBox);
enableButtons();
+ enableEditor();
JComponent customPanel = createCustomPanel();
if (customPanel != null) {
@@ -234,6 +238,7 @@
try {
myApplying = true;
apply();
+ enableEditor();
}
finally {
myApplying = false;
@@ -241,6 +246,12 @@
}
}
+ private void enableEditor() {
+ boolean selected = myAddCommitMessage.isSelected();
+ UIUtil.setEnabled(myEditorPanel, selected, true);
+ ((EditorEx)myEditor).setRendererMode(!selected);
+ }
+
public JComponent createComponent() {
return myPanel;
}
diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskAction.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskAction.java
index 7bf2afa..43dea16 100644
--- a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskAction.java
+++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskAction.java
@@ -50,7 +50,7 @@
repository.setPreferredCloseTaskState(taskState);
}
catch (Exception e1) {
- Messages.showErrorDialog(project, e1.getMessage(), "Cannot Resolve Issue");
+ Messages.showErrorDialog(project, e1.getMessage(), "Cannot Set State For Issue");
}
}
if (dialog.isCommitChanges()) {
diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskDialog.form b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskDialog.form
index 7508f5a..dae0bfe 100644
--- a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskDialog.form
+++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskDialog.form
@@ -73,14 +73,6 @@
<properties/>
<border type="none"/>
<children>
- <component id="b0266" class="javax.swing.JLabel" binding="myStateComboBoxLabel">
- <constraints>
- <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties>
- <text value="Mark &as:"/>
- </properties>
- </component>
<hspacer id="76017">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
@@ -90,7 +82,14 @@
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
- <properties/>
+ </component>
+ <component id="a5cec" class="com.intellij.ui.components.JBCheckBox" binding="myUpdateState">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="&Update issue state"/>
+ </properties>
</component>
</children>
</grid>
diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskDialog.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskDialog.java
index 3fd1662..bd7f3d3 100644
--- a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskDialog.java
+++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskDialog.java
@@ -16,6 +16,7 @@
package com.intellij.tasks.actions;
+import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.vcs.VcsType;
@@ -31,12 +32,16 @@
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.util.Collection;
/**
* @author Dmitry Avdeev
*/
public class CloseTaskDialog extends DialogWrapper {
+ private static final String UPDATE_STATE_ENABLED = "tasks.close.task.update.state.enabled";
+
private final Project myProject;
private final LocalTask myTask;
private JCheckBox myCommitChanges;
@@ -46,6 +51,7 @@
private JPanel myVcsPanel;
private JLabel myStateComboBoxLabel;
private TaskStateCombo myStateCombo;
+ private JBCheckBox myUpdateState;
private final TaskManagerImpl myTaskManager;
public CloseTaskDialog(Project project, final LocalTask task) {
@@ -57,12 +63,25 @@
myTaskLabel.setText(TaskUtil.getTrimmedSummary(task));
myTaskLabel.setIcon(task.getIcon());
- myStateComboBoxLabel.setLabelFor(myStateCombo);
- if (!TaskStateCombo.isStateSupportedFor(task)) {
- myStateComboBoxLabel.setVisible(false);
+ if (!TaskStateCombo.stateUpdatesSupportedFor(task)) {
myStateCombo.setVisible(false);
}
+ final boolean stateUpdatesEnabled = PropertiesComponent.getInstance(myProject).getBoolean(UPDATE_STATE_ENABLED, false);
+ myUpdateState.setSelected(stateUpdatesEnabled);
+ myStateCombo.setEnabled(stateUpdatesEnabled);
+ myUpdateState.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ final boolean selected = myUpdateState.isSelected();
+ myStateCombo.setEnabled(selected);
+ PropertiesComponent.getInstance(myProject).setValue(UPDATE_STATE_ENABLED, String.valueOf(selected));
+ if (selected) {
+ myStateCombo.scheduleUpdateOnce();
+ }
+ }
+ });
+
myTaskManager = (TaskManagerImpl)TaskManager.getManager(project);
if (myTaskManager.isVcsEnabled()) {
@@ -84,7 +103,9 @@
if (preferredFocusedComponent != null) {
myStateCombo.registerUpDownAction(preferredFocusedComponent);
}
- myStateCombo.scheduleUpdate();
+ if (myUpdateState.isSelected()) {
+ myStateCombo.scheduleUpdateOnce();
+ }
init();
}
@@ -95,12 +116,12 @@
@Nullable
@Override
public JComponent getPreferredFocusedComponent() {
- return myStateCombo.isVisible() ? myStateCombo.getComboBox() : null;
+ return myStateCombo.isVisible() && myUpdateState.isSelected() ? myStateCombo.getComboBox() : null;
}
@Nullable
CustomTaskState getCloseIssueState() {
- return myStateCombo.getSelectedState();
+ return myUpdateState.isSelected() ? myStateCombo.getSelectedState() : null;
}
boolean isCommitChanges() {
diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.form b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.form
index 64b57bd..c66261c 100644
--- a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.form
+++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.form
@@ -138,14 +138,6 @@
<properties/>
<border type="none"/>
<children>
- <component id="f14c2" class="javax.swing.JLabel" binding="myTaskStateLabel">
- <constraints>
- <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties>
- <text value="&Mark as:"/>
- </properties>
- </component>
<hspacer id="94ebc">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
@@ -156,6 +148,14 @@
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</component>
+ <component id="459c8" class="com.intellij.ui.components.JBCheckBox" binding="myUpdateState">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="&Update issue state"/>
+ </properties>
+ </component>
</children>
</grid>
</children>
diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.java
index a006604..b8cdd89 100644
--- a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.java
+++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.java
@@ -51,6 +51,7 @@
public class OpenTaskDialog extends DialogWrapper {
private final static Logger LOG = Logger.getInstance("#com.intellij.tasks.actions.SimpleOpenTaskDialog");
private static final String START_FROM_BRANCH = "start.from.branch";
+ private static final String UPDATE_STATE_ENABLED = "tasks.open.task.update.state.enabled";
private JPanel myPanel;
@BindControl(value = "clearContext", instant = true)
@@ -61,9 +62,9 @@
private JTextField myChangelistName;
private JBCheckBox myCreateBranch;
private JBCheckBox myCreateChangelist;
+ private JBCheckBox myUpdateState;
private JBLabel myFromLabel;
private ComboBox myBranchFrom;
- private JLabel myTaskStateLabel;
private TaskStateCombo myTaskStateCombo;
private final Project myProject;
@@ -84,11 +85,23 @@
binder.bindAnnotations(this);
binder.reset();
- myTaskStateLabel.setLabelFor(myTaskStateCombo);
- if (!TaskStateCombo.isStateSupportedFor(task)) {
- myTaskStateLabel.setVisible(false);
+ if (!TaskStateCombo.stateUpdatesSupportedFor(task)) {
+ myUpdateState.setVisible(false);
myTaskStateCombo.setVisible(false);
}
+ final boolean stateUpdatesEnabled = PropertiesComponent.getInstance(project).getBoolean(UPDATE_STATE_ENABLED, true);
+ myUpdateState.setSelected(stateUpdatesEnabled);
+ myUpdateState.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ final boolean selected = myUpdateState.isSelected();
+ PropertiesComponent.getInstance(project).setValue(UPDATE_STATE_ENABLED, String.valueOf(selected));
+ updateFields(false);
+ if (selected) {
+ myTaskStateCombo.scheduleUpdateOnce();
+ }
+ }
+ });
TaskManagerImpl.Config state = taskManager.getState();
myClearContext.setSelected(state.clearContext);
@@ -118,7 +131,7 @@
}
else {
for (VcsTaskHandler handler : handlers) {
- VcsTaskHandler.TaskInfo[] tasks = handler.getCurrentTasks();
+ VcsTaskHandler.TaskInfo[] tasks = handler.getAllExistingTasks();
if (tasks.length > 0) {
myVcsTaskHandler = handler;
//noinspection unchecked
@@ -163,13 +176,15 @@
myBranchName.setText(taskManager.suggestBranchName(task));
myChangelistName.setText(taskManager.getChangelistName(task));
- updateFields(true);
}
+ updateFields(true);
final JComponent preferredFocusedComponent = getPreferredFocusedComponent();
if (preferredFocusedComponent != null) {
myTaskStateCombo.registerUpDownAction(preferredFocusedComponent);
}
- myTaskStateCombo.scheduleUpdate();
+ if (myUpdateState.isSelected()) {
+ myTaskStateCombo.scheduleUpdateOnce();
+ }
init();
}
@@ -182,6 +197,7 @@
myFromLabel.setEnabled(myCreateBranch.isSelected());
myBranchFrom.setEnabled(myCreateBranch.isSelected());
myChangelistName.setEnabled(myCreateChangelist.isSelected());
+ myTaskStateCombo.setEnabled(myUpdateState.isSelected());
}
@@ -197,16 +213,18 @@
taskManager.getState().createChangelist = myCreateChangelist.isSelected();
taskManager.getState().createBranch = myCreateBranch.isSelected();
- final CustomTaskState taskState = myTaskStateCombo.getSelectedState();
- final TaskRepository repository = myTask.getRepository();
- if (repository != null && taskState != null) {
- try {
- repository.setTaskState(myTask, taskState);
- repository.setPreferredOpenTaskState(taskState);
- }
- catch (Exception ex) {
- Messages.showErrorDialog(myProject, ex.getMessage(), "Cannot Set State For Issue");
- LOG.warn(ex);
+ if (myUpdateState.isSelected()) {
+ final CustomTaskState taskState = myTaskStateCombo.getSelectedState();
+ final TaskRepository repository = myTask.getRepository();
+ if (repository != null && taskState != null) {
+ try {
+ repository.setTaskState(myTask, taskState);
+ repository.setPreferredOpenTaskState(taskState);
+ }
+ catch (Exception ex) {
+ Messages.showErrorDialog(myProject, ex.getMessage(), "Cannot Set State For Issue");
+ LOG.warn(ex);
+ }
}
}
final LocalTask activeTask = taskManager.getActiveTask();
@@ -274,7 +292,7 @@
else if (myCreateChangelist.isSelected()) {
return myChangelistName;
}
- else if (myTaskStateCombo.isVisible()){
+ else if (myTaskStateCombo.isVisible() && myTaskStateCombo.isEnabled()){
return myTaskStateCombo.getComboBox();
}
return null;
diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskStateCombo.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskStateCombo.java
index 2126eec..61dc6d9 100644
--- a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskStateCombo.java
+++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskStateCombo.java
@@ -8,7 +8,6 @@
import com.intellij.tasks.Task;
import com.intellij.tasks.TaskRepository;
import com.intellij.tasks.impl.TaskUiUtil.ComboBoxUpdater;
-import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.ui.components.JBLabel;
import com.intellij.util.Function;
import com.intellij.util.PlatformIcons;
@@ -26,9 +25,8 @@
* @author Mikhail Golubev
*/
public abstract class TaskStateCombo extends JPanel {
- private static final CustomTaskState DO_NOT_UPDATE_STATE = new CustomTaskState("", "-- do not update --");
- public static boolean isStateSupportedFor(@Nullable Task task) {
+ public static boolean stateUpdatesSupportedFor(@Nullable Task task) {
if (task == null || !task.isIssue()) {
return false;
}
@@ -51,35 +49,23 @@
myProject = project;
myTask = task;
- final JBLabel hintButton = new JBLabel();
- hintButton.setIcon(PlatformIcons.UP_DOWN_ARROWS);
- hintButton.setToolTipText("Pressing Up or Down arrows while in editor changes the state");
+ final JBLabel hintLabel = new JBLabel();
+ hintLabel.setIcon(PlatformIcons.UP_DOWN_ARROWS);
+ hintLabel.setToolTipText("Pressing Up or Down arrows while in editor changes the state");
final JComboBox comboBox = myKindCombo.getComboBox();
comboBox.setPreferredSize(new Dimension(300, UIUtil.fixComboBoxHeight(comboBox.getPreferredSize().height)));
- final ListCellRenderer defaultRenderer = comboBox.getRenderer();
- comboBox.setRenderer(new ListCellRenderer() {
- @SuppressWarnings({"unchecked", "GtkPreferredJComboBoxRenderer"})
- @Override
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
- if (value == null) {
- return new ListCellRendererWrapper<CustomStateTrinityAdapter>() {
- @Override
- public void customize(JList list, CustomStateTrinityAdapter value, int index, boolean selected, boolean hasFocus) {
- setText("-- no states available --");
- }
- }.getListCellRendererComponent(list, null, index, isSelected, cellHasFocus);
- }
- return defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
- }
- });
-
setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
add(myKindCombo);
- add(hintButton);
+ add(hintLabel);
}
- public boolean scheduleUpdate() {
- if (myProject != null && isStateSupportedFor(myTask)) {
+ /**
+ * One-shot method. Update combo box items only once.
+ *
+ * @return whether update was actually scheduled
+ */
+ public boolean scheduleUpdateOnce() {
+ if (myProject != null && stateUpdatesSupportedFor(myTask) && myKindCombo.getComboBox().getItemCount() == 0) {
final JComboBox comboBox = myKindCombo.getComboBox();
final TaskRepository repository = myTask.getRepository();
assert repository != null;
@@ -96,18 +82,18 @@
final CustomTaskState state = getPreferredState(repository, CustomStateTrinityAdapter.unwrapList(myResult));
return state != null ? new CustomStateTrinityAdapter(state) : null;
}
-
- @Nullable
- @Override
- public CustomStateTrinityAdapter getExtraItem() {
- return new CustomStateTrinityAdapter(DO_NOT_UPDATE_STATE);
- }
}.queue();
return true;
}
return false;
}
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ myKindCombo.setEnabled(enabled);
+ }
+
/**
* @return {@code null} if no state is available at the moment or special "do not update" state was selected
*/
@@ -117,8 +103,7 @@
if (item == null) {
return null;
}
- final CustomTaskState state = item.myState;
- return state == DO_NOT_UPDATE_STATE ? null : state;
+ return item.myState;
}
public void registerUpDownAction(@NotNull JComponent focusable) {
diff --git a/plugins/testng/src/com/theoryinpractice/testng/configuration/SearchingForTestsTask.java b/plugins/testng/src/com/theoryinpractice/testng/configuration/SearchingForTestsTask.java
index 3e53275..538a4bb 100644
--- a/plugins/testng/src/com/theoryinpractice/testng/configuration/SearchingForTestsTask.java
+++ b/plugins/testng/src/com/theoryinpractice/testng/configuration/SearchingForTestsTask.java
@@ -123,10 +123,15 @@
@Override
public void onSuccess() {
- writeTempFile();
- finish();
+ DumbService.getInstance(myProject).runWhenSmart(new Runnable() {
+ @Override
+ public void run() {
+ writeTempFile();
+ finish();
- if (!Registry.is("testng_sm_runner")) myClient.startListening(myConfig);
+ if (!Registry.is("testng_sm_runner")) myClient.startListening(myConfig);
+ }
+ });
}
@Override
diff --git a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGRunnableState.java b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGRunnableState.java
index 6579990..1993525 100644
--- a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGRunnableState.java
+++ b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGRunnableState.java
@@ -146,7 +146,7 @@
if (config.isSaveOutputToFile()) {
unboundOutputRoot.setOutputFilePath(config.getOutputFilePath());
}
- client.prepareListening(listener, port);
+ client.prepareListening(listener, config.getProject(), port);
myStarted = true;
mySearchForTestIndicator = new BackgroundableProcessIndicator(task);
ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, mySearchForTestIndicator);
diff --git a/plugins/testng/src/com/theoryinpractice/testng/model/IDEARemoteTestRunnerClient.java b/plugins/testng/src/com/theoryinpractice/testng/model/IDEARemoteTestRunnerClient.java
index e358692..0570be8 100644
--- a/plugins/testng/src/com/theoryinpractice/testng/model/IDEARemoteTestRunnerClient.java
+++ b/plugins/testng/src/com/theoryinpractice/testng/model/IDEARemoteTestRunnerClient.java
@@ -17,6 +17,8 @@
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
+import com.intellij.openapi.project.DumbService;
+import com.intellij.openapi.project.Project;
import com.theoryinpractice.testng.configuration.TestNGConfiguration;
import com.theoryinpractice.testng.configuration.TestNGRunnableState;
import org.testng.remote.strprotocol.*;
@@ -31,6 +33,7 @@
private TestNGRemoteListener myListener;
private int myPort;
+ private Project myProject;
public synchronized void startListening(TestNGConfiguration config) {
final IMessageSender messageSender = TestNGRunnableState.supportSerializationProtocol(config)
@@ -61,7 +64,7 @@
@Override
protected void notifyStart(final GenericMessage genericMessage) {
- ApplicationManager.getApplication().invokeLater(new Runnable() {
+ DumbService.getInstance(myProject).smartInvokeLater(new Runnable() {
public void run() {
for (final IRemoteSuiteListener listener : m_suiteListeners) {
listener.onInitialization(genericMessage);
@@ -72,7 +75,7 @@
@Override
protected void notifySuiteEvents(final SuiteMessage suiteMessage) {
- ApplicationManager.getApplication().invokeLater(new Runnable() {
+ DumbService.getInstance(myProject).smartInvokeLater(new Runnable() {
public void run() {
for (final IRemoteSuiteListener listener : m_suiteListeners) {
if (suiteMessage.isMessageOnStart()) {
@@ -88,7 +91,7 @@
@Override
protected void notifyTestEvents(final TestMessage testMessage) {
- ApplicationManager.getApplication().invokeLater(new Runnable() {
+ DumbService.getInstance(myProject).smartInvokeLater(new Runnable() {
public void run() {
for (final IRemoteTestListener listener : m_testListeners) {
if (testMessage.isMessageOnStart()) {
@@ -104,7 +107,7 @@
@Override
protected void notifyResultEvents(final TestResultMessage testResultMessage) {
- ApplicationManager.getApplication().invokeLater(new Runnable() {
+ DumbService.getInstance(myProject).smartInvokeLater(new Runnable() {
public void run() {
for (final IRemoteTestListener listener : m_testListeners) {
switch (testResultMessage.getResult()) {
@@ -129,8 +132,11 @@
}, ModalityState.NON_MODAL);
}
- public void prepareListening(TestNGRemoteListener listener, int port) {
+ public void prepareListening(TestNGRemoteListener listener,
+ Project project,
+ int port) {
myListener = listener;
+ myProject = project;
myPort = port;
}
diff --git a/plugins/testng/src/fileTemplates/code/TestNG Test Class.java.html b/plugins/testng/src/fileTemplates/code/TestNG Test Class.java.html
index 5b04f01..f068ea3 100644
--- a/plugins/testng/src/fileTemplates/code/TestNG Test Class.java.html
+++ b/plugins/testng/src/fileTemplates/code/TestNG Test Class.java.html
@@ -17,6 +17,11 @@
<td valign="top"><font face="verdana" size="-1">name of the created class.</font></td>
</tr>
<tr>
+ <td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${CLASS_NAME}</b></font></nobr></td>
+ <td width="10"> </td>
+ <td valign="top"><font face="verdana" size="-1">name of the tested class.</font></td>
+ </tr>
+ <tr>
<td valign="top"><nobr><font face="verdana" size="-2" color="#f45252"><b>${BODY}</b></font></nobr></td>
<td width="10"> </td>
<td valign="top"><font face="verdana" size="-1">generated class body.</font></td>
diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/actions/CreateFormAction.java b/plugins/ui-designer/src/com/intellij/uiDesigner/actions/CreateFormAction.java
index 195c8b4..cb59b93 100644
--- a/plugins/ui-designer/src/com/intellij/uiDesigner/actions/CreateFormAction.java
+++ b/plugins/ui-designer/src/com/intellij/uiDesigner/actions/CreateFormAction.java
@@ -17,6 +17,9 @@
package com.intellij.uiDesigner.actions;
import com.intellij.ide.actions.TemplateKindCombo;
+import com.intellij.ide.fileTemplates.FileTemplate;
+import com.intellij.ide.fileTemplates.FileTemplateManager;
+import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.project.Project;
@@ -48,6 +51,19 @@
public CreateFormAction() {
super(UIDesignerBundle.message("action.gui.form.text"),
UIDesignerBundle.message("action.gui.form.description"), PlatformIcons.UI_FORM_ICON);
+
+ // delete obsolete template
+ ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
+ public void run() {
+ // to prevent deadlocks, this code must run while not holding the ActionManager lock
+ FileTemplateManager manager = FileTemplateManager.getDefaultInstance();
+ final FileTemplate template = manager.getTemplate("GUI Form");
+ //noinspection HardCodedStringLiteral
+ if (template != null && template.getExtension().equals("form")) {
+ manager.removeTemplate(template);
+ }
+ }
+ });
}
@NotNull
diff --git a/python/edu/build/pycharm_edu_build.gant b/python/edu/build/pycharm_edu_build.gant
index 555a241..75e71cb 100644
--- a/python/edu/build/pycharm_edu_build.gant
+++ b/python/edu/build/pycharm_edu_build.gant
@@ -200,7 +200,7 @@
buildNSIS([paths.distAll, paths.distWin],
"$pythonEduHome/build/strings.nsi", "$pythonEduHome/build/paths.nsi",
- "pycharmEDU-", false, true, ".py", system_selector)
+ "pycharmEDU-", false, true, system_selector)
String tarRoot = isEap() ? "pycharm-edu-$buildNumber" : "pycharm-edu-${p("component.version.major")}.${p("component.version.minor")}"
buildTarGz(tarRoot, "$paths.artifacts/pycharm${buildName}.tar", [paths.distAll, paths.distUnix])
diff --git a/python/edu/build/strings.nsi b/python/edu/build/strings.nsi
index fa10d42..5e1ca9f 100644
--- a/python/edu/build/strings.nsi
+++ b/python/edu/build/strings.nsi
@@ -6,6 +6,8 @@
!define PRODUCT_UNINST_ICON_FILE "PC_uninstCom.ico"
!define PRODUCT_LOGO_FILE "logo.bmp"
!define PRODUCT_HEADER_FILE "headerlogo.bmp"
+!define ASSOCIATION "NoAssociation"
+!define UNINSTALL_WEB_PAGE "feedback_web_page"
; if SHOULD_SET_DEFAULT_INSTDIR != 0 then default installation directory will be directory where highest-numbered PyCharm build has been installed
; set to 1 for release build
diff --git a/python/pluginSrc/com/jetbrains/python/module/PythonModuleBuilder.java b/python/pluginSrc/com/jetbrains/python/module/PythonModuleBuilder.java
index f83490c..aebd6a6 100644
--- a/python/pluginSrc/com/jetbrains/python/module/PythonModuleBuilder.java
+++ b/python/pluginSrc/com/jetbrains/python/module/PythonModuleBuilder.java
@@ -59,7 +59,7 @@
}
}) {
@Override
- protected void OnSdkSelected(Sdk sdk) {
+ protected void onSdkSelected(Sdk sdk) {
setSdk(sdk);
}
};
diff --git a/resources-en/src/inspectionDescriptions/UNCHECKED_WARNING.html b/resources-en/src/inspectionDescriptions/UNCHECKED_WARNING.html
index cf5632c..77b9abe 100644
--- a/resources-en/src/inspectionDescriptions/UNCHECKED_WARNING.html
+++ b/resources-en/src/inspectionDescriptions/UNCHECKED_WARNING.html
@@ -8,5 +8,6 @@
}
</code>
</pre>
+Hint: Pass -Xlint:unchecked to javac to get more details.
</body>
</html>
\ No newline at end of file
diff --git a/spellchecker/src/com/intellij/spellchecker/jetbrains.dic b/spellchecker/src/com/intellij/spellchecker/jetbrains.dic
index 89fe3414..84b79fe 100644
--- a/spellchecker/src/com/intellij/spellchecker/jetbrains.dic
+++ b/spellchecker/src/com/intellij/spellchecker/jetbrains.dic
@@ -1,6 +1,7 @@
accessor
aggregator
ajax
+akka
alloc
anyschema
aopalliance
diff --git a/xml/impl/resources/liveTemplates/zen_html.xml b/xml/impl/resources/liveTemplates/zen_html.xml
index 1264946..f04edf4 100644
--- a/xml/impl/resources/liveTemplates/zen_html.xml
+++ b/xml/impl/resources/liveTemplates/zen_html.xml
@@ -3,6 +3,7 @@
<template description="<!doctype html>" name="!!!" toReformat="true" toShortenFQNames="true" value="<!doctype html>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">"
@@ -10,6 +11,7 @@
value="<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">"
@@ -17,6 +19,7 @@
value="<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">"
@@ -24,6 +27,7 @@
value="<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">"
@@ -31,6 +35,7 @@
value="<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">"
@@ -38,27 +43,32 @@
value="<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<!-- -->" name="c" toReformat="true" toShortenFQNames="true" value="<!-- $END$ -->">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="cc:ie6" toReformat="true" toShortenFQNames="true" value="<!--[if lte IE 6]> $END$ <![endif]-->">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="cc:ie" toReformat="true" toShortenFQNames="true" value="<!--[if IE]> $END$ <![endif]-->">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="cc:noie" toReformat="true" toShortenFQNames="true" value="<!--[if !IE]><!--> $END$ <!--<![endif]-->">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="!" toReformat="true" toShortenFQNames="true"
@@ -67,88 +77,105 @@
<variable alwaysStopAt="true" defaultValue=""Document"" expression="" name="TITLE"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<a href="...">...</a>" name="a" toReformat="true" toShortenFQNames="true" value="<a href="$VAR0$">$END$</a>">
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<a href="http://...">...</a>" name="a:link" toReformat="true" toShortenFQNames="true" value="<a href="http://$VAR0$">$END$</a>">
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<a href="mailto:...">...</a>" name="a:mail" toReformat="true" toShortenFQNames="true" value="<a href="mailto:$VAR0$">$END$</a>">
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<abbr title="...">...</abbr>" name="abbr" toReformat="true" toShortenFQNames="true" value="<abbr title="$VAR0$">$END$</abbr>">
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<acronym title="...">...</acronym>" name="acronym" toReformat="true" toShortenFQNames="true" value="<acronym title="$VAR0$">$END$</acronym>">
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<base href="...">" name="base" toReformat="true" toShortenFQNames="true" value="<base href="$VAR0$"/>">
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<basefont/>" name="basefont" toReformat="true" toShortenFQNames="true" value="<basefont/>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<br/>" name="br" toReformat="true" toShortenFQNames="true" value="<br/>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<frame/>" name="frame" toReformat="true" toShortenFQNames="true" value="<frame/>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<hr/>" name="hr" toReformat="true" toShortenFQNames="true" value="<hr/>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<bdo dir="...">...</bdo>" name="bdo" toReformat="true" toShortenFQNames="true" value="<bdo dir="$VAR0$">$END$</bdo>">
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<bdo dir="rtl">...</bdo>" name="bdo:r" toReformat="true" toShortenFQNames="true" value="<bdo dir="rtl">$END$</bdo>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<bdo dir="ltr">...</bdo>" name="bdo:l" toReformat="true" toShortenFQNames="true" value="<bdo dir="ltr">$END$</bdo>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<col/>" name="col" toReformat="true" toShortenFQNames="true" value="<col/>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<link rel="stylesheet" href="...">" name="link" toReformat="true" toShortenFQNames="true" value="<link rel="stylesheet" href="$END$"/>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_STATEMENT" value="true"/>
+ <option name="JSX_EXPRESSION" value="true"/>
</context>
</template>
<template description="<link rel="stylesheet" href="style.css" />" name="link:css"
@@ -157,6 +184,7 @@
<variable alwaysStopAt="true" defaultValue=""style"" expression="" name="STYLE"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<link rel="import" href="">"
@@ -165,6 +193,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="HTML"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<link rel="import" href="">"
@@ -173,6 +202,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="HTML"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<link rel="stylesheet" href="print.css" media="print">"
@@ -181,6 +211,7 @@
<variable alwaysStopAt="true" defaultValue=""print"" expression="" name="STYLE"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">"
@@ -189,6 +220,7 @@
<variable alwaysStopAt="true" defaultValue=""favicon.ico"" expression="" name="FAVICON"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<link rel="apple-touch-icon" href="favicon.png">" name="link:touch" toReformat="true"
@@ -196,6 +228,7 @@
<variable alwaysStopAt="true" defaultValue=""favicon.png"" expression="" name="FAVICON"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">"
@@ -204,6 +237,7 @@
<variable alwaysStopAt="true" defaultValue=""rss.xml"" expression="" name="RSS"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<link rel="alternate" type="application/atom+xml" title="Atom" href="atom.xml">"
@@ -212,11 +246,13 @@
<variable alwaysStopAt="true" defaultValue=""atom.xml"" expression="" name="ATOM"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<meta/>" name="meta" toReformat="true" toShortenFQNames="true" value="<meta/>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">" name="meta:utf"
@@ -224,6 +260,7 @@
value="<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<meta http-equiv="Content-Type" content="text/html;charset=Win-1251">" name="meta:win"
@@ -231,6 +268,7 @@
value="<meta http-equiv="Content-Type" content="text/html;charset=windows-1251"/>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>"
@@ -243,6 +281,7 @@
<variable alwaysStopAt="true" defaultValue=""1.0"" expression="" name="MIN_SCALE"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<meta http-equiv="X-UA-Compatible" content="IE=7"/>" name="meta:compat" toReformat="true"
@@ -250,21 +289,26 @@
<variable alwaysStopAt="true" defaultValue=""IE=7"" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<style>...</style>" name="style" toReformat="true" toShortenFQNames="true" value="<style>$END$</style>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<script>...</script>" name="script" toReformat="true" toShortenFQNames="true" value="<script !src="">$END$</script>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<script src="...">...</script>" name="script:src" toReformat="true" toShortenFQNames="true" value="<script src="$END$"></script>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_STATEMENT" value="true"/>
+ <option name="JSX_EXPRESSION" value="true"/>
</context>
</template>
<template description="<img src="..." alt="...">" name="img" toReformat="true" toShortenFQNames="true"
@@ -273,6 +317,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<img srcset="..." src="..." alt="...">" name="img:s" toReformat="true" toShortenFQNames="true"
@@ -282,6 +327,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<img srcset="..." src="..." alt="...">" name="img:srcset" toReformat="true" toShortenFQNames="true"
@@ -291,6 +337,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<img sizes="..." srcset="..." src="..." alt="...">" name="img:z" toReformat="true" toShortenFQNames="true"
@@ -301,6 +348,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR3"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<img sizes="..." srcset="..." src="..." alt="...">" name="img:sizes" toReformat="true" toShortenFQNames="true"
@@ -311,22 +359,26 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR3"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<picture></picture>" name="picture" toReformat="true" toShortenFQNames="true" value="<picture></picture>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source/>" name="src" toReformat="true" toShortenFQNames="true" value="<source/>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source/>" name="source" toReformat="true" toShortenFQNames="true" value="<source/>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source src="..." type="..."/>" name="src:sc" toReformat="true" toShortenFQNames="true"
@@ -335,6 +387,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source src="..." type="..."/>" name="source:src" toReformat="true" toShortenFQNames="true"
@@ -343,6 +396,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source srcset="..."/>" name="src:s" toReformat="true" toShortenFQNames="true"
@@ -350,6 +404,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source srcset="..."/>" name="source:srcset" toReformat="true" toShortenFQNames="true"
@@ -357,6 +412,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source media="(...)" srcset="..."/>" name="src:m" toReformat="true" toShortenFQNames="true"
@@ -365,6 +421,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source media="(...)" srcset="..."/>" name="source:media" toReformat="true" toShortenFQNames="true"
@@ -373,6 +430,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source srcset="..." type="..."/>" name="src:t" toReformat="true" toShortenFQNames="true"
@@ -381,6 +439,7 @@
<variable alwaysStopAt="true" defaultValue=""image/"" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source srcset="..." type="..."/>" name="source:type" toReformat="true" toShortenFQNames="true"
@@ -389,6 +448,7 @@
<variable alwaysStopAt="true" defaultValue=""image/"" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source sizes="..." srcset="..."/>" name="src:z" toReformat="true" toShortenFQNames="true"
@@ -397,6 +457,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source sizes="..." srcset="..."/>" name="source:sizes" toReformat="true" toShortenFQNames="true"
@@ -405,6 +466,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source media="(...)" srcset="..." type="..."/>" name="src:mt" toReformat="true" toShortenFQNames="true"
@@ -414,6 +476,7 @@
<variable alwaysStopAt="true" defaultValue=""image/"" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source media="(...)" srcset="..." type="..."/>" name="source:media:type" toReformat="true" toShortenFQNames="true"
@@ -423,6 +486,7 @@
<variable alwaysStopAt="true" defaultValue=""image/"" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source media="(...)" sizes="..." srcset="..."/>" name="src:mz" toReformat="true" toShortenFQNames="true"
@@ -432,6 +496,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source media="(...)" sizes="..." srcset="..."/>" name="source:media:sizes" toReformat="true" toShortenFQNames="true"
@@ -441,6 +506,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source sizes="..." srcset="..." type="..."/>" name="src:zt" toReformat="true" toShortenFQNames="true"
@@ -450,6 +516,7 @@
<variable alwaysStopAt="true" defaultValue=""image/"" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<source sizes="..." srcset="..." type="..."/>" name="source:sizes:type" toReformat="true" toShortenFQNames="true"
@@ -459,6 +526,7 @@
<variable alwaysStopAt="true" defaultValue=""image/"" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<iframe src="..." frameborder="0">...</iframe>" name="iframe" toReformat="true"
@@ -466,6 +534,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<embed src="..." type="..."/>" name="embed" toReformat="true" toShortenFQNames="true"
@@ -474,6 +543,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<object data="..." type="...">...</object>" name="object" toReformat="true"
@@ -482,6 +552,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<param name="..." value="...">" name="param" toReformat="true" toShortenFQNames="true"
@@ -490,6 +561,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<map name="...">...</map>" name="map" toReformat="true" toShortenFQNames="true"
@@ -497,6 +569,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<area shape="..." coords="..." href="..." alt="...">" name="area"
@@ -508,6 +581,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR3"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<area shape="default" href="..." alt="...">" name="area:d" toReformat="true"
@@ -516,6 +590,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<area shape="circle" coords="..." href="..." alt="...">"
@@ -526,6 +601,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<area shape="rect" coords="..." href="..." alt="...">" name="area:r"
@@ -536,6 +612,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<area shape="poly" coords="..." href="..." alt="...">" name="area:p"
@@ -546,6 +623,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<form action="...">...</form>" name="form" toReformat="true" toShortenFQNames="true"
@@ -553,6 +631,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<form action="..." method="get">...</form>" name="form:get" toReformat="true"
@@ -560,6 +639,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<form action="..." method="post">...</form>" name="form:post" toReformat="true"
@@ -567,6 +647,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<label for="...">...</label>" name="label" toReformat="true" toShortenFQNames="true"
@@ -574,12 +655,14 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="..."/>" name="input" toReformat="true" toShortenFQNames="true" value="<input type="$VAR0$"/>">
<variable alwaysStopAt="true" defaultValue=""text"" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="..." name="..." id="..."/>" name="inp" toReformat="true" toShortenFQNames="true"
@@ -589,18 +672,21 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="ID"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="hidden" name="..."/>" name="input:hidden" toReformat="true" toShortenFQNames="true" value="<input type="hidden" name="$VAR0$" />">
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="hidden" name="..."/>" name="input:h" toReformat="true" toShortenFQNames="true" value="<input type="hidden" name="$VAR0$"/>">
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="text" name="..." id="..."/>" name="input:text" toReformat="true"
@@ -609,6 +695,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="text" name="..." id="..."/>" name="input:t" toReformat="true"
@@ -617,6 +704,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="search" name="..." id="..."/>" name="input:search"
@@ -626,6 +714,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="email" name="..." id="..."/>" name="input:email" toReformat="true"
@@ -634,6 +723,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="url" name="..." id="..."/>" name="input:url" toReformat="true"
@@ -642,6 +732,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="password" name="..." id="..."/>" name="input:password"
@@ -651,6 +742,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="password" name="..." id="..."/>" name="input:p" toReformat="true"
@@ -659,6 +751,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="datetime" name="..." id="..."/>" name="input:datetime"
@@ -668,6 +761,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="date" name="..." id="..."/>" name="input:date" toReformat="true"
@@ -676,6 +770,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="datetime-local" name="..." id="..."/>" name="input:datetime-local"
@@ -685,6 +780,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="month" name="..." id="..."/>" name="input:month" toReformat="true"
@@ -693,6 +789,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="week" name="..." id="..."/>" name="input:week" toReformat="true"
@@ -701,6 +798,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="time" name="..." id="..."/>" name="input:time" toReformat="true"
@@ -709,6 +807,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="tel" name="..." id="..."/>" name="input:tel"
@@ -718,6 +817,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="number" name="..." id="..."/>" name="input:number"
@@ -727,6 +827,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="color" name="..." id="..."/>" name="input:color" toReformat="true"
@@ -735,6 +836,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="checkbox" name="..." id="..."/>" name="input:checkbox"
@@ -744,6 +846,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="checkbox" name="..." id="..."/>" name="input:c" toReformat="true"
@@ -752,6 +855,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="radio" name="..." id="..."/>" name="input:radio" toReformat="true"
@@ -760,6 +864,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="radio" name="..." id="..."/>" name="input:r" toReformat="true"
@@ -768,6 +873,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="range" name="..." id="..."/>" name="input:range" toReformat="true"
@@ -776,6 +882,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="file" name="..." id="..."/>" name="input:file" toReformat="true"
@@ -784,6 +891,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="file" name="..." id="..."/>" name="input:f" toReformat="true"
@@ -792,6 +900,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="submit" value="..."/>" name="input:submit" toReformat="true"
@@ -799,6 +908,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="submit" value="..."/>" name="input:s" toReformat="true"
@@ -806,6 +916,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="image" src="..." alt="..."/>" name="input:image" toReformat="true"
@@ -814,6 +925,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="image" src="..." alt="..."/>" name="input:i" toReformat="true"
@@ -822,6 +934,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="button" value="..."/>" name="input:button" toReformat="true"
@@ -829,6 +942,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="button" value="..."/>" name="input:b" toReformat="true"
@@ -836,11 +950,13 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<inindex/>" name="isindex" toReformat="true" toShortenFQNames="true" value="<isindex/>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<input type="reset" value="..."/>" name="input:reset" toReformat="true"
@@ -848,6 +964,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<select name="..." id="...">...</select>" name="select" toReformat="true"
@@ -856,6 +973,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<select name="..." id="..." disabled>...</select>" name="select:disabled" toReformat="true"
@@ -864,6 +982,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<select name="..." id="..." disabled>...</select>" name="select:d" toReformat="true"
@@ -872,6 +991,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<option value="...">...</option>" name="option" toReformat="true" toShortenFQNames="true"
@@ -879,6 +999,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<textarea name="..." id="..." cols="30" rows="10">...</textarea>"
@@ -890,6 +1011,7 @@
<variable alwaysStopAt="true" defaultValue=""10"" expression="" name="ROWS"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<marquee behavior="..." direction="...">...</marquee>"
@@ -899,30 +1021,35 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="DIRECTION"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<menu type="context">...</menu>" name="menu:context" toReformat="true"
toShortenFQNames="true" value="<menu type="context">$END$</menu>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<menu type="context">...</menu>" name="menu:c" toReformat="true" toShortenFQNames="true"
value="<menu type="context">$END$</menu>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<menu type="toolbar">...</menu>" name="menu:toolbar" toReformat="true"
toShortenFQNames="true" value="<menu type="toolbar">$END$</menu>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<menu type="toolbar">...</menu>" name="menu:t" toReformat="true" toShortenFQNames="true"
value="<menu type="toolbar">$END$</menu>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<video src="...">...</video>" name="video" toReformat="true" toShortenFQNames="true"
@@ -930,6 +1057,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<audio src="...">...</audio>" name="audio" toReformat="true" toShortenFQNames="true"
@@ -937,76 +1065,89 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<html xmlns="http://www.w3.org/1999/xhtml">...</html>" name="html:xml" toReformat="true"
toShortenFQNames="true" value="<html xmlns="http://www.w3.org/1999/xhtml">$END$</html>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<keygen>" name="keygen" toReformat="true" toShortenFQNames="true" value="<keygen>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<command>" name="command" toReformat="true" toShortenFQNames="true" value="<command>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<button type="submit"></button>" name="button:submit" toReformat="true"
toShortenFQNames="true" value="<button type="submit">$END$</button>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<button type="submit"></button>" name="button:s" toReformat="true"
toShortenFQNames="true" value="<button type="submit">$END$</button>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<button type="reset"></button>" name="button:reset" toReformat="true"
toShortenFQNames="true" value="<button type="reset">$END$</button>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<button type="reset"></button>" name="button:r" toReformat="true"
toShortenFQNames="true" value="<button type="reset">$END$</button>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<button disabled>...</button>" name="button:disabled" toReformat="true" toShortenFQNames="true"
value="<button disabled>$END$</button>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<button disabled>...</button>" name="button:d" toReformat="true" toShortenFQNames="true"
value="<button disabled>$END$</button>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<fieldset disabled>...</fieldset>" name="fieldset:disabled" toReformat="true" toShortenFQNames="true"
value="<fieldset disabled>$END$</fieldset>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<fieldset disabled>...</fieldset>" name="fieldset:d" toReformat="true" toShortenFQNames="true"
value="<fieldset disabled>$END$</fieldset>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<blockquote>...</blockquote>" name="bq" toReformat="true" toShortenFQNames="true"
value="<blockquote>$END$</blockquote>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<acronym title="...">...</acronym>" name="acr" toReformat="true" toShortenFQNames="true"
@@ -1014,23 +1155,27 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<figure>...</figure>" name="fig" toReformat="true" toShortenFQNames="true"
value="<figure>$END$</figure>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<figcaption>...</figcaption>" name="figc" toReformat="true" toShortenFQNames="true"
value="<figcaption>$END$</figcaption>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<picture></picture>" name="pic" toReformat="true" toShortenFQNames="true" value="<picture></picture>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<iframe src="..." frameborder="0">...</iframe>" name="ifr" toReformat="true"
@@ -1038,6 +1183,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<embed src="..." type="..."/>" name="emb" toReformat="true" toShortenFQNames="true"
@@ -1046,6 +1192,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<object data="..." type="...">...</object>" name="obj" toReformat="true"
@@ -1054,66 +1201,77 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<caption>...</caption>" name="cap" toReformat="true" toShortenFQNames="true"
value="<caption>$END$</caption>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<colgroup>...</colgroup>" name="colg" toReformat="true" toShortenFQNames="true"
value="<colgroup>$END$</colgroup>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<fieldset>...</fieldset>" name="fst" toReformat="true" toShortenFQNames="true"
value="<fieldset>$END$</fieldset>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<fieldset disabled>...</fieldset>" name="fst:d" toReformat="true" toShortenFQNames="true"
value="<fieldset disabled>$END$</fieldset>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<button>...</button>" name="btn" toReformat="true" toShortenFQNames="true"
value="<button>$END$</button>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<button type="button">...</button>" name="btn:b" toReformat="true" toShortenFQNames="true"
value="<button type="button">$END$</button>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<button type="reset">...</button>" name="btn:r" toReformat="true" toShortenFQNames="true"
value="<button type="reset">$END$</button>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<button type="submit">...</button>" name="btn:s" toReformat="true" toShortenFQNames="true"
value="<button type="submit">$END$</button>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<button disabled>...</button>" name="btn:d" toReformat="true" toShortenFQNames="true"
value="<button disabled>$END$</button>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<optgroup>...</optgroup>" name="optg" toReformat="true" toShortenFQNames="true"
value="<optgroup>$END$</optgroup>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<option value="...">...</option>" name="opt" toReformat="true" toShortenFQNames="true"
@@ -1121,6 +1279,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<textarea name="..." id="..." cols="30" rows="10">...</textarea>"
@@ -1132,116 +1291,136 @@
<variable alwaysStopAt="true" defaultValue=""10"" expression="" name="ROWS"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<legend>...</legend>" name="leg" toReformat="true" toShortenFQNames="true"
value="<legend>$END$</legend>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<section>...</section>" name="sect" toReformat="true" toShortenFQNames="true"
value="<section>$END$</section>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<article>...</article>" name="art" toReformat="true" toShortenFQNames="true"
value="<article>$END$</article>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<header>...</header>" name="hdr" toReformat="true" toShortenFQNames="true"
value="<header>$END$</header>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<footer>...</footer>" name="ftr" toReformat="true" toShortenFQNames="true"
value="<footer>$END$</footer>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<address>...</address>" name="adr" toReformat="true" toShortenFQNames="true"
value="<address>$END$</address>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<dialog>...</dialog>" name="dlg" toReformat="true" toShortenFQNames="true"
value="<dialog>$END$</dialog>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<strong>...</strong>" name="str" toReformat="true" toShortenFQNames="true"
value="<strong>$END$</strong>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<progress>...</progress>" name="prog" toReformat="true" toShortenFQNames="true"
value="<progress>$END$</progress>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<main>...</main>" name="mn" toReformat="true" toShortenFQNames="true"
value="<main>$END$</main>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<template>...</template>" name="tem" toReformat="true" toShortenFQNames="true"
value="<template>$END$</template>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<fieldset>...</fieldset>" name="fset" toReformat="true" toShortenFQNames="true"
value="<fieldset>$END$</fieldset>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<fieldset disabled>...</fieldset>" name="fset:d" toReformat="true" toShortenFQNames="true"
value="<fieldset disabled>$END$</fieldset>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<datagrid>...</datagrid>" name="datag" toReformat="true" toShortenFQNames="true"
value="<datagrid>$END$</datagrid>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<datalist>...</datalist>" name="datal" toReformat="true" toShortenFQNames="true" value="<datalist>$END$</datalist>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<keygen>" name="kg" toReformat="true" toShortenFQNames="true" value="<keygen>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<output>...</output>" name="out" toReformat="true" toShortenFQNames="true" value="<output>$END$</output>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<details>...</details>" name="det" toReformat="true" toShortenFQNames="true"
value="<details>$END$</details>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<command>" name="cmd" toReformat="true" toShortenFQNames="true" value="<command>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="doc" toReformat="true" toShortenFQNames="true"
@@ -1249,6 +1428,7 @@
<variable alwaysStopAt="true" defaultValue=""Document"" expression="" name="TITLE"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="doc4" toReformat="true" toShortenFQNames="true"
@@ -1256,6 +1436,7 @@
<variable alwaysStopAt="true" defaultValue=""Document"" expression="" name="TITLE"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
@@ -1266,6 +1447,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<img srcset="..." src="..." alt="...">" name="ri:dpr" toReformat="true" toShortenFQNames="true"
@@ -1275,6 +1457,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<img sizes="..." srcset="..." src="..." alt="...">" name="ri:v" toReformat="true" toShortenFQNames="true"
@@ -1285,6 +1468,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR3"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<img sizes="..." srcset="..." src="..." alt="...">" name="ri:viewport" toReformat="true" toShortenFQNames="true"
@@ -1295,6 +1479,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR3"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<picture><source media="(...)" srcset="..."/><img src="..." alt="..."/></picture>"
@@ -1306,6 +1491,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR3"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<picture><source media="(...)" srcset="..."/><img src="..." alt="..."/></picture>"
@@ -1317,6 +1503,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR3"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<picture><source srcset="..." type="..."/><img src="..." alt="..."/></picture>"
@@ -1328,6 +1515,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR3"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="<picture><source srcset="..." type="..."/><img src="..." alt="..."/></picture>"
@@ -1339,6 +1527,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR3"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
@@ -1348,6 +1537,7 @@
<variable alwaysStopAt="true" defaultValue=""Document"" expression="" name="TITLE"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="html:4s" toReformat="true" toShortenFQNames="true"
@@ -1356,6 +1546,7 @@
<variable alwaysStopAt="true" defaultValue=""Document"" expression="" name="TITLE"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="html:xt" toReformat="true" toShortenFQNames="true"
@@ -1364,6 +1555,7 @@
<variable alwaysStopAt="true" defaultValue=""Document"" expression="" name="TITLE"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="html:xs" toReformat="true" toShortenFQNames="true"
@@ -1372,6 +1564,7 @@
<variable alwaysStopAt="true" defaultValue=""Document"" expression="" name="TITLE"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="html:xxs" toReformat="true" toShortenFQNames="true"
@@ -1380,6 +1573,7 @@
<variable alwaysStopAt="true" defaultValue=""Document"" expression="" name="TITLE"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="html:5" toReformat="true" toShortenFQNames="true"
@@ -1388,22 +1582,26 @@
<variable alwaysStopAt="true" defaultValue=""Document"" expression="" name="TITLE"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="ol+" toReformat="true" toShortenFQNames="true" value="<ol> <li>$END$</li> </ol>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="ul+" toReformat="true" toShortenFQNames="true" value="<ul> <li>$END$</li> </ul>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="dl+" toReformat="true" toShortenFQNames="true" value="<dl> <dt>$VAR0$</dt> <dd>$END$</dd> </dl>">
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="map+" toReformat="true" toShortenFQNames="true" value="<map name="$VAR0$"> <area shape="$VAR1$" coords="$VAR2$" href="$VAR3$" alt="$VAR4$"/>$END$ </map>">
@@ -1414,26 +1612,31 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR4"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="table+" toReformat="true" toShortenFQNames="true" value="<table> <tr> <td>$END$</td> </tr> </table>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="colgroup+" toReformat="true" toShortenFQNames="true" value="<colgroup> <col/> </colgroup>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="colg+" toReformat="true" toShortenFQNames="true" value="<colgroup> <col/> </colgroup>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="tr+" toReformat="true" toShortenFQNames="true" value="<tr> <td>$END$</td> </tr>">
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="select+" toReformat="true" toShortenFQNames="true" value="<select name="$VAR0$" id="$VAR1$"> <option value="$VAR2$">$END$</option> </select>">
@@ -1442,18 +1645,21 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="optgroup+" toReformat="true" toShortenFQNames="true" value="<optgroup> <option value="$VAR0$">$END$</option> </optgroup>">
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="optg+" toReformat="true" toShortenFQNames="true" value="<optgroup> <option value="$VAR0$">$END$</option> </optgroup>">
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
<template description="" name="pic+" toReformat="true" toShortenFQNames="true"
@@ -1463,6 +1669,7 @@
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR2"/>
<context>
<option name="HTML_TEXT" value="true"/>
+ <option name="JSX_HTML" value="true"/>
</context>
</template>
</templateSet>
\ No newline at end of file
diff --git a/xml/impl/src/com/intellij/application/options/emmet/XmlEmmetConfigurable.java b/xml/impl/src/com/intellij/application/options/emmet/XmlEmmetConfigurable.java
index 92aba2b..25eeab8e 100644
--- a/xml/impl/src/com/intellij/application/options/emmet/XmlEmmetConfigurable.java
+++ b/xml/impl/src/com/intellij/application/options/emmet/XmlEmmetConfigurable.java
@@ -155,13 +155,13 @@
@Nullable
@Override
public String getHelpTopic() {
- return XmlBundle.message("emmet.configuration.title");
+ return getId();
}
@NotNull
@Override
public String getId() {
- return "xml.emmet";
+ return "reference.idesettings.emmet.xml";
}
@Nullable
diff --git a/xml/impl/src/com/intellij/psi/impl/source/html/HtmlScriptLanguageInjector.java b/xml/impl/src/com/intellij/psi/impl/source/html/HtmlScriptLanguageInjector.java
index aeb08c9..d874118 100644
--- a/xml/impl/src/com/intellij/psi/impl/source/html/HtmlScriptLanguageInjector.java
+++ b/xml/impl/src/com/intellij/psi/impl/source/html/HtmlScriptLanguageInjector.java
@@ -44,7 +44,7 @@
}
String mimeType = scriptTag.getAttributeValue("type");
Collection<Language> languages = Language.findInstancesByMimeType(mimeType);
- Language language = !languages.isEmpty() ? languages.iterator().next() : StdLanguages.TEXT;
+ Language language = !languages.isEmpty() ? languages.iterator().next() : Language.ANY;
if (LanguageUtil.isInjectableLanguage(language)) {
registrar
.startInjecting(language)
diff --git a/xml/impl/src/com/intellij/xml/util/CheckValidXmlInScriptBodyInspection.java b/xml/impl/src/com/intellij/xml/util/CheckValidXmlInScriptBodyInspection.java
index 29e8f04..0d14568 100644
--- a/xml/impl/src/com/intellij/xml/util/CheckValidXmlInScriptBodyInspection.java
+++ b/xml/impl/src/com/intellij/xml/util/CheckValidXmlInScriptBodyInspection.java
@@ -23,8 +23,7 @@
package com.intellij.xml.util;
import com.intellij.codeInsight.FileModificationService;
-import com.intellij.codeInspection.LocalQuickFix;
-import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.codeInspection.LocalQuickFixOnPsiElement;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
@@ -39,39 +38,33 @@
* @author Maxim Mossienko
*/
public class CheckValidXmlInScriptBodyInspection extends CheckValidXmlInScriptBodyInspectionBase {
-
@Override
- protected InsertQuotedCharacterQuickFix createFix(PsiFile psiFile,
- PsiElement psiElement,
+ protected InsertQuotedCharacterQuickFix createFix(PsiElement psiElement,
int offsetInElement) {
return new InsertQuotedCharacterQuickFix(
- psiFile,
psiElement,
offsetInElement
);
}
- private static class InsertQuotedCharacterQuickFix implements LocalQuickFix {
- private final PsiFile psiFile;
- private final PsiElement psiElement;
+ private static class InsertQuotedCharacterQuickFix extends LocalQuickFixOnPsiElement {
private final int startInElement;
- public InsertQuotedCharacterQuickFix(PsiFile psiFile, PsiElement psiElement, int startInElement) {
- this.psiFile = psiFile;
- this.psiElement = psiElement;
+ public InsertQuotedCharacterQuickFix(PsiElement psiElement, int startInElement) {
+ super(psiElement);
this.startInElement = startInElement;
}
@Override
@NotNull
- public String getName() {
+ public String getText() {
final String character = getXmlCharacter();
return XmlBundle.message(
"unescaped.xml.character.fix.message",
character.equals("&") ?
- XmlBundle.message("unescaped.xml.character.fix.message.parameter"):
- character
+ XmlBundle.message("unescaped.xml.character.fix.message.parameter") :
+ character
);
}
@@ -82,9 +75,10 @@
}
@Override
- public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor problemDescriptor) {
+ public void invoke(@NotNull Project project, @NotNull PsiFile file, @NotNull PsiElement startElement, @NotNull PsiElement endElement) {
+ final PsiFile psiFile = startElement.getContainingFile();
if (!FileModificationService.getInstance().prepareFileForWrite(psiFile)) return;
- final TextRange range = psiElement.getTextRange();
+ final TextRange range = startElement.getTextRange();
OpenFileDescriptor descriptor = new OpenFileDescriptor(
project,
psiFile.getVirtualFile(),
@@ -96,7 +90,7 @@
final String xmlCharacter = getXmlCharacter();
String replacement = xmlCharacter.equals("&") ? AMP_ENTITY_REFERENCE : LT_ENTITY_REFERENCE;
- replacement = psiElement.getText().replace(xmlCharacter,replacement);
+ replacement = startElement.getText().replace(xmlCharacter,replacement);
editor.getDocument().replaceString(
range.getStartOffset(),
@@ -106,7 +100,7 @@
}
private String getXmlCharacter() {
- return psiElement.getText().substring(startInElement, startInElement + 1);
+ return getStartElement().getText().substring(startInElement, startInElement + 1);
}
}
}
diff --git a/xml/xml-analysis-impl/src/com/intellij/xml/util/CheckValidXmlInScriptBodyInspectionBase.java b/xml/xml-analysis-impl/src/com/intellij/xml/util/CheckValidXmlInScriptBodyInspectionBase.java
index bf80b8c..8a89f07 100644
--- a/xml/xml-analysis-impl/src/com/intellij/xml/util/CheckValidXmlInScriptBodyInspectionBase.java
+++ b/xml/xml-analysis-impl/src/com/intellij/xml/util/CheckValidXmlInScriptBodyInspectionBase.java
@@ -93,7 +93,7 @@
psiElement,
XmlBundle.message("unescaped.xml.character"),
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
- createFix(psiFile, psiElement, offsetInElement)
+ createFix(psiElement, offsetInElement)
);
int endOfElementInScriptTag = elementRange.getEndOffset() - valueStart;
@@ -112,7 +112,7 @@
};
}
- protected LocalQuickFix createFix(PsiFile psiFile, PsiElement psiElement, int offsetInElement) {
+ protected LocalQuickFix createFix(PsiElement psiElement, int offsetInElement) {
return null;
}
diff --git a/xml/xml-psi-api/src/com/intellij/codeInspection/DefaultXmlSuppressionProvider.java b/xml/xml-psi-api/src/com/intellij/codeInspection/DefaultXmlSuppressionProvider.java
index c314b30..b41f086 100644
--- a/xml/xml-psi-api/src/com/intellij/codeInspection/DefaultXmlSuppressionProvider.java
+++ b/xml/xml-psi-api/src/com/intellij/codeInspection/DefaultXmlSuppressionProvider.java
@@ -29,11 +29,13 @@
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.xml.*;
-import com.intellij.util.ArrayUtil;
+import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.util.HashSet;
+
/**
* @author Dmitry Avdeev
*/
@@ -110,8 +112,8 @@
if (id == null) {
return true;
}
- @NonNls final String[] parts = text.split("[ ,]");
- return ArrayUtil.find(parts, id) != -1 || ArrayUtil.find(parts, XmlSuppressableInspectionTool.ALL) != -1;
+ @NonNls final HashSet<String> parts = ContainerUtil.newHashSet(StringUtil.getWordsIn(text));
+ return parts.contains(id) || parts.contains(XmlSuppressableInspectionTool.ALL);
}
protected void suppress(PsiFile file, final PsiElement suppressionElement, String inspectionId, final int offset) {