diff --git a/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java b/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java
index 527b627b0172..7c101e8ee30f 100644
--- a/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java
+++ b/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java
@@ -135,6 +135,7 @@ public class CompilerTask extends Task.Backgroundable {
try {
try {
+ final Application app = ApplicationManager.getApplication();
while (!acquired) {
acquired = semaphore.tryAcquire(500, TimeUnit.MILLISECONDS);
if (indicator.isCanceled()) {
@@ -142,6 +143,9 @@ public class CompilerTask extends Task.Backgroundable {
// let compile work begin in order to stop gracefuly on cancel event
break;
}
+ if (app.isDispatchThread()) {
+ UIUtil.dispatchAllInvocationEvents();
+ }
}
}
catch (InterruptedException ignored) {
diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
index 5cc6610b558f..5b9f83cd91a8 100644
--- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
+++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
@@ -115,6 +115,7 @@ import static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage
*/
public class BuildManager implements ApplicationComponent{
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.server.BuildManager");
+ private static final String COMPILER_PROCESS_JDK_PROPERTY = "compiler.process.jdk";
private static final String SYSTEM_ROOT = "compile-server";
private static final String LOGGER_CONFIG = "log.xml";
private static final String DEFAULT_LOGGER_CONFIG = "defaultLogConfig.xml";
@@ -123,7 +124,7 @@ public class BuildManager implements ApplicationComponent{
private static final String IWS_EXTENSION = ".iws";
private static final String IPR_EXTENSION = ".ipr";
private static final String IDEA_PROJECT_DIR_PATTERN = "/.idea/";
- private static final Function PATH_FILTER =
+ private static final Function PATH_FILTER =
SystemInfo.isFileSystemCaseSensitive?
new Function() {
@Override
@@ -173,7 +174,7 @@ public class BuildManager implements ApplicationComponent{
mySystemDirectory = system;
projectManager.addProjectManagerListener(new ProjectWatcher());
-
+
final MessageBusConnection conn = ApplicationManager.getApplication().getMessageBus().connect();
conn.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
@Override
@@ -193,7 +194,7 @@ public class BuildManager implements ApplicationComponent{
if (eventFile == null || ProjectCoreUtil.isProjectOrWorkspaceFile(eventFile)) {
continue;
}
-
+
if (activeProjects == null) {
activeProjects = getActiveProjects();
if (activeProjects.isEmpty()) {
@@ -684,72 +685,83 @@ public class BuildManager implements ApplicationComponent{
}
private OSProcessHandler launchBuildProcess(Project project, final int port, final UUID sessionId) throws ExecutionException {
- // choosing sdk with which the build process should be run
- Sdk projectJdk = null;
+ final String compilerPath;
+ final String vmExecutablePath;
JavaSdkVersion sdkVersion = null;
- int sdkMinorVersion = 0;
- final Set candidates = new HashSet();
- final Sdk defaultSdk = ProjectRootManager.getInstance(project).getProjectSdk();
- if (defaultSdk != null && defaultSdk.getSdkType() instanceof JavaSdk) {
- candidates.add(defaultSdk);
- }
+ final String forcedCompiledJdkHome = Registry.stringValue(COMPILER_PROCESS_JDK_PROPERTY);
- for (Module module : ModuleManager.getInstance(project).getModules()) {
- final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
- if (sdk != null && sdk.getSdkType() instanceof JavaSdk) {
- candidates.add(sdk);
+ if (StringUtil.isEmptyOrSpaces(forcedCompiledJdkHome)) {
+ // choosing sdk with which the build process should be run
+ Sdk projectJdk = null;
+ int sdkMinorVersion = 0;
+
+ final Set candidates = new HashSet();
+ final Sdk defaultSdk = ProjectRootManager.getInstance(project).getProjectSdk();
+ if (defaultSdk != null && defaultSdk.getSdkType() instanceof JavaSdk) {
+ candidates.add(defaultSdk);
}
- }
- // now select the latest version from the sdks that are used in the project, but not older than the internal sdk version
- for (Sdk candidate : candidates) {
- final String vs = candidate.getVersionString();
- if (vs != null) {
- final JavaSdkVersion candidateVersion = ((JavaSdk)candidate.getSdkType()).getVersion(vs);
- if (candidateVersion != null) {
- final int candidateMinorVersion = getMinorVersion(vs);
- if (projectJdk == null) {
- sdkVersion = candidateVersion;
- sdkMinorVersion = candidateMinorVersion;
- projectJdk = candidate;
- }
- else {
- final int result = candidateVersion.compareTo(sdkVersion);
- if (result > 0 || (result == 0 && candidateMinorVersion > sdkMinorVersion)) {
+ for (Module module : ModuleManager.getInstance(project).getModules()) {
+ final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
+ if (sdk != null && sdk.getSdkType() instanceof JavaSdk) {
+ candidates.add(sdk);
+ }
+ }
+
+ // now select the latest version from the sdks that are used in the project, but not older than the internal sdk version
+ for (Sdk candidate : candidates) {
+ final String vs = candidate.getVersionString();
+ if (vs != null) {
+ final JavaSdkVersion candidateVersion = ((JavaSdk)candidate.getSdkType()).getVersion(vs);
+ if (candidateVersion != null) {
+ final int candidateMinorVersion = getMinorVersion(vs);
+ if (projectJdk == null) {
sdkVersion = candidateVersion;
sdkMinorVersion = candidateMinorVersion;
projectJdk = candidate;
}
+ else {
+ final int result = candidateVersion.compareTo(sdkVersion);
+ if (result > 0 || (result == 0 && candidateMinorVersion > sdkMinorVersion)) {
+ sdkVersion = candidateVersion;
+ sdkMinorVersion = candidateMinorVersion;
+ projectJdk = candidate;
+ }
+ }
}
}
}
- }
- final Sdk internalJdk = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk();
- if (projectJdk == null || sdkVersion == null || !sdkVersion.isAtLeast(JavaSdkVersion.JDK_1_6)) {
- projectJdk = internalJdk;
- }
-
- // validate tools.jar presence
- final String compilerPath;
- if (projectJdk.equals(internalJdk)) {
- final JavaCompiler systemCompiler = ToolProvider.getSystemJavaCompiler();
- if (systemCompiler == null) {
- throw new ExecutionException("No system java compiler is provided by the JRE. Make sure tools.jar is present in IntelliJ IDEA classpath.");
+ final Sdk internalJdk = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk();
+ if (projectJdk == null || sdkVersion == null || !sdkVersion.isAtLeast(JavaSdkVersion.JDK_1_6)) {
+ projectJdk = internalJdk;
}
- compilerPath = ClasspathBootstrap.getResourcePath(systemCompiler.getClass());
+
+ // validate tools.jar presence
+ if (projectJdk.equals(internalJdk)) {
+ final JavaCompiler systemCompiler = ToolProvider.getSystemJavaCompiler();
+ if (systemCompiler == null) {
+ throw new ExecutionException("No system java compiler is provided by the JRE. Make sure tools.jar is present in IntelliJ IDEA classpath.");
+ }
+ compilerPath = ClasspathBootstrap.getResourcePath(systemCompiler.getClass());
+ }
+ else {
+ compilerPath = ((JavaSdk)projectJdk.getSdkType()).getToolsPath(projectJdk);
+ if (compilerPath == null) {
+ throw new ExecutionException("Cannot determine path to 'tools.jar' library for " + projectJdk.getName() + " (" + projectJdk.getHomePath() + ")");
+ }
+ }
+
+ vmExecutablePath = ((JavaSdkType)projectJdk.getSdkType()).getVMExecutablePath(projectJdk);
}
else {
- compilerPath = ((JavaSdk)projectJdk.getSdkType()).getToolsPath(projectJdk);
- if (compilerPath == null) {
- throw new ExecutionException("Cannot determine path to 'tools.jar' library for " + projectJdk.getName() + " (" + projectJdk.getHomePath() + ")");
- }
+ compilerPath = new File(forcedCompiledJdkHome, "lib/tools.jar").getAbsolutePath();
+ vmExecutablePath = new File(forcedCompiledJdkHome, "bin/java").getAbsolutePath();
}
final CompilerWorkspaceConfiguration config = CompilerWorkspaceConfiguration.getInstance(project);
final GeneralCommandLine cmdLine = new GeneralCommandLine();
- final String vmExecutablePath = ((JavaSdkType)projectJdk.getSdkType()).getVMExecutablePath(projectJdk);
cmdLine.setExePath(vmExecutablePath);
//cmdLine.addParameter("-XX:MaxPermSize=150m");
//cmdLine.addParameter("-XX:ReservedCodeCacheSize=64m");
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
index d880cae77f33..67b143c9b0c1 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -63,6 +63,8 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.PropertyKey;
import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import static com.intellij.util.containers.ContainerUtil.newTroveSet;
@@ -833,27 +835,35 @@ public class HighlightUtil extends HighlightUtilBase {
@Nullable
public static HighlightInfo checkLiteralExpressionParsingError(@NotNull final PsiLiteralExpression expression) {
- final Object value = expression.getValue();
- final PsiElement literal = expression.getFirstChild();
+ PsiElement literal = expression.getFirstChild();
assert literal instanceof PsiJavaToken : literal;
- final IElementType type = ((PsiJavaToken)literal).getTokenType();
- String text = PsiLiteralExpressionImpl.NUMERIC_LITERALS.contains(type) ? literal.getText().toLowerCase() : literal.getText();
+ IElementType type = ((PsiJavaToken)literal).getTokenType();
+ if (type == JavaTokenType.TRUE_KEYWORD || type == JavaTokenType.FALSE_KEYWORD || type == JavaTokenType.NULL_KEYWORD) {
+ return null;
+ }
- if (PsiLiteralExpressionImpl.REAL_LITERALS.contains(type)) {
+ boolean isInt = PsiLiteralExpressionImpl.INTEGER_LITERALS.contains(type);
+ boolean isFP = PsiLiteralExpressionImpl.REAL_LITERALS.contains(type);
+ String text = isInt || isFP ? literal.getText().toLowerCase() : literal.getText();
+ Object value = expression.getValue();
+
+ if (isFP) {
if (text.startsWith(PsiLiteralExpressionImpl.HEX_PREFIX)) {
final HighlightInfo info = checkFeature(expression, Feature.HEX_FP_LITERALS);
if (info != null) return info;
}
}
- if (PsiLiteralExpressionImpl.INTEGER_LITERALS.contains(type)) {
+ if (isInt) {
if (text.startsWith(PsiLiteralExpressionImpl.BIN_PREFIX)) {
final HighlightInfo info = checkFeature(expression, Feature.BIN_LITERALS);
if (info != null) return info;
}
}
- if (PsiLiteralExpressionImpl.NUMERIC_LITERALS.contains(type)) {
+ if (isInt || isFP) {
if (text.contains("_")) {
- final HighlightInfo info = checkFeature(expression, Feature.UNDERSCORES);
+ HighlightInfo info = checkFeature(expression, Feature.UNDERSCORES);
+ if (info != null) return info;
+ info = checkUnderscores(expression, text, isInt);
if (info != null) return info;
}
}
@@ -898,15 +908,12 @@ public class HighlightUtil extends HighlightUtilBase {
}
}
}
- else if (type == JavaTokenType.FLOAT_LITERAL || type == JavaTokenType.DOUBLE_LITERAL) {
+ else if (isFP) {
if (value == null) {
final String message = JavaErrorMessages.message("malformed.floating.point.literal");
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
}
- else if (type == JavaTokenType.TRUE_KEYWORD || type == JavaTokenType.FALSE_KEYWORD || type == JavaTokenType.NULL_KEYWORD) {
- return null;
- }
else if (type == JavaTokenType.CHARACTER_LITERAL) {
// todo[r.sh] clean this mess up
if (value != null) {
@@ -1003,6 +1010,43 @@ public class HighlightUtil extends HighlightUtilBase {
return null;
}
+ private static final Pattern FP_LITERAL_PARTS =
+ Pattern.compile("(?:" +
+ "(?:0x([_\\p{XDigit}]*)\\.?([_\\p{XDigit}]*)p[+-]?([_\\d]*))" +
+ "|" +
+ "(?:([_\\d]*)\\.?([_\\d]*)e?[+-]?([_\\d]*))" +
+ ")[fd]?");
+
+ @Nullable
+ private static HighlightInfo checkUnderscores(PsiElement expression, String text, boolean isInt) {
+ String[] parts = ArrayUtil.EMPTY_STRING_ARRAY;
+
+ if (isInt) {
+ int start = 0, end = text.length();
+ if (text.startsWith(PsiLiteralExpressionImpl.HEX_PREFIX) || text.startsWith(PsiLiteralExpressionImpl.BIN_PREFIX)) start += 2;
+ if (StringUtil.endsWithChar(text, 'l')) --end;
+ parts = new String[]{text.substring(start, end)};
+ }
+ else {
+ Matcher matcher = FP_LITERAL_PARTS.matcher(text);
+ if (matcher.matches()) {
+ parts = new String[matcher.groupCount()];
+ for (int i = 0; i < matcher.groupCount(); i++) {
+ parts[i] = matcher.group(i + 1);
+ }
+ }
+ }
+
+ for (String part : parts) {
+ if (part != null && (StringUtil.startsWithChar(part, '_') || StringUtil.endsWithChar(part, '_'))) {
+ String message = JavaErrorMessages.message("illegal.underscore");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
+ }
+ }
+
+ return null;
+ }
+
// true if floating point literal consists of zeros only
public static boolean isFPZero(@NotNull final String text) {
for (int i = 0; i < text.length(); i++) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodQuickFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodQuickFix.java
index 28de8496e7aa..a1323ae5fd90 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodQuickFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodQuickFix.java
@@ -18,8 +18,8 @@ package com.intellij.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.CodeInsightUtilBase;
import com.intellij.codeInsight.ExpectedTypeInfo;
import com.intellij.codeInsight.daemon.QuickFixBundle;
-import com.intellij.codeInspection.LocalQuickFix;
-import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.codeInspection.IntentionAndQuickFixAction;
+import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.*;
@@ -35,7 +35,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.List;
-public class CreateMethodQuickFix implements LocalQuickFix {
+public class CreateMethodQuickFix extends IntentionAndQuickFixAction {
protected final PsiClass myTargetClass;
protected final String mySignature;
protected final String myBody;
@@ -66,10 +66,10 @@ public class CreateMethodQuickFix implements LocalQuickFix {
}
@Override
- public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
+ public void applyFix(Project project, PsiFile file, @Nullable Editor editor) {
if (!CodeInsightUtilBase.preparePsiElementForWrite(myTargetClass.getContainingFile())) return;
- PsiMethod method = createMethod(project);
+ PsiMethod method = createMethod(project);
List> arguments =
ContainerUtil.map2List(method.getParameterList().getParameters(), new Function>() {
@Override
diff --git a/java/java-psi-impl/src/com/intellij/lang/java/parser/ExpressionParser.java b/java/java-psi-impl/src/com/intellij/lang/java/parser/ExpressionParser.java
index 42a5fafe3309..2dbc3f18edca 100644
--- a/java/java-psi-impl/src/com/intellij/lang/java/parser/ExpressionParser.java
+++ b/java/java-psi-impl/src/com/intellij/lang/java/parser/ExpressionParser.java
@@ -549,10 +549,13 @@ public class ExpressionParser {
final PsiBuilder.Marker mark = builder.mark();
final ReferenceParser.TypeInfo typeInfo = myParser.getReferenceParser().parseTypeInfo(builder, 0);
- if (typeInfo != null && (typeInfo.isPrimitive || !typeInfo.hasErrors && typeInfo.isParameterized)) {
- final PsiBuilder.Marker result = continueClassAccessOrMethodReference(builder, mark, typeInfo.isPrimitive);
- if (result != null) {
- return result;
+ if (typeInfo != null) {
+ boolean optionalClassKeyword = typeInfo.isPrimitive || typeInfo.isArray;
+ if (optionalClassKeyword || !typeInfo.hasErrors && typeInfo.isParameterized) {
+ final PsiBuilder.Marker result = continueClassAccessOrMethodReference(builder, mark, optionalClassKeyword);
+ if (result != null) {
+ return result;
+ }
}
}
@@ -776,10 +779,10 @@ public class ExpressionParser {
@Nullable
private PsiBuilder.Marker continueClassAccessOrMethodReference(final PsiBuilder builder,
final PsiBuilder.Marker expr,
- final boolean primitive) {
+ final boolean optionalClassKeyword) {
final IElementType tokenType = builder.getTokenType();
if (tokenType == JavaTokenType.DOT) {
- return parseClassObjectAccess(builder, expr, primitive);
+ return parseClassObjectAccess(builder, expr, optionalClassKeyword);
}
else if (tokenType == JavaTokenType.DOUBLE_COLON) {
return parseMethodReference(builder, expr);
@@ -789,7 +792,7 @@ public class ExpressionParser {
}
@Nullable
- private static PsiBuilder.Marker parseClassObjectAccess(PsiBuilder builder, PsiBuilder.Marker expr, boolean primitive) {
+ private static PsiBuilder.Marker parseClassObjectAccess(PsiBuilder builder, PsiBuilder.Marker expr, boolean optionalClassKeyword) {
final PsiBuilder.Marker mark = builder.mark();
builder.advanceLexer();
@@ -798,7 +801,7 @@ public class ExpressionParser {
builder.advanceLexer();
}
else {
- if (!primitive) return null;
+ if (!optionalClassKeyword) return null;
mark.rollbackTo();
builder.error(".class expected");
}
diff --git a/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.flex b/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.flex
index 5b62d45a8f4a..30413b509690 100644
--- a/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.flex
+++ b/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.flex
@@ -1,4 +1,18 @@
-/* It's an automatically generated code. Do not modify it. */
+/*
+ * 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.lexer;
import com.intellij.pom.java.LanguageLevel;
@@ -43,38 +57,24 @@ DOC_COMMENT="/*""*"+("/"|([^"/""*"]{COMMENT_TAIL}))?
COMMENT_TAIL=([^"*"]*("*"+[^"*""/"])?)*("*"+"/")?
END_OF_LINE_COMMENT="/""/"[^\r\n]*
-DIGIT=[0-9]
-DIGIT_OR_UNDERSCORE=[_0-9]
-OCTAL_DIGIT=[0-7]
-OCTAL_DIGIT_OR_UNDERSCORE=[_0-7]
-HEX_DIGIT=[0-9A-Fa-f]
-HEX_DIGIT_OR_UNDERSCORE=[_0-9A-Fa-f]
-BINARY_DIGIT=[01]
-BINARY_DIGIT_OR_UNDERSCORE=[_01]
+DIGIT = [0-9]
+DIGIT_OR_UNDERSCORE = [_0-9]
+DIGITS = {DIGIT} | {DIGIT} {DIGIT_OR_UNDERSCORE}*
+HEX_DIGIT_OR_UNDERSCORE = [_0-9A-Fa-f]
-DIGITS={DIGIT}|({DIGIT}{DIGIT_OR_UNDERSCORE}*{DIGIT})
-HEX_DIGITS={HEX_DIGIT}|({HEX_DIGIT}{HEX_DIGIT_OR_UNDERSCORE}*{HEX_DIGIT})
-BINARY_DIGITS={BINARY_DIGIT}|({BINARY_DIGIT}{BINARY_DIGIT_OR_UNDERSCORE}*{BINARY_DIGIT})
+INTEGER_LITERAL = {DIGITS} | {HEX_INTEGER_LITERAL} | {BIN_INTEGER_LITERAL}
+LONG_LITERAL = {INTEGER_LITERAL} [Ll]
+HEX_INTEGER_LITERAL = 0 [Xx] {HEX_DIGIT_OR_UNDERSCORE}*
+BIN_INTEGER_LITERAL = 0 [Bb] {DIGIT_OR_UNDERSCORE}*
-INTEGER_LITERAL={DECIMAL_INTEGER_LITERAL}|{OCTAL_INTEGER_LITERAL}|{HEX_INTEGER_LITERAL}|{BINARY_INTEGER_LITERAL}
-DECIMAL_INTEGER_LITERAL=0|([1-9]({DIGIT_OR_UNDERSCORE}*{DIGIT})?)
-OCTAL_INTEGER_LITERAL=0{OCTAL_DIGIT_OR_UNDERSCORE}*{OCTAL_DIGIT}
-HEX_INTEGER_LITERAL=0[Xx]{HEX_DIGITS}?
-BINARY_INTEGER_LITERAL=0[Bb]{BINARY_DIGITS}?
-LONG_LITERAL={INTEGER_LITERAL}[Ll]
-
-FLOAT_LITERAL=({FLOATING_POINT_LITERAL1}|{FLOATING_POINT_LITERAL2}|{FLOATING_POINT_LITERAL3}|{FLOATING_POINT_LITERAL4})[Ff]
-DOUBLE_LITERAL=(({FLOATING_POINT_LITERAL1}|{FLOATING_POINT_LITERAL2}|{FLOATING_POINT_LITERAL3})[Dd]?)|({FLOATING_POINT_LITERAL4}[Dd])
-FLOATING_POINT_LITERAL1={DIGITS}"."{DIGITS}?{EXPONENT_PART}?
-FLOATING_POINT_LITERAL2="."{DIGITS}{EXPONENT_PART}?
-FLOATING_POINT_LITERAL3={DIGITS}{EXPONENT_PART}
-FLOATING_POINT_LITERAL4={DIGITS}
-EXPONENT_PART=[Ee]["+""-"]?{DIGITS}?
-
-HEX_FLOAT_LITERAL={HEX_SIGNIFICAND}{BINARY_EXPONENT}[Ff]
-HEX_DOUBLE_LITERAL={HEX_SIGNIFICAND}{BINARY_EXPONENT}[Dd]?
-BINARY_EXPONENT=[Pp][+-]?{DIGITS}
-HEX_SIGNIFICAND={HEX_INTEGER_LITERAL}|{HEX_INTEGER_LITERAL}.|0[Xx]{HEX_DIGITS}?.{HEX_DIGITS}
+FLOAT_LITERAL = ({DEC_FP_LITERAL} | {HEX_FP_LITERAL}) [Ff] | {DIGITS} [Ff]
+DOUBLE_LITERAL = ({DEC_FP_LITERAL} | {HEX_FP_LITERAL}) [Dd]? | {DIGITS} [Dd]
+DEC_FP_LITERAL = {DIGITS} {DEC_EXPONENT} | {DEC_SIGNIFICAND} {DEC_EXPONENT}?
+DEC_SIGNIFICAND = "." {DIGITS} | {DIGITS} "." {DIGIT_OR_UNDERSCORE}*
+DEC_EXPONENT = [Ee] [+-]? {DIGIT_OR_UNDERSCORE}*
+HEX_FP_LITERAL = {HEX_SIGNIFICAND} {HEX_EXPONENT}
+HEX_SIGNIFICAND = 0 [Xx] ({HEX_DIGIT_OR_UNDERSCORE}+ "."? | {HEX_DIGIT_OR_UNDERSCORE}* "." {HEX_DIGIT_OR_UNDERSCORE}+)
+HEX_EXPONENT = [Pp] [+-]? {DIGIT_OR_UNDERSCORE}*
CHARACTER_LITERAL="'"([^\\\'\r\n]|{ESCAPE_SEQUENCE})*("'"|\\)?
STRING_LITERAL=\"([^\\\"\r\n]|{ESCAPE_SEQUENCE})*(\"|\\)?
@@ -91,10 +91,7 @@ ESCAPE_SEQUENCE=\\[^\r\n]
{LONG_LITERAL} { return JavaTokenType.LONG_LITERAL; }
{INTEGER_LITERAL} { return JavaTokenType.INTEGER_LITERAL; }
{FLOAT_LITERAL} { return JavaTokenType.FLOAT_LITERAL; }
- {HEX_FLOAT_LITERAL} { return JavaTokenType.FLOAT_LITERAL; }
{DOUBLE_LITERAL} { return JavaTokenType.DOUBLE_LITERAL; }
- {HEX_DOUBLE_LITERAL} { return JavaTokenType.DOUBLE_LITERAL; }
-
{CHARACTER_LITERAL} { return JavaTokenType.CHARACTER_LITERAL; }
{STRING_LITERAL} { return JavaTokenType.STRING_LITERAL; }
diff --git a/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.java b/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.java
index 702d3f66f20a..1c5711cc4c25 100644
--- a/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.java
+++ b/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-/* The following code was generated by JFlex 1.4.3 on 5/14/12 1:21 PM */
-
-/* It's an automatically generated code. Do not modify it. */
+/* The following code was generated by JFlex 1.4.3 on 1/17/13 8:47 PM */
package com.intellij.lexer;
import com.intellij.pom.java.LanguageLevel;
@@ -29,7 +27,7 @@ import com.intellij.psi.tree.IElementType;
/**
* This class is a scanner generated by
* JFlex 1.4.3
- * on 5/14/12 1:21 PM from the specification file
+ * on 1/17/13 8:47 PM from the specification file
* /home/sher/Projects/IDEA/tools/lexer/../../community/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.flex
*/
class _JavaLexer implements FlexLexer {
@@ -53,96 +51,96 @@ class _JavaLexer implements FlexLexer {
* Translates characters to character classes
*/
private static final String ZZ_CMAP_PACKED =
- "\11\3\1\1\1\26\1\0\1\1\1\6\16\3\4\0\1\1\1\63"+
- "\1\31\1\0\1\2\1\72\1\70\1\27\1\73\1\74\1\5\1\65"+
- "\1\102\1\24\1\22\1\4\1\14\1\13\6\11\2\7\1\105\1\101"+
- "\1\66\1\62\1\67\1\104\1\106\1\12\1\16\1\12\1\21\1\23"+
- "\1\20\5\2\1\17\3\2\1\25\7\2\1\15\2\2\1\77\1\30"+
- "\1\100\1\71\1\10\1\0\1\37\1\43\1\44\1\52\1\35\1\36"+
- "\1\55\1\50\1\51\1\2\1\46\1\40\1\53\1\42\1\45\1\56"+
- "\1\2\1\33\1\41\1\32\1\34\1\57\1\60\1\54\1\47\1\61"+
- "\1\75\1\64\1\76\1\103\41\3\2\0\4\2\4\0\1\2\2\0"+
- "\1\3\7\0\1\2\4\0\1\2\5\0\27\2\1\0\37\2\1\0"+
- "\u013f\2\31\0\162\2\4\0\14\2\16\0\5\2\11\0\1\2\21\0"+
- "\130\3\5\0\23\3\12\0\1\2\13\0\1\2\1\0\3\2\1\0"+
- "\1\2\1\0\24\2\1\0\54\2\1\0\46\2\1\0\5\2\4\0"+
- "\202\2\1\0\4\3\3\0\105\2\1\0\46\2\2\0\2\2\6\0"+
- "\20\2\41\0\46\2\2\0\1\2\7\0\47\2\11\0\21\3\1\0"+
- "\27\3\1\0\3\3\1\0\1\3\1\0\2\3\1\0\1\3\13\0"+
- "\33\2\5\0\3\2\15\0\4\3\14\0\6\3\13\0\32\2\5\0"+
- "\13\2\16\3\7\0\12\3\4\0\2\2\1\3\143\2\1\0\1\2"+
- "\10\3\1\0\6\3\2\2\2\3\1\0\4\3\2\2\12\3\3\2"+
- "\2\0\1\2\17\0\1\3\1\2\1\3\36\2\33\3\2\0\3\2"+
- "\60\0\46\2\13\3\1\2\u014f\0\3\3\66\2\2\0\1\3\1\2"+
- "\20\3\2\0\1\2\4\3\3\0\12\2\2\3\2\0\12\3\21\0"+
- "\3\3\1\0\10\2\2\0\2\2\2\0\26\2\1\0\7\2\1\0"+
- "\1\2\3\0\4\2\2\0\1\3\1\2\7\3\2\0\2\3\2\0"+
- "\3\3\11\0\1\3\4\0\2\2\1\0\3\2\2\3\2\0\12\3"+
- "\4\2\15\0\3\3\1\0\6\2\4\0\2\2\2\0\26\2\1\0"+
- "\7\2\1\0\2\2\1\0\2\2\1\0\2\2\2\0\1\3\1\0"+
- "\5\3\4\0\2\3\2\0\3\3\13\0\4\2\1\0\1\2\7\0"+
- "\14\3\3\2\14\0\3\3\1\0\11\2\1\0\3\2\1\0\26\2"+
- "\1\0\7\2\1\0\2\2\1\0\5\2\2\0\1\3\1\2\10\3"+
- "\1\0\3\3\1\0\3\3\2\0\1\2\17\0\2\2\2\3\2\0"+
- "\12\3\1\0\1\2\17\0\3\3\1\0\10\2\2\0\2\2\2\0"+
- "\26\2\1\0\7\2\1\0\2\2\1\0\5\2\2\0\1\3\1\2"+
- "\6\3\3\0\2\3\2\0\3\3\10\0\2\3\4\0\2\2\1\0"+
- "\3\2\4\0\12\3\1\0\1\2\20\0\1\3\1\2\1\0\6\2"+
- "\3\0\3\2\1\0\4\2\3\0\2\2\1\0\1\2\1\0\2\2"+
- "\3\0\2\2\3\0\3\2\3\0\10\2\1\0\3\2\4\0\5\3"+
- "\3\0\3\3\1\0\4\3\11\0\1\3\17\0\11\3\11\0\1\2"+
- "\7\0\3\3\1\0\10\2\1\0\3\2\1\0\27\2\1\0\12\2"+
- "\1\0\5\2\4\0\7\3\1\0\3\3\1\0\4\3\7\0\2\3"+
- "\11\0\2\2\4\0\12\3\22\0\2\3\1\0\10\2\1\0\3\2"+
- "\1\0\27\2\1\0\12\2\1\0\5\2\2\0\1\3\1\2\7\3"+
- "\1\0\3\3\1\0\4\3\7\0\2\3\7\0\1\2\1\0\2\2"+
+ "\11\3\1\1\1\6\1\0\1\1\1\6\16\3\4\0\1\1\1\60"+
+ "\1\26\1\0\1\2\1\67\1\65\1\24\1\70\1\71\1\5\1\62"+
+ "\1\77\1\22\1\20\1\4\1\13\11\7\1\102\1\76\1\63\1\57"+
+ "\1\64\1\101\1\103\1\11\1\15\1\11\1\17\1\21\1\16\5\2"+
+ "\1\12\3\2\1\23\7\2\1\14\2\2\1\74\1\25\1\75\1\66"+
+ "\1\10\1\0\1\34\1\40\1\41\1\47\1\32\1\33\1\52\1\45"+
+ "\1\46\1\2\1\43\1\35\1\50\1\37\1\42\1\53\1\2\1\30"+
+ "\1\36\1\27\1\31\1\54\1\55\1\51\1\44\1\56\1\72\1\61"+
+ "\1\73\1\100\41\3\2\0\4\2\4\0\1\2\2\0\1\3\7\0"+
+ "\1\2\4\0\1\2\5\0\27\2\1\0\37\2\1\0\u013f\2\31\0"+
+ "\162\2\4\0\14\2\16\0\5\2\11\0\1\2\21\0\130\3\5\0"+
+ "\23\3\12\0\1\2\13\0\1\2\1\0\3\2\1\0\1\2\1\0"+
+ "\24\2\1\0\54\2\1\0\46\2\1\0\5\2\4\0\202\2\1\0"+
+ "\4\3\3\0\105\2\1\0\46\2\2\0\2\2\6\0\20\2\41\0"+
+ "\46\2\2\0\1\2\7\0\47\2\11\0\21\3\1\0\27\3\1\0"+
+ "\3\3\1\0\1\3\1\0\2\3\1\0\1\3\13\0\33\2\5\0"+
+ "\3\2\15\0\4\3\14\0\6\3\13\0\32\2\5\0\13\2\16\3"+
+ "\7\0\12\3\4\0\2\2\1\3\143\2\1\0\1\2\10\3\1\0"+
+ "\6\3\2\2\2\3\1\0\4\3\2\2\12\3\3\2\2\0\1\2"+
+ "\17\0\1\3\1\2\1\3\36\2\33\3\2\0\3\2\60\0\46\2"+
+ "\13\3\1\2\u014f\0\3\3\66\2\2\0\1\3\1\2\20\3\2\0"+
+ "\1\2\4\3\3\0\12\2\2\3\2\0\12\3\21\0\3\3\1\0"+
+ "\10\2\2\0\2\2\2\0\26\2\1\0\7\2\1\0\1\2\3\0"+
+ "\4\2\2\0\1\3\1\2\7\3\2\0\2\3\2\0\3\3\11\0"+
+ "\1\3\4\0\2\2\1\0\3\2\2\3\2\0\12\3\4\2\15\0"+
+ "\3\3\1\0\6\2\4\0\2\2\2\0\26\2\1\0\7\2\1\0"+
+ "\2\2\1\0\2\2\1\0\2\2\2\0\1\3\1\0\5\3\4\0"+
+ "\2\3\2\0\3\3\13\0\4\2\1\0\1\2\7\0\14\3\3\2"+
+ "\14\0\3\3\1\0\11\2\1\0\3\2\1\0\26\2\1\0\7\2"+
+ "\1\0\2\2\1\0\5\2\2\0\1\3\1\2\10\3\1\0\3\3"+
+ "\1\0\3\3\2\0\1\2\17\0\2\2\2\3\2\0\12\3\1\0"+
+ "\1\2\17\0\3\3\1\0\10\2\2\0\2\2\2\0\26\2\1\0"+
+ "\7\2\1\0\2\2\1\0\5\2\2\0\1\3\1\2\6\3\3\0"+
+ "\2\3\2\0\3\3\10\0\2\3\4\0\2\2\1\0\3\2\4\0"+
+ "\12\3\1\0\1\2\20\0\1\3\1\2\1\0\6\2\3\0\3\2"+
+ "\1\0\4\2\3\0\2\2\1\0\1\2\1\0\2\2\3\0\2\2"+
+ "\3\0\3\2\3\0\10\2\1\0\3\2\4\0\5\3\3\0\3\3"+
+ "\1\0\4\3\11\0\1\3\17\0\11\3\11\0\1\2\7\0\3\3"+
+ "\1\0\10\2\1\0\3\2\1\0\27\2\1\0\12\2\1\0\5\2"+
+ "\4\0\7\3\1\0\3\3\1\0\4\3\7\0\2\3\11\0\2\2"+
"\4\0\12\3\22\0\2\3\1\0\10\2\1\0\3\2\1\0\27\2"+
- "\1\0\20\2\4\0\6\3\2\0\3\3\1\0\4\3\11\0\1\3"+
- "\10\0\2\2\4\0\12\3\22\0\2\3\1\0\22\2\3\0\30\2"+
- "\1\0\11\2\1\0\1\2\2\0\7\2\3\0\1\3\4\0\6\3"+
- "\1\0\1\3\1\0\10\3\22\0\2\3\15\0\60\2\1\3\2\2"+
- "\7\3\4\0\10\2\10\3\1\0\12\3\47\0\2\2\1\0\1\2"+
- "\2\0\2\2\1\0\1\2\2\0\1\2\6\0\4\2\1\0\7\2"+
- "\1\0\3\2\1\0\1\2\1\0\1\2\2\0\2\2\1\0\4\2"+
- "\1\3\2\2\6\3\1\0\2\3\1\2\2\0\5\2\1\0\1\2"+
- "\1\0\6\3\2\0\12\3\2\0\2\2\42\0\1\2\27\0\2\3"+
- "\6\0\12\3\13\0\1\3\1\0\1\3\1\0\1\3\4\0\2\3"+
- "\10\2\1\0\42\2\6\0\24\3\1\0\2\3\4\2\4\0\10\3"+
- "\1\0\44\3\11\0\1\3\71\0\42\2\1\0\5\2\1\0\2\2"+
- "\1\0\7\3\3\0\4\3\6\0\12\3\6\0\6\2\4\3\106\0"+
- "\46\2\12\0\51\2\7\0\132\2\5\0\104\2\5\0\122\2\6\0"+
- "\7\2\1\0\77\2\1\0\1\2\1\0\4\2\2\0\7\2\1\0"+
- "\1\2\1\0\4\2\2\0\47\2\1\0\1\2\1\0\4\2\2\0"+
- "\37\2\1\0\1\2\1\0\4\2\2\0\7\2\1\0\1\2\1\0"+
- "\4\2\2\0\7\2\1\0\7\2\1\0\27\2\1\0\37\2\1\0"+
- "\1\2\1\0\4\2\2\0\7\2\1\0\47\2\1\0\23\2\16\0"+
- "\11\3\56\0\125\2\14\0\u026c\2\2\0\10\2\12\0\32\2\5\0"+
- "\113\2\3\0\3\2\17\0\15\2\1\0\4\2\3\3\13\0\22\2"+
- "\3\3\13\0\22\2\2\3\14\0\15\2\1\0\3\2\1\0\2\3"+
- "\14\0\64\2\40\3\3\0\1\2\3\0\2\2\1\3\2\0\12\3"+
- "\41\0\3\3\2\0\12\3\6\0\130\2\10\0\51\2\1\3\126\0"+
- "\35\2\3\0\14\3\4\0\14\3\12\0\12\3\36\2\2\0\5\2"+
- "\u038b\0\154\2\224\0\234\2\4\0\132\2\6\0\26\2\2\0\6\2"+
- "\2\0\46\2\2\0\6\2\2\0\10\2\1\0\1\2\1\0\1\2"+
- "\1\0\1\2\1\0\37\2\2\0\65\2\1\0\7\2\1\0\1\2"+
- "\3\0\3\2\1\0\7\2\3\0\4\2\2\0\6\2\4\0\15\2"+
- "\5\0\3\2\1\0\7\2\17\0\4\3\32\0\5\3\20\0\2\2"+
- "\23\0\1\2\13\0\4\3\6\0\6\3\1\0\1\2\15\0\1\2"+
- "\40\0\22\2\36\0\15\3\4\0\1\3\3\0\6\3\27\0\1\2"+
- "\4\0\1\2\2\0\12\2\1\0\1\2\3\0\5\2\6\0\1\2"+
- "\1\0\1\2\1\0\1\2\1\0\4\2\1\0\3\2\1\0\7\2"+
- "\3\0\3\2\5\0\5\2\26\0\44\2\u0e81\0\3\2\31\0\11\2"+
- "\6\3\1\0\5\2\2\0\5\2\4\0\126\2\2\0\2\3\2\0"+
- "\3\2\1\0\137\2\5\0\50\2\4\0\136\2\21\0\30\2\70\0"+
- "\20\2\u0200\0\u19b6\2\112\0\u51a6\2\132\0\u048d\2\u0773\0\u2ba4\2\u215c\0"+
- "\u012e\2\2\0\73\2\225\0\7\2\14\0\5\2\5\0\1\2\1\3"+
- "\12\2\1\0\15\2\1\0\5\2\1\0\1\2\1\0\2\2\1\0"+
- "\2\2\1\0\154\2\41\0\u016b\2\22\0\100\2\2\0\66\2\50\0"+
- "\15\2\3\0\20\3\20\0\4\3\17\0\2\2\30\0\3\2\31\0"+
- "\1\2\6\0\5\2\1\0\207\2\2\0\1\3\4\0\1\2\13\0"+
- "\12\3\7\0\32\2\4\0\1\2\1\0\32\2\12\0\132\2\3\0"+
- "\6\2\2\0\6\2\2\0\6\2\2\0\3\2\3\0\2\2\3\0"+
- "\2\2\22\0\3\3\4\0";
+ "\1\0\12\2\1\0\5\2\2\0\1\3\1\2\7\3\1\0\3\3"+
+ "\1\0\4\3\7\0\2\3\7\0\1\2\1\0\2\2\4\0\12\3"+
+ "\22\0\2\3\1\0\10\2\1\0\3\2\1\0\27\2\1\0\20\2"+
+ "\4\0\6\3\2\0\3\3\1\0\4\3\11\0\1\3\10\0\2\2"+
+ "\4\0\12\3\22\0\2\3\1\0\22\2\3\0\30\2\1\0\11\2"+
+ "\1\0\1\2\2\0\7\2\3\0\1\3\4\0\6\3\1\0\1\3"+
+ "\1\0\10\3\22\0\2\3\15\0\60\2\1\3\2\2\7\3\4\0"+
+ "\10\2\10\3\1\0\12\3\47\0\2\2\1\0\1\2\2\0\2\2"+
+ "\1\0\1\2\2\0\1\2\6\0\4\2\1\0\7\2\1\0\3\2"+
+ "\1\0\1\2\1\0\1\2\2\0\2\2\1\0\4\2\1\3\2\2"+
+ "\6\3\1\0\2\3\1\2\2\0\5\2\1\0\1\2\1\0\6\3"+
+ "\2\0\12\3\2\0\2\2\42\0\1\2\27\0\2\3\6\0\12\3"+
+ "\13\0\1\3\1\0\1\3\1\0\1\3\4\0\2\3\10\2\1\0"+
+ "\42\2\6\0\24\3\1\0\2\3\4\2\4\0\10\3\1\0\44\3"+
+ "\11\0\1\3\71\0\42\2\1\0\5\2\1\0\2\2\1\0\7\3"+
+ "\3\0\4\3\6\0\12\3\6\0\6\2\4\3\106\0\46\2\12\0"+
+ "\51\2\7\0\132\2\5\0\104\2\5\0\122\2\6\0\7\2\1\0"+
+ "\77\2\1\0\1\2\1\0\4\2\2\0\7\2\1\0\1\2\1\0"+
+ "\4\2\2\0\47\2\1\0\1\2\1\0\4\2\2\0\37\2\1\0"+
+ "\1\2\1\0\4\2\2\0\7\2\1\0\1\2\1\0\4\2\2\0"+
+ "\7\2\1\0\7\2\1\0\27\2\1\0\37\2\1\0\1\2\1\0"+
+ "\4\2\2\0\7\2\1\0\47\2\1\0\23\2\16\0\11\3\56\0"+
+ "\125\2\14\0\u026c\2\2\0\10\2\12\0\32\2\5\0\113\2\3\0"+
+ "\3\2\17\0\15\2\1\0\4\2\3\3\13\0\22\2\3\3\13\0"+
+ "\22\2\2\3\14\0\15\2\1\0\3\2\1\0\2\3\14\0\64\2"+
+ "\40\3\3\0\1\2\3\0\2\2\1\3\2\0\12\3\41\0\3\3"+
+ "\2\0\12\3\6\0\130\2\10\0\51\2\1\3\126\0\35\2\3\0"+
+ "\14\3\4\0\14\3\12\0\12\3\36\2\2\0\5\2\u038b\0\154\2"+
+ "\224\0\234\2\4\0\132\2\6\0\26\2\2\0\6\2\2\0\46\2"+
+ "\2\0\6\2\2\0\10\2\1\0\1\2\1\0\1\2\1\0\1\2"+
+ "\1\0\37\2\2\0\65\2\1\0\7\2\1\0\1\2\3\0\3\2"+
+ "\1\0\7\2\3\0\4\2\2\0\6\2\4\0\15\2\5\0\3\2"+
+ "\1\0\7\2\17\0\4\3\32\0\5\3\20\0\2\2\23\0\1\2"+
+ "\13\0\4\3\6\0\6\3\1\0\1\2\15\0\1\2\40\0\22\2"+
+ "\36\0\15\3\4\0\1\3\3\0\6\3\27\0\1\2\4\0\1\2"+
+ "\2\0\12\2\1\0\1\2\3\0\5\2\6\0\1\2\1\0\1\2"+
+ "\1\0\1\2\1\0\4\2\1\0\3\2\1\0\7\2\3\0\3\2"+
+ "\5\0\5\2\26\0\44\2\u0e81\0\3\2\31\0\11\2\6\3\1\0"+
+ "\5\2\2\0\5\2\4\0\126\2\2\0\2\3\2\0\3\2\1\0"+
+ "\137\2\5\0\50\2\4\0\136\2\21\0\30\2\70\0\20\2\u0200\0"+
+ "\u19b6\2\112\0\u51a6\2\132\0\u048d\2\u0773\0\u2ba4\2\u215c\0\u012e\2\2\0"+
+ "\73\2\225\0\7\2\14\0\5\2\5\0\1\2\1\3\12\2\1\0"+
+ "\15\2\1\0\5\2\1\0\1\2\1\0\2\2\1\0\2\2\1\0"+
+ "\154\2\41\0\u016b\2\22\0\100\2\2\0\66\2\50\0\15\2\3\0"+
+ "\20\3\20\0\4\3\17\0\2\2\30\0\3\2\31\0\1\2\6\0"+
+ "\5\2\1\0\207\2\2\0\1\3\4\0\1\2\13\0\12\3\7\0"+
+ "\32\2\4\0\1\2\1\0\32\2\12\0\132\2\3\0\6\2\2\0"+
+ "\6\2\2\0\6\2\2\0\3\2\3\0\2\2\3\0\2\2\22\0"+
+ "\3\3\4\0";
/**
* Translates characters to character classes
@@ -159,28 +157,27 @@ class _JavaLexer implements FlexLexer {
"\1\10\1\11\1\12\20\3\1\13\1\14\1\15\1\16"+
"\1\17\1\20\1\21\1\22\1\23\1\24\1\25\1\26"+
"\1\27\1\30\1\31\1\32\1\33\1\34\1\35\1\36"+
- "\1\37\1\40\1\41\1\42\1\43\1\0\1\44\1\45"+
- "\3\46\2\0\3\6\1\46\1\0\1\47\1\50\1\51"+
- "\2\11\2\12\34\3\1\52\3\3\1\53\6\3\1\54"+
- "\1\55\1\56\1\57\1\60\1\61\1\62\1\63\1\64"+
- "\1\65\1\66\1\67\1\70\1\41\1\71\2\46\2\0"+
- "\1\6\1\44\1\0\1\6\1\0\1\72\2\3\1\73"+
- "\10\3\1\74\13\3\1\75\11\3\1\76\14\3\1\77"+
- "\1\0\2\71\4\0\1\46\2\0\1\100\2\3\1\101"+
- "\1\3\1\102\1\103\6\3\1\104\6\3\1\105\3\3"+
- "\1\106\1\3\1\107\3\3\1\110\6\3\1\111\5\3"+
- "\1\112\1\3\1\41\4\0\1\45\1\46\1\3\1\113"+
- "\2\3\1\114\1\115\1\116\4\3\1\117\1\3\1\120"+
- "\2\3\1\121\1\3\1\122\1\123\1\3\1\124\13\3"+
- "\1\125\1\3\1\126\1\127\2\3\1\130\2\3\1\131"+
- "\1\3\1\132\1\133\5\3\1\134\1\3\1\135\2\3"+
- "\1\136\3\3\1\137\1\140\3\3\1\141\4\3\1\142"+
- "\1\3\1\143\1\144\2\3\1\145\1\146\1\3\1\147"+
- "\4\3\1\150\1\151\1\3\1\152\2\3\1\153\1\3"+
- "\1\154\1\155\1\3\1\156";
+ "\1\37\1\40\1\41\1\42\1\43\1\44\1\45\3\46"+
+ "\2\6\1\0\1\47\1\50\1\51\2\11\2\12\34\3"+
+ "\1\52\3\3\1\53\6\3\1\54\1\55\1\56\1\57"+
+ "\1\60\1\61\1\62\1\63\1\64\1\65\1\66\1\67"+
+ "\1\70\1\41\1\71\1\46\1\6\1\0\1\72\2\3"+
+ "\1\73\10\3\1\74\13\3\1\75\11\3\1\76\14\3"+
+ "\1\77\1\0\2\71\1\0\1\100\2\3\1\101\1\3"+
+ "\1\102\1\103\6\3\1\104\6\3\1\105\3\3\1\106"+
+ "\1\3\1\107\3\3\1\110\6\3\1\111\5\3\1\112"+
+ "\1\3\1\41\1\0\1\3\1\113\2\3\1\114\1\115"+
+ "\1\116\4\3\1\117\1\3\1\120\2\3\1\121\1\3"+
+ "\1\122\1\123\1\3\1\124\13\3\1\125\1\3\1\126"+
+ "\1\127\2\3\1\130\2\3\1\131\1\3\1\132\1\133"+
+ "\5\3\1\134\1\3\1\135\2\3\1\136\3\3\1\137"+
+ "\1\140\3\3\1\141\4\3\1\142\1\3\1\143\1\144"+
+ "\2\3\1\145\1\146\1\3\1\147\4\3\1\150\1\151"+
+ "\1\3\1\152\2\3\1\153\1\3\1\154\1\155\1\3"+
+ "\1\156";
private static int [] zzUnpackAction() {
- int [] result = new int[342];
+ int [] result = new int[320];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
@@ -205,52 +202,49 @@ class _JavaLexer implements FlexLexer {
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
- "\0\0\0\107\0\216\0\325\0\u011c\0\u0163\0\u01aa\0\u01f1"+
- "\0\u0238\0\u027f\0\u02c6\0\u030d\0\u0354\0\u039b\0\u03e2\0\u0429"+
- "\0\u0470\0\u04b7\0\u04fe\0\u0545\0\u058c\0\u05d3\0\u061a\0\u0661"+
- "\0\u06a8\0\u06ef\0\u0736\0\u077d\0\u07c4\0\u080b\0\u0852\0\u0899"+
- "\0\u08e0\0\107\0\u0927\0\u096e\0\u09b5\0\107\0\107\0\107"+
- "\0\107\0\107\0\107\0\107\0\107\0\107\0\107\0\u09fc"+
- "\0\107\0\u0a43\0\u0a8a\0\107\0\107\0\u0ad1\0\107\0\107"+
- "\0\107\0\u0b18\0\u0b5f\0\u0ba6\0\u0bed\0\u0c34\0\u0c7b\0\u0cc2"+
- "\0\u0d09\0\u0d50\0\107\0\107\0\107\0\107\0\u0d97\0\u0dde"+
- "\0\107\0\u0e25\0\u0e6c\0\u0eb3\0\u0efa\0\u0f41\0\u0f88\0\u0fcf"+
- "\0\u1016\0\u105d\0\u10a4\0\u10eb\0\u1132\0\u1179\0\u11c0\0\u1207"+
- "\0\u124e\0\u1295\0\u12dc\0\u1323\0\u136a\0\u13b1\0\u13f8\0\u143f"+
- "\0\u1486\0\u14cd\0\u1514\0\u155b\0\u15a2\0\325\0\u15e9\0\u1630"+
- "\0\u1677\0\u16be\0\u1705\0\u174c\0\u1793\0\u17da\0\u1821\0\u1868"+
- "\0\107\0\107\0\107\0\107\0\107\0\107\0\107\0\u18af"+
- "\0\107\0\107\0\107\0\107\0\107\0\u18f6\0\u193d\0\u1984"+
- "\0\u19cb\0\u1a12\0\u1a59\0\u1aa0\0\u1a59\0\u1ae7\0\u1b2e\0\u1b75"+
- "\0\107\0\u1bbc\0\u1c03\0\325\0\u1c4a\0\u1c91\0\u1cd8\0\u1d1f"+
- "\0\u1d66\0\u1dad\0\u1df4\0\u1e3b\0\325\0\u1e82\0\u1ec9\0\u1f10"+
- "\0\u1f57\0\u1f9e\0\u1fe5\0\u202c\0\u2073\0\u20ba\0\u2101\0\u2148"+
- "\0\325\0\u218f\0\u21d6\0\u221d\0\u2264\0\u22ab\0\u22f2\0\u2339"+
- "\0\u2380\0\u23c7\0\u240e\0\u2455\0\u249c\0\u24e3\0\u252a\0\u2571"+
- "\0\u25b8\0\u25ff\0\u2646\0\u268d\0\u26d4\0\u271b\0\u2762\0\107"+
- "\0\u27a9\0\u27f0\0\107\0\u2837\0\u287e\0\u28c5\0\u290c\0\u2953"+
- "\0\u299a\0\u29e1\0\325\0\u2a28\0\u2a6f\0\325\0\u2ab6\0\325"+
- "\0\325\0\u2afd\0\u2b44\0\u2b8b\0\u2bd2\0\u2c19\0\u2c60\0\325"+
- "\0\u2ca7\0\u2cee\0\u2d35\0\u2d7c\0\u2dc3\0\u2e0a\0\325\0\u2e51"+
- "\0\u2e98\0\u2edf\0\325\0\u2f26\0\325\0\u2f6d\0\u2fb4\0\u2ffb"+
- "\0\325\0\u3042\0\u3089\0\u30d0\0\u3117\0\u315e\0\u31a5\0\325"+
- "\0\u31ec\0\u3233\0\u327a\0\u32c1\0\u3308\0\325\0\u334f\0\107"+
- "\0\u3396\0\u33dd\0\u3424\0\u346b\0\u287e\0\u287e\0\u34b2\0\u34f9"+
- "\0\u3540\0\u3587\0\325\0\325\0\u35ce\0\u3615\0\u365c\0\u36a3"+
- "\0\u36ea\0\325\0\u3731\0\325\0\u3778\0\u37bf\0\325\0\u3806"+
- "\0\325\0\325\0\u384d\0\325\0\u3894\0\u38db\0\u3922\0\u3969"+
- "\0\u39b0\0\u39f7\0\u3a3e\0\u3a85\0\u3acc\0\u3b13\0\u3b5a\0\325"+
- "\0\u3ba1\0\325\0\325\0\u3be8\0\u3c2f\0\325\0\u3c76\0\u3cbd"+
- "\0\325\0\u3d04\0\325\0\325\0\u3d4b\0\u3d92\0\u3dd9\0\u3e20"+
- "\0\u3e67\0\325\0\u3eae\0\325\0\u3ef5\0\u3f3c\0\325\0\u3f83"+
- "\0\u3fca\0\u4011\0\325\0\325\0\u4058\0\u409f\0\u40e6\0\325"+
- "\0\u412d\0\u4174\0\u41bb\0\u4202\0\325\0\u4249\0\325\0\325"+
- "\0\u4290\0\u42d7\0\325\0\325\0\u431e\0\325\0\u4365\0\u43ac"+
- "\0\u43f3\0\u443a\0\325\0\325\0\u4481\0\325\0\u44c8\0\u450f"+
- "\0\325\0\u4556\0\325\0\325\0\u459d\0\325";
+ "\0\0\0\104\0\210\0\314\0\u0110\0\u0154\0\u0198\0\u01dc"+
+ "\0\u0220\0\u0264\0\u02a8\0\u02ec\0\u0330\0\u0374\0\u03b8\0\u03fc"+
+ "\0\u0440\0\u0484\0\u04c8\0\u050c\0\u0550\0\u0594\0\u05d8\0\u061c"+
+ "\0\u0660\0\u06a4\0\u06e8\0\u072c\0\u0770\0\u07b4\0\u07f8\0\u083c"+
+ "\0\u0880\0\104\0\u08c4\0\u0908\0\u094c\0\104\0\104\0\104"+
+ "\0\104\0\104\0\104\0\104\0\104\0\104\0\104\0\u0990"+
+ "\0\104\0\u09d4\0\u0a18\0\104\0\104\0\104\0\104\0\104"+
+ "\0\u0a5c\0\u0aa0\0\u0ae4\0\u0b28\0\u0b6c\0\104\0\104\0\104"+
+ "\0\104\0\u0bb0\0\u0bf4\0\104\0\u0c38\0\u0c7c\0\u0cc0\0\u0d04"+
+ "\0\u0d48\0\u0d8c\0\u0dd0\0\u0e14\0\u0e58\0\u0e9c\0\u0ee0\0\u0f24"+
+ "\0\u0f68\0\u0fac\0\u0ff0\0\u1034\0\u1078\0\u10bc\0\u1100\0\u1144"+
+ "\0\u1188\0\u11cc\0\u1210\0\u1254\0\u1298\0\u12dc\0\u1320\0\u1364"+
+ "\0\314\0\u13a8\0\u13ec\0\u1430\0\u1474\0\u14b8\0\u14fc\0\u1540"+
+ "\0\u1584\0\u15c8\0\u160c\0\104\0\104\0\104\0\104\0\104"+
+ "\0\104\0\104\0\u1650\0\104\0\104\0\104\0\104\0\104"+
+ "\0\u1694\0\u16d8\0\u171c\0\u1760\0\u17a4\0\104\0\u17e8\0\u182c"+
+ "\0\314\0\u1870\0\u18b4\0\u18f8\0\u193c\0\u1980\0\u19c4\0\u1a08"+
+ "\0\u1a4c\0\314\0\u1a90\0\u1ad4\0\u1b18\0\u1b5c\0\u1ba0\0\u1be4"+
+ "\0\u1c28\0\u1c6c\0\u1cb0\0\u1cf4\0\u1d38\0\314\0\u1d7c\0\u1dc0"+
+ "\0\u1e04\0\u1e48\0\u1e8c\0\u1ed0\0\u1f14\0\u1f58\0\u1f9c\0\u1fe0"+
+ "\0\u2024\0\u2068\0\u20ac\0\u20f0\0\u2134\0\u2178\0\u21bc\0\u2200"+
+ "\0\u2244\0\u2288\0\u22cc\0\u2310\0\104\0\u2354\0\u2398\0\104"+
+ "\0\u23dc\0\314\0\u2420\0\u2464\0\314\0\u24a8\0\314\0\314"+
+ "\0\u24ec\0\u2530\0\u2574\0\u25b8\0\u25fc\0\u2640\0\314\0\u2684"+
+ "\0\u26c8\0\u270c\0\u2750\0\u2794\0\u27d8\0\314\0\u281c\0\u2860"+
+ "\0\u28a4\0\314\0\u28e8\0\314\0\u292c\0\u2970\0\u29b4\0\314"+
+ "\0\u29f8\0\u2a3c\0\u2a80\0\u2ac4\0\u2b08\0\u2b4c\0\314\0\u2b90"+
+ "\0\u2bd4\0\u2c18\0\u2c5c\0\u2ca0\0\314\0\u2ce4\0\104\0\u2d28"+
+ "\0\u2d6c\0\u2db0\0\u2df4\0\u2e38\0\314\0\314\0\u2e7c\0\u2ec0"+
+ "\0\u2f04\0\u2f48\0\u2f8c\0\314\0\u2fd0\0\314\0\u3014\0\u3058"+
+ "\0\314\0\u309c\0\314\0\314\0\u30e0\0\314\0\u3124\0\u3168"+
+ "\0\u31ac\0\u31f0\0\u3234\0\u3278\0\u32bc\0\u3300\0\u3344\0\u3388"+
+ "\0\u33cc\0\314\0\u3410\0\314\0\314\0\u3454\0\u3498\0\314"+
+ "\0\u34dc\0\u3520\0\314\0\u3564\0\314\0\314\0\u35a8\0\u35ec"+
+ "\0\u3630\0\u3674\0\u36b8\0\314\0\u36fc\0\314\0\u3740\0\u3784"+
+ "\0\314\0\u37c8\0\u380c\0\u3850\0\314\0\314\0\u3894\0\u38d8"+
+ "\0\u391c\0\314\0\u3960\0\u39a4\0\u39e8\0\u3a2c\0\314\0\u3a70"+
+ "\0\314\0\314\0\u3ab4\0\u3af8\0\314\0\314\0\u3b3c\0\314"+
+ "\0\u3b80\0\u3bc4\0\u3c08\0\u3c4c\0\314\0\314\0\u3c90\0\314"+
+ "\0\u3cd4\0\u3d18\0\314\0\u3d5c\0\314\0\314\0\u3da0\0\314";
private static int [] zzUnpackRowMap() {
- int [] result = new int[342];
+ int [] result = new int[320];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
@@ -274,379 +268,342 @@ class _JavaLexer implements FlexLexer {
private static final String ZZ_TRANS_PACKED_0 =
"\1\2\1\3\1\4\1\2\1\5\1\6\1\3\1\7"+
- "\1\4\1\7\1\4\1\7\1\10\5\4\1\11\1\4"+
- "\1\12\1\4\1\3\1\13\1\2\1\14\1\15\1\16"+
- "\1\4\1\17\1\20\1\21\1\22\1\23\1\24\1\25"+
- "\1\26\4\4\1\27\1\30\2\4\1\31\1\32\1\33"+
- "\1\34\1\4\1\35\1\36\1\37\1\40\1\41\1\42"+
- "\1\43\1\44\1\45\1\46\1\47\1\50\1\51\1\52"+
- "\1\53\1\54\1\55\1\56\1\57\1\60\1\61\110\0"+
- "\1\3\4\0\1\3\17\0\1\3\62\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\30\4\31\0"+
- "\1\62\1\63\54\0\1\64\106\0\1\65\33\0\1\7"+
- "\1\66\1\7\1\0\2\7\2\0\1\67\1\70\1\71"+
- "\1\72\1\73\11\0\1\73\1\70\1\0\1\67\11\0"+
- "\1\71\43\0\1\74\1\75\1\76\1\0\2\76\1\77"+
- "\1\100\1\67\1\70\1\71\1\72\1\73\11\0\1\73"+
- "\1\70\1\0\1\67\2\0\1\100\6\0\1\71\1\0"+
- "\1\77\41\0\1\101\1\0\1\101\1\0\2\101\5\0"+
- "\1\102\110\0\1\103\35\0\1\104\4\0\1\105\17\0"+
- "\6\13\1\0\17\13\1\0\1\106\1\107\56\13\6\14"+
- "\1\0\17\14\1\0\1\14\1\110\1\111\55\14\2\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\1\4\1\112\14\4\1\113\11\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\3\4\1\114"+
- "\24\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\6\4\1\115\1\4\1\116\11\4\1\117"+
- "\5\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\5\4\1\120\1\121\4\4\1\122\3\4"+
- "\1\123\10\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\7\4\1\124\1\4\1\125\16\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\13\4\1\126\14\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\1\127\1\4\1\130"+
- "\12\4\1\131\1\132\7\4\1\133\1\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\2\4"+
- "\1\134\1\135\1\4\1\136\22\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\1\4\1\137"+
- "\11\4\1\140\1\4\1\141\12\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\5\4\1\142"+
- "\1\143\4\4\1\144\2\4\1\145\11\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\4\4"+
- "\1\146\3\4\1\147\10\4\1\150\6\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
- "\1\151\7\4\1\152\14\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\13\4\1\153\14\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\1\4\1\154\1\155\2\4\1\156\22\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\13\4\1\157\14\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\16\4\1\160\11\4\107\0"+
- "\1\161\106\0\1\162\106\0\1\163\1\0\1\164\104\0"+
- "\1\165\2\0\1\166\103\0\1\167\3\0\1\170\102\0"+
- "\1\171\5\0\1\172\100\0\1\173\106\0\1\174\131\0"+
- "\1\175\1\0\6\62\1\0\17\62\1\0\60\62\5\176"+
- "\1\177\101\176\7\0\1\7\1\66\1\7\1\0\2\7"+
- "\101\0\1\101\1\0\1\101\1\0\2\101\3\0\1\70"+
- "\1\71\1\0\1\73\11\0\1\73\1\70\13\0\1\71"+
- "\43\0\1\200\1\0\1\200\1\0\2\200\3\0\1\70"+
- "\1\71\2\0\1\201\11\0\1\70\13\0\1\71\12\0"+
- "\1\201\30\0\1\74\1\202\1\74\1\0\2\74\3\0"+
- "\1\70\1\71\1\72\1\73\11\0\1\73\1\70\13\0"+
- "\1\71\43\0\1\74\1\75\1\76\1\0\2\76\101\0"+
- "\1\74\1\75\1\76\1\0\2\76\2\0\1\67\1\70"+
- "\1\71\1\72\1\73\11\0\1\73\1\70\1\0\1\67"+
- "\11\0\1\71\34\0\7\203\1\204\1\203\4\204\1\203"+
- "\1\204\1\205\2\204\1\203\1\204\1\203\1\206\1\0"+
- "\6\203\3\204\1\205\2\203\2\204\5\203\1\204\3\203"+
- "\1\206\30\203\13\0\2\207\2\0\1\67\20\0\1\67"+
- "\55\0\1\101\1\210\1\101\1\0\2\101\3\0\1\70"+
- "\1\71\1\0\1\73\11\0\1\73\1\70\13\0\1\71"+
- "\56\0\1\211\64\0\6\13\1\0\17\13\1\0\60\13"+
- "\6\14\1\0\17\14\1\0\60\14\2\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\2\4\1\212"+
- "\2\4\1\213\7\4\1\214\12\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\1\4\1\215"+
- "\15\4\1\216\10\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\1\217\27\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\7\4"+
- "\1\220\20\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\2\4\1\221\25\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\222"+
- "\27\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\6\4\1\223\21\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\13\4\1\224"+
- "\14\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\1\4\1\225\26\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\10\4\1\226"+
- "\17\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\7\4\1\227\20\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\7\4\1\230"+
- "\20\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\10\4\1\231\17\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\1\4\1\232"+
- "\3\4\1\233\22\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\24\4\1\234\3\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\10\4\1\235\17\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\13\4\1\236\14\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\17\4\1\237\10\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\6\4\1\240\21\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\26\4\1\241\1\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\1\242\27\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
- "\1\243\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\13\4\1\244\14\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\245"+
- "\27\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\1\246\6\4\1\247\20\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\5\4"+
- "\1\250\22\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\10\4\1\251\17\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\5\4"+
- "\1\252\22\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\1\253\6\4\1\254\20\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\24\4\1\255\3\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\4\4\1\256\23\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\2\4\1\257\25\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\1\260\27\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\13\4"+
- "\1\261\3\4\1\262\10\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\11\4\1\263\16\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\12\4\1\264\15\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\6\4\1\265\10\4"+
- "\1\266\10\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\17\4\1\267\10\4\107\0\1\270"+
- "\24\0\5\176\1\271\101\176\4\272\1\273\1\177\101\272"+
- "\7\0\1\200\1\274\1\200\1\0\2\200\3\0\1\70"+
- "\1\71\14\0\1\70\13\0\1\71\43\0\1\200\1\0"+
- "\1\200\1\0\2\200\3\0\1\70\1\71\14\0\1\70"+
- "\13\0\1\71\43\0\1\74\1\202\1\74\1\0\2\74"+
- "\101\0\1\275\1\0\4\275\1\0\1\275\1\0\2\275"+
- "\1\0\1\275\1\0\1\276\7\0\3\275\3\0\2\275"+
- "\5\0\1\275\3\0\1\276\30\0\7\203\1\204\1\277"+
- "\4\204\1\203\1\204\1\205\2\204\1\203\1\204\1\203"+
- "\1\206\1\0\6\203\3\204\1\205\2\203\2\204\5\203"+
- "\1\204\3\203\1\206\30\203\7\0\1\300\1\0\1\300"+
- "\1\275\2\300\1\0\1\275\1\0\2\275\1\0\1\275"+
- "\1\301\1\276\7\0\3\275\3\0\2\275\5\0\1\275"+
- "\3\0\1\276\6\0\1\301\31\0\1\302\2\0\2\207"+
- "\2\0\1\67\20\0\1\67\55\0\1\101\1\210\1\101"+
- "\1\0\2\101\74\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\3\4\1\303\24\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\10\4"+
- "\1\304\17\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\13\4\1\305\14\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\7\4"+
- "\1\306\20\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\2\4\1\307\25\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
- "\1\310\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\21\4\1\311\6\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
- "\1\312\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\7\4\1\313\20\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\5\4"+
- "\1\314\22\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\5\4\1\315\22\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
- "\1\316\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\1\317\27\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\23\4\1\320"+
- "\4\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\17\4\1\321\10\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\1\322\27\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\3\4\1\323\24\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\12\4\1\324\15\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\1\4\1\325\26\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\1\326\27\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\6\4\1\327\21\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\17\4\1\330\10\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\5\4\1\331\22\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\6\4\1\332\21\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\3\4\1\333\24\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\12\4\1\334\15\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\3\4\1\335\24\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\7\4\1\336\20\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\1\337\6\4\1\340\20\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\1\4\1\341\26\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\3\4\1\342\24\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\1\343\27\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\6\4\1\344\4\4\1\345\14\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\5\4\1\346"+
- "\22\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\11\4\1\347\16\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\13\4\1\350"+
- "\14\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\1\351\27\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\25\4\1\352\2\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\6\4\1\353\21\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\14\4\1\354\13\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\5\4\1\355\22\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\20\4\1\356\7\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\6\4\1\357\21\4\25\0\4\176\1\360\1\271"+
- "\101\176\5\272\1\361\101\272\7\0\1\200\1\274\1\200"+
- "\1\0\2\200\101\0\1\275\1\362\4\275\1\0\1\275"+
- "\1\0\2\275\1\0\1\275\1\0\1\276\7\0\3\275"+
- "\3\0\2\275\5\0\1\275\3\0\1\276\37\0\1\200"+
- "\1\0\1\200\1\0\2\200\7\0\1\301\40\0\1\301"+
- "\30\0\1\204\1\363\4\204\1\0\1\204\1\0\2\204"+
- "\1\0\1\204\1\0\1\276\7\0\3\204\3\0\2\204"+
- "\5\0\1\204\3\0\1\276\37\0\1\300\1\364\1\300"+
- "\1\275\2\300\1\0\1\275\1\0\1\365\1\366\1\0"+
- "\1\275\1\0\1\276\7\0\1\275\1\365\1\275\3\0"+
- "\2\275\5\0\1\366\3\0\1\276\37\0\1\200\1\0"+
- "\1\200\1\0\2\200\102\0\1\302\2\0\2\207\74\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\7\4\1\367\20\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\26\4\1\370\1\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\1\4\1\371\26\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\10\4\1\372\17\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\3\4\1\373\24\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\1\374\27\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\6\4"+
- "\1\375\21\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\1\4\1\376\26\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\4"+
- "\1\377\26\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\12\4\1\u0100\15\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\17\4"+
- "\1\u0101\10\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\1\4\1\u0102\26\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\16\4"+
- "\1\u0103\11\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\1\u0104\27\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\12\4\1\u0105"+
- "\15\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\25\4\1\u0106\2\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\14\4\1\u0107"+
- "\13\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\3\4\1\u0108\24\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\16\4\1\u0109"+
- "\11\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\7\4\1\u010a\20\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\17\4\1\u010b"+
- "\10\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\1\u010c\27\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\1\4\1\u010d\26\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\5\4\1\u010e\22\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\3\4\1\u010f\24\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\1\4\1\u0110\26\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\2\4\1\u0111\25\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\6\4\1\u0112\21\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\3\4\1\u0113\24\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\5\4\1\u0114\22\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\17\4\1\u0115\10\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\5\4\1\u0116\22\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\1\u0117\27\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\3\4\1\u0118\24\4\25\0\4\272\1\273\1\361\101\272"+
- "\7\0\1\275\1\362\4\275\1\0\1\275\1\0\2\275"+
- "\1\0\1\275\11\0\3\275\3\0\2\275\5\0\1\275"+
- "\43\0\1\204\1\363\4\204\1\0\1\204\1\0\2\204"+
- "\1\0\1\204\11\0\3\204\3\0\2\204\5\0\1\204"+
- "\43\0\1\300\1\364\1\300\1\275\2\300\1\0\1\275"+
- "\1\0\2\275\1\0\1\275\11\0\3\275\3\0\2\275"+
- "\5\0\1\275\36\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\17\4\1\u0119\10\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\7\4"+
- "\1\u011a\20\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\10\4\1\u011b\17\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\20\4"+
- "\1\u011c\7\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\6\4\1\u011d\21\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\u011e"+
- "\27\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\5\4\1\u011f\22\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\1\u0120\27\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\12\4\1\u0121\15\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\1\4\1\u0122\26\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\16\4\1\u0123\11\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\3\4\1\u0124\24\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\5\4\1\u0125\22\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\10\4\1\u0126\17\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\4\4\1\u0127\23\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\10\4\1\u0128\17\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\21\4\1\u0129\6\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\1\u012a\27\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\6\4\1\u012b\21\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\3\4\1\u012c\24\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\12\4\1\u012d\15\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\1\u012e\27\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\12\4"+
- "\1\u012f\15\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\23\4\1\u0130\4\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\17\4"+
- "\1\u0131\10\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\3\4\1\u0132\24\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\7\4"+
- "\1\u0133\20\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\15\4\1\u0134\12\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\12\4"+
- "\1\u0135\15\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\4\4\1\u0136\23\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\13\4"+
- "\1\u0137\14\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\10\4\1\u0138\17\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\2\4"+
- "\1\u0139\25\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\5\4\1\u013a\22\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\12\4"+
- "\1\u013b\15\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\3\4\1\u013c\24\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\u013d"+
- "\27\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\1\u013e\27\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\3\4\1\u013f\24\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\3\4\1\u0140\24\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\6\4\1\u0141\21\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\10\4\1\u0142\17\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\1\u0143\27\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\24\4\1\u0144\3\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\10\4\1\u0145\17\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\3\4\1\u0146\24\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\12\4\1\u0147\15\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\3\4\1\u0148\24\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\10\4\1\u0149\17\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\3\4\1\u014a\24\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\3\4\1\u014b\24\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\1\u014c\27\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\17\4\1\u014d\10\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
- "\1\u014e\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\13\4\1\u014f\14\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\u0150"+
- "\27\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\20\4\1\u0151\7\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\27\4\1\u0152"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\4\4\1\u0153\23\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\7\4\1\u0154\20\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\3\4\1\u0155\24\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\20\4\1\u0156\7\4"+
- "\25\0";
+ "\3\4\1\10\4\4\1\11\1\4\1\12\1\4\1\13"+
+ "\1\2\1\14\1\15\1\16\1\4\1\17\1\20\1\21"+
+ "\1\22\1\23\1\24\1\25\1\26\4\4\1\27\1\30"+
+ "\2\4\1\31\1\32\1\33\1\34\1\4\1\35\1\36"+
+ "\1\37\1\40\1\41\1\42\1\43\1\44\1\45\1\46"+
+ "\1\47\1\50\1\51\1\52\1\53\1\54\1\55\1\56"+
+ "\1\57\1\60\1\61\105\0\1\3\4\0\1\3\77\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\30\4\31\0\1\62\1\63\51\0\1\64\103\0\1\65"+
+ "\33\0\2\7\1\0\1\66\1\7\2\0\1\67\1\70"+
+ "\1\71\1\72\10\0\1\72\1\67\1\0\1\66\11\0"+
+ "\1\70\43\0\2\7\1\0\1\66\1\7\1\73\1\74"+
+ "\1\67\1\70\1\71\1\72\10\0\1\72\1\67\1\0"+
+ "\1\66\2\0\1\74\6\0\1\70\1\0\1\73\41\0"+
+ "\1\71\3\0\1\71\4\0\1\75\105\0\1\76\34\0"+
+ "\1\77\4\0\1\100\17\0\6\13\1\0\15\13\1\101"+
+ "\1\102\56\13\6\14\1\0\16\14\1\103\1\104\55\14"+
+ "\2\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\1\4\1\105\14\4\1\106\11\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\3\4"+
+ "\1\107\24\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\6\4\1\110\1\4\1\111\11\4"+
+ "\1\112\5\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\5\4\1\113\1\114\4\4\1\115"+
+ "\3\4\1\116\10\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\7\4\1\117\1\4\1\120"+
+ "\16\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\13\4\1\121\14\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\1\122\1\4"+
+ "\1\123\12\4\1\124\1\125\7\4\1\126\1\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\2\4\1\127\1\130\1\4\1\131\22\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\1\4"+
+ "\1\132\11\4\1\133\1\4\1\134\12\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\5\4"+
+ "\1\135\1\136\4\4\1\137\2\4\1\140\11\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\4\4\1\141\3\4\1\142\10\4\1\143\6\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\3\4\1\144\7\4\1\145\14\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\13\4\1\146"+
+ "\14\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\1\4\1\147\1\150\2\4\1\151\22\4"+
+ "\27\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\13\4\1\152\14\4\27\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\16\4\1\153\11\4"+
+ "\104\0\1\154\103\0\1\155\103\0\1\156\1\0\1\157"+
+ "\101\0\1\160\2\0\1\161\100\0\1\162\3\0\1\163"+
+ "\77\0\1\164\5\0\1\165\75\0\1\166\103\0\1\167"+
+ "\126\0\1\170\1\0\6\62\1\0\75\62\5\171\1\172"+
+ "\76\171\7\0\2\71\2\0\1\71\2\0\1\67\1\70"+
+ "\1\0\1\72\10\0\1\72\1\67\13\0\1\70\43\0"+
+ "\2\173\2\0\1\173\2\0\1\67\1\70\2\0\1\173"+
+ "\10\0\1\67\13\0\1\70\12\0\1\173\30\0\3\174"+
+ "\1\66\1\174\1\0\3\174\1\175\1\174\10\0\3\174"+
+ "\1\66\2\0\2\174\5\0\1\174\43\0\2\74\1\0"+
+ "\1\66\1\74\21\0\1\66\66\0\1\176\63\0\6\13"+
+ "\1\0\75\13\6\14\1\0\75\14\2\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\2\4\1\177"+
+ "\2\4\1\200\7\4\1\201\12\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\1\4\1\202"+
+ "\15\4\1\203\10\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\1\204\27\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\7\4"+
+ "\1\205\20\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\2\4\1\206\25\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\1\207"+
+ "\27\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\6\4\1\210\21\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\13\4\1\211"+
+ "\14\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\1\4\1\212\26\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\10\4\1\213"+
+ "\17\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\7\4\1\214\20\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\7\4\1\215"+
+ "\20\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\10\4\1\216\17\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\1\4\1\217"+
+ "\3\4\1\220\22\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\24\4\1\221\3\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\10\4\1\222\17\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\13\4\1\223\14\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\17\4\1\224\10\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\6\4\1\225\21\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\26\4\1\226\1\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\1\227\27\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\3\4"+
+ "\1\230\24\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\13\4\1\231\14\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\1\232"+
+ "\27\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\1\233\6\4\1\234\20\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\5\4"+
+ "\1\235\22\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\10\4\1\236\17\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\5\4"+
+ "\1\237\22\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\1\240\6\4\1\241\20\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\24\4\1\242\3\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\4\4\1\243\23\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\2\4\1\244\25\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\1\245\27\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\13\4"+
+ "\1\246\3\4\1\247\10\4\27\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\11\4\1\250\16\4"+
+ "\27\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\12\4\1\251\15\4\27\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\6\4\1\252\10\4"+
+ "\1\253\10\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\17\4\1\254\10\4\104\0\1\255"+
+ "\24\0\5\171\1\256\76\171\4\257\1\260\1\172\76\257"+
+ "\7\0\2\173\2\0\1\173\2\0\1\67\1\70\13\0"+
+ "\1\67\13\0\1\70\43\0\3\174\1\66\1\174\1\0"+
+ "\3\174\1\261\1\174\1\0\1\72\6\0\3\174\1\66"+
+ "\2\0\2\174\5\0\1\174\3\0\1\72\37\0\3\261"+
+ "\1\0\1\261\1\0\3\261\1\0\1\261\10\0\3\261"+
+ "\3\0\2\261\5\0\1\261\36\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\3\4\1\262\24\4"+
+ "\27\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\10\4\1\263\17\4\27\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\13\4\1\264\14\4"+
+ "\27\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\7\4\1\265\20\4\27\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\2\4\1\266\25\4"+
+ "\27\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\3\4\1\267\24\4\27\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\21\4\1\270\6\4"+
+ "\27\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\3\4\1\271\24\4\27\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\7\4\1\272\20\4"+
+ "\27\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\5\4\1\273\22\4\27\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\5\4\1\274\22\4"+
+ "\27\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\3\4\1\275\24\4\27\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\1\276\27\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\23\4\1\277\4\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\17\4\1\300\10\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\1\301\27\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\3\4\1\302\24\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\12\4"+
+ "\1\303\15\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\1\4\1\304\26\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\1\305"+
+ "\27\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\6\4\1\306\21\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\17\4\1\307"+
+ "\10\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\5\4\1\310\22\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\6\4\1\311"+
+ "\21\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\3\4\1\312\24\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\12\4\1\313"+
+ "\15\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\3\4\1\314\24\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\7\4\1\315"+
+ "\20\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\1\316\6\4\1\317\20\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\1\4"+
+ "\1\320\26\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\3\4\1\321\24\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\1\322"+
+ "\27\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\6\4\1\323\4\4\1\324\14\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\5\4\1\325\22\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\11\4\1\326\16\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\13\4\1\327\14\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\1\330\27\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\25\4"+
+ "\1\331\2\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\6\4\1\332\21\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\14\4"+
+ "\1\333\13\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\5\4\1\334\22\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\20\4"+
+ "\1\335\7\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\6\4\1\336\21\4\25\0\4\171"+
+ "\1\337\1\256\76\171\5\257\1\340\76\257\7\0\3\261"+
+ "\1\0\1\261\1\0\3\261\1\0\1\261\1\0\1\72"+
+ "\6\0\3\261\3\0\2\261\5\0\1\261\3\0\1\72"+
+ "\32\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\7\4\1\341\20\4\27\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\26\4\1\342\1\4"+
+ "\27\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\1\4\1\343\26\4\27\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\10\4\1\344\17\4"+
+ "\27\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\3\4\1\345\24\4\27\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\1\346\27\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\6\4\1\347\21\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\1\4\1\350\26\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\1\4\1\351\26\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\12\4\1\352\15\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\17\4\1\353\10\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\1\4\1\354\26\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\16\4\1\355\11\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\1\356\27\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\12\4"+
+ "\1\357\15\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\25\4\1\360\2\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\14\4"+
+ "\1\361\13\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\3\4\1\362\24\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\16\4"+
+ "\1\363\11\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\7\4\1\364\20\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\17\4"+
+ "\1\365\10\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\1\366\27\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\1\4\1\367"+
+ "\26\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\5\4\1\370\22\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\3\4\1\371"+
+ "\24\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\1\4\1\372\26\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\2\4\1\373"+
+ "\25\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\6\4\1\374\21\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\3\4\1\375"+
+ "\24\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\5\4\1\376\22\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\17\4\1\377"+
+ "\10\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\5\4\1\u0100\22\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\1\u0101\27\4"+
+ "\27\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\3\4\1\u0102\24\4\25\0\4\257\1\260\1\340"+
+ "\76\257\2\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\17\4\1\u0103\10\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\7\4\1\u0104"+
+ "\20\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\10\4\1\u0105\17\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\20\4\1\u0106"+
+ "\7\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\6\4\1\u0107\21\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\1\u0108\27\4"+
+ "\27\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\5\4\1\u0109\22\4\27\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\1\u010a\27\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\12\4\1\u010b\15\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\1\4\1\u010c\26\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\16\4\1\u010d\11\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\3\4\1\u010e\24\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\5\4\1\u010f\22\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\10\4\1\u0110\17\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\4\4\1\u0111\23\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\10\4\1\u0112\17\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\21\4\1\u0113\6\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\1\u0114\27\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\6\4"+
+ "\1\u0115\21\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\3\4\1\u0116\24\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\12\4"+
+ "\1\u0117\15\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\1\u0118\27\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\12\4\1\u0119"+
+ "\15\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\23\4\1\u011a\4\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\17\4\1\u011b"+
+ "\10\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\3\4\1\u011c\24\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\7\4\1\u011d"+
+ "\20\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\15\4\1\u011e\12\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\12\4\1\u011f"+
+ "\15\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\4\4\1\u0120\23\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\13\4\1\u0121"+
+ "\14\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\10\4\1\u0122\17\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\2\4\1\u0123"+
+ "\25\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\5\4\1\u0124\22\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\12\4\1\u0125"+
+ "\15\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\3\4\1\u0126\24\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\1\u0127\27\4"+
+ "\27\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\1\u0128\27\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\3\4\1\u0129\24\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\3\4\1\u012a\24\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\6\4\1\u012b\21\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\10\4\1\u012c\17\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\1\u012d\27\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\24\4"+
+ "\1\u012e\3\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\10\4\1\u012f\17\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\3\4"+
+ "\1\u0130\24\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\12\4\1\u0131\15\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\3\4"+
+ "\1\u0132\24\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\10\4\1\u0133\17\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\3\4"+
+ "\1\u0134\24\4\27\0\2\4\3\0\11\4\1\0\1\4"+
+ "\1\0\1\4\3\0\3\4\1\u0135\24\4\27\0\2\4"+
+ "\3\0\11\4\1\0\1\4\1\0\1\4\3\0\1\u0136"+
+ "\27\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\17\4\1\u0137\10\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\3\4\1\u0138"+
+ "\24\4\27\0\2\4\3\0\11\4\1\0\1\4\1\0"+
+ "\1\4\3\0\13\4\1\u0139\14\4\27\0\2\4\3\0"+
+ "\11\4\1\0\1\4\1\0\1\4\3\0\1\u013a\27\4"+
+ "\27\0\2\4\3\0\11\4\1\0\1\4\1\0\1\4"+
+ "\3\0\20\4\1\u013b\7\4\27\0\2\4\3\0\11\4"+
+ "\1\0\1\4\1\0\1\4\3\0\27\4\1\u013c\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\4\4\1\u013d\23\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\7\4\1\u013e\20\4\27\0"+
+ "\2\4\3\0\11\4\1\0\1\4\1\0\1\4\3\0"+
+ "\3\4\1\u013f\24\4\27\0\2\4\3\0\11\4\1\0"+
+ "\1\4\1\0\1\4\3\0\20\4\1\u0140\7\4\25\0";
private static int [] zzUnpackTrans() {
- int [] result = new int[17892];
+ int [] result = new int[15844];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
@@ -688,14 +645,12 @@ class _JavaLexer implements FlexLexer {
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\1\0\1\11\37\1\1\11\3\1\12\11\1\1\1\11"+
- "\2\1\2\11\1\0\3\11\2\1\2\0\4\1\1\0"+
- "\4\11\2\1\1\11\47\1\7\11\1\1\5\11\4\1"+
- "\2\0\2\1\1\0\1\1\1\0\1\11\56\1\1\11"+
- "\1\0\1\1\1\11\4\0\1\1\2\0\55\1\1\11"+
- "\4\0\142\1";
+ "\2\1\5\11\4\1\1\0\4\11\2\1\1\11\47\1"+
+ "\7\11\1\1\5\11\4\1\1\0\1\11\56\1\1\11"+
+ "\1\0\1\1\1\11\1\0\55\1\1\11\1\0\140\1";
private static int [] zzUnpackAttribute() {
- int [] result = new int[342];
+ int [] result = new int[320];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
@@ -794,7 +749,7 @@ class _JavaLexer implements FlexLexer {
char [] map = new char[0x10000];
int i = 0; /* index in packed string */
int j = 0; /* index in unpacked array */
- while (i < 1788) {
+ while (i < 1784) {
int count = packed.charAt(i++);
char value = packed.charAt(i++);
do map[j++] = value; while (--count > 0);
@@ -975,7 +930,7 @@ class _JavaLexer implements FlexLexer {
while (true) {
if (zzCurrentPosL < zzEndReadL)
- zzInput = zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++]:zzBufferL.charAt(zzCurrentPosL++);
+ zzInput = (zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++] : zzBufferL.charAt(zzCurrentPosL++));
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
@@ -995,7 +950,7 @@ class _JavaLexer implements FlexLexer {
break zzForAction;
}
else {
- zzInput = zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++]:zzBufferL.charAt(zzCurrentPosL++);
+ zzInput = (zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++] : zzBufferL.charAt(zzCurrentPosL++));
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java
index 129b441e761c..553a5feb38c0 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java
@@ -40,7 +40,7 @@ import javax.swing.*;
public class ClsParameterImpl extends ClsRepositoryPsiElement implements PsiParameter {
private PsiTypeElement myType = null;
private String myName;
- private String myMirrorName = null;
+ private volatile String myMirrorName = null;
public ClsParameterImpl(@NotNull PsiParameterStub stub) {
super(stub);
@@ -142,43 +142,52 @@ public class ClsParameterImpl extends ClsRepositoryPsiElement
}
private String getMirrorName() {
- synchronized (LAZY_BUILT_LOCK) {
- if (myMirrorName == null) {
- @NonNls String name;
-
- final PsiParameterStubImpl stub = (PsiParameterStubImpl)getStub();
- if (!stub.isAutoGeneratedName() || DumbService.getInstance(getProject()).isDumb()) {
- name = stub.getName();
+ String mirrorName = myMirrorName;
+ if (mirrorName == null) {
+ // avoid calculation of nice parameter name under lock as we might need indices for coolness
+ // and latter might produce deadlock, see IDEA-99248
+ mirrorName = calcNiceParameterName();
+ synchronized (LAZY_BUILT_LOCK) {
+ if (myMirrorName == null) {
+ myMirrorName = mirrorName;
}
- else {
- JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(getProject());
- String[] nameSuggestions = codeStyleManager.suggestVariableName(VariableKind.PARAMETER, null, null, getType()).names;
+ }
+ }
+ return mirrorName;
+ }
- name = "p";
- if (nameSuggestions.length > 0) {
- name = nameSuggestions[0];
- }
+ private String calcNiceParameterName() {
+ @NonNls String name;
- PsiParameter[] parameters = ((PsiParameterList) getParent()).getParameters();
- AttemptsLoop:
- while (true) {
- for (PsiParameter parameter : parameters) {
- if (parameter == this) break AttemptsLoop;
- String name1 = ((ClsParameterImpl) parameter).getMirrorName();
- if (name.equals(name1)) {
- name = nextName(name);
- continue AttemptsLoop;
- }
- }
- }
- }
+ final PsiParameterStubImpl stub = (PsiParameterStubImpl)getStub();
+ if (!stub.isAutoGeneratedName() || DumbService.getInstance(getProject()).isDumb()) {
+ name = stub.getName();
+ }
+ else {
+ JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(getProject());
+ String[] nameSuggestions = codeStyleManager.suggestVariableName(VariableKind.PARAMETER, null, null, getType()).names;
- assert name != null : stub;
- myMirrorName = name;
+ name = "p";
+ if (nameSuggestions.length > 0) {
+ name = nameSuggestions[0];
}
- return myMirrorName;
+ PsiParameter[] parameters = ((PsiParameterList) getParent()).getParameters();
+ AttemptsLoop:
+ while (true) {
+ for (PsiParameter parameter : parameters) {
+ if (parameter == this) break AttemptsLoop;
+ String name1 = ((ClsParameterImpl) parameter).getMirrorName();
+ if (name.equals(name1)) {
+ name = nextName(name);
+ continue AttemptsLoop;
+ }
+ }
+ }
}
+
+ assert name != null : stub;
+ return name;
}
private static String nextName(String name) {
diff --git a/java/java-psi-impl/src/messages/JavaErrorMessages.properties b/java/java-psi-impl/src/messages/JavaErrorMessages.properties
index 1b02a298c40f..49f1547690f2 100644
--- a/java/java-psi-impl/src/messages/JavaErrorMessages.properties
+++ b/java/java-psi-impl/src/messages/JavaErrorMessages.properties
@@ -278,6 +278,7 @@ unclosed.char.literal=Unclosed character literal
illegal.escape.character.in.string.literal=Illegal escape character in string literal
floating.point.number.too.large=Floating point number too large
floating.point.number.too.small=Floating point number too small
+illegal.underscore=Illegal underscore
import.statement.identifier.or.asterisk.expected.=Identifier or '*' expected
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/arrayClass.java b/java/java-tests/testData/codeInsight/completion/keywords/arrayClass.java
new file mode 100644
index 000000000000..80690075bcea
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/arrayClass.java
@@ -0,0 +1,5 @@
+public class Util {
+ int goo() {
+ String[].x
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/NumericLiterals.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/NumericLiterals.java
index becdda581a2a..45f728d465f8 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/NumericLiterals.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/NumericLiterals.java
@@ -1,24 +1,4 @@
-/*
- * 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.
- * 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.
- */
-
-/// assignment compatible types
-import java.io.*;
-import java.net.*;
-
-public class a {
+public class NumericLiterals {
final int FI = 2;
final int FIBIG = 200000000;
@@ -38,7 +18,8 @@ public class a {
int i13 = 040000000000;
int i14 = 020000000000;
int i15 = 0xf044332211;
- int octale = 017777777777; // negative
+ int oi1 = 017777777777;
+ int oi2 = 08;
int bi1 = 0b0010;
int bi2 = 0B0010;
int bi3 = 1_2;
@@ -53,8 +34,8 @@ public class a {
long l8 = 0xffffffffffffffffL;
long l9 = 0xffffffffffffffff9L;
long l10 = 0x8000000000000000L;
- long octalValue = 01777777777777777777600L;
- long octalValua = 01777777777777777777777L;
+ long ol1 = 01777777777777777777600L;
+ long ol2 = 01777777777777777777777L;
long bl1 = 0b0010l;
long bl2 = 0B0010L;
long bl3 = 10_24L;
@@ -63,7 +44,8 @@ public class a {
float f2 = 1e39f;
float f3 = 0E1F;
float f4 = 0xabc.defP2f;
- float bf1 = 3.141_592f;
+ float f5 = 3.141_592f;
+ float f6 = .0f;
double dd1 = 1e-324;
double dd2 = 1e309;
@@ -81,5 +63,6 @@ public class a {
double d10 = 1e-F;
double d11 = 1e-f;
double d12 = 3.141_592_653_589_793d;
+ double d13 = .0e;
}
}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/NumericLiterals.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/NumericLiterals.java
index bf9f96ff1e96..cb59ded58cc6 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/NumericLiterals.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/NumericLiterals.java
@@ -7,6 +7,11 @@ public class NumericLiterals {
int i5 = 0b0001_0010_0100_1000;
int i6 = 0b;
int i7 = 0b1_1111_1111_1111_1111_1111_1111_1111_1111;
+ int i8 = 0_;
+ int i9 = 0_8;
+ int i10 = 0x_f;
+ int i11 = 0b_1;
+ int i12 = 0B2;
long l1 = 1_2L;
long l2 = 012__34l;
@@ -41,5 +46,7 @@ public class NumericLiterals {
double d10 = 0x.a_bcP1___23d;
double d11 = 1e-3_2_4;
double d12 = 0xa_bc.de_fP1_234D;
+ double d13 = 0x1.0_p-1;
+ double d14 = 1.0e_1022;
}
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java
index c50a4b5de7cc..fe6d0661508a 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java
@@ -114,6 +114,7 @@ public class KeywordCompletionTest extends LightCompletionTestCase {
public void testIntInClassArray() throws Throwable { doTest(2, "int", "char", "final"); }
public void testIntInClassArray2() throws Throwable { doTest(2, "int", "char", "final"); }
public void testIntInClassArray3() throws Throwable { doTest(2, "int", "char", "final"); }
+ public void testArrayClass() throws Throwable { doTest(1, "class", "interface"); }
public void testIntInGenerics() throws Throwable { doTest(2, "int", "char", "final"); }
public void testIntInGenerics2() throws Throwable { doTest(2, "int", "char", "final"); }
diff --git a/java/java-tests/testSrc/com/intellij/lang/java/lexer/JavaLexerTest.java b/java/java-tests/testSrc/com/intellij/lang/java/lexer/JavaLexerTest.java
index b1639bc4b4be..113211720e39 100644
--- a/java/java-tests/testSrc/com/intellij/lang/java/lexer/JavaLexerTest.java
+++ b/java/java-tests/testSrc/com/intellij/lang/java/lexer/JavaLexerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -52,6 +52,17 @@ public class JavaLexerTest extends LexerTestCase {
"DOUBLE_LITERAL ('3.14')\nWHITE_SPACE (' ')\n" +
"DOUBLE_LITERAL ('1e-9d')\nWHITE_SPACE (' ')\n" +
"DOUBLE_LITERAL ('1e137')");
+
+ doTest(". e0 x1 ax .e .p 08 .0e .0f",
+ "DOT ('.')\nWHITE_SPACE (' ')\n" +
+ "IDENTIFIER ('e0')\nWHITE_SPACE (' ')\n" +
+ "IDENTIFIER ('x1')\nWHITE_SPACE (' ')\n" +
+ "IDENTIFIER ('ax')\nWHITE_SPACE (' ')\n" +
+ "DOT ('.')\nIDENTIFIER ('e')\nWHITE_SPACE (' ')\n" +
+ "DOT ('.')\nIDENTIFIER ('p')\nWHITE_SPACE (' ')\n" +
+ "INTEGER_LITERAL ('08')\nWHITE_SPACE (' ')\n" +
+ "DOUBLE_LITERAL ('.0e')\nWHITE_SPACE (' ')\n" +
+ "FLOAT_LITERAL ('.0f')");
}
public void testTigerNumericLiterals() {
@@ -66,6 +77,9 @@ public class JavaLexerTest extends LexerTestCase {
"DOUBLE_LITERAL ('0xab.P12')\nWHITE_SPACE (' ')\n" +
"DOUBLE_LITERAL ('0x.abcP123d')\nWHITE_SPACE (' ')\n" +
"DOUBLE_LITERAL ('0xabc.defP1234D')");
+
+ doTest("p0",
+ "IDENTIFIER ('p0')");
}
public void testCoinNumericLiterals() {
@@ -116,15 +130,18 @@ public class JavaLexerTest extends LexerTestCase {
}
public void testMalformedCoinLiterals() {
- doTest("0_ _1 0_8 0x_f 0b_1 0B2 0x1.0_p-1 1.0e_1022",
- "INTEGER_LITERAL ('0')\nIDENTIFIER ('_')\nWHITE_SPACE (' ')\n" +
+ doTest("_1 _b ._ 0_ 0_8 0x_f 0b_1 0B2 0x1.0_p-1 1.0e_1022 0._1",
"IDENTIFIER ('_1')\nWHITE_SPACE (' ')\n" +
- "INTEGER_LITERAL ('0')\nIDENTIFIER ('_8')\nWHITE_SPACE (' ')\n" +
- "INTEGER_LITERAL ('0x')\nIDENTIFIER ('_f')\nWHITE_SPACE (' ')\n" +
- "INTEGER_LITERAL ('0b')\nIDENTIFIER ('_1')\nWHITE_SPACE (' ')\n" +
- "INTEGER_LITERAL ('0B')\nINTEGER_LITERAL ('2')\nWHITE_SPACE (' ')\n" +
- "INTEGER_LITERAL ('0x1')\nDOUBLE_LITERAL ('.0')\nIDENTIFIER ('_p')\nMINUS ('-')\nINTEGER_LITERAL ('1')\nWHITE_SPACE (' ')\n" +
- "DOUBLE_LITERAL ('1.0e')\nIDENTIFIER ('_1022')");
+ "IDENTIFIER ('_b')\nWHITE_SPACE (' ')\n" +
+ "DOT ('.')\nIDENTIFIER ('_')\nWHITE_SPACE (' ')\n" +
+ "INTEGER_LITERAL ('0_')\nWHITE_SPACE (' ')\n" +
+ "INTEGER_LITERAL ('0_8')\nWHITE_SPACE (' ')\n" +
+ "INTEGER_LITERAL ('0x_f')\nWHITE_SPACE (' ')\n" +
+ "INTEGER_LITERAL ('0b_1')\nWHITE_SPACE (' ')\n" +
+ "INTEGER_LITERAL ('0B2')\nWHITE_SPACE (' ')\n" +
+ "DOUBLE_LITERAL ('0x1.0_p-1')\nWHITE_SPACE (' ')\n" +
+ "DOUBLE_LITERAL ('1.0e_1022')\nWHITE_SPACE (' ')\n" +
+ "DOUBLE_LITERAL ('0._1')");
}
public void testMalformedOperators() {
diff --git a/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java b/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java
index 49fcdd73f39e..c1d20b4481c5 100644
--- a/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -41,6 +41,14 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class PsiConcurrencyStressTest extends PsiTestCase {
+ private static final boolean SKIP = "true".equalsIgnoreCase(System.getProperty("skip.psi.concurrency.test"));
+
+ @Override
+ public void runBare() throws Throwable {
+ if (!SKIP) {
+ super.runBare();
+ }
+ }
@Override
protected void setUp() throws Exception {
diff --git a/java/jdkAnnotations/javax/swing/plaf/basic/annotations.xml b/java/jdkAnnotations/javax/swing/plaf/basic/annotations.xml
index 6985721e60ec..420b4dcf6c75 100644
--- a/java/jdkAnnotations/javax/swing/plaf/basic/annotations.xml
+++ b/java/jdkAnnotations/javax/swing/plaf/basic/annotations.xml
@@ -1,33 +1,34 @@
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
\ No newline at end of file
+
+
diff --git a/java/jdkAnnotations/javax/swing/tree/annotations.xml b/java/jdkAnnotations/javax/swing/tree/annotations.xml
index 20f818503be0..055cc92a5500 100644
--- a/java/jdkAnnotations/javax/swing/tree/annotations.xml
+++ b/java/jdkAnnotations/javax/swing/tree/annotations.xml
@@ -1,5 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/FSOperations.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/FSOperations.java
index 3fd4fc9d0099..4d4aaf02ded8 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/incremental/FSOperations.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/FSOperations.java
@@ -15,7 +15,6 @@
*/
package org.jetbrains.jps.incremental;
-import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.io.FileSystemUtil;
import com.intellij.openapi.util.io.FileUtil;
import gnu.trove.THashSet;
@@ -44,7 +43,7 @@ import java.util.Set;
* Date: 7/8/12
*/
public class FSOperations {
- public static final Key> ALL_OUTPUTS_KEY = Key.create("_all_project_output_dirs_");
+ public static final GlobalContextKey> ALL_OUTPUTS_KEY = GlobalContextKey.create("_all_project_output_dirs_");
public static void markDirty(CompileContext context, final File file) throws IOException {
final JavaSourceRootDescriptor rd = context.getProjectDescriptor().getBuildRootIndex().findJavaRootDescriptor(context, file);
diff --git a/plugins/generate-tostring/src/org/jetbrains/generate/tostring/inspection/AbstractGenerateToStringQuickFix.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/GlobalContextKey.java
similarity index 51%
rename from plugins/generate-tostring/src/org/jetbrains/generate/tostring/inspection/AbstractGenerateToStringQuickFix.java
rename to jps/jps-builders/src/org/jetbrains/jps/incremental/GlobalContextKey.java
index 06c7e210cf58..e5ec324c6e02 100644
--- a/plugins/generate-tostring/src/org/jetbrains/generate/tostring/inspection/AbstractGenerateToStringQuickFix.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/GlobalContextKey.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2001-2012 the original author or authors.
+ * 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
+ * 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,
@@ -13,24 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jetbrains.generate.tostring.inspection;
+package org.jetbrains.jps.incremental;
-import com.intellij.codeInspection.LocalQuickFix;
+import com.intellij.openapi.util.Key;
+import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
/**
- * Base class to extend for different types of quick fixes.
+ This is type of the key for data that must be visible to all threads
*/
-public abstract class AbstractGenerateToStringQuickFix implements LocalQuickFix {
+public final class GlobalContextKey extends Key {
+ public GlobalContextKey(@NotNull @NonNls String name) {
+ super(name);
+ }
- @NotNull
- public String getName() {
- return "Generate toString()";
- }
-
- @NotNull
- public String getFamilyName() {
- return "Generate";
- }
+ public static GlobalContextKey create(@NotNull @NonNls String name) {
+ return new GlobalContextKey(name);
+ }
}
diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java
index 06d6de86900a..e16c78813312 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java
@@ -16,7 +16,6 @@
package org.jetbrains.jps.incremental;
import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.LowMemoryWatcher;
import com.intellij.openapi.util.UserDataHolder;
import com.intellij.openapi.util.UserDataHolderBase;
@@ -80,7 +79,7 @@ public class IncProjectBuilder {
private static final String CLASSPATH_INDEX_FINE_NAME = "classpath.index";
private static final boolean GENERATE_CLASSPATH_INDEX = Boolean.parseBoolean(System.getProperty(GlobalOptions.GENERATE_CLASSPATH_INDEX_OPTION, "false"));
- private static final Key>> TARGET_WITH_CLEARED_OUTPUT = Key.create("_targets_with_cleared_output_");
+ private static final GlobalContextKey>> TARGET_WITH_CLEARED_OUTPUT = GlobalContextKey.create("_targets_with_cleared_output_");
private static final int MAX_BUILDER_THREADS;
static {
int maxThreads = 6;
@@ -1058,14 +1057,6 @@ public class IncProjectBuilder {
BuildOperations.markTargetsUpToDate(context, chunk);
}
- private static final Set GLOBAL_CONTEXT_KEYS = new HashSet();
- static {
- // keys for data that must be visible to all threads
- GLOBAL_CONTEXT_KEYS.add(ExternalJavacDescriptor.KEY);
- GLOBAL_CONTEXT_KEYS.add(FSOperations.ALL_OUTPUTS_KEY);
- GLOBAL_CONTEXT_KEYS.add(TARGET_WITH_CLEARED_OUTPUT);
- }
-
private static CompileContext createContextWrapper(final CompileContext delegate) {
final ClassLoader loader = delegate.getClass().getClassLoader();
final UserDataHolderBase localDataHolder = new UserDataHolderBase();
@@ -1078,8 +1069,7 @@ public class IncProjectBuilder {
final Class> declaringClass = method.getDeclaringClass();
if (dataHolderInterface.equals(declaringClass)) {
final Object firstArgument = args[0];
- final boolean isGlobalContextKey = firstArgument instanceof Key && GLOBAL_CONTEXT_KEYS.contains((Key)firstArgument);
- if (!isGlobalContextKey) {
+ if (!(firstArgument instanceof GlobalContextKey)) {
final boolean isWriteOperation = args.length == 2 /*&& void.class.equals(method.getReturnType())*/;
if (isWriteOperation) {
if (args[1] == null) {
diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/java/ExternalJavacDescriptor.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/java/ExternalJavacDescriptor.java
index 63e468da0af4..b8882decdf4d 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/incremental/java/ExternalJavacDescriptor.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/java/ExternalJavacDescriptor.java
@@ -16,7 +16,7 @@
package org.jetbrains.jps.incremental.java;
import com.intellij.execution.process.BaseOSProcessHandler;
-import com.intellij.openapi.util.Key;
+import org.jetbrains.jps.incremental.GlobalContextKey;
import org.jetbrains.jps.javac.JavacServerClient;
/**
@@ -24,7 +24,7 @@ import org.jetbrains.jps.javac.JavacServerClient;
* Date: 1/24/12
*/
public class ExternalJavacDescriptor {
- public static final Key KEY = Key.create("_external_javac_descriptor_");
+ public static final GlobalContextKey KEY = GlobalContextKey.create("_external_javac_descriptor_");
public final BaseOSProcessHandler process;
public final JavacServerClient client;
diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/BuildTargetConfiguration.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/BuildTargetConfiguration.java
index 1ed0edbb1bc8..8067aefacd5c 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/BuildTargetConfiguration.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/BuildTargetConfiguration.java
@@ -22,9 +22,13 @@ import com.intellij.util.SmartList;
import gnu.trove.THashSet;
import org.jetbrains.jps.builders.BuildTarget;
import org.jetbrains.jps.incremental.CompileContext;
+import org.jetbrains.jps.incremental.GlobalContextKey;
import java.io.*;
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
/**
* @author nik
@@ -35,6 +39,7 @@ public class BuildTargetConfiguration {
private final BuildTargetsState myTargetsState;
private String myConfiguration;
private volatile String myCurrentState;
+ private static final GlobalContextKey> ALL_DELETED_ROOTS_KEY = GlobalContextKey.create("_all_deleted_output_roots_");
public BuildTargetConfiguration(BuildTarget> target, BuildTargetsState targetsState) {
myTarget = target;
@@ -121,9 +126,7 @@ public class BuildTargetConfiguration {
}
File file = getNonexistentOutputsFile();
if (nonexistentOutputRoots.isEmpty()) {
- if (file.exists()) {
- FileUtil.delete(file);
- }
+ file.delete();
}
else {
FileUtil.writeToFile(file, StringUtil.join(nonexistentOutputRoots, "\n"));
@@ -132,12 +135,31 @@ public class BuildTargetConfiguration {
public boolean outputRootWasDeleted(CompileContext context) throws IOException {
List nonexistentOutputRoots = new SmartList();
- for (File outputRoot : myTarget.getOutputRoots(context)) {
- if (!outputRoot.exists()) {
- nonexistentOutputRoots.add(outputRoot.getAbsolutePath());
+
+ final Collection targetRoots = myTarget.getOutputRoots(context);
+ synchronized (ALL_DELETED_ROOTS_KEY) {
+ Set allDeletedRoots = ALL_DELETED_ROOTS_KEY.get(context);
+ for (File outputRoot : targetRoots) {
+ boolean wasDeleted = allDeletedRoots != null && allDeletedRoots.contains(outputRoot);
+ if (!wasDeleted) {
+ wasDeleted = !outputRoot.exists();
+ if (wasDeleted) {
+ if (allDeletedRoots == null) { // lazy init
+ allDeletedRoots = new THashSet(FileUtil.FILE_HASHING_STRATEGY);
+ ALL_DELETED_ROOTS_KEY.set(context, allDeletedRoots);
+ }
+ allDeletedRoots.add(outputRoot);
+ }
+ }
+ if (wasDeleted) {
+ nonexistentOutputRoots.add(outputRoot.getAbsolutePath());
+ }
}
}
- if (nonexistentOutputRoots.isEmpty()) return false;
+
+ if (nonexistentOutputRoots.isEmpty()) {
+ return false;
+ }
Set storedNonExistentOutputs;
File file = getNonexistentOutputsFile();
diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/BuildResult.java b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/BuildResult.java
index 56b936246fd5..4ada300cb65a 100644
--- a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/BuildResult.java
+++ b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/BuildResult.java
@@ -18,11 +18,13 @@ package org.jetbrains.jps.builders;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Function;
import junit.framework.Assert;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.incremental.MessageHandler;
import org.jetbrains.jps.incremental.messages.BuildMessage;
import org.jetbrains.jps.incremental.messages.DoneSomethingNotification;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
/**
@@ -69,4 +71,9 @@ public class BuildResult implements MessageHandler {
Assert.assertTrue("Build failed. \nErrors:\n" + StringUtil.join(myErrorMessages, toStringFunction, "\n") +
"\nInfo messages:\n" + StringUtil.join(myInfoMessages, toStringFunction, "\n"), isSuccessful());
}
+
+ @NotNull
+ public List getErrorMessages() {
+ return Collections.unmodifiableList(myErrorMessages);
+ }
}
diff --git a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/JpsJavaCompilerConfigurationSerializer.java b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/JpsJavaCompilerConfigurationSerializer.java
index b5cefb3b8b06..d1f6d058ad2d 100644
--- a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/JpsJavaCompilerConfigurationSerializer.java
+++ b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/JpsJavaCompilerConfigurationSerializer.java
@@ -22,6 +22,7 @@ import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsProject;
import org.jetbrains.jps.model.java.JpsJavaExtensionService;
+import org.jetbrains.jps.model.java.compiler.JpsCompilerExcludes;
import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration;
import org.jetbrains.jps.model.serialization.JpsProjectExtensionSerializer;
@@ -55,16 +56,7 @@ public class JpsJavaCompilerConfigurationSerializer extends JpsProjectExtensionS
configuration.setAddNotNullAssertions(Boolean.parseBoolean(addNotNullTag.getAttributeValue(ENABLED, "true")));
}
- Element excludeFromCompileTag = componentTag.getChild(EXCLUDE_FROM_COMPILE);
- if (excludeFromCompileTag != null) {
- for (Element fileTag : JDOMUtil.getChildren(excludeFromCompileTag, "file")) {
- configuration.getCompilerExcludes().addExcludedFile(fileTag.getAttributeValue("url"));
- }
- for (Element directoryTag : JDOMUtil.getChildren(excludeFromCompileTag, "directory")) {
- boolean recursively = Boolean.parseBoolean(directoryTag.getAttributeValue("includeSubdirectories"));
- configuration.getCompilerExcludes().addExcludedDirectory(directoryTag.getAttributeValue("url"), recursively);
- }
- }
+ readExcludes(componentTag.getChild(EXCLUDE_FROM_COMPILE), configuration.getCompilerExcludes());
Element resourcePatternsTag = componentTag.getChild(WILDCARD_RESOURCE_PATTERNS);
for (Element entry : JDOMUtil.getChildren(resourcePatternsTag, ENTRY)) {
@@ -105,6 +97,18 @@ public class JpsJavaCompilerConfigurationSerializer extends JpsProjectExtensionS
}
}
+ public static void readExcludes(Element excludeFromCompileTag, JpsCompilerExcludes excludes) {
+ if (excludeFromCompileTag != null) {
+ for (Element fileTag : JDOMUtil.getChildren(excludeFromCompileTag, "file")) {
+ excludes.addExcludedFile(fileTag.getAttributeValue("url"));
+ }
+ for (Element directoryTag : JDOMUtil.getChildren(excludeFromCompileTag, "directory")) {
+ boolean recursively = Boolean.parseBoolean(directoryTag.getAttributeValue("includeSubdirectories"));
+ excludes.addExcludedDirectory(directoryTag.getAttributeValue("url"), recursively);
+ }
+ }
+ }
+
@Override
public void saveExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
}
diff --git a/lib/jsch-0.1.49.jar b/lib/jsch-0.1.49.jar
new file mode 100644
index 000000000000..18e31bacbb32
Binary files /dev/null and b/lib/jsch-0.1.49.jar differ
diff --git a/lib/required_for_dist.txt b/lib/required_for_dist.txt
index 0c24b25d83c2..6f6e00443b90 100644
--- a/lib/required_for_dist.txt
+++ b/lib/required_for_dist.txt
@@ -19,6 +19,7 @@ jgoodies-forms.jar
jh.jar
jna-utils.jar
jna.jar
+jsch-0.1.49.jar
jsr173_1.0_api.jar
junit.jar
junit-4.10.jar
diff --git a/lib/src/jsch-0.1.49-sources.jar b/lib/src/jsch-0.1.49-sources.jar
new file mode 100644
index 000000000000..73f3b4fefae7
Binary files /dev/null and b/lib/src/jsch-0.1.49-sources.jar differ
diff --git a/native/fsNotifier/linux/main.c b/native/fsNotifier/linux/main.c
index 606e914dbc2e..87fcf26139b9 100644
--- a/native/fsNotifier/linux/main.c
+++ b/native/fsNotifier/linux/main.c
@@ -71,6 +71,7 @@ static void unregister_roots();
static bool register_roots(array* new_roots, array* unwatchable, array* mounts);
static array* unwatchable_mounts();
static void inotify_callback(char* path, int event);
+static void report_event(char* event, char* path);
static void output(const char* format, ...);
@@ -103,7 +104,6 @@ int main(int argc, char** argv) {
}
setvbuf(stdin, NULL, _IONBF, 0);
- setvbuf(stdout, NULL, _IONBF, 0);
roots = array_create(20);
if (init_inotify() && roots != NULL) {
@@ -119,7 +119,7 @@ int main(int argc, char** argv) {
unregister_roots();
}
else {
- printf("GIVEUP\n");
+ output("GIVEUP\n");
}
close_inotify();
array_delete(roots);
@@ -398,26 +398,23 @@ static array* unwatchable_mounts() {
static void inotify_callback(char* path, int event) {
if (event & IN_CREATE || event & IN_MOVED_TO) {
- output("CREATE\n%s\nCHANGE\n%s\n", path, path);
- userlog(LOG_DEBUG, "CREATE: %s", path);
+ report_event("CREATE", path);
+ report_event("CHANGE", path);
return;
}
if (event & IN_MODIFY) {
- output("CHANGE\n%s\n", path);
- userlog(LOG_DEBUG, "CHANGE: %s", path);
+ report_event("CHANGE", path);
return;
}
if (event & IN_ATTRIB) {
- output("STATS\n%s\n", path);
- userlog(LOG_DEBUG, "STATS: %s", path);
+ report_event("STATS", path);
return;
}
if (event & IN_DELETE || event & IN_MOVED_FROM) {
- output("DELETE\n%s\n", path);
- userlog(LOG_DEBUG, "DELETE: %s", path);
+ report_event("DELETE", path);
return;
}
@@ -428,6 +425,24 @@ static void inotify_callback(char* path, int event) {
}
}
+static void report_event(char* event, char* path) {
+ userlog(LOG_DEBUG, "%s: %s", event, path);
+
+ int len = strlen(path);
+ for (char* p = path; *p != '\0'; p++) {
+ if (*p == '\n') {
+ *p = '\0';
+ }
+ }
+
+ fputs(event, stdout);
+ fputc('\n', stdout);
+ fwrite(path, len, 1, stdout);
+ fputc('\n', stdout);
+
+ fflush(stdout);
+}
+
static void output(const char* format, ...) {
if (self_test) {
@@ -438,4 +453,6 @@ static void output(const char* format, ...) {
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
+
+ fflush(stdout);
}
diff --git a/native/fsNotifier/mac/fsnotifier.c b/native/fsNotifier/mac/fsnotifier.c
index df4a14348185..0f872b88eb8f 100644
--- a/native/fsNotifier/mac/fsnotifier.c
+++ b/native/fsNotifier/mac/fsnotifier.c
@@ -20,6 +20,30 @@
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+static void reportEvent(char *event, char *path) {
+ int len = 0;
+ if (path != NULL) {
+ len = strlen(path);
+ for (char* p = path; *p != '\0'; p++) {
+ if (*p == '\n') {
+ *p = '\0';
+ }
+ }
+ }
+
+ pthread_mutex_lock(&lock);
+
+ fputs(event, stdout);
+ fputc('\n', stdout);
+ if (path != NULL) {
+ fwrite(path, len, 1, stdout);
+ fputc('\n', stdout);
+ }
+
+ fflush(stdout);
+ pthread_mutex_unlock(&lock);
+}
+
static void callback(ConstFSEventStreamRef streamRef,
void *clientCallBackInfo,
size_t numEvents,
@@ -32,22 +56,13 @@ static void callback(ConstFSEventStreamRef streamRef,
// TODO[max] Lion has much more detailed flags we need accurately process. For now just reduce to SL events range.
FSEventStreamEventFlags flags = eventFlags[i] & 0xFF;
if ((flags & kFSEventStreamEventFlagMustScanSubDirs) != 0) {
- pthread_mutex_lock(&lock);
- printf("RECDIRTY\n%s\n", paths[i]);
- fflush(stdout);
- pthread_mutex_unlock(&lock);
+ reportEvent("RECDIRTY", paths[i]);
}
else if (flags != kFSEventStreamEventFlagNone) {
- pthread_mutex_lock(&lock);
- printf("RESET\n");
- fflush(stdout);
- pthread_mutex_unlock(&lock);
+ reportEvent("RESET", NULL);
}
else {
- pthread_mutex_lock(&lock);
- printf("DIRTY\n%s\n", paths[i]);
- fflush(stdout);
- pthread_mutex_unlock(&lock);
+ reportEvent("DIRTY", paths[i]);
}
}
}
diff --git a/native/macrestarter/relaunch.m b/native/macrestarter/relaunch.m
deleted file mode 100644
index 5d6a7075ed8b..000000000000
--- a/native/macrestarter/relaunch.m
+++ /dev/null
@@ -1,21 +0,0 @@
-// gcc -Wall -arch i386 -arch ppc -mmacosx-version-min=10.4 -Os -framework AppKit -o relaunch relaunch.m
-
-#import
-
-int main(int argc, const char *argv[]) {
- if (argc != 2) return EXIT_FAILURE;
-
- unsigned int interval = 500; // check every 0.5 second
- unsigned int slept = 0;
- while (getppid() != 1) {
- usleep(interval * 1000);
-
- slept += interval;
- // if (slept > 10 * 1000 /* wait for maximum 10 seconds */) return EXIT_FAILURE;
- }
-
- char const *pathToRelaunch = argv[1];
- [[NSWorkspace sharedWorkspace] launchApplication:[NSString stringWithUTF8String:pathToRelaunch]];
-
- return EXIT_SUCCESS;
-}
\ No newline at end of file
diff --git a/native/restarter/.gitignore b/native/restarter/.gitignore
index 5f88d71148d0..4691cba0cd25 100644
--- a/native/restarter/.gitignore
+++ b/native/restarter/.gitignore
@@ -6,3 +6,4 @@ _UpgradeReport_Files
UpgradeLog.xml
ipch
*.sdf
+xuserdata
\ No newline at end of file
diff --git a/native/restarter/restarter.cpp b/native/restarter/restarter.cpp
index aef7476ab70d..683f828ea371 100644
--- a/native/restarter/restarter.cpp
+++ b/native/restarter/restarter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -15,12 +15,38 @@
*/
#include "stdafx.h"
+#include
+_TCHAR **convert_args(int argc, _TCHAR **argv) {
+ _TCHAR** result = new _TCHAR* [argc+1];
+ for(int i = 0; i < argc; i++)
+ {
+ if (_tcschr(argv[i], ' '))
+ {
+ int len = _tcslen(argv[i]) + 3;
+ TCHAR *arg = new TCHAR[len];
+ arg[0] = '\"';
+ _tcscpy_s(arg+1, len, argv[i]);
+ _tcscat_s(arg, len, _T("\""));
+ result[i] = arg;
+ }
+ else
+ {
+ result[i] = argv[i];
+ }
+ }
+ result[argc] = '\0';
+ return result;
+}
+// usage "pid_to_wait (commands_num commands...)*
int _tmain(int argc, _TCHAR* argv[])
{
if (argc < 3) return 0;
- int ppid = _ttoi(argv [1]);
+
+ int arg_index = 1;
+
+ int ppid = _ttoi(argv [arg_index++]);
HANDLE parent_process = OpenProcess(SYNCHRONIZE, FALSE, ppid);
if (parent_process)
{
@@ -28,32 +54,39 @@ int _tmain(int argc, _TCHAR* argv[])
CloseHandle(parent_process);
}
- int child_argc = argc-2;
- _TCHAR** child_argv = new _TCHAR* [child_argc+1];
- for(int i = 0; i < child_argc; i++)
- {
- if (_tcschr(argv[i+2], ' '))
- {
- int len = _tcslen(argv[i+2]) + 3;
- TCHAR *arg = new TCHAR[len];
- arg[0] = '\"';
- _tcscpy_s(arg+1, len, argv[i+2]);
- _tcscat_s(arg, len, _T("\""));
- child_argv[i] = arg;
- }
- else
- {
- child_argv[i] = argv[i+2];
+ FILE *file = 0;
+#ifdef _DEBUG
+ file = fopen("c:/restarter_debug.txt", "w");
+#endif
+
+ while (arg_index < argc - 1) {
+ int argc_to_perform = _ttoi(argv[arg_index++]);
+ if (argc_to_perform > 0) {
+ _TCHAR *command_to_perform = argv[arg_index];
+ _TCHAR **argv_to_perform = convert_args(argc_to_perform, &argv[arg_index]);
+ arg_index += argc_to_perform;
+
+ if (file) {
+ _fwprintf_p(file, L"=================\n");
+ _fwprintf_p(file, L"argc:%d\n", argc_to_perform);
+ for(int ii = 0; ii < argc_to_perform; ii++) {
+ _fwprintf_p(file, L" %s\n", argv_to_perform[ii]);
+ }
+ fflush(file);
+ }
+
+ int last = arg_index >= argc - 1;
+ int rc = _tspawnv(last ? _P_NOWAIT : _P_WAIT, command_to_perform, argv_to_perform);
+ if (file && rc == -1) {
+ _fwprintf_p(file, L"Error restarting process: errno is %d\n", errno);
+ fflush(file);
+ }
}
}
- child_argv[child_argc] = '\0';
- int rc = _texecv(argv [2], child_argv);
- if (rc == -1)
- {
- _tprintf(_T("Error restarting process: errno is %d"), errno);
+ if (file) {
+ _fwprintf_p(file, L"Finished\n");
+ fclose(file);
}
-
return 0;
}
-
diff --git a/native/restarter/restarter.m b/native/restarter/restarter.m
new file mode 100644
index 000000000000..3b829e12ff03
--- /dev/null
+++ b/native/restarter/restarter.m
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+#import
+
+int main(int argc, const char *argv[]) {
+ if (argc < 2) return EXIT_FAILURE;
+
+ unsigned int interval = 500; // check every 0.5 second
+ unsigned int slept = 0;
+ while (getppid() != 1) {
+ usleep(interval * 1000);
+
+ slept += interval;
+ }
+
+ if (argc > 2) {
+ NSString *launchPath = [NSString stringWithUTF8String:argv[2]];
+ NSMutableArray *arguments = [NSMutableArray array];
+ for (int i = 3; i < argc; i++) {
+ [arguments addObject:[NSString stringWithUTF8String:argv[i]]];
+ }
+ NSTask *task = [NSTask launchedTaskWithLaunchPath:launchPath arguments:arguments];
+ [task waitUntilExit];
+ }
+
+ NSString *pathToRelaunch = [NSString stringWithUTF8String:argv[1]];
+ [[NSWorkspace sharedWorkspace] launchApplication:pathToRelaunch];
+
+ return EXIT_SUCCESS;
+}
\ No newline at end of file
diff --git a/native/restarter/restarter.sln b/native/restarter/restarter.sln
index 359e70e11595..7b9e2583d41a 100644
--- a/native/restarter/restarter.sln
+++ b/native/restarter/restarter.sln
@@ -1,7 +1,7 @@
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "restarter", "restarter.vcproj", "{1B2485B2-CFED-4B2F-8FFD-00F1C9E1BD0C}"
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "restarter", "restarter.vcxproj", "{1B2485B2-CFED-4B2F-8FFD-00F1C9E1BD0C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/native/macrestarter/relaunch.xcodeproj/project.pbxproj b/native/restarter/restarter.xcodeproj/project.pbxproj
similarity index 79%
rename from native/macrestarter/relaunch.xcodeproj/project.pbxproj
rename to native/restarter/restarter.xcodeproj/project.pbxproj
index 8cc758f70181..23c4cc62bed6 100644
--- a/native/macrestarter/relaunch.xcodeproj/project.pbxproj
+++ b/native/restarter/restarter.xcodeproj/project.pbxproj
@@ -7,25 +7,27 @@
objects = {
/* Begin PBXBuildFile section */
- 3A6C10B4148122790074811C /* relaunch.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A6C10B3148122790074811C /* relaunch.m */; };
+ 3A6C10B4148122790074811C /* restarter.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A6C10B3148122790074811C /* restarter.m */; };
3A6C10B7148122940074811C /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A6C10B6148122940074811C /* AppKit.framework */; };
+ 3ABC975E16A5A3CD0088619F /* restarter in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3A6C10AE148122660074811C /* restarter */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
CF2F99674C3F98D5739C1B44 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
- buildActionMask = 2147483647;
- dstPath = /usr/share/man/man1/;
+ buildActionMask = 12;
+ dstPath = "$(PROJECT_DIR)/../../bin/mac";
dstSubfolderSpec = 0;
files = (
+ 3ABC975E16A5A3CD0088619F /* restarter in CopyFiles */,
);
- runOnlyForDeploymentPostprocessing = 1;
+ runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
- 3A6C10AE148122660074811C /* relaunch */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = relaunch; sourceTree = BUILT_PRODUCTS_DIR; };
- 3A6C10B3148122790074811C /* relaunch.m */ = {isa = PBXFileReference; fileEncoding = 11; lastKnownFileType = sourcecode.c.objc; path = relaunch.m; sourceTree = ""; };
+ 3A6C10AE148122660074811C /* restarter */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = restarter; sourceTree = BUILT_PRODUCTS_DIR; };
+ 3A6C10B3148122790074811C /* restarter.m */ = {isa = PBXFileReference; fileEncoding = 11; lastKnownFileType = sourcecode.c.objc; path = restarter.m; sourceTree = ""; };
3A6C10B6148122940074811C /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
@@ -44,7 +46,7 @@
CF2F99674C3F98D5739C1B39 = {
isa = PBXGroup;
children = (
- 3A6C10B3148122790074811C /* relaunch.m */,
+ 3A6C10B3148122790074811C /* restarter.m */,
CF2F99674C3F98D5739C1B3A /* Products */,
CF2F99674C3F98D5739C1B45 /* Frameworks */,
3A6C10B6148122940074811C /* AppKit.framework */,
@@ -54,7 +56,7 @@
CF2F99674C3F98D5739C1B3A /* Products */ = {
isa = PBXGroup;
children = (
- 3A6C10AE148122660074811C /* relaunch */,
+ 3A6C10AE148122660074811C /* restarter */,
);
name = Products;
sourceTree = "";
@@ -69,9 +71,9 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
- CF2F99674C3F98D5739C1B3E /* relaunch */ = {
+ CF2F99674C3F98D5739C1B3E /* restarter */ = {
isa = PBXNativeTarget;
- buildConfigurationList = CF2F99674C3F98D5739C1B3F /* Build configuration list for PBXNativeTarget "relaunch" */;
+ buildConfigurationList = CF2F99674C3F98D5739C1B3F /* Build configuration list for PBXNativeTarget "restarter" */;
buildPhases = (
CF2F99674C3F98D5739C1B42 /* Sources */,
CF2F99674C3F98D5739C1B43 /* Frameworks */,
@@ -81,9 +83,9 @@
);
dependencies = (
);
- name = relaunch;
- productName = relaunch;
- productReference = 3A6C10AE148122660074811C /* relaunch */;
+ name = restarter;
+ productName = restarter;
+ productReference = 3A6C10AE148122660074811C /* restarter */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
@@ -91,7 +93,7 @@
/* Begin PBXProject section */
CF2F99674C3F98D5739C1B37 /* Project object */ = {
isa = PBXProject;
- buildConfigurationList = CF2F99674C3F98D5739C1B38 /* Build configuration list for PBXProject "relaunch" */;
+ buildConfigurationList = CF2F99674C3F98D5739C1B38 /* Build configuration list for PBXProject "restarter" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
@@ -103,7 +105,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
- CF2F99674C3F98D5739C1B3E /* relaunch */,
+ CF2F99674C3F98D5739C1B3E /* restarter */,
);
};
/* End PBXProject section */
@@ -113,7 +115,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 3A6C10B4148122790074811C /* relaunch.m in Sources */,
+ 3A6C10B4148122790074811C /* restarter.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -129,14 +131,14 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
- GCC_VERSION = 4.0;
+ GCC_VERSION = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.4;
ONLY_ACTIVE_ARCH = NO;
- SDKROOT = macosx10.4;
+ SDKROOT = macosx;
};
name = Release;
};
@@ -155,14 +157,14 @@
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
- GCC_VERSION = 4.0;
+ GCC_VERSION = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.4;
ONLY_ACTIVE_ARCH = NO;
- SDKROOT = macosx10.4;
+ SDKROOT = macosx;
};
name = Debug;
};
@@ -185,7 +187,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
- CF2F99674C3F98D5739C1B38 /* Build configuration list for PBXProject "relaunch" */ = {
+ CF2F99674C3F98D5739C1B38 /* Build configuration list for PBXProject "restarter" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CF2F99674C3F98D5739C1B3B /* Release */,
@@ -194,7 +196,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- CF2F99674C3F98D5739C1B3F /* Build configuration list for PBXNativeTarget "relaunch" */ = {
+ CF2F99674C3F98D5739C1B3F /* Build configuration list for PBXNativeTarget "restarter" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CF2F99674C3F98D5739C1B40 /* Release */,
diff --git a/native/runner/runnerw/.gitignore b/native/runner/runnerw/.gitignore
new file mode 100644
index 000000000000..998f2ddef2dc
--- /dev/null
+++ b/native/runner/runnerw/.gitignore
@@ -0,0 +1,6 @@
+*.aps
+*.vcxproj.user
+Release
+*.suo
+*.opensdf
+*.sdf
diff --git a/native/runner/runnerw/resource.h b/native/runner/runnerw/resource.h
new file mode 100644
index 000000000000..a0616b1908d9
--- /dev/null
+++ b/native/runner/runnerw/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by runnerw.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/native/runner/runnerw/runnerw.rc b/native/runner/runnerw/runnerw.rc
new file mode 100644
index 000000000000..fe1db004a142
Binary files /dev/null and b/native/runner/runnerw/runnerw.rc differ
diff --git a/native/runner/runnerw/runnerw.sln b/native/runner/runnerw/runnerw.sln
new file mode 100644
index 000000000000..b57b19419e16
--- /dev/null
+++ b/native/runner/runnerw/runnerw.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runnerw", "runnerw.vcxproj", "{52ADCA3D-82E9-86CF-9DEC-FF1A4A1B4E15}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {52ADCA3D-82E9-86CF-9DEC-FF1A4A1B4E15}.Debug|Win32.ActiveCfg = Debug|Win32
+ {52ADCA3D-82E9-86CF-9DEC-FF1A4A1B4E15}.Debug|Win32.Build.0 = Debug|Win32
+ {52ADCA3D-82E9-86CF-9DEC-FF1A4A1B4E15}.Release|Win32.ActiveCfg = Release|Win32
+ {52ADCA3D-82E9-86CF-9DEC-FF1A4A1B4E15}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/native/runner/runnerw/runnerw.vcxproj b/native/runner/runnerw/runnerw.vcxproj
new file mode 100644
index 000000000000..abc09279a216
--- /dev/null
+++ b/native/runner/runnerw/runnerw.vcxproj
@@ -0,0 +1,82 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ Win32Proj
+
+
+
+ Application
+ true
+
+
+ Application
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ true
+
+
+
+ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ MultiThreadedDebugDLL
+ Level3
+ ProgramDatabase
+ Disabled
+
+
+ MachineX86
+ true
+ Console
+
+
+
+
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ MultiThreaded
+ Level3
+ ProgramDatabase
+
+
+ MachineX86
+ true
+ Console
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/native/runner/runnerw/runnerw.vcxproj.filters b/native/runner/runnerw/runnerw.vcxproj.filters
new file mode 100644
index 000000000000..1440d88b668e
--- /dev/null
+++ b/native/runner/runnerw/runnerw.vcxproj.filters
@@ -0,0 +1,32 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hpp;hxx;hm;inl;inc;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav
+
+
+
+
+ Source Files
+
+
+
+
+ Header Files
+
+
+
+
+ Resource Files
+
+
+
\ No newline at end of file
diff --git a/platform/bootstrap/src/com/intellij/idea/Main.java b/platform/bootstrap/src/com/intellij/idea/Main.java
index 4eb26720ade2..9a0f753104df 100644
--- a/platform/bootstrap/src/com/intellij/idea/Main.java
+++ b/platform/bootstrap/src/com/intellij/idea/Main.java
@@ -17,9 +17,10 @@
package com.intellij.idea;
import com.intellij.ide.Bootstrap;
+import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.io.StreamUtil;
+import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.util.Restarter;
import org.jetbrains.annotations.NonNls;
@@ -27,11 +28,7 @@ import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
+import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -39,37 +36,11 @@ import java.util.List;
public class Main {
private static boolean isHeadless;
- private Main() { }
+ private Main() {
+ }
@SuppressWarnings("MethodNamesDifferingOnlyByCase")
public static void main(final String[] args) {
- final int[] restartCode = {Restarter.getRestartCode()};
-
- Runnable restart = new Runnable() {
- @Override
- public void run() {
- if (restartCode[0] == 0) {
- try {
- if (Restarter.restart()) restartCode[0] = 1;
- }
- catch (Throwable ignore) {
- }
- }
- }
- };
-
- if (installPatch(restart)) {
- if (restartCode[0] == 0) {
- try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable ignore) { }
-
- String msg = "Patch has been applied successfully, please restart application.";
- JOptionPane.showMessageDialog(null, msg, "Update", JOptionPane.INFORMATION_MESSAGE);
- }
-
- System.exit(restartCode[0]);
- return;
- }
-
isHeadless = isHeadless(args);
if (isHeadless) {
System.setProperty("java.awt.headless", Boolean.TRUE.toString());
@@ -78,6 +49,40 @@ public class Main {
throw new HeadlessException("Unable to detect graphics environment");
}
+ if (!isHeadless) {
+ try {
+ installPatch();
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+
+ File log = null;
+ try {
+ log = FileUtilRt.createTempFile("patch", ".log", false);
+ PrintWriter writer = new PrintWriter(log);
+ try {
+ e.printStackTrace(writer);
+ }
+ finally {
+ writer.close();
+ }
+ }
+ catch (IOException ignore) {
+ ignore.printStackTrace();
+ }
+
+ try {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ }
+ catch (Throwable ignore) {
+ }
+ String message = e.getMessage()
+ + "\n" + (log == null ? "Log cannot be saved" : "Log is saved in " + log)
+ + "\n\nPlease download and install update manually" ;
+ JOptionPane.showMessageDialog(null, message, "Cannot Apply Patch", JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
Bootstrap.main(args, Main.class.getName() + "Impl", "start");
}
@@ -112,100 +117,34 @@ public class Main {
return isHeadless;
}
- private static boolean installPatch(Runnable restart) {
- try {
- File ideaHomeDir = getIdeaHomeDir();
- if (ideaHomeDir == null) return false;
+ private static void installPatch() throws IOException {
+ String platform = System.getProperty("idea.platform.prefix", "idea");
+ String patchFileName = ("jetbrains.patch.jar." + platform).toLowerCase();
+ File originalPatchFile = new File(System.getProperty("java.io.tmpdir"), patchFileName);
+ File copyPatchFile = new File(System.getProperty("java.io.tmpdir"), patchFileName + "_copy");
- String platform = System.getProperty("idea.platform.prefix", "idea");
- String patchFileName = ("jetbrains.patch.jar." + platform).toLowerCase();
- File patchFile = new File(System.getProperty("java.io.tmpdir"), patchFileName);
+ // always delete previous patch copy
+ if (!FileUtilRt.delete(copyPatchFile)) throw new IOException("Cannot create temporary patch file");
- if (!patchFile.exists()) return false;
+ if (!originalPatchFile.exists()) return;
- try {
- List args = new ArrayList();
- if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
- File launcherFile = new File(ideaHomeDir, "bin/vistalauncher.exe");
- File launcherCopy = FileUtil.createTempFile("vistalauncher", ".exe");
- launcherCopy.deleteOnExit();
- FileUtil.copy(launcherFile, launcherCopy);
- args.add(launcherCopy.getPath());
- }
-
- restart.run();
-
- Collections.addAll(args,
- System.getProperty("java.home") + "/bin/java",
- "-classpath",
- patchFile.getPath(),
- "com.intellij.updater.Runner",
- "install",
- ideaHomeDir.getPath());
- Process process = Runtime.getRuntime().exec(args.toArray(new String[args.size()]));
-
- Thread outThread = new Thread(new StreamRedirector(process.getInputStream(), System.out));
- Thread errThread = new Thread(new StreamRedirector(process.getErrorStream(), System.err));
- outThread.start();
- errThread.start();
-
- try {
- process.waitFor();
- }
- finally {
- outThread.join();
- errThread.join();
- }
-
- return true;
- }
- finally {
- patchFile.delete();
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- return false;
- }
-
- private static class StreamRedirector implements Runnable {
- private final InputStream myIn;
- private final OutputStream myOut;
-
- private StreamRedirector(InputStream in, OutputStream out) {
- myIn = in;
- myOut = out;
+ if (!originalPatchFile.renameTo(copyPatchFile) || !FileUtilRt.delete(originalPatchFile)) {
+ throw new IOException("Cannot create temporary patch file");
}
- public void run() {
- try {
- StreamUtil.copyStreamContent(myIn, myOut);
- }
- catch (IOException e) {
- e.printStackTrace();
- }
+ List args = new ArrayList();
+ if (SystemInfo.isWindows) {
+ args.add(Restarter.createTempExecutable(new File(PathManager.getBinPath(), "vistalauncher.exe")).getPath());
}
- }
- private static File getIdeaHomeDir() throws IOException {
- URL url = Bootstrap.class.getResource("");
- if (url == null || !"jar".equals(url.getProtocol())) return null;
+ Collections.addAll(args,
+ System.getProperty("java.home") + "/bin/java",
+ "-classpath",
+ copyPatchFile.getPath(),
+ "com.intellij.updater.Runner",
+ "install",
+ PathManager.getHomePath());
- String path = url.getPath();
-
- int start = path.indexOf("file:/");
- int end = path.indexOf("!/");
- if (start == -1 || end == -1) return null;
-
- String jarFileUrl = path.substring(start, end);
-
- try {
- File bootstrapJar = new File(new URI(jarFileUrl));
- return bootstrapJar.getParentFile().getParentFile();
- }
- catch (URISyntaxException e) {
- return null;
- }
+ System.exit(Restarter.scheduleRestart(args.toArray(new String[args.size()])));
}
}
diff --git a/platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java b/platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java
index dbd1d96c1317..0b04f72590a9 100644
--- a/platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java
+++ b/platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java
@@ -110,10 +110,6 @@ public final class TextAttributesKey implements Comparable, J
*/
public TextAttributes getDefaultAttributes() {
if (myDefaultAttributes == NULL_ATTRIBUTES) {
- if (myFallbackAttributeKey != null) {
- TextAttributes fallbackAttributes = myFallbackAttributeKey.getDefaultAttributes();
- if (fallbackAttributes != null && !fallbackAttributes.isEmpty()) return fallbackAttributes;
- }
// E.g. if one text key reuse default attributes of some other predefined key
myDefaultAttributes = null;
final TextAttributeKeyDefaultsProvider provider = ourDefaultsProvider.getValue();
@@ -166,34 +162,6 @@ public final class TextAttributesKey implements Comparable, J
return key;
}
- /**
- * Similar to createTextAttributesKey(externalName, fallbackAttributeKey) but allows to specify attributes which will be used
- * in default scheme as well as in a scheme created as a copy of default scheme. If specified, shadows a fallback attribute: a scheme
- * designer may need to clear the attributes to restore dependency on the fallback key. It is strongly recommended to use this method
- * only if absolutely necessary to define specific highlighting attributes which can not be referenced by any of the keys in
- * DefaultLanguageHighlighterColors.
- *
- * If a scheme doesn't have the specified key if, for example, it was designed without an installed language plug-in, a fallback key
- * will be used instead of default text attributes specified here.
- *
- *
- * @param externalName The unique identifier of the key.
- * @param fallbackAttributeKey The fallback key to use if text attributes for this key are not defined.
- * @param defaultAttributes The default text attributes associated with the key.
- * @return
- */
- @NotNull
- public static TextAttributesKey createTextAttributesKey(@NonNls @NotNull String externalName,
- TextAttributesKey fallbackAttributeKey,
- TextAttributes defaultAttributes) {
- TextAttributesKey key = find(externalName);
- key.setFallbackAttributeKey(fallbackAttributeKey);
- if (key.myDefaultAttributes == null || key.myDefaultAttributes == NULL_ATTRIBUTES) {
- key.myDefaultAttributes = defaultAttributes;
- }
- return key;
- }
-
public TextAttributesKey getFallbackAttributeKey() {
return myFallbackAttributeKey;
}
diff --git a/platform/core-api/src/com/intellij/openapi/editor/markup/TextAttributes.java b/platform/core-api/src/com/intellij/openapi/editor/markup/TextAttributes.java
index 6a2eabb94b75..6236708ab912 100644
--- a/platform/core-api/src/com/intellij/openapi/editor/markup/TextAttributes.java
+++ b/platform/core-api/src/com/intellij/openapi/editor/markup/TextAttributes.java
@@ -32,6 +32,8 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
public static final TextAttributes ERASE_MARKER = new TextAttributes();
+ private boolean myEnforcedDefaults = false;
+
/**
* Merges (layers) the two given text attributes.
*
@@ -175,6 +177,10 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
return getForegroundColor() == null && getBackgroundColor() == null && getEffectColor() == null && getFontType() == Font.PLAIN;
}
+ public boolean isFallbackEnabled() {
+ return isEmpty() && !myEnforcedDefaults;
+ }
+
public void reset() {
setForegroundColor(null);
setBackgroundColor(null);
@@ -251,6 +257,7 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
public TextAttributes clone() {
TextAttributes cloned = new TextAttributes();
cloned.myAttrs = myAttrs;
+ cloned.myEnforcedDefaults = myEnforcedDefaults;
return cloned;
}
@@ -276,6 +283,7 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
ext.EFFECT_COLOR,
ext.getEffectType(),
ext.ERROR_STRIPE_COLOR);
+ if (isEmpty()) myEnforcedDefaults = true;
}
@Override
diff --git a/platform/core-api/src/com/intellij/psi/ElementManipulators.java b/platform/core-api/src/com/intellij/psi/ElementManipulators.java
index 787997eb4747..654c46e3886f 100644
--- a/platform/core-api/src/com/intellij/psi/ElementManipulators.java
+++ b/platform/core-api/src/com/intellij/psi/ElementManipulators.java
@@ -37,7 +37,7 @@ public class ElementManipulators extends ClassExtension {
}
public static ElementManipulator getManipulator(@NotNull T element) {
- return ElementManipulators.INSTANCE.forClass(element.getClass());
+ return INSTANCE.forClass(element.getClass());
}
public static int getOffsetInElement(final PsiElement element) {
@@ -48,8 +48,7 @@ public class ElementManipulators extends ClassExtension {
public static TextRange getValueTextRange(final PsiElement element) {
final ElementManipulator manipulator = getManipulator(element);
- assert manipulator != null: element.getClass().getName();
- return manipulator.getRangeInElement(element);
+ return manipulator == null ? TextRange.from(0, element.getTextLength()) : manipulator.getRangeInElement(element);
}
public static String getValueText(final PsiElement element) {
diff --git a/platform/core-impl/src/com/intellij/extapi/psi/StubBasedPsiElementBase.java b/platform/core-impl/src/com/intellij/extapi/psi/StubBasedPsiElementBase.java
index 1c40ae9adafe..e0fb0ea7fdf8 100644
--- a/platform/core-impl/src/com/intellij/extapi/psi/StubBasedPsiElementBase.java
+++ b/platform/core-impl/src/com/intellij/extapi/psi/StubBasedPsiElementBase.java
@@ -23,10 +23,10 @@ import com.intellij.lang.ASTNode;
import com.intellij.lang.Language;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.progress.NonCancelableSection;
import com.intellij.openapi.progress.ProgressIndicatorProvider;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiInvalidElementAccessException;
@@ -71,38 +71,34 @@ public class StubBasedPsiElementBase extends ASTDelegateP
if (node == null) {
ApplicationManager.getApplication().assertReadAccessAllowed();
PsiFileImpl file = (PsiFileImpl)getContainingFile();
- synchronized (file.getStubLock()) {
- node = myNode;
- if (node == null) {
- NonCancelableSection criticalSection = ProgressIndicatorProvider.startNonCancelableSectionIfSupported();
- try {
- if (!file.isValid()) throw new PsiInvalidElementAccessException(this);
- FileElement treeElement = file.getTreeElement();
- StubTree stubTree = file.getStubTree();
- if (treeElement != null) {
- return notBoundInExistingAst(file, treeElement, stubTree);
- }
- final FileElement fileElement = file.calcTreeElement();
- node = myNode;
- if (node == null) {
- @NonNls String message = "Failed to bind stub to AST for element " + getClass() + " in " +
- (file.getVirtualFile() == null ? "" : file.getVirtualFile().getPath()) +
- "\nFile stub tree:\n" +
- (stubTree != null ? StringUtil.trimLog(((PsiFileStubImpl)stubTree.getRoot()).printTree(), 1024) : " is null") +
- "\nLoaded file AST:\n" + StringUtil.trimLog(DebugUtil.treeToString(fileElement, true), 1024);
- throw new IllegalArgumentException(message);
- }
- }
- finally {
- criticalSection.done();
- }
- }
+ if (!file.isValid()) throw new PsiInvalidElementAccessException(this);
+
+ FileElement treeElement = file.getTreeElement();
+ StubTree stubTree = file.getStubTree();
+ if (treeElement != null && myNode == null) {
+ return notBoundInExistingAst(file, treeElement, stubTree);
+ }
+
+ final FileElement fileElement = file.calcTreeElement();
+ node = myNode;
+ if (node == null) {
+ return failedToBindStubToAst(file, stubTree, fileElement);
}
}
return node;
}
+ private ASTNode failedToBindStubToAst(PsiFileImpl file, StubTree stubTree, FileElement fileElement) {
+ VirtualFile vFile = file.getVirtualFile();
+ @NonNls String message = "Failed to bind stub to AST for element " + getClass() + " in " +
+ (vFile == null ? "" : vFile.getPath()) +
+ "\nFile stub tree:\n" +
+ (stubTree != null ? StringUtil.trimLog(((PsiFileStubImpl)stubTree.getRoot()).printTree(), 1024) : " is null") +
+ "\nLoaded file AST:\n" + StringUtil.trimLog(DebugUtil.treeToString(fileElement, true), 1024);
+ throw new IllegalArgumentException(message);
+ }
+
private ASTNode notBoundInExistingAst(PsiFileImpl file, FileElement treeElement, StubTree stubTree) {
@NonNls String message = "this=" + this.getClass() + "; file.isPhysical=" + file.isPhysical() + "; node=" + myNode + "; file=" + file +
"; tree=" + treeElement + "; stubTree=" + stubTree;
@@ -119,7 +115,7 @@ public class StubBasedPsiElementBase extends ASTDelegateP
throw new AssertionError(message);
}
- public void setNode(final ASTNode node) {
+ public final void setNode(final ASTNode node) {
myNode = node;
}
@@ -241,7 +237,7 @@ public class StubBasedPsiElementBase extends ASTDelegateP
return myStub;
}
- public void setStub(@Nullable T stub) {
+ public final void setStub(@Nullable T stub) {
myStub = stub;
}
diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java b/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java
index 084dc1320a1b..a71d800d7585 100644
--- a/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java
+++ b/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java
@@ -30,6 +30,8 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.progress.NonCancelableSection;
+import com.intellij.openapi.progress.ProgressIndicatorProvider;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Queryable;
import com.intellij.openapi.util.Key;
@@ -79,7 +81,6 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
protected PsiFile myOriginalFile = null;
private final FileViewProvider myViewProvider;
private static final Key HARD_REFERENCE_TO_DOCUMENT = new Key("HARD_REFERENCE_TO_DOCUMENT");
- private final Object myStubLock = new Object();
private volatile SoftReference myStub;
protected final PsiManagerEx myManager;
private volatile Object myTreeElementPointer; // SoftReference/WeakReference to ASTNode or a strong reference to a tree if the file is a DummyHolder
@@ -124,12 +125,12 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
FileElement node = derefTreeElement();
if (node != null) return node;
- synchronized (myStubLock) {
- node = derefTreeElement();
- if (node == null && !getViewProvider().isPhysical()) {
- return loadTreeElementUnderLock();
- }
- return node;
+ if (!getViewProvider().isPhysical()) {
+ return loadTreeElement();
+ }
+
+ synchronized (PsiLock.LOCK) {
+ return derefTreeElement();
}
}
@@ -142,7 +143,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
FileElement treeElement = (FileElement)((Reference)pointer).get();
if (treeElement != null) return treeElement;
- synchronized (myStubLock) {
+ synchronized (PsiLock.LOCK) {
if (myTreeElementPointer == pointer) {
myTreeElementPointer = null;
}
@@ -186,11 +187,8 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
return derefTreeElement() != null;
}
- private FileElement loadTreeElementUnderLock() {
- FileElement treeElement = derefTreeElement();
- if (treeElement != null) {
- return treeElement;
- }
+ private FileElement loadTreeElement() {
+ ApplicationManager.getApplication().assertReadAccessAllowed();
final FileViewProvider viewProvider = getViewProvider();
if (viewProvider.isPhysical() && myManager.isAssertOnFileLoading(viewProvider.getVirtualFile())) {
@@ -198,34 +196,39 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
}
final Document document = viewProvider.isEventSystemEnabled() ? viewProvider.getDocument() : null;
- treeElement = createFileElement(viewProvider.getContents());
+ FileElement treeElement = createFileElement(viewProvider.getContents());
if (document != null) {
treeElement.putUserData(HARD_REFERENCE_TO_DOCUMENT, document);
}
treeElement.setPsi(this);
- StubTree stub = derefStub();
-
- if (stub != null) {
- ApplicationManager.getApplication().assertReadAccessAllowed();
- final Iterator> stubs = stub.getPlainList().iterator();
- stubs.next(); // Skip file stub;
- synchronized (PsiLock.LOCK) {
- switchFromStubToAST(treeElement, stubs);
+ synchronized (PsiLock.LOCK) {
+ FileElement existing = derefTreeElement();
+ if (existing != null) {
+ return existing;
}
- myStub = null;
- }
- myTreeElementPointer = createTreeElementPointer(treeElement);
+ NonCancelableSection section = ProgressIndicatorProvider.startNonCancelableSectionIfSupported();
+ try {
+ switchFromStubToAST(treeElement);
- if (LOG.isDebugEnabled() && getViewProvider().isPhysical()) {
- LOG.debug("Loaded text for file " + getViewProvider().getVirtualFile().getPresentableUrl());
- }
+ myStub = null;
+ myTreeElementPointer = createTreeElementPointer(treeElement);
- if (document != null && isPhysical()) {
- TextBlock.get(this).clear();
+ if (document != null && isPhysical()) {
+ TextBlock.get(this).clear();
+ }
+
+ if (LOG.isDebugEnabled() && viewProvider.isPhysical()) {
+ LOG.debug("Loaded text for file " + viewProvider.getVirtualFile().getPresentableUrl());
+ }
+
+ return treeElement;
+ }
+ finally {
+ section.done();
+ }
}
- return treeElement;
}
@Override
@@ -255,13 +258,20 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
return null;
}
- private void switchFromStubToAST(final ASTNode root, final Iterator> stubs) {
+ private void switchFromStubToAST(final ASTNode root) {
+ StubTree stubTree = derefStub();
+ if (stubTree == null) {
+ return;
+ }
+
+ final Iterator> stubs = stubTree.getPlainList().iterator();
+ stubs.next(); // Skip file stub;
final IElementType contentElementType = getContentElementType();
if (!(contentElementType instanceof IStubFileElementType)) {
final VirtualFile vFile = getVirtualFile();
- throw new AssertionError("A stub in a non-stub file '" + vFile +"'; isValid()=" + (vFile != null? vFile.isValid() : "null") +
- " type: "+contentElementType+"; content:<<<\n"+
- StringUtil.first(getViewProvider().getContents(),200,true)+
+ throw new AssertionError("A stub in a non-stub file '" + vFile + "'; isValid()=" + (vFile != null ? vFile.isValid() : "null") +
+ " type: " + contentElementType + "; content:<<<\n" +
+ StringUtil.first(getViewProvider().getContents(), 200, true) +
"\n>>>; stubs=" + ContainerUtil.collect(stubs));
}
final StubBuilder builder = ((IStubFileElementType)contentElementType).getBuilder();
@@ -329,7 +339,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
LOG.assertTrue(getTreeElement() != null);
clearCaches();
myViewProvider.beforeContentsSynchronized();
- synchronized (myStubLock) {
+ synchronized (PsiLock.LOCK) {
myTreeElementPointer = null;
clearStub();
}
@@ -393,7 +403,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
tree.clearCaches();
}
- synchronized (myStubLock) {
+ synchronized (PsiLock.LOCK) {
clearStub();
if (tree != null) {
tree.putUserData(STUB_TREE_IN_PARSED_TREE, null);
@@ -672,7 +682,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
"\n>>>; stubs=" + stubHolder.getPlainList());
}
- synchronized (myStubLock) {
+ synchronized (PsiLock.LOCK) {
if (getTreeElement() != null) return null;
final StubTree derefdOnLock = derefStub();
@@ -689,7 +699,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
private StubTree derefStub() {
if (myStub == null) return null;
- synchronized (myStubLock) {
+ synchronized (PsiLock.LOCK) {
return myStub != null ? myStub.get() : null;
}
}
@@ -714,10 +724,6 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
: new PatchedSoftReference(treeElement);
}
- public Object getStubLock() {
- return myStubLock;
- }
-
@Override
public PsiManager getManager() {
return myManager;
@@ -738,9 +744,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
FileElement treeElement = getTreeElement();
if (treeElement != null) return treeElement;
- synchronized (myStubLock) {
- return loadTreeElementUnderLock();
- }
+ return loadTreeElement();
}
@Override
@@ -955,8 +959,8 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
private static final Key STUB_TREE_IN_PARSED_TREE = new Key("STUB_TREE_IN_PARSED_TREE");
public StubTree calcStubTree() {
- synchronized (myStubLock) {
- final FileElement fileElement = calcTreeElement();
+ final FileElement fileElement = calcTreeElement();
+ synchronized (PsiLock.LOCK) {
StubTree tree = fileElement.getUserData(STUB_TREE_IN_PARSED_TREE);
if (tree == null) {
IElementType contentElementType = getContentElementType();
diff --git a/platform/core-impl/src/com/intellij/util/PatchedWeakReference.java b/platform/core-impl/src/com/intellij/util/PatchedWeakReference.java
index 9a4fb1792b1f..408216276b93 100644
--- a/platform/core-impl/src/com/intellij/util/PatchedWeakReference.java
+++ b/platform/core-impl/src/com/intellij/util/PatchedWeakReference.java
@@ -32,7 +32,7 @@ public class PatchedWeakReference extends WeakReference{
private static final ReferenceQueue ourQueue = new ReferenceQueue();
static {
- JobScheduler.getScheduler().scheduleAtFixedRate(new Runnable() {
+ JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
processQueue();
@@ -42,9 +42,6 @@ public class PatchedWeakReference extends WeakReference{
public PatchedWeakReference(T referent) {
super(referent, ourQueue);
- if(ourRefsList.size() % 100 == 0) {
- int i = 0;
- }
synchronized(ourQueue) {
ourRefsList.add(this);
}
diff --git a/platform/icons/src/actions/download.png b/platform/icons/src/actions/download.png
index b4c66afd4e86..efbb8808d578 100644
Binary files a/platform/icons/src/actions/download.png and b/platform/icons/src/actions/download.png differ
diff --git a/platform/icons/src/actions/download@2x.png b/platform/icons/src/actions/download@2x.png
new file mode 100644
index 000000000000..a596b7bd4a91
Binary files /dev/null and b/platform/icons/src/actions/download@2x.png differ
diff --git a/platform/lang-api/src/com/intellij/codeInspection/InspectionProfileEntry.java b/platform/lang-api/src/com/intellij/codeInspection/InspectionProfileEntry.java
index c17ccf891d5e..4edc7640cdf5 100644
--- a/platform/lang-api/src/com/intellij/codeInspection/InspectionProfileEntry.java
+++ b/platform/lang-api/src/com/intellij/codeInspection/InspectionProfileEntry.java
@@ -146,6 +146,7 @@ public abstract class InspectionProfileEntry {
}
/**
+ * This method is called each time UI is shown.
* @return null if no UI options required.
*/
@Nullable
diff --git a/platform/lang-api/src/com/intellij/codeInspection/ProblemsHolder.java b/platform/lang-api/src/com/intellij/codeInspection/ProblemsHolder.java
index a89139a08f70..027366df9a2a 100644
--- a/platform/lang-api/src/com/intellij/codeInspection/ProblemsHolder.java
+++ b/platform/lang-api/src/com/intellij/codeInspection/ProblemsHolder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -209,6 +209,10 @@ public class ProblemsHolder {
return !myProblems.isEmpty();
}
+ public int getResultCount() {
+ return myProblems.size();
+ }
+
public boolean isOnTheFly() {
return myOnTheFly;
}
diff --git a/platform/lang-api/src/com/intellij/codeInspection/ui/ListWrappingTableModel.java b/platform/lang-api/src/com/intellij/codeInspection/ui/ListWrappingTableModel.java
index a7fcba9c0500..ef52f6d5c57e 100644
--- a/platform/lang-api/src/com/intellij/codeInspection/ui/ListWrappingTableModel.java
+++ b/platform/lang-api/src/com/intellij/codeInspection/ui/ListWrappingTableModel.java
@@ -114,7 +114,10 @@ public class ListWrappingTableModel extends AbstractTableModel {
@Override
public void setValueAt(Object value, int rowIndex, int columnIndex) {
- list.get(columnIndex).set(rowIndex, String.valueOf(value));
- fireTableCellUpdated(rowIndex, columnIndex);
+ List strings = list.get(columnIndex);
+ if (rowIndex >= 0 && rowIndex < strings.size()) {
+ strings.set(rowIndex, String.valueOf(value));
+ fireTableCellUpdated(rowIndex, columnIndex);
+ }
}
}
diff --git a/platform/lang-api/src/com/intellij/openapi/editor/DefaultLanguageHighlighterColors.java b/platform/lang-api/src/com/intellij/openapi/editor/DefaultLanguageHighlighterColors.java
index ac4cdef78851..482a91f90240 100644
--- a/platform/lang-api/src/com/intellij/openapi/editor/DefaultLanguageHighlighterColors.java
+++ b/platform/lang-api/src/com/intellij/openapi/editor/DefaultLanguageHighlighterColors.java
@@ -16,48 +16,48 @@
package com.intellij.openapi.editor;
import com.intellij.openapi.editor.colors.TextAttributesKey;
+import com.intellij.openapi.editor.markup.TextAttributes;
/**
* Base highlighter colors for multiple languages.
*
* @author Rustam Vishnyakov
*/
-@SuppressWarnings("deprecation") // SyntaxHighlighterColors is used for compatibility with old schemes
public class DefaultLanguageHighlighterColors {
public final static TextAttributesKey TEMPLATE_LANGUAGE_COLOR =
- TextAttributesKey.createTextAttributesKey("DEFAULT_TEMPLATE_LANGUAGE_COLOR");
+ TextAttributesKey.createTextAttributesKey("DEFAULT_TEMPLATE_LANGUAGE_COLOR", HighlighterColors.TEXT);
public final static TextAttributesKey IDENTIFIER =
TextAttributesKey.createTextAttributesKey("DEFAULT_IDENTIFIER", HighlighterColors.TEXT);
public final static TextAttributesKey NUMBER =
- TextAttributesKey.createTextAttributesKey("DEFAULT_NUMBER", SyntaxHighlighterColors.NUMBER.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_NUMBER");
public final static TextAttributesKey KEYWORD =
- TextAttributesKey.createTextAttributesKey("DEFAULT_KEYWORD", SyntaxHighlighterColors.KEYWORD.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_KEYWORD");
public final static TextAttributesKey STRING =
- TextAttributesKey.createTextAttributesKey("DEFAULT_STRING", SyntaxHighlighterColors.STRING.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_STRING", HighlighterColors.TEXT);
public final static TextAttributesKey BLOCk_COMMENT =
- TextAttributesKey.createTextAttributesKey("DEFAULT_BLOCK_COMMENT", SyntaxHighlighterColors.JAVA_BLOCK_COMMENT.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_BLOCK_COMMENT");
public final static TextAttributesKey LINE_COMMENT =
- TextAttributesKey.createTextAttributesKey("DEFAULT_LINE_COMMENT", SyntaxHighlighterColors.LINE_COMMENT.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_LINE_COMMENT");
public final static TextAttributesKey DOC_COMMENT =
- TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT", SyntaxHighlighterColors.DOC_COMMENT.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT");
public final static TextAttributesKey OPERATION_SIGN =
- TextAttributesKey.createTextAttributesKey("DEFAULT_OPERATION_SIGN", SyntaxHighlighterColors.OPERATION_SIGN.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_OPERATION_SIGN");
public final static TextAttributesKey BRACES =
- TextAttributesKey.createTextAttributesKey("DEFAULT_BRACES", SyntaxHighlighterColors.BRACES.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_BRACES");
public final static TextAttributesKey DOT =
- TextAttributesKey.createTextAttributesKey("DEFAULT_DOT", SyntaxHighlighterColors.DOT.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_DOT");
public final static TextAttributesKey SEMICOLON =
- TextAttributesKey.createTextAttributesKey("DEFAULT_SEMICOLON", SyntaxHighlighterColors.JAVA_SEMICOLON.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_SEMICOLON");
public final static TextAttributesKey COMMA =
- TextAttributesKey.createTextAttributesKey("DEFAULT_COMMA", SyntaxHighlighterColors.COMMA.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_COMMA");
public final static TextAttributesKey PARENTHESES =
- TextAttributesKey.createTextAttributesKey("DEFAULT_PARENTHS", SyntaxHighlighterColors.PARENTHS.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_PARENTHS");
public final static TextAttributesKey BRACKETS =
- TextAttributesKey.createTextAttributesKey("DEFAULT_BRACKETS", SyntaxHighlighterColors.BRACKETS.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_BRACKETS");
public final static TextAttributesKey LABEL =
- TextAttributesKey.createTextAttributesKey("DEFAULT_LABEL");
+ TextAttributesKey.createTextAttributesKey("DEFAULT_LABEL", IDENTIFIER);
public final static TextAttributesKey CONSTANT =
TextAttributesKey.createTextAttributesKey("DEFAULT_CONSTANT", IDENTIFIER);
public final static TextAttributesKey LOCAL_VARIABLE =
@@ -87,15 +87,15 @@ public class DefaultLanguageHighlighterColors {
TextAttributesKey.createTextAttributesKey("DEFAULT_STATIC_FIELD", IDENTIFIER);
public final static TextAttributesKey DOC_COMMENT_MARKUP =
- TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_MARKUP", SyntaxHighlighterColors.DOC_COMMENT_MARKUP.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_MARKUP");
public final static TextAttributesKey DOC_COMMENT_TAG =
- TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT_TAG", SyntaxHighlighterColors.DOC_COMMENT_TAG.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT_TAG");
+ public final static TextAttributesKey DOC_COMMENT_TAG_VALUE =
+ TextAttributesKey.createTextAttributesKey("DEFAULT_DOC_COMMENT_TAG_VALUE");
public final static TextAttributesKey VALID_STRING_ESCAPE =
- TextAttributesKey
- .createTextAttributesKey("DEFAULT_VALID_STRING_ESCAPE", SyntaxHighlighterColors.VALID_STRING_ESCAPE.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_VALID_STRING_ESCAPE");
public final static TextAttributesKey INVALID_STRING_ESCAPE =
- TextAttributesKey
- .createTextAttributesKey("DEFAULT_INVALID_STRING_ESCAPE", SyntaxHighlighterColors.INVALID_STRING_ESCAPE.getDefaultAttributes());
+ TextAttributesKey.createTextAttributesKey("DEFAULT_INVALID_STRING_ESCAPE");
public final static TextAttributesKey PREDEFINED_SYMBOL =
TextAttributesKey.createTextAttributesKey("DEFAULT_PREDEFINED_SYMBOL", IDENTIFIER);
diff --git a/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java b/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java
index c195be03040a..07feda12dc6c 100644
--- a/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java
+++ b/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java
@@ -815,7 +815,7 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract
@Override
public boolean isInherited() {
- return myFallbackAttributes != null && getTextAttributes().isEmpty();
+ return myFallbackAttributes != null && getTextAttributes().isFallbackEnabled();
}
@Nullable
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java
index d846748b8e0b..952c7ac7103b 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java
@@ -598,24 +598,20 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
@Nullable
public HighlightInfo findHighlightByOffset(@NotNull Document document, final int offset, final boolean includeFixRange) {
- return findHighlightByOffset(document, offset, includeFixRange, true);
+ return findHighlightByOffset(document, offset, includeFixRange, HighlightSeverity.INFORMATION);
}
@Nullable
public HighlightInfo findHighlightByOffset(@NotNull Document document,
final int offset,
final boolean includeFixRange,
- final boolean includeAllButInformation) {
+ @NotNull HighlightSeverity minSeverity) {
final List foundInfoList = new SmartList();
- processHighlightsNearOffset(document, myProject, HighlightSeverity.INFORMATION, offset, includeFixRange,
+ processHighlightsNearOffset(document, myProject, minSeverity, offset, includeFixRange,
new Processor() {
@Override
public boolean process(@NotNull HighlightInfo info) {
- if (includeAllButInformation) {
- if (HighlightSeverity.INFORMATION.compareTo(info.getSeverity()) >= 0) {
- return true;
- }
- } else if (!foundInfoList.isEmpty()) {
+ if (!foundInfoList.isEmpty()) {
HighlightInfo foundInfo = foundInfoList.get(0);
int compare = foundInfo.getSeverity().compareTo(info.getSeverity());
if (compare < 0) {
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/StatusBarUpdater.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/StatusBarUpdater.java
index 26d64974c326..9f044e7795cc 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/StatusBarUpdater.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/StatusBarUpdater.java
@@ -17,6 +17,7 @@
package com.intellij.codeInsight.daemon.impl;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
+import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
@@ -94,7 +95,7 @@ public class StatusBarUpdater implements Disposable {
int offset = editor.getCaretModel().getOffset();
DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(myProject);
- HighlightInfo info = ((DaemonCodeAnalyzerImpl)codeAnalyzer).findHighlightByOffset(document, offset, false, false);
+ HighlightInfo info = ((DaemonCodeAnalyzerImpl)codeAnalyzer).findHighlightByOffset(document, offset, false, HighlightSeverity.WARNING);
String text = info != null && info.description != null ? info.description : "";
StatusBar statusBar = WindowManager.getInstance().getStatusBar(editor.getContentComponent(), myProject);
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/WolfHighlightingPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/WolfHighlightingPass.java
index 79fab4d3e0dd..d2da3e272529 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/WolfHighlightingPass.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/WolfHighlightingPass.java
@@ -22,6 +22,7 @@ import com.intellij.openapi.editor.Document;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.problems.WolfTheProblemSolver;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
@@ -36,6 +37,7 @@ class WolfHighlightingPass extends ProgressableTextEditorHighlightingPass implem
@Override
protected void collectInformationWithProgress(final ProgressIndicator progress) {
+ if (!Registry.is("wolf.the.problem.solver", true)) return;
final WolfTheProblemSolver solver = WolfTheProblemSolver.getInstance(myProject);
if (solver instanceof WolfTheProblemSolverImpl) {
((WolfTheProblemSolverImpl)solver).startCheckingIfVincentSolvedProblemsYet(progress, this);
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoController.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoController.java
index 67f745f4f440..a486736b6c4d 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoController.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoController.java
@@ -20,12 +20,15 @@ import com.intellij.codeInsight.lookup.Lookup;
import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.codeInsight.lookup.impl.LookupImpl;
import com.intellij.lang.parameterInfo.*;
+import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.RangeMarker;
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.editor.event.*;
+import com.intellij.openapi.editor.impl.EditorImpl;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.PsiDocumentManager;
@@ -178,32 +181,8 @@ public class ParameterInfoController {
myEditorCaretListener = new CaretListener(){
@Override
public void caretPositionChanged(CaretEvent e) {
- if (!myHandler.tracksParameterIndex()) {
- myAlarm.cancelAllRequests();
- addAlarmRequest();
- return;
- }
-
- int oldOffset = e.getEditor().logicalPositionToOffset(e.getOldPosition());
- int newOffset = e.getEditor().logicalPositionToOffset(e.getNewPosition());
- if (newOffset <= myLbraceMarker.getStartOffset()){
- myAlarm.cancelAllRequests();
- addAlarmRequest();
- return;
- }
- int offset1 = Math.min(oldOffset, newOffset);
- int offset2 = Math.max(oldOffset, newOffset);
- CharSequence chars = e.getEditor().getDocument().getCharsSequence();
- int offset = CharArrayUtil.shiftForwardUntil(chars, offset1, myParameterCloseChars);
- if (offset < offset2){
- myAlarm.cancelAllRequests();
- addAlarmRequest();
- }
- else{
- if (myAlarm.cancelAllRequests() > 0){
- addAlarmRequest();
- }
- }
+ myAlarm.cancelAllRequests();
+ addAlarmRequest();
}
};
myEditor.getCaretModel().addCaretListener(myEditorCaretListener);
@@ -211,27 +190,8 @@ public class ParameterInfoController {
myEditorDocumentListener = new DocumentAdapter(){
@Override
public void documentChanged(DocumentEvent e) {
- if (!myHandler.tracksParameterIndex()) {
- myAlarm.cancelAllRequests();
- addAlarmRequest();
- return;
- }
-
- CharSequence oldS = e.getOldFragment();
- if (CharArrayUtil.shiftForwardUntil(oldS, 0, myParameterCloseChars) < oldS.length()){
- myAlarm.cancelAllRequests();
- addAlarmRequest();
- return;
- }
- CharSequence newS = e.getNewFragment();
- if (CharArrayUtil.shiftForwardUntil(newS, 0, myParameterCloseChars) < newS.length()){
- myAlarm.cancelAllRequests();
- addAlarmRequest();
- return;
- }
- if (myAlarm.cancelAllRequests() > 0){
- addAlarmRequest();
- }
+ myAlarm.cancelAllRequests();
+ addAlarmRequest();
}
};
myEditor.getDocument().addDocumentListener(myEditorDocumentListener);
@@ -250,6 +210,14 @@ public class ParameterInfoController {
LookupManager.getInstance(project).addPropertyChangeListener(myLookupListener);
updateComponent();
+ if (myEditor instanceof EditorImpl) {
+ Disposer.register(((EditorImpl)myEditor).getDisposable(), new Disposable() {
+ @Override
+ public void dispose() {
+ ParameterInfoController.this.dispose();
+ }
+ });
+ }
}
private void dispose(){
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/EmptyIntentionAction.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/EmptyIntentionAction.java
index 76a293d1ea5f..f4a32a6da98a 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/intention/EmptyIntentionAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/EmptyIntentionAction.java
@@ -17,19 +17,22 @@
package com.intellij.codeInsight.intention;
import com.intellij.codeInspection.InspectionsBundle;
+import com.intellij.icons.AllIcons;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Iconable;
import com.intellij.psi.PsiFile;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
+import javax.swing.*;
import java.util.List;
/**
* User: anna
* Date: May 11, 2005
*/
-public final class EmptyIntentionAction implements IntentionAction, LowPriorityAction{
+public final class EmptyIntentionAction implements IntentionAction, LowPriorityAction, Iconable {
private final String myName;
public EmptyIntentionAction(@NotNull String name) {
@@ -80,4 +83,9 @@ public final class EmptyIntentionAction implements IntentionAction, LowPriorityA
public EmptyIntentionAction(@NotNull final String name, @NotNull List options) {
myName = name;
}
+
+ @Override
+ public Icon getIcon(@IconFlags int flags) {
+ return AllIcons.Actions.RealIntentionBulb;
+ }
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupCellRenderer.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupCellRenderer.java
index 286bfb6af03c..24cda004f14c 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupCellRenderer.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupCellRenderer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -124,23 +124,22 @@ public class LookupCellRenderer implements ListCellRenderer {
myIsSelected = isSelected;
final LookupElement item = (LookupElement)value;
- final boolean dark = UIUtil.isUnderDarcula();
final Color foreground = getForegroundColor(isSelected);
- final Color background = isSelected ? SELECTED_BACKGROUND_COLOR : dark ? BACKGROUND_COLOR_DARK_VARIANT : BACKGROUND_COLOR;
+ final Color background = isSelected ? SELECTED_BACKGROUND_COLOR : new JBColor(BACKGROUND_COLOR, BACKGROUND_COLOR_DARK_VARIANT);
int allowedWidth = list.getWidth() - AFTER_TAIL - AFTER_TYPE - getIconIndent();
final LookupElementPresentation presentation = new RealLookupElementPresentation(isSelected ? getMaxWidth() : allowedWidth, myNormalMetrics, myBoldMetrics, myLookup);
if (item.isValid()) {
item.renderElement(presentation);
} else {
- presentation.setItemTextForeground(Color.RED);
+ presentation.setItemTextForeground(JBColor.RED);
presentation.setItemText("Invalid");
}
myNameComponent.clear();
myNameComponent.setIcon(augmentIcon(presentation.getIcon(), myEmptyIcon));
myNameComponent.setBackground(background);
- allowedWidth -= setItemTextLabel(item, dark ? foreground : isSelected ? SELECTED_FOREGROUND_COLOR : presentation.getItemTextForeground(), isSelected, presentation, allowedWidth);
+ allowedWidth -= setItemTextLabel(item, new JBColor(isSelected ? SELECTED_FOREGROUND_COLOR : presentation.getItemTextForeground(), foreground), isSelected, presentation, allowedWidth);
myTypeLabel.clear();
if (allowedWidth > 0) {
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java
index 2781854470f6..a30b7c44ab24 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -35,10 +35,15 @@ import com.intellij.openapi.command.undo.DocumentReferenceManager;
import com.intellij.openapi.command.undo.UndoManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.*;
+import com.intellij.openapi.editor.colors.EditorColors;
+import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.event.DocumentAdapter;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.ex.DocumentEx;
-import com.intellij.openapi.editor.markup.*;
+import com.intellij.openapi.editor.markup.HighlighterLayer;
+import com.intellij.openapi.editor.markup.HighlighterTargetArea;
+import com.intellij.openapi.editor.markup.RangeHighlighter;
+import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
@@ -59,9 +64,7 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.awt.*;
import java.util.*;
-import java.util.List;
public class TemplateState implements Disposable {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.template.impl.TemplateState");
@@ -969,7 +972,8 @@ public class TemplateState implements Disposable {
}
private RangeHighlighter getSegmentHighlighter(int segmentNumber, boolean isSelected, boolean isEnd) {
- TextAttributes attributes = isSelected ? new TextAttributes(null, null, Color.red, EffectType.BOXED, Font.PLAIN) : new TextAttributes();
+ final TextAttributes lvAttr = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(EditorColors.LIVE_TEMPLATE_ATTRIBUTES);
+ TextAttributes attributes = isSelected ? lvAttr : new TextAttributes();
TextAttributes endAttributes = new TextAttributes();
int start = mySegments.getSegmentStart(segmentNumber);
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 c4bd425a7a62..1763b165ecc8 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
@@ -1072,6 +1072,11 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
myMinimizedButtonsPlaceholder.clear();
myCommonActionsPlaceholder.clear();
myContextActions.clear();
+
+ myOriginal = null;
+ myTopActions = null;
+ myAdditonalFocusActions = null;
+ myLeftToolbarActions = null;
}
public void restoreLayout() {
diff --git a/platform/lang-impl/src/com/intellij/ide/commander/CommanderPanel.java b/platform/lang-impl/src/com/intellij/ide/commander/CommanderPanel.java
index ceae6980ded8..8b17215783bc 100644
--- a/platform/lang-impl/src/com/intellij/ide/commander/CommanderPanel.java
+++ b/platform/lang-impl/src/com/intellij/ide/commander/CommanderPanel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -279,7 +279,7 @@ public class CommanderPanel extends JPanel {
myParentTitle = new MyTitleLabel(myTitlePanel);
myParentTitle.setText(" ");
myParentTitle.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
- myParentTitle.setForeground(Color.black);
+ myParentTitle.setForeground(JBColor.foreground);
myParentTitle.setUI(new RightAlignedLabelUI());
final JPanel panel1 = new JPanel(new BorderLayout());
panel1.setOpaque(false);
@@ -392,7 +392,7 @@ public class CommanderPanel extends JPanel {
LOG.assertTrue(color != null);
myTitlePanel.setBackground(color);
myTitlePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, color.brighter(), color.darker()));
- myParentTitle.setForeground(Color.black);
+ myParentTitle.setForeground(JBColor.foreground);
}
final int[] selectedIndices = myList.getSelectedIndices();
if (selectedIndices.length == 0 && myList.getModel().getSize() > 0) {
diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java
index 6e4ab7a0c8e1..66de8a6a09c2 100644
--- a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java
+++ b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java
@@ -22,6 +22,7 @@ import com.intellij.ide.structureView.impl.StructureViewFactoryImpl;
import com.intellij.ide.structureView.impl.StructureViewState;
import com.intellij.ide.structureView.impl.common.PsiTreeElementBase;
import com.intellij.ide.ui.customization.CustomizationUtil;
+import com.intellij.ide.util.FileStructurePopup;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.ide.util.treeView.AbstractTreeStructure;
import com.intellij.ide.util.treeView.NodeDescriptorProvidingKey;
@@ -52,6 +53,7 @@ import com.intellij.util.Alarm;
import com.intellij.util.ArrayUtil;
import com.intellij.util.EditSourceOnDoubleClickHandler;
import com.intellij.util.OpenSourceUtil;
+import com.intellij.util.containers.Convertor;
import com.intellij.util.ui.tree.TreeUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NonNls;
@@ -182,7 +184,17 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre
myAutoScrollFromSourceHandler.install();
TreeUtil.installActions(getTree());
- new TreeSpeedSearch(getTree());
+
+ new TreeSpeedSearch(getTree(), new Convertor() {
+ public String convert(final TreePath treePath) {
+ final DefaultMutableTreeNode node = (DefaultMutableTreeNode)treePath.getLastPathComponent();
+ final Object userObject = node.getUserObject();
+ if (userObject != null) {
+ return FileStructurePopup.getSpeedSearchText(userObject);
+ }
+ return null;
+ }
+ });
addTreeKeyListener();
addTreeMouseListeners();
@@ -626,7 +638,7 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre
return myAbstractTreeBuilder.getTreeStructure();
}
- public JTree getTree() {
+ public Tree getTree() {
return myTree;
}
diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java
index 9d350f9b0c3b..ae15cf5cfc03 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java
+++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java
@@ -29,6 +29,7 @@ import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.ide.util.treeView.NodeRenderer;
import com.intellij.ide.util.treeView.smartTree.*;
import com.intellij.navigation.ItemPresentation;
+import com.intellij.navigation.LocationPresentation;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.MnemonicHelper;
import com.intellij.openapi.actionSystem.*;
@@ -771,27 +772,38 @@ public class FileStructurePopup implements Disposable {
}
@Nullable
- private static String getText(final Object node) {
- String text = String.valueOf(node);
+ public static String getSpeedSearchText(final Object userObject) {
+ String text = String.valueOf(userObject);
if (text != null) {
- if (node instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
- final TreeElement value = ((StructureViewComponent.StructureViewTreeElementWrapper)node).getValue();
+ if (userObject instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
+ final TreeElement value = ((StructureViewComponent.StructureViewTreeElementWrapper)userObject).getValue();
if (value instanceof PsiTreeElementBase && ((PsiTreeElementBase)value).isSearchInLocationString()) {
- final String string = ((PsiTreeElementBase)value).getLocationString();
- if (!StringUtil.isEmpty(string)) {
- return text + " (" + string + ")";
+ final String locationString = ((PsiTreeElementBase)value).getLocationString();
+ if (!StringUtil.isEmpty(locationString)) {
+ String locationPrefix = null;
+ String locationSuffix = null;
+ if (value instanceof LocationPresentation) {
+ locationPrefix = ((LocationPresentation)value).getLocationPrefix();
+ locationSuffix = ((LocationPresentation)value).getLocationSuffix();
+ }
+
+ return text +
+ StringUtil.notNullize(locationPrefix, LocationPresentation.DEFAULT_LOCATION_PREFIX) +
+ locationString +
+ StringUtil.notNullize(locationSuffix, LocationPresentation.DEFAULT_LOCATION_SUFFIX);
}
}
}
return text;
}
- if (node instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
+ if (userObject instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
return ApplicationManager.getApplication().runReadAction(new Computable() {
@Nullable
@Override
public String compute() {
- final ItemPresentation presentation = ((StructureViewComponent.StructureViewTreeElementWrapper)node).getValue().getPresentation();
+ final ItemPresentation presentation =
+ ((StructureViewComponent.StructureViewTreeElementWrapper)userObject).getValue().getPresentation();
return presentation.getPresentableText();
}
});
@@ -819,7 +831,7 @@ public class FileStructurePopup implements Disposable {
return true;
}
- final String text = getText(value);
+ final String text = getSpeedSearchText(value);
if (text == null) return false;
if (matches(text)) {
@@ -863,7 +875,7 @@ public class FileStructurePopup implements Disposable {
final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
final Object userObject = node.getUserObject();
if (userObject instanceof FilteringTreeStructure.FilteringNode) {
- return getText(((FilteringTreeStructure.FilteringNode)userObject).getDelegate());
+ return getSpeedSearchText(((FilteringTreeStructure.FilteringNode)userObject).getDelegate());
}
return "";
}
diff --git a/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubTagListProvider.java b/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubTagListProvider.java
index 23ab1895f777..818a350d3787 100644
--- a/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubTagListProvider.java
+++ b/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubTagListProvider.java
@@ -65,8 +65,8 @@ public class GithubTagListProvider {
public void run() {
final String[] urls = formatTagListDownloadUrls();
String firstErrorMessage = null;
- String errorMessage = null;
for (String url : urls) {
+ String errorMessage;
try {
final ImmutableSet tags = fetchGithubTagsByUrl(url);
LOG.info(getGeneratorName() + "Cache has been successfully updated");
diff --git a/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java b/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java
index 50e651ba9a38..b2bb141e9058 100644
--- a/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java
+++ b/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -80,6 +80,7 @@ public class GeneralColorsPage implements ColorSettingsPage, InspectionColorSett
new AttributesDescriptor(OptionsBundle.message("options.general.attribute.descriptior.identifier.under.caret.write"), EditorColors.WRITE_IDENTIFIER_UNDER_CARET_ATTRIBUTES),
new AttributesDescriptor(OptionsBundle.message("options.general.attribute.descriptor.text.search.result"), EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES),
+ new AttributesDescriptor(OptionsBundle.message("options.general.attribute.descriptor.live.template"), EditorColors.LIVE_TEMPLATE_ATTRIBUTES),
new AttributesDescriptor(OptionsBundle.message("options.general.attribute.descriptor.template.variable"), TemplateColors.TEMPLATE_VARIABLE_ATTRIBUTES),
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.injected.language.fragment"), EditorColors.INJECTED_LANGUAGE_FRAGMENT),
diff --git a/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java b/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java
index 6dfdf5c2b0c3..6c939197b441 100644
--- a/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java
+++ b/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java
@@ -316,11 +316,7 @@ public class RegistryUi implements Disposable {
LaterInvocator.invokeLater(new Runnable() {
@Override
public void run() {
- if (app.isRestartCapable()) {
- app.restart();
- } else {
- app.exit(true);
- }
+ app.restart(true);
}
}, ModalityState.NON_MODAL);
}
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 c3e88646ab23..32a56bdbe14f 100644
--- a/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java
+++ b/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -765,7 +765,7 @@ public class DependenciesPanel extends JPanel implements Disposable, DataProvide
}
});
final JEditorPane pane = new JEditorPane(UIUtil.HTML_MIME, "" + buf.toString()+ "");
- pane.setForeground(Color.black);
+ pane.setForeground(JBColor.foreground);
pane.setBackground(HintUtil.INFORMATION_COLOR);
pane.setOpaque(true);
final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(pane);
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
index 209f15f7408e..b9c796e9c4b1 100644
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
@@ -1119,7 +1119,7 @@ public class SingleInspectionProfilePanel extends JPanel {
private class MyFilterComponent extends FilterComponent {
private MyFilterComponent() {
super(INSPECTION_FILTER_HISTORY, 10);
- setHistory(Arrays.asList("\"New in 11\""));
+ setHistory(Arrays.asList("\"New in 12\""));
}
public void filter() {
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/MultiHostRegistrarImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/MultiHostRegistrarImpl.java
index 61ac24305495..a3012ad62bb3 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/MultiHostRegistrarImpl.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/MultiHostRegistrarImpl.java
@@ -201,7 +201,6 @@ public class MultiHostRegistrarImpl implements MultiHostRegistrar, ModificationT
VirtualFileWindowImpl virtualFile = new VirtualFileWindowImpl(myHostVirtualFile, documentWindow, myLanguage, outChars);
Language forcedLanguage = myContextElement.getUserData(InjectedFileViewProvider.LANGUAGE_FOR_INJECTED_COPY_KEY);
myLanguage = forcedLanguage == null ? LanguageSubstitutors.INSTANCE.substituteLanguage(myLanguage, virtualFile, myProject) : forcedLanguage;
- virtualFile.setLanguage(myLanguage);
DocumentImpl decodedDocument;
if (StringUtil.indexOf(outChars, '\r') == -1) {
diff --git a/platform/lang-impl/src/com/intellij/refactoring/actions/BaseRefactoringAction.java b/platform/lang-impl/src/com/intellij/refactoring/actions/BaseRefactoringAction.java
index da105cd31dc2..332f352d3881 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/actions/BaseRefactoringAction.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/actions/BaseRefactoringAction.java
@@ -96,18 +96,20 @@ public abstract class BaseRefactoringAction extends AnAction {
return;
}
- final LookupEx lookup = LookupManager.getActiveLookup(editor);
- if (lookup instanceof LookupImpl) {
- Runnable command = new Runnable() {
- @Override
- public void run() {
- ((LookupImpl)lookup).finishLookup(Lookup.NORMAL_SELECT_CHAR);
- }
- };
- assert editor != null;
- Document doc = editor.getDocument();
- DocCommandGroupId group = DocCommandGroupId.noneGroupId(doc);
- CommandProcessor.getInstance().executeCommand(editor.getProject(), command, "Completion", group, UndoConfirmationPolicy.DEFAULT, doc);
+ if (InplaceRefactoring.getActiveInplaceRenamer(editor) == null) {
+ final LookupEx lookup = LookupManager.getActiveLookup(editor);
+ if (lookup instanceof LookupImpl) {
+ Runnable command = new Runnable() {
+ @Override
+ public void run() {
+ ((LookupImpl)lookup).finishLookup(Lookup.NORMAL_SELECT_CHAR);
+ }
+ };
+ assert editor != null;
+ Document doc = editor.getDocument();
+ DocCommandGroupId group = DocCommandGroupId.noneGroupId(doc);
+ CommandProcessor.getInstance().executeCommand(editor.getProject(), command, "Completion", group, UndoConfirmationPolicy.DEFAULT, doc);
+ }
}
diff --git a/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java b/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java
index c3f63c93c0bf..17435f45cb9d 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java
@@ -42,6 +42,7 @@ import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.refactoring.RefactoringActionHandler;
import com.intellij.refactoring.rename.inplace.InplaceRefactoring;
import com.intellij.ui.DottedBorder;
import com.intellij.util.ui.PositionTracker;
@@ -560,6 +561,11 @@ public abstract class AbstractInplaceIntroducer
+
diff --git a/platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java b/platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java
index 4235cc071af7..e18eddfbd9f3 100644
--- a/platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java
+++ b/platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java
@@ -47,9 +47,11 @@ import java.util.Map;
* as required by the underlying platform.
*/
public class GeneralCommandLine implements UserDataHolder {
- public static Key DO_NOT_ESCAPE_QUOTES = Key.create("GeneralCommandLine.do.not.escape.quotes");
+ /** @deprecated use {@linkplain #inescapableQuote(String)} (to remove in IDEA 13) */
+ @SuppressWarnings("UnusedDeclaration") public static Key DO_NOT_ESCAPE_QUOTES = Key.create("GeneralCommandLine.do.not.escape.quotes");
private static final Logger LOG = Logger.getInstance("#com.intellij.execution.configurations.GeneralCommandLine");
+ private static final char QUOTE = '\uEFEF';
private String myExePath = null;
private File myWorkDirectory = null;
@@ -236,26 +238,29 @@ public class GeneralCommandLine implements UserDataHolder {
private String[] prepareCommands() {
final List parameters = myProgramParams.getList();
- final boolean doNotEscape = Boolean.TRUE.equals(getUserData(DO_NOT_ESCAPE_QUOTES));
-
final String[] result = new String[parameters.size() + 1];
- result[0] = myExePath != null ? prepareCommand(FileUtil.toSystemDependentName(myExePath), doNotEscape) : null;
+ result[0] = myExePath != null ? prepareCommand(FileUtil.toSystemDependentName(myExePath)) : null;
for (int i = 0; i < parameters.size(); i++) {
- result[i + 1] = prepareCommand(parameters.get(i), doNotEscape);
+ result[i + 1] = prepareCommand(parameters.get(i));
}
return result;
}
- // please keep in sync with com.intellij.rt.execution.junit.ProcessBuilder.prepareCommand() (besides doNotEscape option)
- private static String prepareCommand(String parameter, final boolean doNotEscape) {
+ // please keep in sync with com.intellij.rt.execution.junit.ProcessBuilder.prepareCommand()
+ private static String prepareCommand(String parameter) {
if (SystemInfo.isWindows) {
- if (!doNotEscape && parameter.contains("\"")) {
+ if (parameter.contains("\"")) {
parameter = StringUtil.replace(parameter, "\"", "\\\"");
}
else if (parameter.length() == 0) {
parameter = "\"\"";
}
}
+
+ if (parameter.length() >= 2 && parameter.charAt(0) == QUOTE && parameter.charAt(parameter.length() - 1) == QUOTE) {
+ parameter = '"' + parameter.substring(1, parameter.length() - 1) + '"';
+ }
+
return parameter;
}
@@ -277,6 +282,18 @@ public class GeneralCommandLine implements UserDataHolder {
}
}
+ /**
+ * Normally, double quotes in parameters are escaped so they arrive to a called program as-is.
+ * But some commands (e.g. {@code 'cmd /c start "title" ...'}) should get they quotes non-escaped.
+ * Wrapping a parameter by this method (instead of using quotes) will do exactly this.
+ *
+ * @see com.intellij.execution.util.ExecUtil#getTerminalCommand(String, String)
+ */
+ @NotNull
+ public static String inescapableQuote(@NotNull String parameter) {
+ return QUOTE + parameter + QUOTE;
+ }
+
@Override
public String toString() {
return myExePath + " " + myProgramParams;
diff --git a/platform/platform-api/src/com/intellij/execution/configurations/ParametersList.java b/platform/platform-api/src/com/intellij/execution/configurations/ParametersList.java
index 1c22a7e51613..503d217ba1f7 100644
--- a/platform/platform-api/src/com/intellij/execution/configurations/ParametersList.java
+++ b/platform/platform-api/src/com/intellij/execution/configurations/ParametersList.java
@@ -47,10 +47,7 @@ public class ParametersList implements Cloneable {
}
public boolean hasProperty(@NonNls final String name) {
- for (@NonNls String parameter : myParameters) {
- if (parameter.startsWith("-D" + name + '=')) return true;
- }
- return false;
+ return getPropertyValue(name) != null;
}
@Nullable
diff --git a/platform/platform-api/src/com/intellij/execution/util/ExecUtil.java b/platform/platform-api/src/com/intellij/execution/util/ExecUtil.java
index a8675ab27611..9887b956b1d9 100644
--- a/platform/platform-api/src/com/intellij/execution/util/ExecUtil.java
+++ b/platform/platform-api/src/com/intellij/execution/util/ExecUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -217,9 +217,10 @@ public class ExecUtil {
}
@NotNull
- public static List getTerminalCommand(@Nullable final String title, @NotNull final String command) {
+ public static List getTerminalCommand(@Nullable String title, @NotNull String command) {
if (SystemInfo.isWindows) {
- return Arrays.asList("cmd.exe", "/c", "start", '"' + (title != null ? title : "") + '"', command);
+ title = title != null ? title.replace("\"", "'") : "";
+ return Arrays.asList("cmd.exe", "/c", "start", GeneralCommandLine.inescapableQuote(title), command);
}
else if (SystemInfo.isMac) {
return Arrays.asList(getOpenCommandPath(), "-a", "Terminal", command); // todo: title?
diff --git a/platform/platform-api/src/com/intellij/ide/BrowserUtil.java b/platform/platform-api/src/com/intellij/ide/BrowserUtil.java
index bb751a626711..d1288a82e210 100644
--- a/platform/platform-api/src/com/intellij/ide/BrowserUtil.java
+++ b/platform/platform-api/src/com/intellij/ide/BrowserUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -207,7 +207,7 @@ public class BrowserUtil {
@NonNls
private static List getDefaultBrowserCommand() {
if (SystemInfo.isWindows) {
- return newArrayList(ExecUtil.getWindowsShellName(), "/c", "start", "\"\"");
+ return newArrayList(ExecUtil.getWindowsShellName(), "/c", "start", GeneralCommandLine.inescapableQuote(""));
}
else if (SystemInfo.isMac) {
return newSmartList(ExecUtil.getOpenCommandPath());
@@ -221,11 +221,8 @@ public class BrowserUtil {
private static void launchBrowserByCommand(@NotNull final URI uri, @NotNull final List command) {
try {
- final GeneralCommandLine commandLine = new GeneralCommandLine(command);
- commandLine.addParameter(escapeUrl(uri.toString()));
- if (SystemInfo.isWindows) {
- commandLine.putUserData(GeneralCommandLine.DO_NOT_ESCAPE_QUOTES, true);
- }
+ GeneralCommandLine commandLine = new GeneralCommandLine(command);
+ commandLine.addParameter(uri.toString());
commandLine.createProcess();
if (LOG.isDebugEnabled()) {
@@ -237,6 +234,7 @@ public class BrowserUtil {
}
}
+ /** @deprecated unneeded and misleading (to remove in IDEA 13) */
@NotNull
public static String escapeUrl(@NotNull @NonNls String url) {
return SystemInfo.isWindows ? '"' + url + '"' : url;
@@ -251,7 +249,7 @@ public class BrowserUtil {
return newArrayList(ExecUtil.getOpenCommandPath(), "-a", browserPathOrName);
}
else if (SystemInfo.isWindows) {
- return newArrayList(ExecUtil.getWindowsShellName(), "/c", "start", "\"\"", browserPathOrName);
+ return newArrayList(ExecUtil.getWindowsShellName(), "/c", "start", GeneralCommandLine.inescapableQuote(""), browserPathOrName);
}
else {
return newSmartList(browserPathOrName);
diff --git a/platform/platform-api/src/com/intellij/openapi/application/ApplicationNamesInfo.java b/platform/platform-api/src/com/intellij/openapi/application/ApplicationNamesInfo.java
index 9cd6853425dc..847c6817be31 100644
--- a/platform/platform-api/src/com/intellij/openapi/application/ApplicationNamesInfo.java
+++ b/platform/platform-api/src/com/intellij/openapi/application/ApplicationNamesInfo.java
@@ -17,6 +17,7 @@ package com.intellij.openapi.application;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.PlatformUtils;
import org.jdom.Document;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
@@ -94,7 +95,7 @@ public class ApplicationNamesInfo {
}
public static String getComponentName() {
- final String prefix = System.getProperty("idea.platform.prefix");
+ final String prefix = System.getProperty(PlatformUtils.PLATFORM_PREFIX_KEY);
if (prefix != null) {
return prefix + COMPONENT_NAME;
}
diff --git a/platform/platform-api/src/com/intellij/openapi/editor/colors/EditorColors.java b/platform/platform-api/src/com/intellij/openapi/editor/colors/EditorColors.java
index a68b1ab19b0a..fe3242e47b44 100644
--- a/platform/platform-api/src/com/intellij/openapi/editor/colors/EditorColors.java
+++ b/platform/platform-api/src/com/intellij/openapi/editor/colors/EditorColors.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -38,6 +38,7 @@ public interface EditorColors {
TextAttributesKey REFERENCE_HYPERLINK_COLOR = TextAttributesKey.createTextAttributesKey("CTRL_CLICKABLE", new TextAttributes(JBColor.blue, null, JBColor.blue, EffectType.LINE_UNDERSCORE, 0));
TextAttributesKey SEARCH_RESULT_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("SEARCH_RESULT_ATTRIBUTES");
+ TextAttributesKey LIVE_TEMPLATE_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("LIVE_TEMPLATE_ATTRIBUTES");
TextAttributesKey WRITE_SEARCH_RESULT_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("WRITE_SEARCH_RESULT_ATTRIBUTES");
TextAttributesKey IDENTIFIER_UNDER_CARET_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("IDENTIFIER_UNDER_CARET_ATTRIBUTES");
TextAttributesKey WRITE_IDENTIFIER_UNDER_CARET_ATTRIBUTES =
diff --git a/platform/platform-api/src/com/intellij/ui/ToolbarDecorator.java b/platform/platform-api/src/com/intellij/ui/ToolbarDecorator.java
index 3b6eafa93bf2..607ed126afe6 100644
--- a/platform/platform-api/src/com/intellij/ui/ToolbarDecorator.java
+++ b/platform/platform-api/src/com/intellij/ui/ToolbarDecorator.java
@@ -306,6 +306,9 @@ public abstract class ToolbarDecorator implements DataProvider, CommonActionsPan
return this;
}
+ /**
+ * @return panel that contains wrapped component (with added scrollpane) and toolbar panel.
+ */
public JPanel createPanel() {
final CommonActionsPanel.Buttons[] buttons = getButtons();
final JComponent contextComponent = getComponent();
diff --git a/platform/platform-api/src/com/intellij/ui/components/JBTabbedPane.java b/platform/platform-api/src/com/intellij/ui/components/JBTabbedPane.java
index eed06e68e414..30e3b1fec937 100644
--- a/platform/platform-api/src/com/intellij/ui/components/JBTabbedPane.java
+++ b/platform/platform-api/src/com/intellij/ui/components/JBTabbedPane.java
@@ -1,6 +1,22 @@
+/*
+ * 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.ui.components;
import com.intellij.openapi.util.SystemInfo;
+import com.intellij.ui.JBColor;
import com.intellij.ui.ScreenUtil;
import com.intellij.util.ui.UIUtil;
import org.intellij.lang.annotations.JdkConstants;
@@ -76,7 +92,7 @@ public class JBTabbedPane extends JTabbedPane implements HierarchyListener {
getTabComponentAt(getSelectedIndex()).setForeground(Color.WHITE);
}
if (previousSelectedIndex != -1 && getTabComponentAt(previousSelectedIndex) != null) {
- getTabComponentAt(previousSelectedIndex).setForeground(Color.BLACK);
+ getTabComponentAt(previousSelectedIndex).setForeground(JBColor.foreground);
}
}
}
diff --git a/platform/platform-api/src/com/intellij/ui/components/panels/ValidatingComponent.java b/platform/platform-api/src/com/intellij/ui/components/panels/ValidatingComponent.java
index 33ba62c1dc6f..3b779a15ce5e 100644
--- a/platform/platform-api/src/com/intellij/ui/components/panels/ValidatingComponent.java
+++ b/platform/platform-api/src/com/intellij/ui/components/panels/ValidatingComponent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -15,6 +15,7 @@
*/
package com.intellij.ui.components.panels;
+import com.intellij.ui.JBColor;
import com.intellij.util.ui.UIUtil;
import javax.swing.*;
@@ -74,7 +75,7 @@ public abstract class ValidatingComponent extends NonOpaqu
protected JLabel createErrorLabel() {
final JLabel label = new JLabel(" ");
- label.setForeground(Color.red);
+ label.setForeground(JBColor.red);
label.setFont(ERROR_FONT);
return label;
}
diff --git a/platform/platform-api/src/com/intellij/util/PlatformUtils.java b/platform/platform-api/src/com/intellij/util/PlatformUtils.java
index 79b69414162f..ad6840591f15 100644
--- a/platform/platform-api/src/com/intellij/util/PlatformUtils.java
+++ b/platform/platform-api/src/com/intellij/util/PlatformUtils.java
@@ -23,6 +23,8 @@ import org.jetbrains.annotations.Nullable;
* @author Konstantin Bulenkov
*/
public class PlatformUtils {
+ public static final String PLATFORM_PREFIX_KEY = "idea.platform.prefix";
+
public static final String IDEA_PREFIX = "idea";
public static final String COMMUNITY_PREFIX = "Idea";
public static final String APPCODE_PREFIX = "AppCode";
@@ -40,7 +42,7 @@ public class PlatformUtils {
}
public static String getPlatformPrefix(String defaultPrefix) {
- return System.getProperty("idea.platform.prefix", defaultPrefix);
+ return System.getProperty(PLATFORM_PREFIX_KEY, defaultPrefix);
}
public static boolean isIdea() {
diff --git a/platform/platform-api/src/com/intellij/util/concurrency/QueueProcessor.java b/platform/platform-api/src/com/intellij/util/concurrency/QueueProcessor.java
index 313b83cc28e9..c42ac0dab5f2 100644
--- a/platform/platform-api/src/com/intellij/util/concurrency/QueueProcessor.java
+++ b/platform/platform-api/src/com/intellij/util/concurrency/QueueProcessor.java
@@ -24,8 +24,9 @@ import com.intellij.util.Consumer;
import com.intellij.util.PairConsumer;
import org.jetbrains.annotations.NotNull;
+import java.util.ArrayDeque;
+import java.util.Deque;
import java.util.HashMap;
-import java.util.LinkedList;
import java.util.Map;
/**
@@ -45,7 +46,7 @@ public class QueueProcessor {
}
private final PairConsumer myProcessor;
- private final LinkedList myQueue = new LinkedList();
+ private final Deque myQueue = new ArrayDeque();
private final Runnable myContinuationContext = new Runnable() {
@Override
public void run() {
diff --git a/platform/platform-api/src/com/intellij/util/ui/Animator.java b/platform/platform-api/src/com/intellij/util/ui/Animator.java
index b57ddfc929a6..89611b2e5160 100644
--- a/platform/platform-api/src/com/intellij/util/ui/Animator.java
+++ b/platform/platform-api/src/com/intellij/util/ui/Animator.java
@@ -41,7 +41,7 @@ public abstract class Animator implements Disposable {
private int myCurrentFrame;
private long myStartTime;
private long myStopTime;
- private boolean myDisposed = false;
+ private volatile boolean myDisposed = false;
public Animator(@NonNls final String name,
final int totalFrames,
@@ -138,12 +138,12 @@ public abstract class Animator implements Disposable {
animationDone();
}
else if (myTicker == null) {
- myTicker = scheduler.scheduleAtFixedRate(new Runnable() {
+ myTicker = scheduler.scheduleWithFixedDelay(new Runnable() {
AtomicBoolean scheduled = new AtomicBoolean(false);
@Override
public void run() {
- if (scheduled.compareAndSet(false, true)) {
+ if (scheduled.compareAndSet(false, true) && !isDisposed()) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
diff --git a/platform/platform-impl/src/com/intellij/diagnostic/IdeFatalErrorsIcon.java b/platform/platform-impl/src/com/intellij/diagnostic/IdeFatalErrorsIcon.java
index f19d9126dcb2..124e3211f0cc 100644
--- a/platform/platform-impl/src/com/intellij/diagnostic/IdeFatalErrorsIcon.java
+++ b/platform/platform-impl/src/com/intellij/diagnostic/IdeFatalErrorsIcon.java
@@ -108,7 +108,7 @@ public class IdeFatalErrorsIcon extends JLabel {
return;
}
- myBlinker = JobScheduler.getScheduler().scheduleAtFixedRate(new Runnable() {
+ myBlinker = JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
boolean enabled = false;
@Override
diff --git a/platform/platform-impl/src/com/intellij/diagnostic/MessagePool.java b/platform/platform-impl/src/com/intellij/diagnostic/MessagePool.java
index 574a6d7ba16f..7fe363ebf9cc 100644
--- a/platform/platform-impl/src/com/intellij/diagnostic/MessagePool.java
+++ b/platform/platform-impl/src/com/intellij/diagnostic/MessagePool.java
@@ -41,7 +41,7 @@ public class MessagePool {
MessagePool(int maxGroupSize, int timeout) {
myFatalsGrouper = new MessageGrouper(timeout, maxGroupSize);
- JobScheduler.getScheduler().scheduleAtFixedRate(myFatalsGrouper, (long)300, (long)300, TimeUnit.MILLISECONDS);
+ JobScheduler.getScheduler().scheduleWithFixedDelay(myFatalsGrouper, (long)300, (long)300, TimeUnit.MILLISECONDS);
}
private static class MessagePoolHolder {
diff --git a/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java b/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java
index 31efcfd05613..0a95fcfeb3ff 100644
--- a/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java
+++ b/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -600,7 +600,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
}
public static void setColors(JComponent pane) {
- pane.setForeground(Color.black);
+ pane.setForeground(JBColor.foreground);
pane.setBackground(HintUtil.INFORMATION_COLOR);
pane.setOpaque(true);
}
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ImportSettingsAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ImportSettingsAction.java
index d68996eb630b..4d2c6b56cf9e 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/ImportSettingsAction.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/ImportSettingsAction.java
@@ -111,12 +111,7 @@ public class ImportSettingsAction extends AnAction implements DumbAware {
ApplicationNamesInfo.getInstance().getFullProductName()),
IdeBundle.message("title.restart.needed"), Messages.getQuestionIcon());
if (ret == 0) {
- if (ApplicationManager.getApplication().isRestartCapable()) {
- ApplicationManager.getApplication().restart();
- }
- else {
- ApplicationManager.getApplication().exit();
- }
+ ApplicationManager.getApplication().restart();
}
}
catch (ZipException e1) {
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/NewDummyProjectAction.java b/platform/platform-impl/src/com/intellij/ide/actions/NewDummyProjectAction.java
index 65f7862db9a3..e7c65bbaf640 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/NewDummyProjectAction.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/NewDummyProjectAction.java
@@ -21,6 +21,7 @@ import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.ex.ProjectManagerEx;
+import com.intellij.util.PlatformUtils;
/**
* @author yole
@@ -35,6 +36,6 @@ public class NewDummyProjectAction extends AnAction implements DumbAware {
@Override
public void update(final AnActionEvent e) {
- e.getPresentation().setVisible("Platform".equals(System.getProperty("idea.platform.prefix")));
+ e.getPresentation().setVisible("Platform".equals(System.getProperty(PlatformUtils.PLATFORM_PREFIX_KEY)));
}
}
\ No newline at end of file
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/SaveAsDirectoryBasedFormatAction.java b/platform/platform-impl/src/com/intellij/ide/actions/SaveAsDirectoryBasedFormatAction.java
index 83f3ba480791..c1fa55bbe05b 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/SaveAsDirectoryBasedFormatAction.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/SaveAsDirectoryBasedFormatAction.java
@@ -33,6 +33,8 @@ import com.intellij.openapi.vfs.VirtualFile;
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
/**
* @author spleaner
@@ -58,7 +60,8 @@ public class SaveAsDirectoryBasedFormatAction extends AnAction implements DumbAw
final StateStorageManager storageManager = projectStore.getStateStorageManager();
- for (String file : storageManager.getStorageFileNames()) {
+ final Collection storageFileNames = new ArrayList(storageManager.getStorageFileNames());
+ for (String file : storageFileNames) {
storageManager.clearStateStorage(file);
}
diff --git a/platform/platform-impl/src/com/intellij/ide/errorTreeView/ErrorViewStructure.java b/platform/platform-impl/src/com/intellij/ide/errorTreeView/ErrorViewStructure.java
index d23f1dd41835..4d199bb17b6b 100644
--- a/platform/platform-impl/src/com/intellij/ide/errorTreeView/ErrorViewStructure.java
+++ b/platform/platform-impl/src/com/intellij/ide/errorTreeView/ErrorViewStructure.java
@@ -385,7 +385,7 @@ public class ErrorViewStructure extends AbstractTreeStructure {
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
- PsiFile psiFile = PsiManager.getInstance(myProject).findFile(virtualFile);
+ final PsiFile psiFile = virtualFile.isValid()? PsiManager.getInstance(myProject).findFile(virtualFile) : null;
if (psiFile != null) {
DaemonCodeAnalyzer.getInstance(myProject).restart(psiFile); // urge the daemon to re-highlight the file despite no modification has been made
}
diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManager.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManager.java
index 739224d9a157..4d156792a1ec 100644
--- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManager.java
+++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManager.java
@@ -45,6 +45,7 @@ import com.intellij.openapi.wm.IdeFrame;
import com.intellij.openapi.wm.ex.WindowManagerEx;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
+import com.intellij.util.PlatformUtils;
import com.intellij.util.graph.CachingSemiGraph;
import com.intellij.util.graph.DFSTBuilder;
import com.intellij.util.graph.Graph;
@@ -231,7 +232,7 @@ public class PluginManager {
}
final IdeaPluginDescriptor corePluginDescriptor = idToDescriptorMap.get(PluginId.getId(CORE_PLUGIN_ID));
- assert corePluginDescriptor != null : CORE_PLUGIN_ID + " not found; platform prefix is " + System.getProperty("idea.platform.prefix");
+ assert corePluginDescriptor != null : CORE_PLUGIN_ID + " not found; platform prefix is " + System.getProperty(PlatformUtils.PLATFORM_PREFIX_KEY);
for (IdeaPluginDescriptorImpl descriptor : result) {
if (descriptor != corePluginDescriptor) {
descriptor.insertDependency(corePluginDescriptor);
@@ -631,7 +632,7 @@ public class PluginManager {
private static void loadDescriptorsFromClassPath(final List result, @Nullable StartupProgress progress) {
try {
final Collection urls = getClassLoaderUrls();
- final String platformPrefix = System.getProperty("idea.platform.prefix");
+ final String platformPrefix = System.getProperty(PlatformUtils.PLATFORM_PREFIX_KEY);
int i = 0;
for (URL url : urls) {
i++;
diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurable.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurable.java
index e1b7b272dd7a..712e15e5a3cf 100644
--- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurable.java
+++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurable.java
@@ -135,21 +135,13 @@ public class PluginManagerConfigurable extends BaseConfigurable implements Searc
if (myPluginManagerMain.isRequireShutdown()) {
final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
- if (app.isRestartCapable()) {
- if (showRestartIDEADialog() == 0) {
- app.restart();
- }
- else {
- myPluginManagerMain.ignoreChanges();
- }
+
+ int response = app.isRestartCapable() ? showRestartIDEADialog() : showShutDownIDEADialog();
+ if (response == 0) {
+ app.restart(true);
}
else {
- if (showShutDownIDEADialog() == 0) {
- app.exit(true);
- }
- else {
- myPluginManagerMain.ignoreChanges();
- }
+ myPluginManagerMain.ignoreChanges();
}
}
}
@@ -181,16 +173,8 @@ public class PluginManagerConfigurable extends BaseConfigurable implements Searc
public static void shutdownOrRestartApp(String title) {
final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
- if (app.isRestartCapable()) {
- if (showRestartIDEADialog(title) == 0) {
- app.restart();
- }
- }
- else {
- if (showShutDownIDEADialog(title) == 0) {
- app.exit(true);
- }
- }
+ int response = app.isRestartCapable() ? showRestartIDEADialog(title) : showShutDownIDEADialog(title);
+ if (response == 0) app.restart(true);
}
public boolean isModified() {
diff --git a/platform/platform-impl/src/com/intellij/openapi/application/ex/ApplicationEx.java b/platform/platform-impl/src/com/intellij/openapi/application/ex/ApplicationEx.java
index 40184ad941f7..927239124418 100644
--- a/platform/platform-impl/src/com/intellij/openapi/application/ex/ApplicationEx.java
+++ b/platform/platform-impl/src/com/intellij/openapi/application/ex/ApplicationEx.java
@@ -51,6 +51,8 @@ public interface ApplicationEx extends Application {
//force exit
void exit(boolean force);
+ void restart(boolean force);
+
/**
* Runs modal process. For internal use only, see {@link Task}
*/
diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
index 1c9aadff56b0..3e6dea3b2873 100644
--- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
@@ -116,8 +116,6 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
private boolean myDoNotSave;
private volatile boolean myDisposeInProgress = false;
- private int myRestartCode = 0;
- private volatile int myExitCode = 0;
private final Disposable myLastDisposable = Disposer.newDisposable(); // will be disposed last
private boolean myHandlingInitComponentError;
@@ -268,8 +266,6 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
});
}
- myRestartCode = Restarter.getRestartCode();
-
registerFont("/fonts/Inconsolata.ttf");
registerFont("/fonts/SourceCodePro-Regular.ttf");
registerFont("/fonts/SourceCodePro-Bold.ttf");
@@ -807,10 +803,20 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
@Override
public void exit(final boolean force) {
- exit(force, true);
+ exit(force, true, false);
}
- public void exit(final boolean force, final boolean allowListenersToCancel) {
+ @Override
+ public void restart() {
+ restart(false);
+ }
+
+ @Override
+ public void restart(boolean force) {
+ exit(force, true, true);
+ }
+
+ public void exit(final boolean force, final boolean allowListenersToCancel, final boolean restart) {
if (!force && getDefaultModalityState() != ModalityState.NON_MODAL) {
return;
}
@@ -820,15 +826,13 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
public void run() {
if (!force && !showConfirmation()) {
saveAll();
- myExitCode = 0;
return;
}
getMessageBus().syncPublisher(AppLifecycleListener.TOPIC).appClosing();
myDisposeInProgress = true;
- if (!doExit(allowListenersToCancel)) {
+ if (!doExit(allowListenersToCancel, restart)) {
myDisposeInProgress = false;
- myExitCode = 0;
}
}
};
@@ -841,7 +845,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
}
}
- private boolean doExit(boolean allowListenersToCancel) {
+ private boolean doExit(boolean allowListenersToCancel, boolean restart) {
saveSettings();
if (allowListenersToCancel && !canExit()) {
@@ -853,7 +857,16 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
return false;
}
- System.exit(myExitCode);
+ int exitCode = 0;
+ if (restart) {
+ try {
+ exitCode = Restarter.scheduleRestart();
+ }
+ catch (IOException e) {
+ LOG.warn("Cannot restart", e);
+ }
+ }
+ System.exit(exitCode);
return true;
}
@@ -1468,24 +1481,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
@Override
public boolean isRestartCapable() {
- return Restarter.isSupported() || myRestartCode > 0;
- }
-
- @Override
- public void restart() {
- boolean restarted = false;
- try {
- restarted = Restarter.restart();
- }
- catch (Restarter.CannotRestartException e) {
- LOG.warn(e);
- }
-
- if (!restarted) {
- myExitCode = myRestartCode;
- }
-
- exit(true);
+ return Restarter.isSupported();
}
public boolean isSaving() {
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java
index 75c70d08bc16..cc864c55ff2d 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -45,11 +45,13 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.ConnectException;
import java.util.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public abstract class StateStorageManagerImpl implements StateStorageManager, Disposable, StreamProvider, ComponentVersionProvider {
- private static final Logger LOG = Logger.getInstance("#" + StateStorageManagerImpl.class.getName());
+ private static final Logger LOG = Logger.getInstance(StateStorageManagerImpl.class);
private static final boolean ourHeadlessEnvironment;
static {
@@ -58,6 +60,7 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
}
private final Map myMacros = new HashMap();
+ private final Lock myStorageLock = new ReentrantLock();
private final Map myStorages = new THashMap();
private final Map myPathToStorage = new THashMap();
private final TrackingPathMacroSubstitutor myPathMacroSubstitutor;
@@ -73,8 +76,8 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
private final MultiMap myStreamProviders = new MultiMap();
private boolean isDirty;
- public StateStorageManagerImpl(@Nullable final TrackingPathMacroSubstitutor pathMacroSubstitutor,
- final String rootTagName,
+ public StateStorageManagerImpl(@Nullable TrackingPathMacroSubstitutor pathMacroSubstitutor,
+ String rootTagName,
@Nullable Disposable parentDisposable,
PicoContainer picoContainer) {
myPicoContainer = picoContainer;
@@ -96,32 +99,46 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
@Nullable
public StateStorage getStateStorage(@NotNull final Storage storageSpec) throws StateStorageException {
- final String key = getStorageSpecId(storageSpec);
- return getStateStorage(storageSpec, key);
- }
+ String key = getStorageSpecId(storageSpec);
- @Nullable
- private StateStorage getStateStorage(final Storage storageSpec, final String key) throws StateStorageException {
- if (myStorages.get(key) == null) {
- final StateStorage stateStorage = createStateStorage(storageSpec);
- putStorageToMap(key, stateStorage);
+ myStorageLock.lock();
+ try {
+ StateStorage stateStorage = myStorages.get(key);
+ if (stateStorage == null) {
+ stateStorage = createStateStorage(storageSpec);
+ putStorageToMap(key, stateStorage);
+ }
+ return stateStorage;
+ }
+ finally {
+ myStorageLock.unlock();
}
-
- return myStorages.get(key);
}
@Nullable
public StateStorage getFileStateStorage(final String fileName) {
- if (myStorages.get(fileName) == null) {
- final StateStorage stateStorage = createFileStateStorage(fileName);
- putStorageToMap(fileName, stateStorage);
+ myStorageLock.lock();
+ try {
+ StateStorage stateStorage = myStorages.get(fileName);
+ if (stateStorage == null) {
+ stateStorage = createFileStateStorage(fileName);
+ putStorageToMap(fileName, stateStorage);
+ }
+ return stateStorage;
+ }
+ finally {
+ myStorageLock.unlock();
}
-
- return myStorages.get(fileName);
}
public Collection getStorageFileNames() {
- return Collections.unmodifiableCollection(new HashSet(myStorages.keySet()));
+ myStorageLock.lock();
+ try {
+ return Collections.unmodifiableCollection(myStorages.keySet());
+ }
+ finally {
+ myStorageLock.unlock();
+ }
}
private void putStorageToMap(final String key, final StateStorage stateStorage) {
@@ -144,6 +161,84 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
}
}
+ @Nullable
+ private StateStorage createStateStorage(Storage storageSpec) throws StateStorageException {
+ if (!storageSpec.storageClass().equals(StorageAnnotationsDefaultValues.NullStateStorage.class)) {
+ String key = UUID.randomUUID().toString();
+ ((MutablePicoContainer)myPicoContainer).registerComponentImplementation(key, storageSpec.storageClass());
+ return (StateStorage)myPicoContainer.getComponentInstance(key);
+ }
+ else if (!storageSpec.stateSplitter().equals(StorageAnnotationsDefaultValues.NullStateSplitter.class)) {
+ return createDirectoryStateStorage(storageSpec.file(), storageSpec.stateSplitter());
+ }
+ else {
+ return createFileStateStorage(storageSpec.file());
+ }
+ }
+
+ private static String getStorageSpecId(Storage storageSpec) {
+ if (!storageSpec.storageClass().equals(StorageAnnotationsDefaultValues.NullStateStorage.class)) {
+ return storageSpec.storageClass().getName();
+ }
+ else {
+ return storageSpec.file();
+ }
+ }
+
+ public void clearStateStorage(@NotNull String file) {
+ myStorageLock.lock();
+ try {
+ myStorages.remove(file);
+ }
+ finally {
+ myStorageLock.unlock();
+ }
+ }
+
+ @Nullable
+ private StateStorage createDirectoryStateStorage(String file, Class extends StateSplitter> splitterClass) throws StateStorageException {
+ String expandedFile = expandMacros(file);
+ if (expandedFile == null) {
+ myStorages.put(file, null);
+ return null;
+ }
+
+ final StateSplitter splitter;
+ try {
+ splitter = splitterClass.newInstance();
+ }
+ catch (InstantiationException e) {
+ throw new StateStorageException(e);
+ }
+ catch (IllegalAccessException e) {
+ throw new StateStorageException(e);
+ }
+
+ return new DirectoryBasedStorage(myPathMacroSubstitutor, expandedFile, splitter, this, myPicoContainer);
+ }
+
+ @Nullable
+ private StateStorage createFileStateStorage(@NotNull final String fileSpec) {
+ String expandedFile = expandMacros(fileSpec);
+ if (expandedFile == null) {
+ myStorages.put(fileSpec, null);
+ return null;
+ }
+
+ String extension = FileUtil.getExtension(new File(expandedFile).getName());
+ if (!ourHeadlessEnvironment && extension.length() == 0) {
+ throw new IllegalArgumentException("Extension is missing for storage file: " + expandedFile);
+ }
+
+ return new FileBasedStorage(getMacroSubstitutor(fileSpec), this, expandedFile, fileSpec, myRootTagName, this,
+ myPicoContainer, ComponentRoamingManager.getInstance(), this) {
+ @NotNull
+ protected StorageData createStorageData() {
+ return StateStorageManagerImpl.this.createStorageData(fileSpec);
+ }
+ };
+ }
+
public long getVersion(String name) {
Map versions = getComponentVersions();
return versions.containsKey(name) ? versions.get(name).longValue() : 0;
@@ -155,7 +250,7 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
synchronized (myComponentVersionsLock) {
myComponentVersions = null;
}
- isDirty=false;
+ isDirty = false;
}
private Map loadVersions() {
@@ -211,86 +306,6 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
isDirty = true;
}
- @Nullable
- private StateStorage createStateStorage(final Storage storageSpec) throws StateStorageException {
- if (!storageSpec.storageClass().equals(StorageAnnotationsDefaultValues.NullStateStorage.class)) {
- final String key = UUID.randomUUID().toString();
- ((MutablePicoContainer)myPicoContainer).registerComponentImplementation(key, storageSpec.storageClass());
-
- return (StateStorage)myPicoContainer.getComponentInstance(key);
- }
- else if (!storageSpec.stateSplitter().equals(StorageAnnotationsDefaultValues.NullStateSplitter.class)) {
- return createDirectoryStateStorage(storageSpec.file(), storageSpec.stateSplitter());
- }
- else {
- return createFileStateStorage(storageSpec.file());
- }
- }
-
- private static String getStorageSpecId(final Storage storageSpec) {
- if (!storageSpec.storageClass().equals(StorageAnnotationsDefaultValues.NullStateStorage.class)) {
- return storageSpec.storageClass().getName();
- }
- else {
- return storageSpec.file();
- }
- }
-
- public void clearStateStorage(@NotNull final String file) {
- myStorages.remove(file);
- }
-
- @Nullable
- private StateStorage createDirectoryStateStorage(final String file, final Class extends StateSplitter> splitterClass)
- throws StateStorageException {
- final String expandedFile = expandMacros(file);
- if (expandedFile == null) {
- myStorages.put(file, null);
- return null;
- }
-
- final StateSplitter splitter;
-
- try {
- splitter = splitterClass.newInstance();
- }
- catch (InstantiationException e) {
- throw new StateStorageException(e);
- }
- catch (IllegalAccessException e) {
- throw new StateStorageException(e);
- }
-
- return new DirectoryBasedStorage(myPathMacroSubstitutor, expandedFile, splitter, this, myPicoContainer);
- }
-
- @Nullable
- StateStorage createFileStateStorage(@NotNull final String fileSpec) {
- String expandedFile = expandMacros(fileSpec);
- if (expandedFile == null) {
- myStorages.put(fileSpec, null);
- return null;
- }
-
- final String extension = FileUtil.getExtension(new File(expandedFile).getName());
- if (!ourHeadlessEnvironment && extension.length() == 0) {
- throw new IllegalArgumentException("Extension is missing for storage file: " + expandedFile);
- }
-
- return createFileStateStorage(fileSpec, expandedFile, myRootTagName, myPicoContainer);
- }
-
- protected StateStorage createFileStateStorage(final String fileSpec, final String expandedFile, final String rootTagName,
- final PicoContainer picoContainer) {
- return new FileBasedStorage(getMacroSubstitutor(fileSpec), this, expandedFile, fileSpec, rootTagName, this, picoContainer,
- ComponentRoamingManager.getInstance(), this) {
- @NotNull
- protected StorageData createStorageData() {
- return StateStorageManagerImpl.this.createStorageData(fileSpec);
- }
- };
- }
-
public void saveContent(final String fileSpec, final InputStream content, final long size, final RoamingType roamingType, boolean async) {
for (StreamProvider streamProvider : getStreamProviders(roamingType)) {
try {
@@ -403,20 +418,20 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
return session;
}
- public SaveSession startSave(final ExternalizationSession externalizationSession) {
+ public SaveSession startSave(final ExternalizationSession externalizationSession) {
assert mySession == externalizationSession;
SaveSession session = createSaveSession(externalizationSession);
mySession = session;
return session;
}
- protected MySaveSession createSaveSession(final ExternalizationSession externalizationSession) {
+ protected MySaveSession createSaveSession(final ExternalizationSession externalizationSession) {
return new MySaveSession((MyExternalizationSession)externalizationSession);
}
public void finishSave(final SaveSession saveSession) {
try {
- assert mySession == saveSession: "mySession=" + mySession + " saveSession=" + saveSession;
+ assert mySession == saveSession : "mySession=" + mySession + " saveSession=" + saveSession;
((MySaveSession)saveSession).finishSave();
}
finally {
@@ -425,7 +440,7 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
}
}
- public void reset(){
+ public void reset() {
mySession = null;
}
@@ -497,7 +512,8 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
public Set analyzeExternalChanges(final Set> changedFiles) {
Set result = new HashSet();
- nextStorage: for (Pair pair : changedFiles) {
+ nextStorage:
+ for (Pair pair : changedFiles) {
final StateStorage stateStorage = pair.second;
final StateStorage.SaveSession saveSession = myCompoundSaveSession.getSaveSession(stateStorage);
if (saveSession == null) continue nextStorage;
@@ -566,7 +582,6 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
element.setAttribute("name", name);
element.setAttribute("version", String.valueOf(version));
}
-
}
return root;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/MergeList.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/MergeList.java
index 13e244e237fc..b17dc4d33397 100644
--- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/MergeList.java
+++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/MergeList.java
@@ -33,7 +33,7 @@ import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.*;
-import com.intellij.util.containers.SequenceIterator;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.diff.FilesTooBigForDiffException;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -187,8 +187,7 @@ public class MergeList implements UserDataHolder {
}
public Iterator getAllChanges() {
- return SequenceIterator.create(myBaseToLeftChangeList.getChanges().iterator(),
- myBaseToRightChangeList.getChanges().iterator());
+ return ContainerUtil.concatIterators(myBaseToLeftChangeList.getChanges().iterator(), myBaseToRightChangeList.getChanges().iterator());
}
public void addListener(ChangeList.Listener listener) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java
index 261f072e13d9..9c60d5a6b7d4 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java
@@ -442,13 +442,10 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme {
}
private boolean haveToWrite(final TextAttributesKey key, final TextAttributes value, final TextAttributes defaultAttribute) {
- if (key.getFallbackAttributeKey() != null && value.isEmpty()) return false;
+ if (key.getFallbackAttributeKey() != null && value.isFallbackEnabled()) return false;
boolean hasDefaultValue = value.equals(defaultAttribute);
if (myParentScheme == null) return !hasDefaultValue;
- if (EditorColorsManager.getInstance().getGlobalScheme() == this
- && myParentScheme instanceof AbstractColorsScheme
- && !((AbstractColorsScheme)myParentScheme).myAttributesMap.containsKey(key)) return !value.isEmpty();
- return !value.equals(myParentScheme.getAttributes(key));
+ return true;
}
private void writeAttributes(Element attrElements) throws WriteExternalException {
@@ -562,7 +559,7 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme {
if (fallbackKey == null) return null;
if (myAttributesMap.containsKey(fallbackKey)) {
TextAttributes fallbackAttributes = myAttributesMap.get(fallbackKey);
- if (fallbackAttributes != null && (!fallbackAttributes.isEmpty() || fallbackKey.getFallbackAttributeKey() == null)) {
+ if (fallbackAttributes != null && (!fallbackAttributes.isFallbackEnabled() || fallbackKey.getFallbackAttributeKey() == null)) {
return fallbackAttributes;
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java
index 7f996360d6eb..004f08c9178b 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java
@@ -43,7 +43,11 @@ public class DefaultColorsScheme extends AbstractColorsScheme implements ReadOnl
if (key == null) return null;
TextAttributes attrs = myAttributesMap.get(key);
if (attrs == null) {
- attrs = key.getDefaultAttributes();
+ if (key.getFallbackAttributeKey() != null) {
+ attrs = getFallbackAttributes(key.getFallbackAttributeKey());
+ if (attrs != null && !attrs.isFallbackEnabled()) return attrs;
+ }
+ attrs = key.getDefaultAttributes();
}
return attrs;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java
index 9d9c86981004..4bc634e9797d 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java
@@ -53,14 +53,14 @@ public class EditorColorsSchemeImpl extends AbstractColorsScheme implements Exte
@Override
public TextAttributes getAttributes(TextAttributesKey key) {
- if (key != null) {
+ if (key != null) {
TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
TextAttributes attributes = myAttributesMap.get(key);
if (fallbackKey == null) {
if (attributes != null) return attributes;
}
else {
- if (attributes != null && !attributes.isEmpty()) return attributes;
+ if (attributes != null && !attributes.isFallbackEnabled()) return attributes;
attributes = getFallbackAttributes(fallbackKey);
if (attributes != null) return attributes;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
index 68e055937440..7890f5dfe602 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
@@ -4117,7 +4117,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
if (mySchedulerHandle != null) {
mySchedulerHandle.cancel(false);
}
- mySchedulerHandle = JobScheduler.getScheduler().scheduleAtFixedRate(this, mySleepTime, mySleepTime, TimeUnit.MILLISECONDS);
+ mySchedulerHandle = JobScheduler.getScheduler().scheduleWithFixedDelay(this, mySleepTime, mySleepTime, TimeUnit.MILLISECONDS);
}
private void setBlinkPeriod(int blinkPeriod) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
index 492dfa503c7d..b68074ed3eb6 100644
--- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
@@ -662,12 +662,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
((XmlElementStorage)stateStorage).disableSaving();
}
}
- if (canRestart) {
- ApplicationManagerEx.getApplicationEx().restart();
- }
- else {
- ApplicationManagerEx.getApplicationEx().exit(true);
- }
+ ApplicationManagerEx.getApplicationEx().restart(true);
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/AbstractUpdateDialog.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/AbstractUpdateDialog.java
index 47c9b548c907..78c280dfaba9 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/AbstractUpdateDialog.java
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/AbstractUpdateDialog.java
@@ -107,12 +107,7 @@ public abstract class AbstractUpdateDialog extends DialogWrapper {
app.invokeLater(new Runnable() {
@Override
public void run() {
- if (app.isRestartCapable()) {
- app.restart();
- }
- else {
- app.exit(true);
- }
+ app.restart(true);
}
});
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java
index 7f050bc1f5dc..8cc7491f6946 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java
@@ -42,7 +42,7 @@ import java.util.*;
public class JarFileSystemImpl extends JarFileSystem implements ApplicationComponent {
private static final class JarFileSystemImplLock { }
- private static final Object LOCK = new JarFileSystemImplLock();
+ private static final JarFileSystemImplLock LOCK = new JarFileSystemImplLock();
private final Set myNoCopyJarPaths =
SystemProperties.getBooleanProperty("idea.jars.nocopy", false) ? null : new ConcurrentHashSet(FileUtil.PATH_HASHING_STRATEGY);
@@ -252,7 +252,7 @@ public class JarFileSystemImpl extends JarFileSystem implements ApplicationCompo
@NotNull
public OutputStream getOutputStream(@NotNull final VirtualFile file, final Object requestor, final long modStamp, final long timeStamp)
throws IOException {
- return getHandler(file).getOutputStream(file, requestor, modStamp, timeStamp);
+ throw new IOException("Read-only: "+file.getPresentableUrl());
}
public boolean isMakeCopyOfJar(File originalJar) {
@@ -284,12 +284,12 @@ public class JarFileSystemImpl extends JarFileSystem implements ApplicationCompo
@Override
public void setTimeStamp(@NotNull final VirtualFile file, final long modStamp) throws IOException {
- getHandler(file).setTimeStamp(file, modStamp);
+ throw new IOException("Read-only: "+file.getPresentableUrl());
}
@Override
public void setWritable(@NotNull final VirtualFile file, final boolean writableFlag) throws IOException {
- getHandler(file).setWritable(file, writableFlag);
+ throw new IOException("Read-only: "+file.getPresentableUrl());
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandler.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandler.java
index d2553126eee1..49a2c03603d3 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandler.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandler.java
@@ -33,17 +33,14 @@ import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsBundle;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.newvfs.FileSystemInterface;
import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.IOException;
-import java.io.OutputStream;
-public class JarHandler extends JarHandlerBase implements FileSystemInterface {
+public class JarHandler extends JarHandlerBase {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vfs.impl.jar.JarHandler");
@NonNls private static final String JARS_FOLDER = "jars";
@@ -135,82 +132,4 @@ public class JarHandler extends JarHandlerBase implements FileSystemInterface {
return mirror;
}
-
- @Override
- public boolean isWritable(@NotNull final VirtualFile file) {
- return false;
- }
-
- private static void throwReadOnly() throws IOException {
- throw new IOException("Jar file system is read-only");
- }
-
- @Override
- @NotNull
- @SuppressWarnings({"ConstantConditions"})
- public OutputStream getOutputStream(@NotNull final VirtualFile file, final Object requestor, final long modStamp, final long timeStamp) throws IOException {
- throwReadOnly();
- return null; // Unreachable
- }
-
- @Override
- @SuppressWarnings({"ConstantConditions"})
- public VirtualFile copyFile(final Object requestor, @NotNull final VirtualFile file, @NotNull final VirtualFile newParent, @NotNull final String copyName) throws IOException {
- throwReadOnly();
- return null;
- }
-
- @Override
- public void moveFile(final Object requestor, @NotNull final VirtualFile file, @NotNull final VirtualFile newParent) throws IOException {
- throwReadOnly();
- }
-
- @Override
- public void renameFile(final Object requestor, @NotNull final VirtualFile file, @NotNull final String newName) throws IOException {
- throwReadOnly();
- }
-
- @Override
- public void setTimeStamp(@NotNull final VirtualFile file, final long timeStamp) throws IOException {
- throwReadOnly();
- }
-
- @Override
- public void setWritable(@NotNull final VirtualFile file, final boolean writableFlag) throws IOException {
- throwReadOnly();
- }
-
- @Override
- public boolean isSymLink(@NotNull VirtualFile file) {
- return false;
- }
-
- @Override
- public String resolveSymLink(@NotNull VirtualFile file) {
- return null;
- }
-
- @Override
- public boolean isSpecialFile(@NotNull VirtualFile file) {
- return false;
- }
-
- @Override
- @SuppressWarnings({"ConstantConditions"})
- public VirtualFile createChildDirectory(final Object requestor, @NotNull final VirtualFile parent, @NotNull final String dir) throws IOException {
- throwReadOnly();
- return null;
- }
-
- @Override
- @SuppressWarnings({"ConstantConditions"})
- public VirtualFile createChildFile(final Object requestor, @NotNull final VirtualFile parent, @NotNull final String file) throws IOException {
- throwReadOnly();
- return null;
- }
-
- @Override
- public void deleteFile(final Object requestor, @NotNull final VirtualFile file) throws IOException {
- throwReadOnly();
- }
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java
index 5e068ae74aa5..d23536467b56 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java
@@ -117,6 +117,9 @@ public class FileWatcher {
}
});
}
+ else if (!isUpToDate(myExecutable)) {
+ notifyOnFailure(ApplicationBundle.message("watcher.exe.outdated"), null);
+ }
else {
try {
startupProcess(false);
@@ -170,6 +173,14 @@ public class FileWatcher {
return null;
}
+ private static boolean isUpToDate(File executable) {
+ long length = SystemInfo.isWindows ? 70216 :
+ SystemInfo.isMac ? 13924 :
+ SystemInfo.isLinux ? SystemInfo.isAMD64 ? 29308 : 22809 :
+ -1;
+ return length < 0 || length == executable.length();
+ }
+
private void notifyOnFailure(final String cause, @Nullable final NotificationListener listener) {
LOG.warn(cause);
@@ -463,7 +474,8 @@ public class FileWatcher {
}
}
else {
- processChange(line, myLastOp);
+ String path = line.replace('\0', '\n'); // unescape
+ processChange(path, myLastOp);
myLastOp = null;
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java
index f4630d5b8481..3a6cd2666993 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java
@@ -520,7 +520,8 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap
boolean update = false;
for (WatchRequest watchRequest : watchRequests) {
- final boolean wasWatched = myRootsToWatch.remove((WatchRequestImpl)watchRequest) && !((WatchRequestImpl)watchRequest).myDominated;
+ WatchRequestImpl impl = (WatchRequestImpl)watchRequest;
+ boolean wasWatched = myRootsToWatch.remove(impl) && !impl.myDominated;
update |= wasWatched;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowWatcher.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowWatcher.java
index 317dd406ba12..d6a3c06fd289 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowWatcher.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowWatcher.java
@@ -24,6 +24,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.FocusWatcher;
import com.intellij.openapi.wm.ex.WindowManagerEx;
import com.intellij.util.containers.HashMap;
+import com.intellij.util.containers.WeakHashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -37,6 +38,7 @@ import java.beans.PropertyChangeListener;
import java.lang.ref.WeakReference;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Map;
/**
* @author Anton Katilin
@@ -44,8 +46,8 @@ import java.util.Iterator;
*/
public final class WindowWatcher implements PropertyChangeListener{
private static final Logger LOG=Logger.getInstance("#com.intellij.openapi.wm.impl.WindowWatcher");
- private final Object myLock;
- private final HashMap myWindow2Info;
+ private final Object myLock = new Object();
+ private final Map myWindow2Info = new WeakHashMap();
/**
* Currenly focused window (window which has focused component). Can be null if there is no focused
* window at all.
@@ -54,14 +56,10 @@ public final class WindowWatcher implements PropertyChangeListener{
/**
* Contains last focused window for each project.
*/
- private final HashSet myFocusedWindows;
+ private final HashSet myFocusedWindows = new HashSet();
@NonNls protected static final String FOCUSED_WINDOW_PROPERTY = "focusedWindow";
- WindowWatcher(){
- myLock=new Object();
- myWindow2Info=new HashMap();
- myFocusedWindows=new HashSet();
- }
+ WindowWatcher() {}
/**
* This method should get notifications abount changes of focused window.
@@ -111,7 +109,8 @@ public final class WindowWatcher implements PropertyChangeListener{
final void dispatchComponentEvent(final ComponentEvent e){
final int id=e.getID();
- if(WindowEvent.WINDOW_CLOSED==id||(ComponentEvent.COMPONENT_HIDDEN==id&&e.getSource() instanceof Window)){
+ if(WindowEvent.WINDOW_CLOSED == id ||
+ (ComponentEvent.COMPONENT_HIDDEN == id && e.getSource() instanceof Window)){
dispatchHiddenOrClosed((Window)e.getSource());
}
// Clear obsolete reference on root frame
@@ -268,7 +267,7 @@ public final class WindowWatcher implements PropertyChangeListener{
}
}
- public final void doNotSuggestAsParent(final Window window){
+ public final void doNotSuggestAsParent(final Window window) {
if(LOG.isDebugEnabled()){
LOG.debug("enter: doNotSuggestAsParent("+window+")");
}
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 edce131fabe8..be4d32c81ced 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
@@ -222,7 +222,7 @@ public class MemoryUsagePanel extends JButton implements CustomStatusBarWidget {
*/
@Override
public void addNotify() {
- myFuture = JobScheduler.getScheduler().scheduleAtFixedRate(new Runnable() {
+ myFuture = JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
public void run() {
if (isDisplayable()) {
updateState();
diff --git a/platform/platform-impl/src/com/intellij/platform/WebProjectGenerator.java b/platform/platform-impl/src/com/intellij/platform/WebProjectGenerator.java
index 712fbc2700c8..a0a65f4c2e3f 100644
--- a/platform/platform-impl/src/com/intellij/platform/WebProjectGenerator.java
+++ b/platform/platform-impl/src/com/intellij/platform/WebProjectGenerator.java
@@ -118,7 +118,6 @@ public abstract class WebProjectGenerator implements DirectoryProjectGenerato
@Override
public void stateChanged(boolean validSettings) {
getOKAction().setEnabled(validSettings);
- initValidation();
}
});
setTitle(WebProjectGenerator.this.getName());
diff --git a/platform/platform-impl/src/com/intellij/ui/docking/impl/DockManagerImpl.java b/platform/platform-impl/src/com/intellij/ui/docking/impl/DockManagerImpl.java
index 7c80b324fe4e..76e906610ed6 100644
--- a/platform/platform-impl/src/com/intellij/ui/docking/impl/DockManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/ui/docking/impl/DockManagerImpl.java
@@ -473,19 +473,6 @@ public class DockManagerImpl extends DockManager implements PersistentStateCompo
}
}, this);
- Extensions.getArea(myProject).getExtensionPoint(IdeRootPaneNorthExtension.EP_NAME).addExtensionPointListener(
- new ExtensionPointListener() {
- @Override
- public void extensionAdded(@NotNull IdeRootPaneNorthExtension extension, @Nullable PluginDescriptor pluginDescriptor) {
- updateNorthPanel();
- }
-
- @Override
- public void extensionRemoved(@NotNull IdeRootPaneNorthExtension extension, @Nullable PluginDescriptor pluginDescriptor) {
- updateNorthPanel();
- }
- });
-
UISettings.getInstance().addUISettingsListener(new UISettingsListener() {
@Override
public void uiSettingsChanged(UISettings source) {
diff --git a/platform/platform-impl/src/com/intellij/util/BufferedListConsumer.java b/platform/platform-impl/src/com/intellij/util/BufferedListConsumer.java
new file mode 100644
index 000000000000..857c300281cd
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/util/BufferedListConsumer.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2000-2010 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.util;
+
+import com.intellij.openapi.application.ApplicationManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BufferedListConsumer implements Consumer> {
+ private final int myInterval;
+ private long myTs;
+ private final int mySize;
+ private List myBuffer;
+ private final Object myFlushLock;
+ private final Consumer> myConsumer;
+ private int myCnt;
+ private Runnable myFlushListener;
+ private volatile boolean myPendingFlush;
+
+ public BufferedListConsumer(int size, Consumer> consumer, int interval) {
+ mySize = size;
+ myFlushLock = new Object();
+ myBuffer = new ArrayList(size);
+ myConsumer = consumer;
+ myInterval = interval;
+ myTs = System.currentTimeMillis();
+ myCnt = 0;
+ myPendingFlush = false;
+ }
+
+ public void consumeOne(final T t) {
+ synchronized (myFlushLock) {
+ ++ myCnt;
+ myBuffer.add(t);
+ flushCheck();
+ }
+ }
+
+ public void consume(List list) {
+ synchronized (myFlushLock) {
+ myCnt += list.size();
+ myBuffer.addAll(list);
+ flushCheck();
+ }
+ }
+
+ private void flushCheck() {
+ final long ts = System.currentTimeMillis();
+ if ((myBuffer.size() >= mySize) || (myInterval > 0) && ((ts - myInterval) > myTs)) {
+ flushImpl(ts);
+ }
+ }
+
+ // we need to 1) pass information to consumer in another thread since consumer potentially has heavy consume() - with info linking (git log)
+ // 2) requests passed to background thread can come in wrong order -> solution: initiate pooled thread requests which would take what we have currently
+ // 3) time is updated at the moment of flush -> buffer is empty at that moment
+ private void flushImpl(final long ts) {
+ synchronized (myFlushLock) {
+ if (myPendingFlush || myBuffer.isEmpty()) return;
+ myPendingFlush = true;
+ ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
+ @Override
+ public void run() {
+ myTs = ts;
+ final List list;
+ synchronized (myFlushLock) {
+ myPendingFlush = false;
+ if (myBuffer.isEmpty()) return;
+ list = myBuffer;
+ myBuffer = new ArrayList(mySize);
+ }
+ myConsumer.consume(list);
+ }
+ });
+ }
+ }
+
+ public void flush() {
+ flushImpl(System.currentTimeMillis());
+ if (myFlushListener != null) {
+ myFlushListener.run();
+ }
+ }
+
+ public int getCnt() {
+ synchronized (myFlushLock) {
+ return myCnt;
+ }
+ }
+
+ public Consumer asConsumer() {
+ return new Consumer() {
+ @Override
+ public void consume(T t) {
+ consumeOne(t);
+ }
+ };
+ }
+}
diff --git a/platform/platform-main/src/com/intellij/idea/MainImpl.java b/platform/platform-main/src/com/intellij/idea/MainImpl.java
index 4e86563d7da5..41760d6b2d0d 100644
--- a/platform/platform-main/src/com/intellij/idea/MainImpl.java
+++ b/platform/platform-main/src/com/intellij/idea/MainImpl.java
@@ -22,6 +22,7 @@ import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.ui.AppUIUtil;
+import com.intellij.util.PlatformUtils;
import com.intellij.util.text.DateFormatUtilRt;
import com.intellij.util.ui.UIUtil;
@@ -37,9 +38,7 @@ public class MainImpl {
* Called from PluginManager via reflection.
*/
protected static void start(final String[] args) {
- if (System.getProperty("idea.platform.prefix") == null) {
- System.setProperty("idea.platform.prefix", "Idea");
- }
+ System.setProperty(PlatformUtils.PLATFORM_PREFIX_KEY, PlatformUtils.getPlatformPrefix(PlatformUtils.COMMUNITY_PREFIX));
StartupUtil.isHeadless = Main.isHeadless(args);
if (!StartupUtil.isHeadless) {
diff --git a/platform/platform-resources-en/src/messages/ApplicationBundle.properties b/platform/platform-resources-en/src/messages/ApplicationBundle.properties
index 3f6d608c3e0e..066dfb5b4814 100644
--- a/platform/platform-resources-en/src/messages/ApplicationBundle.properties
+++ b/platform/platform-resources-en/src/messages/ApplicationBundle.properties
@@ -555,6 +555,7 @@ title.tabs.and.indents=Tabs and Indents
watcher.slow.sync=External file changes sync may be slow
watcher.exe.not.found=Native file watcher executable not found
watcher.exe.not.exe=Native file watcher is not executable: {0}
+watcher.exe.outdated=Native file watcher executable is outdated
watcher.failed.to.start=File watcher failed to start
watcher.non.watchable.project=Project content is under network-mounted directory
diff --git a/platform/platform-resources-en/src/messages/OptionsBundle.properties b/platform/platform-resources-en/src/messages/OptionsBundle.properties
index c3c4cff26eb3..68a92243bd96 100644
--- a/platform/platform-resources-en/src/messages/OptionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/OptionsBundle.properties
@@ -229,4 +229,5 @@ color.settings.console.yellow=ANSI Yellow
color.settings.console.blue=ANSI Blue
color.settings.console.magenta=ANSI Magenta
color.settings.console.cyan=ANSI Cyan
-color.settings.console.gray=ANSI Gray
\ No newline at end of file
+color.settings.console.gray=ANSI Gray
+options.general.attribute.descriptor.live.template=Live Template
\ No newline at end of file
diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties
index ffc7118ecef6..10a97a7c0602 100644
--- a/platform/platform-resources-en/src/misc/registry.properties
+++ b/platform/platform-resources-en/src/misc/registry.properties
@@ -145,6 +145,9 @@ compiler.max.static.constants.searches=3000
compiler.max.static.constants.searches.description=If the number of changed compile time constants exceeds this value,\
make will start full-project rebuild
+compiler.process.jdk=
+compiler.process.jdk.description=Path to a JDK home. Force build process to be run using the JDK specified. It is assumed that the jdk is at least of version 1.6.
+
compiler.process.32bit.vm.on.mac=true
# suppress inspection "UnusedProperty"
compiler.process.32bit.vm.on.mac.description=Force -d32 VM option on Mac (recommended for faster startup and lower memory footprint).
@@ -268,3 +271,5 @@ debugger.enable.breakpoints.during.evaluation=false
new.project.wizard=false
new.ruby.sdk.configurable=false
diagrams.rendering.no.cache=true
+
+wolf.the.problem.solver=true
\ No newline at end of file
diff --git a/platform/platform-resources/src/DefaultColorSchemesManager.xml b/platform/platform-resources/src/DefaultColorSchemesManager.xml
index a40dcc80f0ab..d7819c5511e7 100644
--- a/platform/platform-resources/src/DefaultColorSchemesManager.xml
+++ b/platform/platform-resources/src/DefaultColorSchemesManager.xml
@@ -90,6 +90,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -669,6 +734,14 @@
+
+
+
+
+
+
+
+
diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml
index 481c38ec01a6..48aa64581ca3 100644
--- a/platform/platform-resources/src/META-INF/LangExtensions.xml
+++ b/platform/platform-resources/src/META-INF/LangExtensions.xml
@@ -795,6 +795,9 @@
+
+
diff --git a/community-resources/src/idea/PlatformLangXmlApplicationInfo.xml b/platform/platform-resources/src/idea/PlatformLangXmlApplicationInfo.xml
similarity index 100%
rename from community-resources/src/idea/PlatformLangXmlApplicationInfo.xml
rename to platform/platform-resources/src/idea/PlatformLangXmlApplicationInfo.xml
diff --git a/platform/platform-tests/testSrc/com/intellij/notification/EventLogTest.groovy b/platform/platform-tests/testSrc/com/intellij/notification/EventLogTest.groovy
index ffd1207a39cb..78bc07b2b5d5 100644
--- a/platform/platform-tests/testSrc/com/intellij/notification/EventLogTest.groovy
+++ b/platform/platform-tests/testSrc/com/intellij/notification/EventLogTest.groovy
@@ -30,8 +30,8 @@ class EventLogTest extends LightPlatformTestCase {
}
public void testHtmlEntities() {
- def entry = format("Title", "Hello world«»")
- assert entry.message == 'Title: Hello world<<>>'
+ def entry = format("Title", "Hello world«»<>")
+ assert entry.message == 'Title: Hello world<<>><>'
}
public void testParseMultilineText() {
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/PathMacroManagerTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/PathMacroManagerTest.java
index ee96e0414211..3f7a66f89414 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/PathMacroManagerTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/PathMacroManagerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -18,6 +18,7 @@ package com.intellij.openapi.components.impl;
import com.intellij.application.options.PathMacrosImpl;
import com.intellij.application.options.ReplacePathToMacroMap;
import com.intellij.mock.MockFileSystem;
+import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.application.PathMacros;
import com.intellij.openapi.application.PathManager;
@@ -45,6 +46,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeNotNull;
/**
* @author mike
@@ -65,6 +67,9 @@ public class PathMacroManagerTest {
@Before
public final void setupApplication() throws Exception {
+ // in fact the test accesses extension points so it rather should be converted to a platform one
+ assumeNotNull(ApplicationManager.getApplication());
+
context = new JUnit4Mockery();
context.setImposteriser(ClassImposteriser.INSTANCE);
myApplication = context.mock(ApplicationEx.class, "application");
@@ -74,7 +79,7 @@ public class PathMacroManagerTest {
allowing(myApplication).isUnitTestMode(); will(returnValue(false));
allowing(myApplication).getName(); will(returnValue("IDEA"));
- //some tests leave invokeLaters after them...
+ // some tests leave invokeLater()'s after them
allowing(myApplication).invokeLater(with(any(Runnable.class)), with(any(ModalityState.class)));
allowing(myApplication).runReadAction(with(any(Runnable.class)));
@@ -217,6 +222,7 @@ public class PathMacroManagerTest {
}
}
+ @SuppressWarnings("SpellCheckingInspection")
@Test
public void testProjectUnderUserHome_ReplaceRecursively() {
setUpMocks("/home/user/foo");
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/ProjectStoreBaseTestCase.java b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/ProjectStoreBaseTestCase.java
new file mode 100644
index 000000000000..f3f68cc328d5
--- /dev/null
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/ProjectStoreBaseTestCase.java
@@ -0,0 +1,63 @@
+/*
+ * 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.openapi.components.impl;
+
+import com.intellij.openapi.components.PersistentStateComponent;
+import com.intellij.openapi.components.State;
+import com.intellij.openapi.components.Storage;
+import com.intellij.openapi.util.JDOMBuilder;
+import com.intellij.openapi.util.JDOMUtil;
+import com.intellij.testFramework.PlatformLangTestCase;
+import com.intellij.util.text.CharsetUtil;
+
+import java.io.UnsupportedEncodingException;
+
+public abstract class ProjectStoreBaseTestCase extends PlatformLangTestCase {
+ protected byte[] getIprFileContent() throws UnsupportedEncodingException {
+ final String iprContent = JDOMUtil.writeDocument(
+ JDOMBuilder.document(JDOMBuilder.tag("project",
+ JDOMBuilder.attr("version", "4"),
+ JDOMBuilder.tag("component", JDOMBuilder.attr("name", "TestIprComponent"),
+ JDOMBuilder.tag("option", JDOMBuilder.attr("name", "VALUE"), JDOMBuilder.attr("value", "true")))
+ )),
+ "\n");
+ return iprContent.getBytes(CharsetUtil.UTF8);
+ }
+
+ @State(
+ name = "TestIprComponent",
+ storages = {
+ @Storage(file = "$PROJECT_FILE$")
+ }
+ )
+ public static class TestIprComponent implements PersistentStateComponent {
+ ProjectStoreBaseTestCase.DataBean myState;
+
+ @Override
+ public ProjectStoreBaseTestCase.DataBean getState() {
+ throw new UnsupportedOperationException("Method getState not implemented in " + getClass());
+ }
+
+ @Override
+ public void loadState(ProjectStoreBaseTestCase.DataBean object) {
+ myState = object;
+ }
+ }
+
+ public static class DataBean {
+ @SuppressWarnings("UnusedDeclaration") public boolean VALUE = false;
+ }
+}
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/ProjectStoreImplIdeaDirTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/ProjectStoreImplIdeaDirTest.java
new file mode 100644
index 000000000000..afb8323dec97
--- /dev/null
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/ProjectStoreImplIdeaDirTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.openapi.components.impl;
+
+import com.intellij.openapi.components.impl.stores.IProjectStore;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ex.ProjectEx;
+import com.intellij.openapi.util.io.FileUtil;
+
+import java.io.File;
+import java.io.IOException;
+
+public class ProjectStoreImplIdeaDirTest extends ProjectStoreBaseTestCase {
+ @Override
+ protected File getIprFile() throws IOException {
+ final File projectDir = FileUtil.createTempDirectory(getTestName(true), "project");
+ File ideaDir = new File(projectDir, Project.DIRECTORY_STORE_FOLDER);
+ assertTrue(ideaDir.mkdir() || ideaDir.isDirectory());
+ File iprFile = new File(ideaDir, "misc.xml");
+ FileUtil.writeToFile(iprFile, getIprFileContent());
+
+ myFilesToDelete.add(projectDir);
+ return projectDir;
+ }
+
+ public void testLoadFromDirectoryStorage() throws Exception {
+ final IProjectStore projectStore = ((ProjectEx)myProject).getStateStore();
+ ((ProjectEx)myProject).setOptimiseTestLoadSpeed(false);
+
+ final TestIprComponent testIprComponent = new TestIprComponent();
+ projectStore.initComponent(testIprComponent, false);
+ assertNotNull(testIprComponent.myState);
+ }
+}
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/ProjectStoreImplIprFileTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/ProjectStoreImplIprFileTest.java
new file mode 100644
index 000000000000..8452b1f214f2
--- /dev/null
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/ProjectStoreImplIprFileTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.openapi.components.impl;
+
+import com.intellij.openapi.components.impl.stores.IProjectStore;
+import com.intellij.openapi.project.ex.ProjectEx;
+import com.intellij.openapi.util.io.FileUtil;
+
+import java.io.File;
+import java.io.IOException;
+
+public class ProjectStoreImplIprFileTest extends ProjectStoreBaseTestCase {
+ @Override
+ protected File getIprFile() throws IOException {
+ final File iprFile = super.getIprFile();
+ FileUtil.writeToFile(iprFile, getIprFileContent());
+ return iprFile;
+ }
+
+ public void testLoadFromOldStorage() throws Exception {
+ final IProjectStore projectStore = ((ProjectEx)myProject).getStateStore();
+
+ ((ProjectEx)myProject).setOptimiseTestLoadSpeed(false);
+
+ final TestIprComponent testIprComponent = new TestIprComponent();
+ projectStore.initComponent(testIprComponent, false);
+ assertNotNull(testIprComponent.myState);
+ }
+}
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/StateStorageManagerImplTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/StateStorageManagerImplTest.java
new file mode 100644
index 000000000000..a4e3024a60d0
--- /dev/null
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/StateStorageManagerImplTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.openapi.components.impl;
+
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.components.StateStorage;
+import com.intellij.openapi.components.StateStorageException;
+import com.intellij.openapi.components.StateStorageOperation;
+import com.intellij.openapi.components.impl.stores.StateStorageManagerImpl;
+import com.intellij.openapi.components.impl.stores.StorageData;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.testFramework.LightPlatformLangTestCase;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+
+/**
+ * @author mike
+ */
+public class StateStorageManagerImplTest extends LightPlatformLangTestCase {
+ private StateStorageManagerImpl myStateStorageManager;
+
+ @Override
+ public final void setUp() throws Exception {
+ super.setUp();
+ myStateStorageManager = new StateStorageManagerImpl(null, "foo", null, ApplicationManager.getApplication().getPicoContainer()) {
+ @Override
+ protected StorageData createStorageData(String storageSpec) {
+ throw new UnsupportedOperationException("Method createStorageData not implemented in " + getClass());
+ }
+
+ @Override
+ protected String getOldStorageSpec(Object component, String componentName, StateStorageOperation operation) throws StateStorageException {
+ throw new UnsupportedOperationException("Method getOldStorageSpec not implemented in " + getClass());
+ }
+
+ @Override
+ protected String getVersionsFilePath() {
+ return null;
+ }
+ };
+ myStateStorageManager.addMacro("MACRO1", "/temp/m1");
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ Disposer.dispose(myStateStorageManager);
+ super.tearDown();
+ }
+
+ public void testCreateFileStateStorageMacroSubstituted() {
+ StateStorage data = myStateStorageManager.getFileStateStorage("$MACRO1$/test.xml");
+ assertThat(data, is(notNullValue()));
+ }
+
+ public void testCreateStateStorageAssertionThrownWhenUnknownMacro() {
+ try {
+ myStateStorageManager.getFileStateStorage("$UNKNOWN_MACRO$/test.xml");
+ fail("Exception expected");
+ }
+ catch (IllegalArgumentException e) {
+ assertEquals("Unknown macro: $UNKNOWN_MACRO$ in storage spec: $UNKNOWN_MACRO$/test.xml", e.getMessage());
+ }
+ }
+
+ public void testCreateFileStateStorageMacroSubstitutedWhenExpansionHas$() {
+ myStateStorageManager.addMacro("DOLLAR_MACRO", "/temp/d$");
+ StateStorage data = myStateStorageManager.getFileStateStorage("$DOLLAR_MACRO$/test.xml");
+ assertThat(data, is(notNullValue()));
+ }
+}
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/XmlElementStorageTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/XmlElementStorageTest.java
new file mode 100644
index 000000000000..a85ba0808ceb
--- /dev/null
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/XmlElementStorageTest.java
@@ -0,0 +1,160 @@
+/*
+ * 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.openapi.components.impl;
+
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.components.StateStorage;
+import com.intellij.openapi.components.StateStorageException;
+import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
+import com.intellij.openapi.components.impl.stores.ComponentRoamingManager;
+import com.intellij.openapi.components.impl.stores.ComponentVersionProvider;
+import com.intellij.openapi.components.impl.stores.XmlElementStorage;
+import com.intellij.openapi.options.StreamProvider;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.testFramework.LightPlatformLangTestCase;
+import com.intellij.util.io.fs.IFile;
+import org.jdom.Document;
+import org.jdom.Element;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import static com.intellij.openapi.util.JDOMBuilder.*;
+
+/**
+ * @author mike
+ */
+public class XmlElementStorageTest extends LightPlatformLangTestCase {
+ private Disposable myParentDisposable;
+
+ public void setUp() throws Exception {
+ super.setUp();
+ myParentDisposable = Disposer.newDisposable();
+ }
+
+ public void tearDown() throws Exception {
+ Disposer.dispose(myParentDisposable);
+ super.tearDown();
+ }
+
+ public void testGetStateSucceeded() throws Exception {
+ MyXmlElementStorage storage =
+ new MyXmlElementStorage(document(tag("root", tag("component", attr("name", "test"), tag("foo")))), myParentDisposable);
+ Element state = storage.getState(this, "test", Element.class, null);
+ assertNotNull(state);
+ assertEquals("component", state.getName());
+ assertNotNull(state.getChild("foo"));
+ }
+
+ public void testGetStateNotSucceeded() throws Exception {
+ MyXmlElementStorage storage = new MyXmlElementStorage(document(tag("root")), myParentDisposable);
+ Element state = storage.getState(this, "test", Element.class, null);
+ assertNull(state);
+ }
+
+ public void testSetStateOverridesOldState() throws Exception {
+ MyXmlElementStorage storage =
+ new MyXmlElementStorage(document(tag("root", tag("component", attr("name", "test"), tag("foo")))), myParentDisposable);
+ Element newState = tag("component", attr("name", "test"), tag("bar"));
+ StateStorage.ExternalizationSession externalizationSession = storage.startExternalization();
+ externalizationSession.setState(this, "test", newState, null);
+ storage.startSave(externalizationSession).save();
+ assertNotNull(storage.mySavedDocument);
+ assertNotNull(storage.mySavedDocument.getRootElement().getChild("component").getChild("bar"));
+ assertNull(storage.mySavedDocument.getRootElement().getChild("component").getChild("foo"));
+ }
+
+
+ private class MyXmlElementStorage extends XmlElementStorage {
+ private final Document myDocument;
+ private Document mySavedDocument;
+
+ public MyXmlElementStorage(final Document document, final Disposable parentDisposable) throws StateStorageException {
+ super(new MyPathMacroManager(), parentDisposable, "root", StreamProvider.DEFAULT, "", ComponentRoamingManager.getInstance(), ComponentVersionProvider.EMPTY);
+ myDocument = document;
+ }
+
+ @Override
+ protected Document loadDocument() throws StateStorageException {
+ return myDocument;
+ }
+
+ @Override
+ protected MySaveSession createSaveSession(final MyExternalizationSession externalizationSession) {
+ return new MySaveSession(externalizationSession) {
+ @Override
+ protected void doSave() throws StateStorageException {
+ mySavedDocument = (Document)getDocumentToSave().clone();
+ }
+
+ @Override
+ public Collection getStorageFilesToSave() throws StateStorageException {
+ return needsSave() ? getAllStorageFiles() : Collections.emptyList();
+ }
+
+ @Override
+ public List getAllStorageFiles() {
+ throw new UnsupportedOperationException("Method getAllStorageFiles not implemented in " + getClass());
+ }
+
+ };
+ }
+ }
+
+ private static class MyPathMacroManager implements TrackingPathMacroSubstitutor {
+ @Override
+ public void expandPaths(final Element element) {
+ }
+
+ @Override
+ public void reset() {
+ }
+
+ @Override
+ public Collection getComponents(Collection macros) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public void collapsePaths(final Element element) {
+ }
+
+ @Override
+ public String expandPath(final String path) {
+ throw new UnsupportedOperationException("Method expandPath not implemented in " + getClass());
+ }
+
+ @Override
+ public String collapsePath(final String path) {
+ throw new UnsupportedOperationException("Method collapsePath not implemented in " + getClass());
+ }
+
+ @Override
+ public Collection getUnknownMacros(final String componentName) {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public void invalidateUnknownMacros(Set macros) {
+ }
+
+ @Override
+ public void addUnknownMacros(String componentName, Collection unknownMacros) {
+ }
+ }
+}
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/FileWatcherTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/FileWatcherTest.java
index ee03f738bdee..3acbbc27160d 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/FileWatcherTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/FileWatcherTest.java
@@ -76,7 +76,7 @@ public class FileWatcherTest extends PlatformLangTestCase {
};
private final Object myWaiter = new Object();
private int myTimeout = NATIVE_PROCESS_DELAY;
- private final List myEvents = new ArrayList();
+ private final List myEvents = ContainerUtil.createLockFreeCopyOnWriteList();
@Override
protected void setUp() throws Exception {
@@ -288,11 +288,11 @@ public class FileWatcherTest extends PlatformLangTestCase {
public void testDirectoryOverlapping() throws Exception {
final File topDir = FileUtil.createTempDirectory("top.", null);
- final File fileInTopDir = FileUtil.createTempFile(topDir, "file1.", ".txt");
- final File subDir = FileUtil.createTempDirectory(topDir, "sub.", null);
- final File fileInSubDir = FileUtil.createTempFile(subDir, "file2.", ".txt");
+ final File fileInTopDir = new File(topDir, "file1.txt"); FileUtil.createIfNotExists(fileInTopDir);
+ final File subDir = new File(topDir, "sub"); FileUtil.createDirectory(subDir);
+ final File fileInSubDir = new File(subDir, "file2.txt"); FileUtil.createIfNotExists(fileInSubDir);
final File sideDir = FileUtil.createTempDirectory("side.", null);
- final File fileInSideDir = FileUtil.createTempFile(sideDir, "file3.", ".txt");
+ final File fileInSideDir = new File(sideDir, "file3.txt"); FileUtil.createIfNotExists(fileInSideDir);
refresh(topDir);
refresh(sideDir);
@@ -550,6 +550,45 @@ public class FileWatcherTest extends PlatformLangTestCase {
myTimeout = NATIVE_PROCESS_DELAY;
}
+ /*public void testUnicodePaths() throws Exception {
+ File topDir = IoTestUtil.createTestDir("topDir");
+ File testDir = IoTestUtil.createTestDir(topDir, "unicode директория");
+ File testFile = IoTestUtil.createTestFile(testDir, "unicode файл");
+ refresh(topDir);
+
+ LocalFileSystem.WatchRequest request = watch(topDir);
+ try {
+ myAccept = true;
+ FileUtil.writeToFile(testFile, "abc");
+ assertEvent(VFileContentChangeEvent.class, testFile.getPath());
+ }
+ finally {
+ unwatch(request);
+ }
+ }*/
+
+ public void testLineBreaksInName() throws Exception {
+ if (!SystemInfo.isUnix) {
+ System.err.println("Ignored: Unix required");
+ return;
+ }
+
+ File topDir = IoTestUtil.createTestDir("topDir");
+ File testDir = IoTestUtil.createTestDir(topDir, "weird\ndir\nname");
+ File testFile = IoTestUtil.createTestFile(testDir, "weird\nfile\nname");
+ refresh(topDir);
+
+ LocalFileSystem.WatchRequest request = watch(topDir);
+ try {
+ myAccept = true;
+ FileUtil.writeToFile(testFile, "abc");
+ assertEvent(VFileContentChangeEvent.class, testFile.getPath());
+ }
+ finally {
+ unwatch(request);
+ }
+ }
+
@NotNull
private LocalFileSystem.WatchRequest watch(final File watchFile) {
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java
index 9ff7cda19e63..72a306afe16f 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java
@@ -78,14 +78,8 @@ public class ModuleFileIndexImpl implements ModuleFileIndex {
@Override
public boolean isInContent(@NotNull VirtualFile fileOrDir) {
- if (fileOrDir.isDirectory()) {
- DirectoryInfo info = myDirectoryIndex.getInfoForDirectory(fileOrDir);
- return info != null && myModule.equals(info.getModule());
- }
- else {
- VirtualFile parent = fileOrDir.getParent();
- return parent != null && isInContent(parent);
- }
+ DirectoryInfo info = ProjectFileIndexImpl.getInfoForFileOrDirectory(fileOrDir, myDirectoryIndex);
+ return info != null && myModule.equals(info.getModule());
}
@Override
@@ -103,19 +97,14 @@ public class ModuleFileIndexImpl implements ModuleFileIndex {
@Override
@NotNull
public List getOrderEntriesForFile(@NotNull VirtualFile fileOrDir) {
- VirtualFile dir = fileOrDir.isDirectory() ? fileOrDir : fileOrDir.getParent();
- if (dir == null) return Collections.emptyList();
- final DirectoryInfo info = myDirectoryIndex.getInfoForDirectory(dir);
+ DirectoryInfo info = ProjectFileIndexImpl.getInfoForFileOrDirectory(fileOrDir, myDirectoryIndex);
if (info == null) return Collections.emptyList();
-
return info.findAllOrderEntriesWithOwnerModule(myModule);
}
@Override
public OrderEntry getOrderEntryForFile(@NotNull VirtualFile fileOrDir) {
- VirtualFile dir = fileOrDir.isDirectory() ? fileOrDir : fileOrDir.getParent();
- if (dir == null) return null;
- final DirectoryInfo info = myDirectoryIndex.getInfoForDirectory(dir);
+ DirectoryInfo info = ProjectFileIndexImpl.getInfoForFileOrDirectory(fileOrDir, myDirectoryIndex);
if (info == null) return null;
return info.findOrderEntryWithOwnerModule(myModule);
}
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java
index 9ac1b7f3d37a..ae2236bfdc0c 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java
@@ -62,13 +62,13 @@ public class ProjectFileIndexImpl implements ProjectFileIndex {
if (module.isDisposed()) continue;
VirtualFile[] contentRoots = ModuleRootManager.getInstance(module).getContentRoots();
for (VirtualFile contentRoot : contentRoots) {
- DirectoryInfo info = getInfoForDirectory(contentRoot);
+ DirectoryInfo info = getInfoForFileOrDirectory(contentRoot);
if (info == null) continue; // is excluded or ignored
if (!module.equals(info.getModule())) continue; // maybe 2 modules have the same content root?
VirtualFile parent = contentRoot.getParent();
if (parent != null) {
- DirectoryInfo parentInfo = getInfoForDirectory(parent);
+ DirectoryInfo parentInfo = getInfoForFileOrDirectory(parent);
if (parentInfo != null && parentInfo.getModule() != null) continue; // inner content - skip it
}
@@ -81,8 +81,25 @@ public class ProjectFileIndexImpl implements ProjectFileIndex {
}
@Nullable
- private DirectoryInfo getInfoForDirectory(@NotNull VirtualFile file) {
- return myDirectoryIndex.getInfoForDirectory(file);
+ private DirectoryInfo getInfoForFileOrDirectory(@NotNull VirtualFile file) {
+ return getInfoForFileOrDirectory(file, myDirectoryIndex);
+ }
+
+ @Nullable
+ public static DirectoryInfo getInfoForFileOrDirectory(@NotNull VirtualFile file, DirectoryIndex directoryIndex) {
+ if (!file.isDirectory() && file.getParent() == null) return null; // e.g. LightVirtualFile in test
+ DirectoryInfo info = directoryIndex.getInfoForDirectory(file);
+ if (info != null) {
+ return info;
+ }
+
+ if (!file.isDirectory()) {
+ VirtualFile dir = file.getParent();
+ if (dir != null) {
+ return directoryIndex.getInfoForDirectory(dir);
+ }
+ }
+ return null;
}
@Override
@@ -97,14 +114,14 @@ public class ProjectFileIndexImpl implements ProjectFileIndex {
VirtualFile dir = file.isDirectory() ? file : file.getParent();
if (dir == null) return false;
- DirectoryInfo info = getInfoForDirectory(dir);
+ DirectoryInfo info = getInfoForFileOrDirectory(dir);
if (info != null) return false;
if (myDirectoryIndex.isProjectExcludeRoot(dir)) return true;
VirtualFile parent = dir.getParent();
while (true) {
if (parent == null) return false;
- DirectoryInfo parentInfo = getInfoForDirectory(parent);
+ DirectoryInfo parentInfo = getInfoForFileOrDirectory(parent);
if (parentInfo != null) return true;
if (myDirectoryIndex.isProjectExcludeRoot(parent)) return true;
parent = parent.getParent();
@@ -116,7 +133,7 @@ public class ProjectFileIndexImpl implements ProjectFileIndex {
if (file instanceof VirtualFileWindow) file = ((VirtualFileWindow)file).getDelegate();
VirtualFile dir = file.isDirectory() ? file : file.getParent();
if (dir == null) return null;
- DirectoryInfo info = getInfoForDirectory(dir);
+ DirectoryInfo info = getInfoForFileOrDirectory(dir);
if (info == null) return null;
return info.getModule();
}
@@ -124,36 +141,28 @@ public class ProjectFileIndexImpl implements ProjectFileIndex {
@Override
@NotNull
public List getOrderEntriesForFile(@NotNull VirtualFile file) {
- VirtualFile dir = file.isDirectory() ? file : file.getParent();
- if (dir == null) return Collections.emptyList();
- final DirectoryInfo info = getInfoForDirectory(dir);
+ DirectoryInfo info = getInfoForFileOrDirectory(file);
if (info == null) return Collections.emptyList();
return Arrays.asList(info.getOrderEntries());
}
@Override
public VirtualFile getClassRootForFile(@NotNull VirtualFile file) {
- VirtualFile dir = file.isDirectory() ? file : file.getParent();
- if (dir == null) return null;
- final DirectoryInfo info = getInfoForDirectory(dir);
+ final DirectoryInfo info = getInfoForFileOrDirectory(file);
if (info == null) return null;
return info.getLibraryClassRoot();
}
@Override
public VirtualFile getSourceRootForFile(@NotNull VirtualFile file) {
- final VirtualFile dir = file.isDirectory() ? file : file.getParent();
- if (dir == null) return null;
- final DirectoryInfo info = getInfoForDirectory(dir);
+ final DirectoryInfo info = getInfoForFileOrDirectory(file);
if (info == null) return null;
return info.getSourceRoot();
}
@Override
public VirtualFile getContentRootForFile(@NotNull VirtualFile file) {
- VirtualFile dir = file.isDirectory() ? file : file.getParent();
- if (dir == null) return null;
- final DirectoryInfo info = getInfoForDirectory(dir);
+ final DirectoryInfo info = getInfoForFileOrDirectory(file);
if (info == null) return null;
return info.getContentRoot();
}
@@ -175,14 +184,13 @@ public class ProjectFileIndexImpl implements ProjectFileIndex {
public boolean isLibraryClassFile(@NotNull VirtualFile file) {
if (file.isDirectory()) return false;
if (myFileTypeRegistry.isFileIgnored(file)) return false;
- VirtualFile parent = file.getParent();
- DirectoryInfo parentInfo = getInfoForDirectory(parent);
+ DirectoryInfo parentInfo = getInfoForFileOrDirectory(file);
return parentInfo != null && parentInfo.hasLibraryClassRoot();
}
@Override
public boolean isInSource(@NotNull VirtualFile fileOrDir) {
- DirectoryInfo info = getInfoForDirectory(fileOrDir);
+ DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
if (info != null) {
return info.isInModuleSource() || info.isInLibrarySource();
}
@@ -194,7 +202,7 @@ public class ProjectFileIndexImpl implements ProjectFileIndex {
@Override
public boolean isInLibraryClasses(@NotNull VirtualFile fileOrDir) {
- DirectoryInfo info = getInfoForDirectory(fileOrDir);
+ DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
if (info != null) {
return info.hasLibraryClassRoot();
}
@@ -206,7 +214,7 @@ public class ProjectFileIndexImpl implements ProjectFileIndex {
@Override
public boolean isInLibrarySource(@NotNull VirtualFile fileOrDir) {
- DirectoryInfo info = getInfoForDirectory(fileOrDir);
+ DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
if (info != null) {
return info.isInLibrarySource();
}
@@ -218,45 +226,27 @@ public class ProjectFileIndexImpl implements ProjectFileIndex {
@Override
public boolean isInContent(@NotNull VirtualFile fileOrDir) {
- if (fileOrDir.isDirectory()) {
- DirectoryInfo info = getInfoForDirectory(fileOrDir);
- return info != null && info.getModule() != null;
- }
- else {
- VirtualFile parent = fileOrDir.getParent();
- return parent != null && isInContent(parent);
- }
+ DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
+ return info != null && info.getModule() != null;
}
@Override
public boolean isInSourceContent(@NotNull VirtualFile fileOrDir) {
- if (fileOrDir.isDirectory()) {
- DirectoryInfo info = getInfoForDirectory(fileOrDir);
- return info != null && info.isInModuleSource();
- }
- else {
- VirtualFile parent = fileOrDir.getParent();
- return parent != null && isInSourceContent(parent);
- }
+ DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
+ return info != null && info.isInModuleSource();
}
@Override
public boolean isInTestSourceContent(@NotNull VirtualFile fileOrDir) {
- if (fileOrDir.isDirectory()) {
- DirectoryInfo info = getInfoForDirectory(fileOrDir);
- return info != null && info.isInModuleSource() && info.isTestSource();
- }
- else {
- VirtualFile parent = fileOrDir.getParent();
- return parent != null && isInTestSourceContent(parent);
- }
+ DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
+ return info != null && info.isInModuleSource() && info.isTestSource();
}
private class ContentFilter implements VirtualFileFilter {
@Override
public boolean accept(@NotNull VirtualFile file) {
if (file.isDirectory()) {
- DirectoryInfo info = getInfoForDirectory(file);
+ DirectoryInfo info = getInfoForFileOrDirectory(file);
return info != null && info.getModule() != null;
}
else {
diff --git a/platform/testFramework/src/com/intellij/mock/MockApplicationEx.java b/platform/testFramework/src/com/intellij/mock/MockApplicationEx.java
index 5b078fbcec3f..4aaa1814380f 100644
--- a/platform/testFramework/src/com/intellij/mock/MockApplicationEx.java
+++ b/platform/testFramework/src/com/intellij/mock/MockApplicationEx.java
@@ -57,6 +57,10 @@ public class MockApplicationEx extends MockApplication implements ApplicationEx
public void exit(boolean force) {
}
+ @Override
+ public void restart(boolean force) {
+ }
+
@Override
public void doNotSave() {
}
diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java
index dd20c25fd090..794cd1eae27b 100644
--- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java
+++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java
@@ -68,6 +68,7 @@ import com.intellij.psi.impl.DocumentCommitThread;
import com.intellij.psi.impl.PsiManagerEx;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl;
import com.intellij.util.PatchedWeakReference;
+import com.intellij.util.PlatformUtils;
import com.intellij.util.indexing.IndexableSetContributor;
import com.intellij.util.indexing.IndexedRootsProvider;
import com.intellij.util.ui.UIUtil;
@@ -813,7 +814,7 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
}
private static void setPlatformPrefix(String prefix) {
- System.setProperty("idea.platform.prefix", prefix);
+ System.setProperty(PlatformUtils.PLATFORM_PREFIX_KEY, prefix);
}
@Retention(RetentionPolicy.RUNTIME)
diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/CompletionAutoPopupTester.groovy b/platform/testFramework/src/com/intellij/testFramework/fixtures/CompletionAutoPopupTester.groovy
index 59f1725045cd..7a7c77238f40 100644
--- a/platform/testFramework/src/com/intellij/testFramework/fixtures/CompletionAutoPopupTester.groovy
+++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/CompletionAutoPopupTester.groovy
@@ -15,8 +15,6 @@
*/
package com.intellij.testFramework.fixtures
import com.intellij.codeInsight.AutoPopupController
-import com.intellij.codeInsight.completion.CompletionPhase
-import com.intellij.codeInsight.completion.impl.CompletionServiceImpl
import com.intellij.codeInsight.editorActions.CompletionAutoPopupHandler
import com.intellij.codeInsight.lookup.LookupManager
import com.intellij.codeInsight.lookup.impl.LookupImpl
@@ -25,7 +23,6 @@ import com.intellij.openapi.editor.ex.DocumentEx
import com.intellij.psi.PsiDocumentManager
import com.intellij.testFramework.UsefulTestCase
import com.intellij.util.ui.UIUtil
-import junit.framework.Assert
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicInteger
@@ -52,16 +49,6 @@ class CompletionAutoPopupTester {
}
void joinCompletion() {
- for (i in 0.1000) {
- if (i==999) {
- UsefulTestCase.printThreadDump()
- Assert.fail("Could not wait for committed doc")
- }
- CompletionPhase phase = CompletionServiceImpl.getCompletionPhase()
- if (phase != com.intellij.codeInsight.completion.CompletionPhase.NoCompletion) break;
- Thread.sleep(10)
- }
-
for (j in 1..4000) {
LookupImpl l = null
UsefulTestCase.edt {
diff --git a/platform/testFramework/testFramework.iml b/platform/testFramework/testFramework.iml
index 418a92d5c28a..7985252e6abc 100644
--- a/platform/testFramework/testFramework.iml
+++ b/platform/testFramework/testFramework.iml
@@ -17,11 +17,15 @@
-
+
+
+
+
+
diff --git a/platform/usageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java b/platform/usageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java
index daa4c67b6ce5..4f1bc20e0a19 100644
--- a/platform/usageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java
+++ b/platform/usageView/src/com/intellij/usages/UsageInfo2UsageAdapter.java
@@ -36,6 +36,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.reference.SoftReference;
import com.intellij.usageView.UsageInfo;
+import com.intellij.usageView.UsageViewBundle;
import com.intellij.usages.rules.*;
import com.intellij.util.ArrayUtil;
import com.intellij.util.IncorrectOperationException;
@@ -465,7 +466,7 @@ public class UsageInfo2UsageAdapter implements UsageInModule,
return s;
}
}
- return "";
+ return UsageViewBundle.message("node.invalid");
}
@Override
diff --git a/platform/usageView/src/com/intellij/usages/impl/GroupNode.java b/platform/usageView/src/com/intellij/usages/impl/GroupNode.java
index e9af4c26c9fd..4f4f4c7b85e0 100644
--- a/platform/usageView/src/com/intellij/usages/impl/GroupNode.java
+++ b/platform/usageView/src/com/intellij/usages/impl/GroupNode.java
@@ -54,13 +54,18 @@ public class GroupNode extends Node implements Navigatable, Comparable edtQueue) {
@@ -340,7 +345,7 @@ public class GroupNode extends Node implements Navigatable, Comparable> flag;
+ return (state & 1) != 0;
+ }
+
+ private void setFlag(@FlagConstant int flag, boolean value) {
+ int state = value ? 1 : 0;
+ flags = (byte)(flags & ~(1 << flag) | state << flag);
+ }
protected Node(@NotNull DefaultTreeModel model) {
myTreeModel = model;
@@ -44,35 +62,57 @@ public abstract class Node extends DefaultMutableTreeNode {
protected abstract boolean isDataValid();
protected abstract boolean isDataReadOnly();
protected abstract boolean isDataExcluded();
- protected abstract String getText(UsageView view);
+ protected abstract String getText(@NotNull UsageView view);
public final boolean isValid() {
- return myIsValid;
+ return !isFlagSet(INVALID_FLAG);
}
public final boolean isReadOnly() {
- if (myIsReadOnly == null) myIsReadOnly = Boolean.valueOf(isDataReadOnly());
- return myIsReadOnly.booleanValue();
+ boolean result;
+ boolean computed = isFlagSet(READ_ONLY_COMPUTED_FLAG);
+ if (computed) {
+ result = isFlagSet(READ_ONLY_FLAG);
+ }
+ else {
+ result = isDataReadOnly();
+ setFlag(READ_ONLY_COMPUTED_FLAG, true);
+ setFlag(READ_ONLY_FLAG, result);
+ }
+ return result;
}
public final boolean isExcluded() {
- return myExcluded;
+ return isFlagSet(EXCLUDED_FLAG);
}
- public final void update(UsageView view) {
+ public final void update(@NotNull UsageView view) {
boolean isDataValid = isDataValid();
boolean isReadOnly = isDataReadOnly();
boolean isExcluded = isDataExcluded();
String text = getText(view);
- if (isDataValid != myIsValid || myIsReadOnly == null || isReadOnly != myIsReadOnly.booleanValue() || isExcluded != myExcluded ||
- !Comparing.equal(myText, text)) {
- myIsValid = isDataValid;
- myExcluded = isExcluded;
- myIsReadOnly = Boolean.valueOf(isReadOnly);
+
+ boolean cachedValid = isValid();
+ boolean cachedExcluded = isFlagSet(EXCLUDED_FLAG);
+ boolean cachedReadOnly = isFlagSet(READ_ONLY_FLAG);
+
+ if (isDataValid != cachedValid || isReadOnly != cachedReadOnly || isExcluded != cachedExcluded || !Comparing.equal(myText, text)) {
+ setFlag(INVALID_FLAG, !isDataValid);
+ setFlag(READ_ONLY_FLAG, isReadOnly);
+ setFlag(EXCLUDED_FLAG, isExcluded);
+
myText = text;
updateNotify();
myTreeModel.nodeChanged(this);
}
+ setFlag(UPDATED_FLAG, true);
+ }
+
+ public void markNeedUpdate() {
+ setFlag(UPDATED_FLAG, false);
+ }
+ public boolean needsUpdate() {
+ return !isFlagSet(UPDATED_FLAG);
}
/**
diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageNode.java b/platform/usageView/src/com/intellij/usages/impl/UsageNode.java
index 18d06f28ff56..8ddcce83a865 100644
--- a/platform/usageView/src/com/intellij/usages/impl/UsageNode.java
+++ b/platform/usageView/src/com/intellij/usages/impl/UsageNode.java
@@ -89,7 +89,7 @@ public class UsageNode extends Node implements Comparable, Navigatabl
}
@Override
- protected String getText(final UsageView view) {
+ protected String getText(@NotNull final UsageView view) {
try {
return myUsage.getPresentation().getPlainText();
}
diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageTargetNode.java b/platform/usageView/src/com/intellij/usages/impl/UsageTargetNode.java
index d0ee47818f04..ad9c0248935c 100644
--- a/platform/usageView/src/com/intellij/usages/impl/UsageTargetNode.java
+++ b/platform/usageView/src/com/intellij/usages/impl/UsageTargetNode.java
@@ -54,7 +54,7 @@ public class UsageTargetNode extends Node {
}
@Override
- protected String getText(final UsageView view) {
+ protected String getText(@NotNull final UsageView view) {
return myTarget.getPresentation().getPresentableText();
}
diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java b/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java
index 12f71aeafa16..8825c3746be7 100644
--- a/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java
+++ b/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java
@@ -65,10 +65,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
+import javax.swing.event.*;
import javax.swing.tree.*;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
@@ -143,10 +140,10 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
private final Object lock = new Object();
private Splitter myPreviewSplitter;
- public UsageViewImpl(@NotNull final Project project,
- @NotNull UsageViewPresentation presentation,
- @NotNull UsageTarget[] targets,
- Factory usageSearcherFactory) {
+ UsageViewImpl(@NotNull final Project project,
+ @NotNull UsageViewPresentation presentation,
+ @NotNull UsageTarget[] targets,
+ Factory usageSearcherFactory) {
myPresentation = presentation;
myTargets = targets;
myUsageSearcherFactory = usageSearcherFactory;
@@ -316,7 +313,6 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
}
}
});
-
tabbedPane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
myPreviewSplitter.setSecondComponent(tabbedPane);
}
@@ -417,6 +413,24 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
TreeUtil.selectFirstNode(myTree);
PopupHandler.installPopupHandler(myTree, IdeActions.GROUP_USAGE_VIEW_POPUP, ActionPlaces.USAGE_VIEW_POPUP);
+
+ myTree.addTreeExpansionListener(new TreeExpansionListener() {
+ @Override
+ public void treeExpanded(TreeExpansionEvent event) {
+ TreePath path = event.getPath();
+ Object component = path.getLastPathComponent();
+ if (!(component instanceof Node)) return;
+ Node node = (Node)component;
+ if (node.needsUpdate()) {
+ checkNodeValidity(node, path);
+ }
+ }
+
+ @Override
+ public void treeCollapsed(TreeExpansionEvent event) {
+ }
+ });
+
//TODO: install speed search. Not in openapi though. It makes sense to create a common TreeEnchancer service.
}
@@ -542,7 +556,6 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
actionsManager.createPrevOccurenceAction(myRootPanel),
actionsManager.createNextOccurenceAction(myRootPanel),
actionsManager.installAutoscrollToSourceHandler(myProject, myTree, new MyAutoScrollToSourceOptionProvider()),
- //createImportToFavorites(),
actionsManager.createExportToTextFileAction(myTextFileExporter),
actionsManager.createHelpAction(HELP_ID)
};
@@ -907,7 +920,8 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
private void updateImmediately() {
if (myProject.isDisposed()) return;
- checkNodeValidity((DefaultMutableTreeNode)myTree.getModel().getRoot());
+ TreeNode root = (TreeNode)myTree.getModel().getRoot();
+ checkNodeValidity(root, new TreePath(root));
updateOnSelectionChanged();
}
@@ -918,12 +932,20 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
}
}
- private void checkNodeValidity(@NotNull DefaultMutableTreeNode node) {
- Enumeration enumeration = node.children();
- while (enumeration.hasMoreElements()) {
- checkNodeValidity((DefaultMutableTreeNode)enumeration.nextElement());
+ private void checkNodeValidity(@NotNull TreeNode node, @NotNull TreePath path) {
+ if (node instanceof Node && node != getModelRoot()) {
+ ((Node)node).update(this);
+ }
+ if (myTree.isCollapsed(path)) {
+ if (node instanceof Node) {
+ ((Node)node).markNeedUpdate();
+ }
+ return; // optimization: do not call expensive update() on invisible node
+ }
+ for (int i=0; i < node.getChildCount(); i++) {
+ TreeNode child = node.getChildAt(i);
+ checkNodeValidity(child, path.pathByAddingChild(child));
}
- if (node instanceof Node && node != getModelRoot()) ((Node)node).update(this);
}
private void updateLater() {
diff --git a/platform/util/src/com/intellij/openapi/util/objectTree/ObjectTree.java b/platform/util/src/com/intellij/openapi/util/objectTree/ObjectTree.java
index a3c2b7c5726f..84ab39cd7005 100644
--- a/platform/util/src/com/intellij/openapi/util/objectTree/ObjectTree.java
+++ b/platform/util/src/com/intellij/openapi/util/objectTree/ObjectTree.java
@@ -21,8 +21,6 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.Equality;
-import gnu.trove.THashMap;
-import gnu.trove.TObjectHashingStrategy;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
@@ -36,8 +34,8 @@ public final class ObjectTree {
private final CopyOnWriteArraySet myListeners = new CopyOnWriteArraySet();
// identity used here to prevent problems with hashCode/equals overridden by not very bright minds
- private final Set myRootObjects = ContainerUtil.newIdentityTroveSet();
- private final Map> myObject2NodeMap = ContainerUtil.>newIdentityTroveMap();
+ private final Set myRootObjects = ContainerUtil.newIdentityTroveSet();
+ private final Map> myObject2NodeMap = ContainerUtil.newIdentityTroveMap();
private final List> myExecutedNodes = new ArrayList>();
private final List myExecutedUnregisteredNodes = new ArrayList();
diff --git a/platform/util/src/com/intellij/ui/LightColors.java b/platform/util/src/com/intellij/ui/LightColors.java
index 5395a396b80b..a41e82a69b2c 100644
--- a/platform/util/src/com/intellij/ui/LightColors.java
+++ b/platform/util/src/com/intellij/ui/LightColors.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -30,6 +30,6 @@ public interface LightColors {
Color RED = UIUtil.isUnderDarcula() ? new Color(70, 0, 0) : new Color(0xffcccc);
Color CYAN = new Color(0xccffff);
- Color SLIGHTLY_GREEN = new JBColor(0xeeffee, 0x515B51);
+ Color SLIGHTLY_GREEN = new JBColor(new Color(0xeeffee), new Color(0x515B51));
Color SLIGHTLY_GRAY = new Color(0xf5f5f5);
}
diff --git a/platform/util/src/com/intellij/ui/SideBorder.java b/platform/util/src/com/intellij/ui/SideBorder.java
index 788d2abb384f..28637482fb49 100644
--- a/platform/util/src/com/intellij/ui/SideBorder.java
+++ b/platform/util/src/com/intellij/ui/SideBorder.java
@@ -17,6 +17,7 @@
package com.intellij.ui;
import com.intellij.util.ui.UIUtil;
+import org.intellij.lang.annotations.MagicConstant;
import javax.swing.border.LineBorder;
import java.awt.*;
@@ -30,19 +31,23 @@ public class SideBorder extends LineBorder {
public static final int BOTTOM = 0x08;
public static final int ALL = LEFT | TOP | RIGHT | BOTTOM;
+ @MagicConstant(flags = {NONE, LEFT, TOP, RIGHT, BOTTOM, ALL})
+ public @interface SideMask {}
+
private final int mySideMask;
private final boolean myDotted;
- public SideBorder(Color color, int mask) {
+ public SideBorder(Color color, @SideMask int mask) {
this(color, mask, false);
}
- public SideBorder(Color color, int mask, boolean dotted) {
+ public SideBorder(Color color, @SideMask int mask, boolean dotted) {
super(color, 1);
mySideMask = mask;
myDotted = dotted;
}
+ @Override
public Insets getBorderInsets(Component component) {
return new Insets(
(mySideMask & TOP) != 0 ? getThickness() : 0,
@@ -52,6 +57,7 @@ public class SideBorder extends LineBorder {
);
}
+ @Override
public Insets getBorderInsets(Component component, Insets insets) {
insets.top = (mySideMask & TOP) != 0 ? getThickness() : 0;
insets.left = (mySideMask & LEFT) != 0 ? getThickness() : 0;
@@ -60,29 +66,29 @@ public class SideBorder extends LineBorder {
return insets;
}
+ @Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Color oldColor = g.getColor();
- int i;
g.setColor(getLineColor());
- for(i = 0; i < getThickness(); i++){
+ for(int i = 0; i < getThickness(); i++){
if ((mySideMask & LEFT) != 0){
- drawLine(c, g, x + i, y + i, x + i, y + height - i - i - 1);
+ drawLine(g, x + i, y + i, x + i, y + height - i - i - 1);
}
if ((mySideMask & TOP) != 0){
- drawLine(c, g, x + i, y + i, x + width - i - i - 1, y + i);
+ drawLine(g, x + i, y + i, x + width - i - i - 1, y + i);
}
if ((mySideMask & RIGHT) != 0){
- drawLine(c, g, x + width - i - i - 1, y + i, x + width - i - i - 1, y + height - i - i - 1);
+ drawLine(g, x + width - i - i - 1, y + i, x + width - i - i - 1, y + height - i - i - 1);
}
if ((mySideMask & BOTTOM) != 0){
- drawLine(c, g, x + i, y + height - i - i - 1, x + width - i - i - 1, y + height - i - i - 1);
+ drawLine(g, x + i, y + height - i - i - 1, x + width - i - i - 1, y + height - i - i - 1);
}
}
g.setColor(oldColor);
}
- private void drawLine(Component c, Graphics g, int x1, int y1, int x2, int y2) {
+ private void drawLine(Graphics g, int x1, int y1, int x2, int y2) {
if (myDotted) {
UIUtil.drawDottedLine((Graphics2D)g, x1, y1, x2, y2, null, getLineColor());
}
diff --git a/platform/util/src/com/intellij/ui/TitlePanel.java b/platform/util/src/com/intellij/ui/TitlePanel.java
index 11f1a25e302e..8ce3b45d15e4 100644
--- a/platform/util/src/com/intellij/ui/TitlePanel.java
+++ b/platform/util/src/com/intellij/ui/TitlePanel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -44,7 +44,7 @@ public class TitlePanel extends CaptionPanel {
if (UIUtil.isUnderAquaLookAndFeel()) {
myLabel.setFont(myLabel.getFont().deriveFont(12f));
}
- myLabel.setForeground(Color.black);
+ myLabel.setForeground(JBColor.foreground);
myLabel.setHorizontalAlignment(SwingConstants.CENTER);
myLabel.setVerticalAlignment(SwingConstants.CENTER);
myLabel.setBorder(new EmptyBorder(1, 2, 2, 2));
diff --git a/platform/util/src/com/intellij/util/BufferedListConsumer.java b/platform/util/src/com/intellij/util/BufferedListConsumer.java
deleted file mode 100644
index 6619dc554b7e..000000000000
--- a/platform/util/src/com/intellij/util/BufferedListConsumer.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2000-2010 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.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class BufferedListConsumer implements Consumer> {
- private final int myInterval;
- private long myTs;
- private final int mySize;
- private final List myBuffer;
- private final Consumer> myConsumer;
- private int myCnt;
- private Runnable myFlushListener;
-
- public BufferedListConsumer(int size, Consumer> consumer, int interval) {
- mySize = size;
- myBuffer = new ArrayList();
- myConsumer = consumer;
- myInterval = interval;
- myTs = System.currentTimeMillis();
- myCnt = 0;
- }
-
- public void consumeOne(final T t) {
- consume(Collections.singletonList(t));
- }
-
- public void consume(List list) {
- myCnt += list.size();
-
- myBuffer.addAll(list);
- final long ts = System.currentTimeMillis();
- if ((mySize <= myBuffer.size()) || (myInterval > 0) && ((ts - myInterval) > myTs)) {
- myConsumer.consume(new ArrayList(myBuffer));
- myBuffer.clear();
- myTs = ts;
- }
- }
-
- public void flushPart() {
- if (! myBuffer.isEmpty()) {
- myConsumer.consume(new ArrayList(myBuffer));
- myBuffer.clear();
- }
- }
-
- public void flush() {
- flushPart();
- if (myFlushListener != null) {
- myFlushListener.run();
- }
- }
-
- public void setFlushListener(Runnable flushListener) {
- myFlushListener = flushListener;
- }
-
- public int getCnt() {
- return myCnt;
- }
-
- public Consumer asConsumer() {
- return new Consumer() {
- @Override
- public void consume(T t) {
- consumeOne(t);
- }
- };
- }
-}
diff --git a/platform/util/src/com/intellij/util/Restarter.java b/platform/util/src/com/intellij/util/Restarter.java
index 6b0b087a6f23..2ce3b9bab649 100644
--- a/platform/util/src/com/intellij/util/Restarter.java
+++ b/platform/util/src/com/intellij/util/Restarter.java
@@ -17,19 +17,30 @@ package com.intellij.util;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.util.SystemInfo;
-import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.util.io.FileUtilRt;
+import com.intellij.openapi.util.io.StreamUtil;
+import com.intellij.openapi.util.text.StringUtil;
import com.sun.jna.Native;
+import com.sun.jna.Pointer;
import com.sun.jna.WString;
+import com.sun.jna.ptr.IntByReference;
import com.sun.jna.win32.StdCallLibrary;
+import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+@SuppressWarnings({"UseOfSystemOutOrSystemErr", "CallToPrintStackTrace"})
public class Restarter {
private Restarter() {
}
- public static int getRestartCode() {
+ private static int getRestartCode() {
String s = System.getProperty("jb.restart.code");
if (s != null) {
try {
@@ -42,45 +53,63 @@ public class Restarter {
}
public static boolean isSupported() {
- return SystemInfo.isWindows || SystemInfo.isMac;
+ return getRestartCode() != 0 || SystemInfo.isWindows || SystemInfo.isMac;
}
- public static boolean restart() throws CannotRestartException {
- try {
- if (SystemInfo.isWindows) {
- return restartOnWindows();
+ public static int scheduleRestart(@NotNull String... beforeRestart) throws IOException {
+ int restartCode = getRestartCode();
+ if (restartCode != 0) {
+ try {
+ Process process = Runtime.getRuntime().exec(beforeRestart);
+
+ Thread outThread = new Thread(new StreamRedirector(process.getInputStream(), System.out));
+ Thread errThread = new Thread(new StreamRedirector(process.getErrorStream(), System.err));
+ outThread.start();
+ errThread.start();
+
+ try {
+ process.waitFor();
+ }
+ finally {
+ outThread.join();
+ errThread.join();
+ }
}
- else if (SystemInfo.isMac) {
- return restartOnMac();
+ catch (InterruptedException ignore) {
}
+
+ return restartCode;
}
- catch (CannotRestartException e) {
- throw e;
+ else if (SystemInfo.isWindows) {
+ restartOnWindows(beforeRestart);
+ return 0;
}
- catch (Throwable e) {
- throw new CannotRestartException(e);
+ else if (SystemInfo.isMac) {
+ restartOnMac(beforeRestart);
+ return 0;
}
- return false;
+ throw new IOException("Cannot restart application: not supported.");
}
- private static boolean restartOnWindows() throws CannotRestartException {
+ private static void restartOnWindows(@NotNull final String... beforeRestart) throws IOException {
Kernel32 kernel32 = (Kernel32)Native.loadLibrary("kernel32", Kernel32.class);
- WString cline = kernel32.GetCommandLineW();
- int pid = kernel32.GetCurrentProcessId();
+ Shell32 shell32 = (Shell32)Native.loadLibrary("shell32", Shell32.class);
- try {
- // to prevent blocking exe file during update we should copy it
- File restarterFile = new File(PathManager.getBinPath(), "restarter.exe");
- File restarterCopy = FileUtil.createTempFile("restarter", ".exe");
+ final int pid = kernel32.GetCurrentProcessId();
+ final IntByReference argc = new IntByReference();
+ Pointer argv_ptr = shell32.CommandLineToArgvW(kernel32.GetCommandLineW(), argc);
+ final String[] argv = argv_ptr.getStringArray(0, argc.getValue(), true);
+ kernel32.LocalFree(argv_ptr);
- FileUtil.copy(restarterFile, restarterCopy);
-
- String command = "\"" + restarterCopy + "\" " + Integer.toString(pid) + " " + cline;
- Runtime.getRuntime().exec(command, null, new File(PathManager.getBinPath()));
- }
- catch (IOException ex) {
- throw new CannotRestartException(ex);
- }
+ doScheduleRestart(new File(PathManager.getBinPath(), "restarter.exe"), new Consumer>() {
+ @Override
+ public void consume(List commands) {
+ Collections.addAll(commands, String.valueOf(pid), String.valueOf(beforeRestart.length));
+ Collections.addAll(commands, beforeRestart);
+ Collections.addAll(commands, String.valueOf(argc.getValue()));
+ Collections.addAll(commands, argv);
+ }
+ });
// Since the process ID is passed through the command line, we want to make sure that we don't exit before the "restarter"
// process has a chance to open the handle to our process, and that it doesn't wait for the termination of an unrelated
@@ -88,39 +117,67 @@ public class Restarter {
try {
Thread.sleep(500);
}
- catch (InterruptedException e1) {
- // ignore
+ catch (InterruptedException ignore) {
}
- return true;
+ }
+
+ private static void restartOnMac(@NotNull final String... beforeRestart) throws IOException {
+ final String homePath = PathManager.getHomePath();
+ if (!StringUtil.endsWithIgnoreCase(homePath, ".app")) throw new IOException("Application bundle not found: " + homePath);
+
+ doScheduleRestart(new File(PathManager.getBinPath(), "restarter"), new Consumer>() {
+ @Override
+ public void consume(List commands) {
+ Collections.addAll(commands, homePath);
+ Collections.addAll(commands, beforeRestart);
+ }
+ });
+ }
+
+ private static void doScheduleRestart(File restarterFile, Consumer> argumentsBuilder) throws IOException {
+ List commands = new ArrayList();
+ commands.add(createTempExecutable(restarterFile).getPath());
+ argumentsBuilder.consume(commands);
+ Runtime.getRuntime().exec(commands.toArray(new String[commands.size()]));
+ }
+
+ public static File createTempExecutable(File executable) throws IOException {
+ String ext = FileUtilRt.getExtension(executable.getName());
+ File copy = FileUtilRt.createTempFile(FileUtilRt.getNameWithoutExtension(executable.getName()),
+ StringUtil.isEmptyOrSpaces(ext) ? ".tmp" : ("." + ext),
+ false);
+ FileUtilRt.copy(executable, copy);
+ if (!copy.setExecutable(executable.canExecute())) throw new IOException("Cannot make file executable: " + copy);
+ return copy;
}
private interface Kernel32 extends StdCallLibrary {
+ int GetCurrentProcessId();
+
WString GetCommandLineW();
- int GetCurrentProcessId();
+ Pointer LocalFree(Pointer pointer);
}
- private static boolean restartOnMac() throws CannotRestartException {
- String binPath = PathManager.getBinPath();
-
- if (!binPath.contains(".app")) return false;
-
- int appIndex = binPath.indexOf(".app");
- String appPath = binPath.substring(0, appIndex + 4);
-
- try {
- Runtime.getRuntime().exec(new String[]{new File(PathManager.getBinPath(), "relaunch").getPath(), appPath});
- }
- catch (IOException e) {
- throw new CannotRestartException(e);
- }
-
- return true;
+ private interface Shell32 extends StdCallLibrary {
+ Pointer CommandLineToArgvW(WString command_line, IntByReference argc);
}
- public static class CannotRestartException extends Exception {
- public CannotRestartException(Throwable cause) {
- super(cause);
+ private static class StreamRedirector implements Runnable {
+ private final InputStream myIn;
+ private final OutputStream myOut;
+
+ private StreamRedirector(InputStream in, OutputStream out) {
+ myIn = in;
+ myOut = out;
+ }
+
+ public void run() {
+ try {
+ StreamUtil.copyStreamContent(myIn, myOut);
+ }
+ catch (IOException ignore) {
+ }
}
}
-}
+}
\ No newline at end of file
diff --git a/platform/util/src/com/intellij/util/containers/CompositeIterator.java b/platform/util/src/com/intellij/util/containers/CompositeIterator.java
deleted file mode 100644
index 0f5c5f5a08f7..000000000000
--- a/platform/util/src/com/intellij/util/containers/CompositeIterator.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2000-2011 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.util.containers;
-
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Created by IntelliJ IDEA.
- * User: Irina.Chernushina
- * Date: 9/28/11
- * Time: 12:38 PM
- */
-public class CompositeIterator implements Iterator {
- private int myPreviousIdx;
- private int myIdx;
- private final List> myIterators;
- private boolean myIsOnLast;
-
- public CompositeIterator(final List> iterators) {
- myIterators = iterators;
- myIdx = -1;
- myPreviousIdx = -1;
- for (int i = 0; i < myIterators.size(); i++) {
- final Iterator iterator = myIterators.get(i);
- if (iterator.hasNext()) {
- myIdx = i;
- break;
- }
- }
- }
-
- @Override
- public boolean hasNext() {
- return (myIdx >= 0) && myIterators.get(myIdx).hasNext();
- }
-
- @Override
- public Key next() {
- final Key result = myIterators.get(myIdx).next();
- myIsOnLast = false;
- recalculateCurrent();
- return result;
- }
-
- private void recalculateCurrent() {
- if (myIdx == -1) return;
- if (! myIterators.get(myIdx).hasNext()) {
- myIsOnLast = true;
- myPreviousIdx = myIdx;
- myIdx = -1;
- for (int i = myPreviousIdx; i < myIterators.size(); i++) {
- final Iterator iterator = myIterators.get(i);
- if (iterator.hasNext()) {
- myIdx = i;
- break;
- }
- }
- }
- }
-
- @Override
- public void remove() {
- if (myIsOnLast) {
- // last element
- myIterators.get(myPreviousIdx).remove(); // already on last position
- } else {
- myIterators.get(myIdx).remove();
- }
- }
-}
diff --git a/platform/util/src/com/intellij/util/containers/ContainerUtil.java b/platform/util/src/com/intellij/util/containers/ContainerUtil.java
index bd1a7d795ccc..c817d2001fb7 100644
--- a/platform/util/src/com/intellij/util/containers/ContainerUtil.java
+++ b/platform/util/src/com/intellij/util/containers/ContainerUtil.java
@@ -1044,10 +1044,21 @@ public class ContainerUtil extends ContainerUtilRt {
Iterable extends T> iterable = iterables[i];
iterators[i] = iterable.iterator();
}
- return new SequenceIterator(iterators);
+ return concatIterators(iterators);
}
};
}
+
+ @NotNull
+ public static Iterator concatIterators(@NotNull Iterator... iterators) {
+ return new SequenceIterator(iterators);
+ }
+
+ @NotNull
+ public static Iterator concatIterators(@NotNull Collection> iterators) {
+ return new SequenceIterator(iterators);
+ }
+
@NotNull
public static Iterable concat(@NotNull final T[]... iterables) {
return new Iterable() {
@@ -1058,7 +1069,7 @@ public class ContainerUtil extends ContainerUtilRt {
T[] iterable = iterables[i];
iterators[i] = Arrays.asList(iterable).iterator();
}
- return new SequenceIterator(iterators);
+ return concatIterators(iterators);
}
};
}
diff --git a/platform/util/src/com/intellij/util/containers/RefHashMap.java b/platform/util/src/com/intellij/util/containers/RefHashMap.java
index cba8230bdd72..057b96604e60 100644
--- a/platform/util/src/com/intellij/util/containers/RefHashMap.java
+++ b/platform/util/src/com/intellij/util/containers/RefHashMap.java
@@ -185,7 +185,8 @@ abstract class RefHashMap extends AbstractMap implements Map {
}
@Override
- public boolean containsKey(@NotNull Object key) {
+ public boolean containsKey(Object key) {
+ if (key == null) return false;
// optimization:
myHardKeyInstance.set((K)key);
boolean result = myMap.containsKey(myHardKeyInstance);
@@ -194,7 +195,8 @@ abstract class RefHashMap extends AbstractMap implements Map {
}
@Override
- public V get(@NotNull Object key) {
+ public V get(Object key) {
+ if (key == null) return null;
myHardKeyInstance.set((K)key);
V result = myMap.get(myHardKeyInstance);
myHardKeyInstance.clear();
diff --git a/platform/util/src/com/intellij/util/containers/SequenceIterator.java b/platform/util/src/com/intellij/util/containers/SequenceIterator.java
index ca5f69ea01e7..b0bbeff13208 100644
--- a/platform/util/src/com/intellij/util/containers/SequenceIterator.java
+++ b/platform/util/src/com/intellij/util/containers/SequenceIterator.java
@@ -17,44 +17,48 @@ package com.intellij.util.containers;
import org.jetbrains.annotations.NotNull;
+import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;
public class SequenceIterator implements Iterator {
- private final Iterator[] myIterators;
+ private final Iterator[] myIterators;
private int myCurrentIndex;
- public SequenceIterator(@NotNull Iterator... iterators){
+ public SequenceIterator(@NotNull Iterator... iterators){
myIterators = new Iterator[iterators.length];
System.arraycopy(iterators, 0, myIterators, 0, iterators.length);
}
-
- public boolean hasNext(){
- if(myCurrentIndex >= myIterators.length){
- return false;
- }
- else if(myIterators[myCurrentIndex] == null){
- myCurrentIndex++;
- return hasNext();
- }
- else if(myIterators[myCurrentIndex].hasNext()){
- return true;
- }
- else{
- myCurrentIndex++;
- return hasNext();
- }
+ public SequenceIterator(@NotNull Collection> iterators) {
+ this(iterators.toArray(new Iterator[iterators.size()]));
}
+ @Override
+ public boolean hasNext(){
+ for (int index = myCurrentIndex; index < myIterators.length; index++) {
+ Iterator iterator = myIterators[index];
+ if (iterator != null && iterator.hasNext()) {
+ myCurrentIndex = index;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
public T next(){
- if(hasNext()){
- return (T)myIterators[myCurrentIndex].next();
+ if(hasNext()) {
+ return myIterators[myCurrentIndex].next();
}
throw new NoSuchElementException("Iterator has no more elements");
}
+ @Override
public void remove(){
- throw new UnsupportedOperationException("Remove not supported");
+ if(myCurrentIndex >= myIterators.length){
+ throw new IllegalStateException();
+ }
+ myIterators[myCurrentIndex].remove();
}
public static SequenceIterator create(Iterator first, Iterator second) {
diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java
index e4e3bf3b7e07..c7070134e85d 100644
--- a/platform/util/src/com/intellij/util/ui/UIUtil.java
+++ b/platform/util/src/com/intellij/util/ui/UIUtil.java
@@ -1529,7 +1529,6 @@ public class UIUtil {
g.setComposite(X_RENDER_ACTIVE.getValue() ? AlphaComposite.SrcOver : AlphaComposite.Src);
}
- @TestOnly
public static void dispatchAllInvocationEvents() {
assert SwingUtilities.isEventDispatchThread() : Thread.currentThread();
final EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
diff --git a/platform/util/testSrc/com/intellij/util/containers/SequenceIteratorTest.java b/platform/util/testSrc/com/intellij/util/containers/SequenceIteratorTest.java
index e75d6dd36da0..dd2790c289e9 100644
--- a/platform/util/testSrc/com/intellij/util/containers/SequenceIteratorTest.java
+++ b/platform/util/testSrc/com/intellij/util/containers/SequenceIteratorTest.java
@@ -23,41 +23,254 @@ import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
+import java.util.List;
public class SequenceIteratorTest extends TestCase {
private final Assertion CHECK = new Assertion();
public void testOneIterator() {
Iterator
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/plugins/git4idea/lib/jgit/jsch-0.1.44.jar b/plugins/git4idea/lib/jgit/jsch-0.1.44.jar
deleted file mode 100644
index 644850c83eb7..000000000000
Binary files a/plugins/git4idea/lib/jgit/jsch-0.1.44.jar and /dev/null differ
diff --git a/plugins/git4idea/lib/jgit/jsch-0.1.44.zip b/plugins/git4idea/lib/jgit/jsch-0.1.44.zip
deleted file mode 100644
index 10f3e7cc34d6..000000000000
Binary files a/plugins/git4idea/lib/jgit/jsch-0.1.44.zip and /dev/null differ
diff --git a/plugins/git4idea/src/git4idea/commands/GitHandler.java b/plugins/git4idea/src/git4idea/commands/GitHandler.java
index 90e18ad62cb6..1ec1a1cb04d0 100644
--- a/plugins/git4idea/src/git4idea/commands/GitHandler.java
+++ b/plugins/git4idea/src/git4idea/commands/GitHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * 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.
@@ -51,7 +51,6 @@ import java.util.concurrent.LinkedBlockingQueue;
* A handler for git commands
*/
public abstract class GitHandler {
-
protected final Project myProject;
protected final GitCommand myCommand;
@@ -785,9 +784,4 @@ public abstract class GitHandler {
public String toString() {
return myCommandLine.toString();
}
-
- public void dontEscapeQuotes() {
- myCommandLine.putUserData(GeneralCommandLine.DO_NOT_ESCAPE_QUOTES, true);
- }
-
}
diff --git a/plugins/git4idea/src/git4idea/commands/GitSimpleHandler.java b/plugins/git4idea/src/git4idea/commands/GitSimpleHandler.java
index d672f4522e5e..75436608246b 100644
--- a/plugins/git4idea/src/git4idea/commands/GitSimpleHandler.java
+++ b/plugins/git4idea/src/git4idea/commands/GitSimpleHandler.java
@@ -81,7 +81,7 @@ public class GitSimpleHandler extends GitTextHandler {
protected void processTerminated(final int exitCode) {
if (myVcs == null) { return; }
String stdout = myStdoutLine.toString();
- String stderr = myStdoutLine.toString();
+ String stderr = myStderrLine.toString();
if (!isStdoutSuppressed() && !StringUtil.isEmptyOrSpaces(stdout)) {
myVcs.showMessages(stdout);
LOG.info(stdout.trim());
diff --git a/plugins/git4idea/src/git4idea/history/browser/LowLevelAccessImpl.java b/plugins/git4idea/src/git4idea/history/browser/LowLevelAccessImpl.java
index 723f7e901207..b96995b5dc53 100644
--- a/plugins/git4idea/src/git4idea/history/browser/LowLevelAccessImpl.java
+++ b/plugins/git4idea/src/git4idea/history/browser/LowLevelAccessImpl.java
@@ -22,7 +22,6 @@ import com.intellij.openapi.util.Getter;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vcs.FilePathImpl;
import com.intellij.openapi.vcs.VcsException;
-import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
import com.intellij.util.AsynchConsumer;
@@ -35,6 +34,7 @@ import git4idea.config.GitConfigUtil;
import git4idea.history.GitHistoryUtils;
import git4idea.history.wholeTree.AbstractHash;
import git4idea.history.wholeTree.CommitHashPlusParents;
+import git4idea.repo.GitBranchTrackInfo;
import git4idea.repo.GitRepository;
import git4idea.repo.GitRepositoryFiles;
import git4idea.repo.GitRepositoryImpl;
@@ -127,14 +127,22 @@ public class LowLevelAccessImpl implements LowLevelAccess {
final GitBranch current = repository.getCurrentBranch();
refs.setCurrentBranch(current);
if (current != null) {
- GitBranch tracked = GitBranchUtil.tracked(myProject, myRoot, current.getName());
- String fullName = tracked == null ? null : tracked.getFullName();
- fullName = fullName != null && fullName.startsWith(GitBranch.REFS_REMOTES_PREFIX) ? fullName.substring(GitBranch.REFS_REMOTES_PREFIX.length()) : fullName;
- refs.setTrackedRemoteName(fullName);
+ final Collection infos = repository.getBranchTrackInfos();
+ for (GitBranchTrackInfo info : infos) {
+ if (info.getLocalBranch().equals(current)) {
+ String fullName = info.getRemoteBranch().getFullName();
+ fullName = fullName.startsWith(GitBranch.REFS_REMOTES_PREFIX)
+ ? fullName.substring(GitBranch.REFS_REMOTES_PREFIX.length()) : fullName;
+ refs.setTrackedRemoteName(fullName);
+ break;
+ }
+ }
}
refs.setUsername(GitConfigUtil.getValue(myProject, myRoot, GitConfigUtil.USER_NAME));
- final VcsRevisionNumber head = GitHistoryUtils.getCurrentRevision(myProject, new FilePathImpl(myRoot), "HEAD", true);
- refs.setHeadHash(AbstractHash.create(head.asString()));
+ final String head = repository.getCurrentRevision();
+ if (head != null) {
+ refs.setHeadHash(AbstractHash.create(head));
+ }
return refs;
}
diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/ByRootLoader.java b/plugins/git4idea/src/git4idea/history/wholeTree/ByRootLoader.java
index b123c21e386e..800ef2eb1f2c 100644
--- a/plugins/git4idea/src/git4idea/history/wholeTree/ByRootLoader.java
+++ b/plugins/git4idea/src/git4idea/history/wholeTree/ByRootLoader.java
@@ -72,15 +72,14 @@ public class ByRootLoader extends TaskDescriptor {
@Override
public void run(ContinuationContext context) {
- final ProgressIndicator pi = ProgressManager.getInstance().getProgressIndicator();
/*progress(pi, "Load stashed");
loadStash();*/
reportStashHead();
- progress(pi, "Try to load by reference");
loadByHashesAside(context);
}
private void reportStashHead() {
+ progress("Getting stash head");
try {
myMediator.acceptStashHead(myTicket, myRootHolder.getRoot(), GitHistoryUtils.getStashTop(myProject, myRootHolder.getRoot()));
}
@@ -89,7 +88,8 @@ public class ByRootLoader extends TaskDescriptor {
}
}
- private void progress(final ProgressIndicator pi, final String progress) {
+ private void progress(final String progress) {
+ final ProgressIndicator pi = ProgressManager.getInstance().getProgressIndicator();
if (pi != null) {
pi.checkCanceled();
pi.setText(progress);
@@ -149,6 +149,7 @@ public class ByRootLoader extends TaskDescriptor {
final List hashes = myGitLogFilters.getPossibleReferencies();
if (hashes == null) return;
+ progress("Try to load by reference");
myGitLogFilters.callConsumer(new Consumer>() {
@Override
public void consume(List filters) {
diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/CommitIdsHolder.java b/plugins/git4idea/src/git4idea/history/wholeTree/CommitIdsHolder.java
index 3d6dab152673..280691ea003c 100644
--- a/plugins/git4idea/src/git4idea/history/wholeTree/CommitIdsHolder.java
+++ b/plugins/git4idea/src/git4idea/history/wholeTree/CommitIdsHolder.java
@@ -15,7 +15,7 @@
*/
package git4idea.history.wholeTree;
-import com.intellij.util.containers.CompositeIterator;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.SLRUMap;
import java.util.*;
@@ -74,7 +74,7 @@ public class CommitIdsHolder {
final List> iterators = new ArrayList>(2);
iterators.add(myProbationalQueue.keySet().iterator());
iterators.add(myProtectedQueue.keySet().iterator());
- return new CompositeIterator(iterators);
+ return ContainerUtil.concatIterators(iterators);
}
}
}
diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/GitLogDetailsPanel.java b/plugins/git4idea/src/git4idea/history/wholeTree/GitLogDetailsPanel.java
index 524d8cad2f17..9fc405c6aa3c 100644
--- a/plugins/git4idea/src/git4idea/history/wholeTree/GitLogDetailsPanel.java
+++ b/plugins/git4idea/src/git4idea/history/wholeTree/GitLogDetailsPanel.java
@@ -265,7 +265,7 @@ public class GitLogDetailsPanel {
hash).append("" + "
Author:
")
.append(author).append(" (").append(c.getAuthorEmail()).append(") at ")
.append(DateFormatUtil.formatPrettyDateTime(c.getAuthorTime()))
- .append("
" + "
Commiter:
")
+ .append("
" + "
Committer:
")
.append(committer).append(" (").append(c.getComitterEmail()).append(") at ")
.append(DateFormatUtil.formatPrettyDateTime(c.getDate())).append(
"
" + "
Description:
")
diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/GitLogUI.java b/plugins/git4idea/src/git4idea/history/wholeTree/GitLogUI.java
index bc214d8e3198..552e8d31a1bb 100644
--- a/plugins/git4idea/src/git4idea/history/wholeTree/GitLogUI.java
+++ b/plugins/git4idea/src/git4idea/history/wholeTree/GitLogUI.java
@@ -1616,19 +1616,6 @@ public class GitLogUI implements Disposable {
@Override
public void actionPerformed(AnActionEvent e) {
rootsChanged(myRootsUnderVcs);
- updateRefs();
- }
-
- private void updateRefs() {
- for (VirtualFile root : myRootsUnderVcs) {
- try {
- CachedRefs cachedRefs = new LowLevelAccessImpl(myProject, root).getRefs();
- myUIRefresh.reportSymbolicRefs(root, cachedRefs);
- }
- catch (VcsException e) {
- LOG.warn("Couldn't update references in repository " + root, e);
- }
- }
}
@Override
diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/LoadAlgorithm.java b/plugins/git4idea/src/git4idea/history/wholeTree/LoadAlgorithm.java
index 48b875654135..d0b654fd31c5 100644
--- a/plugins/git4idea/src/git4idea/history/wholeTree/LoadAlgorithm.java
+++ b/plugins/git4idea/src/git4idea/history/wholeTree/LoadAlgorithm.java
@@ -12,12 +12,15 @@
*/
package git4idea.history.wholeTree;
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.CalledInAwt;
import com.intellij.util.containers.Convertor;
import com.intellij.util.continuation.*;
import org.jetbrains.annotations.Nullable;
+import java.util.Collections;
import java.util.List;
/**
@@ -29,20 +32,22 @@ public class LoadAlgorithm {
private final Project myProject;
private final List> myLoaders;
private final List myShortLoaders;
- private final Continuation myContinuation;
+ private Continuation myContinuation;
private final GitCommitsSequentially myGitCommitsSequentially;
public LoadAlgorithm(final Project project,
final List> loaders,
- final List shortLoaders,
- Continuation continuation, final GitCommitsSequentially gitCommitsSequentially) {
+ final List shortLoaders, final GitCommitsSequentially gitCommitsSequentially) {
myProject = project;
myLoaders = loaders;
myShortLoaders = shortLoaders;
- myContinuation = continuation;
myGitCommitsSequentially = gitCommitsSequentially;
}
+ public void setContinuation(Continuation continuation) {
+ myContinuation = continuation;
+ }
+
public void fillContinuation() {
final GatheringContinuationContext initContext = new GatheringContinuationContext();
@@ -72,19 +77,22 @@ public class LoadAlgorithm {
}
public void resume() {
- myContinuation.resume();
+ myContinuation.clearQueue();
+ for (LoaderAndRefresher loader : myLoaders) {
+ final LoaderFactory factory = new LoaderFactory(loader);
+ myContinuation.add(Collections.singletonList(factory.convert(new State(factory))));
+ }
+ myContinuation.resumeOnNewIndicator(myProject, true, ProgressManager.getInstance().getProgressIndicator().getText());
}
- private static class LoadTaskDescriptor extends TaskDescriptor {
+ private class LoadTaskDescriptor extends TaskDescriptor {
protected final State myState;
private final LoaderAndRefresher myLoader;
- private final RefreshTaskDescriptor myRefreshTaskDescriptor;
- protected LoadTaskDescriptor(final State state, final LoaderAndRefresher loader, final RefreshTaskDescriptor refreshTaskDescriptor) {
+ protected LoadTaskDescriptor(final State state, final LoaderAndRefresher loader) {
super("Load git tree skeleton", Where.POOLED);
myState = state;
myLoader = loader;
- myRefreshTaskDescriptor = refreshTaskDescriptor;
}
protected void processResult(final Result result) {
@@ -92,6 +100,7 @@ public class LoadAlgorithm {
@Override
public void run(final ContinuationContext context) {
+ ProgressManager.progress(getName());
final Result result = myLoader.load(myState.myValue, myState.getContinuationTs());
processResult(result);
myState.setContinuationTs(result.getLast() == null ? -1 : result.getLast().getTime());
@@ -101,18 +110,27 @@ public class LoadAlgorithm {
if (! myLoader.isInterrupted()) {
myState.scheduleSelf(context);
}
- context.next(myRefreshTaskDescriptor);
- } else {
- context.next(myRefreshTaskDescriptor);
+ }
+ flushIntoUiCalledFromBackground(context, myLoader);
+ }
+ }
+
+ private void flushIntoUiCalledFromBackground(final ContinuationContext context, LoaderAndRefresher uiRefresh) {
+ final StepType stepType = uiRefresh.flushIntoUI();
+ if (StepType.STOP.equals(stepType)) {
+ context.cancelEverything();
+ } else if (StepType.PAUSE.equals(stepType)) {
+ context.cancelCurrent();
+ final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
+ if (indicator != null) {
+ indicator.cancel();
}
}
}
- private static class TestLoadTaskDescriptor extends LoadTaskDescriptor {
- private TestLoadTaskDescriptor(final State state,
- final LoaderAndRefresher loader,
- final RefreshTaskDescriptor refreshTaskDescriptor) {
- super(state, loader, refreshTaskDescriptor);
+ private class TestLoadTaskDescriptor extends LoadTaskDescriptor {
+ private TestLoadTaskDescriptor(final State state, final LoaderAndRefresher loader) {
+ super(state, loader);
}
@Override
@@ -123,25 +141,6 @@ public class LoadAlgorithm {
}
}
- private static class RefreshTaskDescriptor extends TaskDescriptor {
- private final LoaderAndRefresher myUiRefresh;
-
- private RefreshTaskDescriptor(final LoaderAndRefresher uiRefresh) {
- super("", Where.AWT);
- myUiRefresh = uiRefresh;
- }
-
- @Override
- public void run(final ContinuationContext context) {
- final StepType stepType = myUiRefresh.flushIntoUI();
- if (StepType.STOP.equals(stepType)) {
- context.cancelEverything();
- } else if (StepType.PAUSE.equals(stepType)) {
- context.suspend();
- }
- }
- }
-
public static enum LoadType {
TEST(true, false),
FULL_START(false, true),
@@ -191,21 +190,19 @@ public class LoadAlgorithm {
}
}
- private static class LoaderFactory implements Convertor {
+ private class LoaderFactory implements Convertor {
private final LoaderAndRefresher myLoader;
- private final RefreshTaskDescriptor myRefreshTaskDescriptor;
private LoaderFactory(final LoaderAndRefresher loader) {
myLoader = loader;
- myRefreshTaskDescriptor = new RefreshTaskDescriptor(loader);
}
@Override
public LoadTaskDescriptor convert(final State state) {
if (LoadType.TEST.equals(state.myValue)) {
- return new TestLoadTaskDescriptor(state, myLoader, myRefreshTaskDescriptor);
+ return new TestLoadTaskDescriptor(state, myLoader);
}
- return new LoadTaskDescriptor(state, myLoader, myRefreshTaskDescriptor);
+ return new LoadTaskDescriptor(state, myLoader);
}
}
diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/LoadController.java b/plugins/git4idea/src/git4idea/history/wholeTree/LoadController.java
index 2c799d170639..222a37b9c8af 100644
--- a/plugins/git4idea/src/git4idea/history/wholeTree/LoadController.java
+++ b/plugins/git4idea/src/git4idea/history/wholeTree/LoadController.java
@@ -13,6 +13,9 @@
package git4idea.history.wholeTree;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.progress.ProgressManager;
+import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vcs.CalledInAwt;
@@ -29,6 +32,7 @@ import git4idea.history.GitHistoryUtils;
import git4idea.history.NewGitUsersComponent;
import git4idea.history.browser.ChangesFilter;
import git4idea.history.browser.SymbolicRefsI;
+import org.jetbrains.annotations.NotNull;
import java.util.*;
@@ -105,26 +109,49 @@ public class LoadController implements Loader {
oldContinuation.clearQueue();
}
- final Continuation continuation = Continuation.createFragmented(myProject, true);
- continuation.add(Arrays.asList(new RepositoriesSorter(list, shortLoaders, continuation)));
- continuation.resume();
+ final RepositoriesSorter sorter = new RepositoriesSorter(list, shortLoaders); // this will set previous algorithm for stop
+
+ final Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ final Continuation continuation = Continuation.createForCurrentProgress(myProject, true, "Load git log data");
+ sorter.setContinuation(continuation);
+ continuation.add(Arrays.asList(sorter));
+ continuation.resume();
+ }
+ };
+ loadUnderProgress(runnable);
+ }
+
+ private void loadUnderProgress(final Runnable runnable) {
+ ProgressManager.getInstance().run(new Task.Backgroundable(myProject, "Load git log data", true) {
+ @Override
+ public void run(@NotNull ProgressIndicator indicator) {
+ runnable.run();
+ }
+ });
}
private class RepositoriesSorter extends TaskDescriptor {
private final List> mySimpleLoaders;
private final List myShortLoaders;
- private final Continuation myContinuation;
+ private Continuation myContinuation;
- private RepositoriesSorter(final List> simpleLoaders, final List shortLoaders,
- final Continuation continuation) {
+ private RepositoriesSorter(final List> simpleLoaders, final List shortLoaders) {
super("Order repositories", Where.POOLED);
mySimpleLoaders = simpleLoaders;
myShortLoaders = shortLoaders;
+ myPreviousAlgorithm = new LoadAlgorithm(myProject, mySimpleLoaders, myShortLoaders, myGitCommitsSequentially);
+ }
+
+ private void setContinuation(Continuation continuation) {
myContinuation = continuation;
+ myPreviousAlgorithm.setContinuation(continuation);
}
@Override
public void run(ContinuationContext context) {
+ assert myContinuation != null;
final Map map = new HashMap();
for (ByRootLoader shortLoader : myShortLoaders) {
final VirtualFile root = shortLoader.getRootHolder().getRoot();
@@ -161,7 +188,6 @@ public class LoadController implements Loader {
}
});
- myPreviousAlgorithm = new LoadAlgorithm(myProject, mySimpleLoaders, myShortLoaders, myContinuation, myGitCommitsSequentially);
myPreviousAlgorithm.fillContinuation();
}
}
@@ -169,7 +195,12 @@ public class LoadController implements Loader {
@Override
public void resume() {
assert myPreviousAlgorithm != null;
- myPreviousAlgorithm.resume();
+ loadUnderProgress(new Runnable() {
+ @Override
+ public void run() {
+ myPreviousAlgorithm.resume();
+ }
+ });
}
private List filterNumbers(final String[] s) {
diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/MediatorImpl.java b/plugins/git4idea/src/git4idea/history/wholeTree/MediatorImpl.java
index 3b4a88703a8a..b7421d508676 100644
--- a/plugins/git4idea/src/git4idea/history/wholeTree/MediatorImpl.java
+++ b/plugins/git4idea/src/git4idea/history/wholeTree/MediatorImpl.java
@@ -25,6 +25,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Processor;
import com.intellij.util.Ticket;
import com.intellij.util.containers.Convertor;
+import com.intellij.util.ui.UIUtil;
import git4idea.history.browser.CachedRefs;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
@@ -131,8 +132,13 @@ public class MediatorImpl implements Mediator {
@Override
public void oneFinished() {
if (myController.isEmpty()) {
- myUIRefresh.finished();
- myTableWrapper.finished();
+ UIUtil.invokeLaterIfNeeded(new Runnable() {
+ @Override
+ public void run() {
+ myUIRefresh.finished();
+ myTableWrapper.finished();
+ }
+ });
}
}
@@ -193,7 +199,7 @@ public class MediatorImpl implements Mediator {
}
}));
filters.setUseOnlyHashes(true);
- myLoader.loadSkeleton(myTicket.copy(), rootsHolder, Collections.emptyList(), filters, myController, false);
+ myLoader.loadSkeleton(myTicket.copy(), rootsHolder, Collections.emptyList(), filters, myController, true);
} else {
myUIRefresh.finished();
myTableWrapper.finished();
@@ -242,7 +248,8 @@ public class MediatorImpl implements Mediator {
}
@NonNls public static final String GIT_LOG_PAGE_SIZE = "git.log.page.size";
- public final static int ourManyLoadedStep = (! pageSizeOk(Integer.getInteger(GIT_LOG_PAGE_SIZE))) ? 1000 : Integer.getInteger(
+ public static final int ourDefaultPageSize = 1000;
+ public final static int ourManyLoadedStep = (! pageSizeOk(Integer.getInteger(GIT_LOG_PAGE_SIZE))) ? ourDefaultPageSize : Integer.getInteger(
GIT_LOG_PAGE_SIZE);
private static class SequenceSupportBuffer {
diff --git a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
index d52371263a32..0e3b7175ccd6 100644
--- a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
+++ b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -16,6 +16,7 @@
package git4idea.ui;
import com.intellij.CommonBundle;
+import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType;
@@ -239,8 +240,7 @@ public class GitUnstashDialog extends DialogWrapper {
*/
private void addStashParameter(@NotNull GitHandler handler, @NotNull String stash) {
if (GitVersionSpecialty.NEEDS_QUOTES_IN_STASH_NAME.existsIn(myVcs.getVersion())) {
- handler.addParameters("\"" + stash + "\"");
- handler.dontEscapeQuotes();
+ handler.addParameters(GeneralCommandLine.inescapableQuote(stash));
}
else {
handler.addParameters(stash);
diff --git a/plugins/gradle/src/META-INF/plugin.xml b/plugins/gradle/src/META-INF/plugin.xml
index 41a8d54d8990..1c6dffafb409 100644
--- a/plugins/gradle/src/META-INF/plugin.xml
+++ b/plugins/gradle/src/META-INF/plugin.xml
@@ -45,12 +45,15 @@
-
+
+
+
+
@@ -59,6 +62,8 @@
serviceImplementation="org.jetbrains.plugins.gradle.notification.GradleProgressNotificationManagerImpl"/>
+
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleAbstractConflictingPropertyChange.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleAbstractConflictingPropertyChange.java
index ed49c1d9f3a6..9b3b50d727c2 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleAbstractConflictingPropertyChange.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleAbstractConflictingPropertyChange.java
@@ -35,17 +35,17 @@ public abstract class GradleAbstractConflictingPropertyChange extends GradleA
@NotNull private final GradleEntityId myEntityId;
@NotNull private final String myPropertyDescription;
@NotNull private final T myGradleValue;
- @NotNull private final T myIntellijValue;
+ @NotNull private final T myIdeValue;
public GradleAbstractConflictingPropertyChange(@NotNull GradleEntityId id,
@NotNull String propertyDescription,
@NotNull T gradleValue,
- @NotNull T intellijValue)
+ @NotNull T ideValue)
{
myEntityId = id;
myPropertyDescription = propertyDescription;
myGradleValue = gradleValue;
- myIntellijValue = intellijValue;
+ myIdeValue = ideValue;
}
@NotNull
@@ -54,7 +54,7 @@ public abstract class GradleAbstractConflictingPropertyChange extends GradleA
}
/**
- * @return target property's value at Gradle side
+ * @return target property's value at Gradle side
*/
@NotNull
public T getGradleValue() {
@@ -62,18 +62,18 @@ public abstract class GradleAbstractConflictingPropertyChange extends GradleA
}
/**
- * @return target property's value at IntelliJ IDEA side
+ * @return target property's value at ide side
*/
@NotNull
- public T getIntellijValue() {
- return myIntellijValue;
+ public T getIdeValue() {
+ return myIdeValue;
}
@Override
public int hashCode() {
int result = 31 * super.hashCode() + myEntityId.hashCode();
result = 31 * result + myGradleValue.hashCode();
- return 31 * result + myIntellijValue.hashCode();
+ return 31 * result + myIdeValue.hashCode();
}
@Override
@@ -84,11 +84,11 @@ public abstract class GradleAbstractConflictingPropertyChange extends GradleA
GradleAbstractConflictingPropertyChange that = (GradleAbstractConflictingPropertyChange)o;
- return myEntityId.equals(that.myEntityId) && myGradleValue.equals(that.myGradleValue) && myIntellijValue.equals(that.myIntellijValue);
+ return myEntityId.equals(that.myEntityId) && myGradleValue.equals(that.myGradleValue) && myIdeValue.equals(that.myIdeValue);
}
@Override
public String toString() {
- return String.format("%s change: gradle='%s', intellij='%s'", myPropertyDescription, myGradleValue, myIntellijValue);
+ return String.format("%s change: gradle='%s', ide='%s'", myPropertyDescription, myGradleValue, myIdeValue);
}
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleAbstractEntityPresenceChange.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleAbstractEntityPresenceChange.java
index cbb2f9bb6423..a8015ac8c844 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleAbstractEntityPresenceChange.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleAbstractEntityPresenceChange.java
@@ -30,32 +30,32 @@ import org.jetbrains.annotations.Nullable;
public abstract class GradleAbstractEntityPresenceChange extends GradleAbstractProjectStructureChange {
private final T myGradleEntity;
- private final T myIntellijEntity;
+ private final T myIdeEntity;
private final String myEntityName;
/**
* Creates new GradleEntityPresenceChange project.
*
* @param gradleEntity target entity at Gradle side. null as indication that the entity was removed at Gradle side
- * or added at IntelliJ side
- * @param intellijEntity target entity at IntelliJ IDEA side. null as indication that the entity was removed
- * at IntelliJ IDEA side or added at IntelliJ side
+ * or added at ide side
+ * @param ideEntity target entity at ide side. null as indication that the entity was removed
+ * at ide side or added at ide side
* @throws IllegalArgumentException if both of the given entities are defined or undefined. Expecting this constructor to be
* called with one null argument and one non-null argument
*/
public GradleAbstractEntityPresenceChange(@NotNull String entityName,
@Nullable T gradleEntity,
- @Nullable T intellijEntity)
+ @Nullable T ideEntity)
throws IllegalArgumentException
{
- if (!(gradleEntity == null ^ intellijEntity == null)) {
+ if (!(gradleEntity == null ^ ideEntity == null)) {
throw new IllegalArgumentException(String.format(
- "Can't construct %s object. Reason: expected that only gradle or intellij entity is null, actual: gradle='%s'; intellij='%s'",
- getClass(), gradleEntity, intellijEntity
+ "Can't construct %s object. Reason: expected that only gradle or ide entity is null, actual: gradle='%s'; ide='%s'",
+ getClass(), gradleEntity, ideEntity
));
}
myGradleEntity = gradleEntity;
- myIntellijEntity = intellijEntity;
+ myIdeEntity = ideEntity;
myEntityName = entityName;
}
@@ -65,15 +65,15 @@ public abstract class GradleAbstractEntityPresenceChange extends GradleAbstra
}
@Nullable
- public T getIntellijEntity() {
- return myIntellijEntity;
+ public T getIdeEntity() {
+ return myIdeEntity;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (myGradleEntity != null ? myGradleEntity.hashCode() : 0);
- return 31 * result + (myIntellijEntity != null ? myIntellijEntity.hashCode() : 0);
+ return 31 * result + (myIdeEntity != null ? myIdeEntity.hashCode() : 0);
}
@SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
@@ -84,13 +84,13 @@ public abstract class GradleAbstractEntityPresenceChange extends GradleAbstra
GradleAbstractEntityPresenceChange that = (GradleAbstractEntityPresenceChange)o;
if (myGradleEntity != null ? !myGradleEntity.equals(that.myGradleEntity) : that.myGradleEntity != null) return false;
- if (myIntellijEntity != null ? !myIntellijEntity.equals(that.myIntellijEntity) : that.myIntellijEntity != null) return false;
+ if (myIdeEntity != null ? !myIdeEntity.equals(that.myIdeEntity) : that.myIdeEntity != null) return false;
return true;
}
@Override
public String toString() {
- return String.format("%s presence change: gradle='%s', intellij='%s'", myEntityName, myGradleEntity, myIntellijEntity);
+ return String.format("%s presence change: gradle='%s', ide='%s'", myEntityName, myGradleEntity, myIdeEntity);
}
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleAbstractProjectStructureChange.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleAbstractProjectStructureChange.java
index f17281be4a6a..895b25e483f9 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleAbstractProjectStructureChange.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleAbstractProjectStructureChange.java
@@ -15,26 +15,12 @@
*/
package org.jetbrains.plugins.gradle.diff;
-import java.util.concurrent.atomic.AtomicBoolean;
-
/**
* @author Denis Zhdanov
* @since 11/15/11 1:33 PM
*/
public abstract class GradleAbstractProjectStructureChange implements GradleProjectStructureChange {
- private final AtomicBoolean myConfirmed = new AtomicBoolean();
-
- @Override
- public boolean isConfirmed() {
- return myConfirmed.get();
- }
-
- @Override
- public void confirm() {
- myConfirmed.set(true);
- }
-
@Override
public int hashCode() {
return 31;
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleChangesCalculationContext.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleChangesCalculationContext.java
index 4df3a92954cc..2048e4e49b1a 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleChangesCalculationContext.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleChangesCalculationContext.java
@@ -2,6 +2,7 @@ package org.jetbrains.plugins.gradle.diff;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.gradle.config.PlatformFacade;
+import org.jetbrains.plugins.gradle.util.GradleLibraryPathTypeMapper;
import java.util.HashSet;
import java.util.Set;
@@ -16,15 +17,19 @@ public class GradleChangesCalculationContext {
@NotNull private final Set myKnownChanges = new HashSet();
@NotNull private final Set myCurrentChanges = new HashSet();
- @NotNull private final PlatformFacade myPlatformFacade;
+ @NotNull private final PlatformFacade myPlatformFacade;
+ @NotNull private final GradleLibraryPathTypeMapper myLibraryPathTypeMapper;
/**
- * @param knownChanges changes between the gradle and intellij project structure that has been known up until now
+ * @param knownChanges changes between the gradle and ide project structure that has been known up until now
* @param platformFacade platform facade to use during the calculations
+ * @param mapper library path type mapper to use during the calculation
*/
public GradleChangesCalculationContext(@NotNull Set knownChanges,
- @NotNull PlatformFacade platformFacade)
+ @NotNull PlatformFacade platformFacade,
+ @NotNull GradleLibraryPathTypeMapper mapper)
{
+ myLibraryPathTypeMapper = mapper;
myKnownChanges.addAll(knownChanges);
myPlatformFacade = platformFacade;
}
@@ -51,4 +56,9 @@ public class GradleChangesCalculationContext {
public PlatformFacade getPlatformFacade() {
return myPlatformFacade;
}
+
+ @NotNull
+ public GradleLibraryPathTypeMapper getLibraryPathTypeMapper() {
+ return myLibraryPathTypeMapper;
+ }
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleDiffUtil.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleDiffUtil.java
index 70dcd38a3819..f8c0ffcb2b0f 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleDiffUtil.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleDiffUtil.java
@@ -13,7 +13,7 @@ import org.jetbrains.plugins.gradle.diff.dependency.GradleModuleDependencyPresen
import org.jetbrains.plugins.gradle.diff.library.GradleJarPresenceChange;
import org.jetbrains.plugins.gradle.diff.module.GradleModulePresenceChange;
import org.jetbrains.plugins.gradle.model.gradle.*;
-import org.jetbrains.plugins.gradle.model.intellij.IntellijEntityVisitor;
+import org.jetbrains.plugins.gradle.model.intellij.IdeEntityVisitor;
import org.jetbrains.plugins.gradle.model.intellij.ModuleAwareContentRoot;
import org.jetbrains.plugins.gradle.util.GradleUtil;
@@ -89,7 +89,7 @@ public class GradleDiffUtil {
/**
* Performs argument type-based dispatch and delegates to one of strongly typed 'buildLocalChanges()' methods.
*
- * @param entity target intellij-local entity that doesn't present at the gradle side
+ * @param entity target ide-local entity that doesn't present at the gradle side
* @param context changes calculation context to use
*/
public static void buildLocalChanges(@NotNull Object entity, @NotNull final GradleChangesCalculationContext context) {
@@ -97,7 +97,7 @@ public class GradleDiffUtil {
buildLocalChanges((GradleEntity)entity, context);
}
else {
- GradleUtil.dispatch(entity, new IntellijEntityVisitor() {
+ GradleUtil.dispatch(entity, new IdeEntityVisitor() {
@Override
public void visit(@NotNull Project project) {
}
@@ -140,39 +140,39 @@ public class GradleDiffUtil {
/**
* Utility method for comparing entity collections. For example, it may be provided with the collection of gradle modules and
- * collection of intellij modules. Matched entities are found and the comparison is delegated to the given 'calculator'.
+ * collection of ide modules. Matched entities are found and the comparison is delegated to the given 'calculator'.
* Corresponding changes are generated for the non-matched (local) changes (e.g. particular library dependency presents
- * at the intellij side but not at the gradle).
+ * at the ide side but not at the gradle).
*
* @param calculator comparison strategy that works with the single entities (not collection of entities)
* @param gradleEntities entities available at the gradle side
- * @param intellijEntities entities available at the intellij side
+ * @param ideEntities entities available at the ide side
* @param context changes calculation context
- * @param target intellij entity type
+ * @param target ide entity type
* @param target gradle entity type
*/
public static void calculate(
@NotNull GradleStructureChangesCalculator calculator,
@NotNull Iterable extends G> gradleEntities,
- @NotNull Iterable extends I> intellijEntities,
+ @NotNull Iterable extends I> ideEntities,
@NotNull GradleChangesCalculationContext context)
{
- Map intellijEntitiesByKeys = new HashMap();
- for (I entity : intellijEntities) {
- final I previous = intellijEntitiesByKeys.put(calculator.getIntellijKey(entity), entity);
+ Map ideEntitiesByKeys = new HashMap();
+ for (I entity : ideEntities) {
+ final I previous = ideEntitiesByKeys.put(calculator.getIdeKey(entity), entity);
assert previous == null;
}
for (G gradleEntity: gradleEntities) {
- I intellijEntity = intellijEntitiesByKeys.remove(calculator.getGradleKey(gradleEntity, context));
- if (intellijEntity == null) {
+ I ideEntity = ideEntitiesByKeys.remove(calculator.getGradleKey(gradleEntity, context));
+ if (ideEntity == null) {
buildLocalChanges(gradleEntity, context);
}
else {
- calculator.calculate(gradleEntity, intellijEntity, context);
+ calculator.calculate(gradleEntity, ideEntity, context);
}
}
- for (I entity : intellijEntitiesByKeys.values()) {
+ for (I entity : ideEntitiesByKeys.values()) {
buildLocalChanges(entity, context);
}
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleProjectStructureChange.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleProjectStructureChange.java
index aca8d344516d..c2f7c341c998 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleProjectStructureChange.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleProjectStructureChange.java
@@ -14,16 +14,6 @@ import org.jetbrains.annotations.NotNull;
*/
public interface GradleProjectStructureChange {
- /**
- * @return true if the change is {@link #confirm() confirmed}; false otherwise
- */
- boolean isConfirmed();
-
- /**
- * Allows to confirm current change, i.e. indicate that end-user checked the change and consider it to remain.
- */
- void confirm();
-
/**
* Allows to perform double-dispatch of the current change object within the given visitor.
*
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleStructureChangesCalculator.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleStructureChangesCalculator.java
index 04feeaa63b4d..f313b6349acd 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleStructureChangesCalculator.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/GradleStructureChangesCalculator.java
@@ -20,49 +20,49 @@ public interface GradleStructureChangesCalculator {
* Calculates changes between the given entities.
*
* @param gradleEntity target gradle entity
- * @param intellijEntity target intellij entity
+ * @param ideEntity target ide entity
* @param context target diff calculation context
*/
- void calculate(@NotNull G gradleEntity, @NotNull I intellijEntity, @NotNull GradleChangesCalculationContext context);
+ void calculate(@NotNull G gradleEntity, @NotNull I ideEntity, @NotNull GradleChangesCalculationContext context);
/**
- * There are three possible situations when we compare a set of gradle entities with a set of intellij entities:
+ * There are three possible situations when we compare a set of gradle entities with a set of ide entities:
*
*
*
particular entity presents only at the gradle side;
- *
particular entity presents only at the intellij side;
- *
particular gradle entity is matched to particular intellij entity (they may have difference in their settings though);
+ *
particular entity presents only at the ide side;
+ *
particular gradle entity is matched to particular ide entity (they may have difference in their settings though);
*
*
*
- * The general idea is to map every item at the given sets of gradle and intellij entities to particular key (both gradle and
- * intellij keys are expected to belong to the same class) and then compare them. Matched keys shows that corresponding
+ * The general idea is to map every item at the given sets of gradle and ide entities to particular key (both gradle and
+ * ide keys are expected to belong to the same class) and then compare them. Matched keys shows that corresponding
* entities should be {@link #calculate(GradleEntity, Object, GradleChangesCalculationContext) compared to each other};
- * non-matched indicate that corresponding entities are gradle- or intellij-local.
+ * non-matched indicate that corresponding entities are gradle- or ide-local.
*
- * This method allows to match intellij entity to the target key.
+ * This method allows to match ide entity to the target key.
*
- * @param entity intellij entity to match
+ * @param entity ide entity to match
* @return key for the given entity
* @see #getGradleKey(GradleEntity, GradleChangesCalculationContext)
*/
@NotNull
- Object getIntellijKey(@NotNull I entity);
+ Object getIdeKey(@NotNull I entity);
/**
- * Serves the same purpose as {@link #getIntellijKey(Object)} but targets gradle entities.
+ * Serves the same purpose as {@link #getIdeKey(Object)} but targets gradle entities.
*
- * There is a possible case that two corresponding gradle and intellij entities differ from each other by the setting that
- * affects the resulting key (e.g. we may use module name as a key for 'module' entities and intellij module name differs from
+ * There is a possible case that two corresponding gradle and ide entities differ from each other by the setting that
+ * affects the resulting key (e.g. we may use module name as a key for 'module' entities and ide module name differs from
* the name of the corresponding gradle module). We need to match only in one direction then (e.g. consider a situation when
- * particular module is named differently at gradle and intellij. We shouldn't consider that change during both
- * {@code intellij-entity -> key} and {@code gradle-entity -> key} mappings because that would produce two different keys).
+ * particular module is named differently at gradle and ide. We shouldn't consider that change during both
+ * {@code ide-entity -> key} and {@code gradle-entity -> key} mappings because that would produce two different keys).
* So, we take into consideration the known changes only during {@code gradle-entity -> key} processing.
*
* @param entity target gradle entity that should be mapped to a key
* @param context changes calculation context
* @return key for the given entity
- * @see #getIntellijKey(Object)
+ * @see #getIdeKey(Object)
*/
@NotNull
Object getGradleKey(@NotNull G entity, @NotNull GradleChangesCalculationContext context);
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/contentroot/GradleContentRootStructureChangesCalculator.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/contentroot/GradleContentRootStructureChangesCalculator.java
index 081037d7baf2..91bb681b9b84 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/contentroot/GradleContentRootStructureChangesCalculator.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/contentroot/GradleContentRootStructureChangesCalculator.java
@@ -16,14 +16,14 @@ public class GradleContentRootStructureChangesCalculator
{
@Override
public void calculate(@NotNull GradleContentRoot gradleEntity,
- @NotNull ModuleAwareContentRoot intellijEntity,
+ @NotNull ModuleAwareContentRoot ideEntity,
@NotNull GradleChangesCalculationContext context)
{
}
@NotNull
@Override
- public Object getIntellijKey(@NotNull ModuleAwareContentRoot entity) {
+ public Object getIdeKey(@NotNull ModuleAwareContentRoot entity) {
return GradleEntityIdMapper.mapEntityToId(entity);
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/GradleAbstractDependencyStructureChangesCalculator.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/GradleAbstractDependencyStructureChangesCalculator.java
index 8053d0939dc2..9131822f65ee 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/GradleAbstractDependencyStructureChangesCalculator.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/GradleAbstractDependencyStructureChangesCalculator.java
@@ -20,16 +20,16 @@ public abstract class GradleAbstractDependencyStructureChangesCalculator
{
@Override
- public void calculate(@NotNull G gradleEntity, @NotNull I intellijEntity, @NotNull GradleChangesCalculationContext context) {
+ public void calculate(@NotNull G gradleEntity, @NotNull I ideEntity, @NotNull GradleChangesCalculationContext context) {
final GradleAbstractDependencyId id = GradleEntityIdMapper.mapEntityToId(gradleEntity);
- if (gradleEntity.getScope() != intellijEntity.getScope()) {
- context.register(new GradleDependencyScopeChange(id, gradleEntity.getScope(), intellijEntity.getScope()));
+ if (gradleEntity.getScope() != ideEntity.getScope()) {
+ context.register(new GradleDependencyScopeChange(id, gradleEntity.getScope(), ideEntity.getScope()));
}
- if (gradleEntity.isExported() != intellijEntity.isExported()) {
- context.register(new GradleDependencyExportedChange(id, gradleEntity.isExported(), intellijEntity.isExported()));
+ if (gradleEntity.isExported() != ideEntity.isExported()) {
+ context.register(new GradleDependencyExportedChange(id, gradleEntity.isExported(), ideEntity.isExported()));
}
- doCalculate(gradleEntity, intellijEntity, context);
+ doCalculate(gradleEntity, ideEntity, context);
}
protected abstract void doCalculate(@NotNull G gradleEntity, @NotNull I intellijEntity, @NotNull GradleChangesCalculationContext context);
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/GradleLibraryDependencyStructureChangesCalculator.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/GradleLibraryDependencyStructureChangesCalculator.java
index 0f1a97570e7e..ad2616c1c0b7 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/GradleLibraryDependencyStructureChangesCalculator.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/GradleLibraryDependencyStructureChangesCalculator.java
@@ -35,12 +35,12 @@ public class GradleLibraryDependencyStructureChangesCalculator
@NotNull
@Override
- public Object getIntellijKey(@NotNull LibraryOrderEntry entity) {
+ public Object getIdeKey(@NotNull LibraryOrderEntry entity) {
final Library library = entity.getLibrary();
if (library == null) {
return "";
}
- return myLibraryCalculator.getIntellijKey(library);
+ return myLibraryCalculator.getIdeKey(library);
}
@NotNull
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/GradleModuleDependencyStructureChangesCalculator.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/GradleModuleDependencyStructureChangesCalculator.java
index 8d868ef57874..477fb766cc62 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/GradleModuleDependencyStructureChangesCalculator.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/dependency/GradleModuleDependencyStructureChangesCalculator.java
@@ -3,7 +3,6 @@ package org.jetbrains.plugins.gradle.diff.dependency;
import com.intellij.openapi.roots.ModuleOrderEntry;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.gradle.diff.GradleChangesCalculationContext;
-import org.jetbrains.plugins.gradle.diff.dependency.GradleAbstractDependencyStructureChangesCalculator;
import org.jetbrains.plugins.gradle.model.gradle.GradleModuleDependency;
/**
@@ -24,7 +23,7 @@ public class GradleModuleDependencyStructureChangesCalculator
@NotNull
@Override
- public Object getIntellijKey(@NotNull ModuleOrderEntry entity) {
+ public Object getIdeKey(@NotNull ModuleOrderEntry entity) {
final String intellijModuleName = entity.getModuleName();
if (intellijModuleName == null) {
return "";
@@ -35,7 +34,6 @@ public class GradleModuleDependencyStructureChangesCalculator
@NotNull
@Override
public Object getGradleKey(@NotNull GradleModuleDependency entity, @NotNull GradleChangesCalculationContext context) {
- // TODO den consider known changes here.
return entity.getTarget().getName();
}
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/library/GradleJarPresenceChange.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/library/GradleJarPresenceChange.java
index 9de59ea9ea93..b1907f579c2d 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/library/GradleJarPresenceChange.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/library/GradleJarPresenceChange.java
@@ -14,9 +14,9 @@ import org.jetbrains.plugins.gradle.util.GradleBundle;
public class GradleJarPresenceChange extends GradleAbstractEntityPresenceChange {
public GradleJarPresenceChange(@Nullable GradleJarId gradleEntity,
- @Nullable GradleJarId intellijEntity) throws IllegalArgumentException
+ @Nullable GradleJarId ideEntity) throws IllegalArgumentException
{
- super(GradleBundle.message("gradle.sync.change.entity.type.jar"), gradleEntity, intellijEntity);
+ super(GradleBundle.message("gradle.sync.change.entity.type.jar"), gradleEntity, ideEntity);
}
@Override
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/library/GradleLibraryStructureChangesCalculator.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/library/GradleLibraryStructureChangesCalculator.java
index cb00e9726044..f4c339858a87 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/library/GradleLibraryStructureChangesCalculator.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/library/GradleLibraryStructureChangesCalculator.java
@@ -31,36 +31,47 @@ public class GradleLibraryStructureChangesCalculator implements GradleStructureC
@Override
public void calculate(@NotNull GradleLibrary gradleEntity,
- @NotNull Library intellijEntity,
+ @NotNull Library ideEntity,
@NotNull GradleChangesCalculationContext context)
{
- final Set gradleBinaryPaths = new HashSet(gradleEntity.getPaths(LibraryPathType.BINARY));
- final Set intellijBinaryPaths = new HashSet();
- for (VirtualFile file : intellijEntity.getFiles(OrderRootType.CLASSES)) {
+ for (LibraryPathType pathType : LibraryPathType.values()) {
+ doCalculate(gradleEntity, pathType, context.getLibraryPathTypeMapper().map(pathType), ideEntity, context);
+ }
+ }
+
+ private void doCalculate(@NotNull GradleLibrary gradleEntity,
+ @NotNull LibraryPathType gradleType,
+ @NotNull OrderRootType ideType,
+ @NotNull Library ideEntity,
+ @NotNull GradleChangesCalculationContext context)
+ {
+ final Set gradleBinaryPaths = new HashSet(gradleEntity.getPaths(gradleType));
+ final Set ideBinaryPaths = new HashSet();
+ for (VirtualFile file : ideEntity.getFiles(ideType)) {
final String path = myPlatformFacade.getLocalFileSystemPath(file);
if (!gradleBinaryPaths.remove(path)) {
- intellijBinaryPaths.add(path);
+ ideBinaryPaths.add(path);
}
}
if (!gradleBinaryPaths.isEmpty()) {
GradleLibraryId libraryId = new GradleLibraryId(GradleEntityOwner.GRADLE, gradleEntity.getName());
for (String path : gradleBinaryPaths) {
- context.register(new GradleJarPresenceChange(new GradleJarId(path, libraryId), null));
+ context.register(new GradleJarPresenceChange(new GradleJarId(path, gradleType, libraryId), null));
}
}
- if (!intellijBinaryPaths.isEmpty()) {
- GradleLibraryId libraryId = new GradleLibraryId(GradleEntityOwner.INTELLIJ, GradleUtil.getLibraryName(intellijEntity));
- for (String path : intellijBinaryPaths) {
- context.register(new GradleJarPresenceChange(null, new GradleJarId(path, libraryId)));
+ if (!ideBinaryPaths.isEmpty()) {
+ GradleLibraryId libraryId = new GradleLibraryId(GradleEntityOwner.IDE, GradleUtil.getLibraryName(ideEntity));
+ for (String path : ideBinaryPaths) {
+ context.register(new GradleJarPresenceChange(null, new GradleJarId(path, gradleType, libraryId)));
}
}
}
@NotNull
@Override
- public Object getIntellijKey(@NotNull Library entity) {
+ public Object getIdeKey(@NotNull Library entity) {
return GradleUtil.getLibraryName(entity);
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/module/GradleModuleStructureChangesCalculator.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/module/GradleModuleStructureChangesCalculator.java
index 4115c65244e3..7f2aeee9e9ca 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/module/GradleModuleStructureChangesCalculator.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/module/GradleModuleStructureChangesCalculator.java
@@ -59,21 +59,21 @@ public class GradleModuleStructureChangesCalculator implements GradleStructureCh
@Override
public void calculate(@NotNull GradleModule gradleEntity,
- @NotNull Module intellijEntity,
+ @NotNull Module ideEntity,
@NotNull GradleChangesCalculationContext context)
{
// Content roots.
final Collection gradleContentRoots = gradleEntity.getContentRoots();
- final Collection intellijContentRoots = context.getPlatformFacade().getContentRoots(intellijEntity);
+ final Collection intellijContentRoots = context.getPlatformFacade().getContentRoots(ideEntity);
GradleDiffUtil.calculate(myContentRootCalculator, gradleContentRoots, intellijContentRoots, context);
// Dependencies.
- checkDependencies(gradleEntity, intellijEntity, context);
+ checkDependencies(gradleEntity, ideEntity, context);
}
@NotNull
@Override
- public Object getIntellijKey(@NotNull Module entity) {
+ public Object getIdeKey(@NotNull Module entity) {
return entity.getName();
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/project/GradleLanguageLevelChange.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/project/GradleLanguageLevelChange.java
index 5d69e1d49dec..93c9b27c798a 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/project/GradleLanguageLevelChange.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/project/GradleLanguageLevelChange.java
@@ -30,7 +30,7 @@ import org.jetbrains.plugins.gradle.util.GradleBundle;
public class GradleLanguageLevelChange extends GradleAbstractConflictingPropertyChange {
public GradleLanguageLevelChange(@NotNull LanguageLevel gradleValue, @NotNull LanguageLevel intellijValue) {
- super(new GradleProjectId(GradleEntityOwner.INTELLIJ), GradleBundle.message("gradle.sync.change.project.language.level.text"),
+ super(new GradleProjectId(GradleEntityOwner.IDE), GradleBundle.message("gradle.sync.change.project.language.level.text"),
gradleValue, intellijValue);
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/project/GradleProjectRenameChange.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/project/GradleProjectRenameChange.java
index 385d708065c0..b8e7e3326e2f 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/project/GradleProjectRenameChange.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/project/GradleProjectRenameChange.java
@@ -16,7 +16,7 @@ import org.jetbrains.plugins.gradle.util.GradleBundle;
public class GradleProjectRenameChange extends GradleAbstractConflictingPropertyChange {
public GradleProjectRenameChange(@NotNull String gradleName, @NotNull String intellijName) {
- super(new GradleProjectId(GradleEntityOwner.INTELLIJ), GradleBundle.message("gradle.sync.change.project.name.text"),
+ super(new GradleProjectId(GradleEntityOwner.IDE), GradleBundle.message("gradle.sync.change.project.name.text"),
gradleName, intellijName);
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/project/GradleProjectStructureChangesCalculator.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/project/GradleProjectStructureChangesCalculator.java
index f999dd659b0c..89f5d491f45b 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/project/GradleProjectStructureChangesCalculator.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/diff/project/GradleProjectStructureChangesCalculator.java
@@ -44,22 +44,22 @@ public class GradleProjectStructureChangesCalculator implements GradleStructureC
@Override
public void calculate(@NotNull GradleProject gradleEntity,
- @NotNull Project intellijEntity,
+ @NotNull Project ideEntity,
@NotNull GradleChangesCalculationContext context)
{
- calculateProjectChanges(gradleEntity, intellijEntity, context.getCurrentChanges());
+ calculateProjectChanges(gradleEntity, ideEntity, context.getCurrentChanges());
final Set extends GradleModule> gradleSubEntities = gradleEntity.getModules();
- final Collection intellijSubEntities = myPlatformFacade.getModules(intellijEntity);
+ final Collection intellijSubEntities = myPlatformFacade.getModules(ideEntity);
GradleDiffUtil.calculate(myModuleChangesCalculator, gradleSubEntities, intellijSubEntities, context);
- LibraryTable libraryTable = myPlatformFacade.getProjectLibraryTable(intellijEntity);
+ LibraryTable libraryTable = myPlatformFacade.getProjectLibraryTable(ideEntity);
GradleDiffUtil.calculate(myLibraryChangesCalculator, gradleEntity.getLibraries(), Arrays.asList(libraryTable.getLibraries()), context);
}
@NotNull
@Override
- public Object getIntellijKey(@NotNull Project entity) {
+ public Object getIdeKey(@NotNull Project entity) {
return entity.getName();
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleDependencyManager.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleDependencyManager.java
index f8ec9ac9121b..77807200391e 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleDependencyManager.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleDependencyManager.java
@@ -68,7 +68,7 @@ public class GradleDependencyManager {
final GradleProjectStructureHelper projectStructureHelper = module.getProject().getComponent(GradleProjectStructureHelper.class);
for (GradleModuleDependency dependency : dependencies) {
final String moduleName = dependency.getName();
- final Module intellijModule = projectStructureHelper.findIntellijModule(moduleName);
+ final Module intellijModule = projectStructureHelper.findIdeModule(moduleName);
if (intellijModule == null) {
assert false;
continue;
@@ -78,7 +78,7 @@ public class GradleDependencyManager {
continue;
}
- ModuleOrderEntry orderEntry = projectStructureHelper.findIntellijModuleDependency(dependency, moduleRootModel);
+ ModuleOrderEntry orderEntry = projectStructureHelper.findIdeModuleDependency(dependency, moduleRootModel);
if (orderEntry == null) {
orderEntry = moduleRootModel.addModuleOrderEntry(intellijModule);
}
@@ -120,7 +120,7 @@ public class GradleDependencyManager {
assert false;
continue;
}
- LibraryOrderEntry orderEntry = helper.findIntellijLibraryDependency(dependency.getName(), moduleRootModel);
+ LibraryOrderEntry orderEntry = helper.findIdeLibraryDependency(dependency.getName(), moduleRootModel);
if (orderEntry == null) {
// We need to get the most up-to-date Library object due to our project model restrictions.
orderEntry = moduleRootModel.addLibraryEntry(library);
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleJarManager.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleJarManager.java
index 0d2b4a6b46bf..614dd7a4d7fe 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleJarManager.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleJarManager.java
@@ -28,7 +28,9 @@ import com.intellij.util.containers.ContainerUtilRt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.gradle.config.PlatformFacade;
import org.jetbrains.plugins.gradle.model.gradle.GradleJar;
+import org.jetbrains.plugins.gradle.model.gradle.LibraryPathType;
import org.jetbrains.plugins.gradle.model.id.GradleLibraryId;
+import org.jetbrains.plugins.gradle.util.GradleLibraryPathTypeMapper;
import org.jetbrains.plugins.gradle.util.GradleLog;
import org.jetbrains.plugins.gradle.util.GradleUtil;
@@ -44,10 +46,12 @@ import java.util.Set;
*/
public class GradleJarManager {
- @NotNull private final PlatformFacade myPlatformFacade;
+ @NotNull private final PlatformFacade myPlatformFacade;
+ @NotNull private final GradleLibraryPathTypeMapper myLibraryPathTypeMapper;
- public GradleJarManager(@NotNull PlatformFacade facade) {
+ public GradleJarManager(@NotNull PlatformFacade facade, @NotNull GradleLibraryPathTypeMapper mapper) {
myPlatformFacade = facade;
+ myLibraryPathTypeMapper = mapper;
}
public void importJar(@NotNull final GradleJar jar, @NotNull final Project project) {
@@ -61,7 +65,8 @@ public class GradleJarManager {
}
Library.ModifiableModel model = library.getModifiableModel();
try {
- for (VirtualFile file : model.getFiles(OrderRootType.CLASSES)) {
+ OrderRootType ideJarType = myLibraryPathTypeMapper.map(jar.getPathType());
+ for (VirtualFile file : model.getFiles(ideJarType)) {
if (jar.getPath().equals(GradleUtil.getLocalFileSystemPath(file))) {
return;
}
@@ -75,7 +80,7 @@ public class GradleJarManager {
return;
}
if (virtualFile.isDirectory()) {
- model.addRoot(virtualFile, OrderRootType.CLASSES);
+ model.addRoot(virtualFile, ideJarType);
}
else {
VirtualFile jarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(virtualFile);
@@ -85,7 +90,7 @@ public class GradleJarManager {
));
return;
}
- model.addRoot(jarRoot, OrderRootType.CLASSES);
+ model.addRoot(jarRoot, ideJarType);
}
}
finally {
@@ -117,7 +122,7 @@ public class GradleJarManager {
Set libraryJars = ContainerUtilRt.newHashSet(entry.getValue());
for (GradleJar jar : entry.getValue()) {
boolean valid = false;
- for (VirtualFile file : library.getFiles(OrderRootType.CLASSES)) {
+ for (VirtualFile file : library.getFiles(myLibraryPathTypeMapper.map(jar.getPathType()))) {
if (jar.getPath().equals(GradleUtil.getLocalFileSystemPath(file))) {
valid = true;
break;
@@ -158,9 +163,12 @@ public class GradleJarManager {
});
Library.ModifiableModel model = library.getModifiableModel();
try {
- for (VirtualFile file : model.getFiles(OrderRootType.CLASSES)) {
- if (pathsToRemove.contains(GradleUtil.getLocalFileSystemPath(file))) {
- model.removeRoot(file.getUrl(), OrderRootType.CLASSES);
+ for (LibraryPathType gradlePathType : LibraryPathType.values()) {
+ OrderRootType idePathType = myLibraryPathTypeMapper.map(gradlePathType);
+ for (VirtualFile file : model.getFiles(idePathType)) {
+ if (pathsToRemove.contains(GradleUtil.getLocalFileSystemPath(file))) {
+ model.removeRoot(file.getUrl(), idePathType);
+ }
}
}
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleLibraryManager.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleLibraryManager.java
index c0b38fae255e..2ea2fcc7927b 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleLibraryManager.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleLibraryManager.java
@@ -1,7 +1,6 @@
package org.jetbrains.plugins.gradle.manage;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.JavadocOrderRootType;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryTable;
@@ -14,6 +13,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.gradle.config.PlatformFacade;
import org.jetbrains.plugins.gradle.model.gradle.GradleLibrary;
import org.jetbrains.plugins.gradle.model.gradle.LibraryPathType;
+import org.jetbrains.plugins.gradle.util.GradleLibraryPathTypeMapper;
import org.jetbrains.plugins.gradle.util.GradleLog;
import org.jetbrains.plugins.gradle.util.GradleUtil;
@@ -26,10 +26,12 @@ import java.util.*;
*/
public class GradleLibraryManager {
- @NotNull private final PlatformFacade myPlatformFacade;
+ @NotNull private final PlatformFacade myPlatformFacade;
+ @NotNull private final GradleLibraryPathTypeMapper myLibraryPathTypeMapper;
- public GradleLibraryManager(@NotNull PlatformFacade platformFacade) {
+ public GradleLibraryManager(@NotNull PlatformFacade platformFacade, @NotNull GradleLibraryPathTypeMapper mapper) {
myPlatformFacade = platformFacade;
+ myLibraryPathTypeMapper = mapper;
}
public void importLibraries(@NotNull Collection extends GradleLibrary> libraries, @NotNull Project project) {
@@ -37,7 +39,7 @@ public class GradleLibraryManager {
importLibrary(library, project);
}
}
-
+
public void importLibrary(@NotNull final GradleLibrary library, @NotNull final Project project) {
Map> libraryFiles = new HashMap>();
for (LibraryPathType pathType : LibraryPathType.values()) {
@@ -45,7 +47,7 @@ public class GradleLibraryManager {
if (paths.isEmpty()) {
continue;
}
- libraryFiles.put(Lazy.LIBRARY_ROOT_MAPPINGS.get(pathType), ContainerUtil.map(paths, new NotNullFunction() {
+ libraryFiles.put(myLibraryPathTypeMapper.map(pathType), ContainerUtil.map(paths, new NotNullFunction() {
@NotNull
@Override
public File fun(String path) {
@@ -119,16 +121,4 @@ public class GradleLibraryManager {
//LibraryTable table = library.getTable();
//table.removeLibrary(library);
}
-
-
- private static class Lazy {
- static final Map LIBRARY_ROOT_MAPPINGS
- = new EnumMap(LibraryPathType.class);
- static {
- LIBRARY_ROOT_MAPPINGS.put(LibraryPathType.BINARY, OrderRootType.CLASSES);
- LIBRARY_ROOT_MAPPINGS.put(LibraryPathType.SOURCE, OrderRootType.SOURCES);
- LIBRARY_ROOT_MAPPINGS.put(LibraryPathType.DOC, JavadocOrderRootType.getInstance());
- assert LibraryPathType.values().length == LIBRARY_ROOT_MAPPINGS.size();
- }
- }
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleLocalNodeManageHelper.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleLocalNodeManageHelper.java
index d034e210d356..4456d5b765a4 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleLocalNodeManageHelper.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleLocalNodeManageHelper.java
@@ -17,7 +17,7 @@ import org.jetbrains.plugins.gradle.model.gradle.*;
import org.jetbrains.plugins.gradle.model.id.GradleContentRootId;
import org.jetbrains.plugins.gradle.model.id.GradleEntityId;
import org.jetbrains.plugins.gradle.model.id.GradleEntityIdMapper;
-import org.jetbrains.plugins.gradle.model.intellij.IntellijEntityVisitor;
+import org.jetbrains.plugins.gradle.model.intellij.IdeEntityVisitor;
import org.jetbrains.plugins.gradle.model.intellij.ModuleAwareContentRoot;
import org.jetbrains.plugins.gradle.sync.GradleProjectStructureHelper;
import org.jetbrains.plugins.gradle.ui.GradleProjectStructureNode;
@@ -139,7 +139,7 @@ public class GradleLocalNodeManageHelper {
}
private void collectModuleEntities(@NotNull GradleModule module, @NotNull Context context) {
- final Module intellijModule = myProjectStructureHelper.findIntellijModule(module);
+ final Module intellijModule = myProjectStructureHelper.findIdeModule(module);
if (intellijModule != null) {
// Already imported
return;
@@ -158,7 +158,7 @@ public class GradleLocalNodeManageHelper {
private void collectContentRoots(@NotNull GradleContentRoot contentRoot, @NotNull Context context) {
final GradleContentRootId id = GradleEntityIdMapper.mapEntityToId(contentRoot);
- final ModuleAwareContentRoot intellijContentRoot = myProjectStructureHelper.findIntellijContentRoot(id);
+ final ModuleAwareContentRoot intellijContentRoot = myProjectStructureHelper.findIdeContentRoot(id);
if (intellijContentRoot != null) {
// Already imported.
return;
@@ -167,14 +167,14 @@ public class GradleLocalNodeManageHelper {
}
private void collectModuleDependencyEntities(@NotNull GradleModuleDependency dependency, @NotNull Context context) {
- final ModuleOrderEntry intellijModuleDependency = myProjectStructureHelper.findIntellijModuleDependency(dependency);
+ final ModuleOrderEntry intellijModuleDependency = myProjectStructureHelper.findIdeModuleDependency(dependency);
if (intellijModuleDependency != null) {
// Already imported.
return;
}
context.dependencies.add(dependency);
final GradleModule gradleModule = dependency.getTarget();
- final Module intellijModule = myProjectStructureHelper.findIntellijModule(gradleModule);
+ final Module intellijModule = myProjectStructureHelper.findIdeModule(gradleModule);
if (intellijModule != null) {
return;
}
@@ -190,7 +190,7 @@ public class GradleLocalNodeManageHelper {
private void collectLibraryDependencyEntities(@NotNull GradleLibraryDependency dependency, @NotNull Context context) {
final LibraryOrderEntry intellijDependency
- = myProjectStructureHelper.findIntellijLibraryDependency(dependency.getOwnerModule().getName(), dependency.getName());
+ = myProjectStructureHelper.findIdeLibraryDependency(dependency.getOwnerModule().getName(), dependency.getName());
Set intellijPaths = ContainerUtilRt.newHashSet();
GradleLibrary gradleLibrary = dependency.getTarget();
Library intellijLibrary = null;
@@ -202,7 +202,7 @@ public class GradleLocalNodeManageHelper {
}
if (intellijLibrary == null) {
- intellijLibrary = myProjectStructureHelper.findIntellijLibrary(gradleLibrary);
+ intellijLibrary = myProjectStructureHelper.findIdeLibrary(gradleLibrary);
}
if (intellijLibrary == null) {
@@ -216,7 +216,7 @@ public class GradleLocalNodeManageHelper {
for (String gradleJarPath : gradleLibrary.getPaths(LibraryPathType.BINARY)) {
if (!intellijPaths.contains(gradleJarPath)) {
- context.jars.add(new GradleJar(gradleJarPath, null, gradleLibrary));
+ context.jars.add(new GradleJar(gradleJarPath, LibraryPathType.BINARY, null, gradleLibrary));
}
}
}
@@ -240,7 +240,7 @@ public class GradleLocalNodeManageHelper {
@Override
public void visit(@NotNull GradleContentRoot contentRoot) {
- final Module intellijModule = myProjectStructureHelper.findIntellijModule(contentRoot.getOwnerModule());
+ final Module intellijModule = myProjectStructureHelper.findIdeModule(contentRoot.getOwnerModule());
if (intellijModule == null) {
GradleLog.LOG.warn(String.format(
"Can't import gradle module content root. Reason: corresponding module is not registered at the current intellij project. "
@@ -263,14 +263,14 @@ public class GradleLocalNodeManageHelper {
@Override
public void visit(@NotNull GradleModuleDependency dependency) {
- final Module module = myProjectStructureHelper.findIntellijModule(dependency.getOwnerModule());
+ final Module module = myProjectStructureHelper.findIdeModule(dependency.getOwnerModule());
assert module != null;
myModuleDependencyManager.importDependency(dependency, module);
}
@Override
public void visit(@NotNull GradleLibraryDependency dependency) {
- final Module module = myProjectStructureHelper.findIntellijModule(dependency.getOwnerModule());
+ final Module module = myProjectStructureHelper.findIdeModule(dependency.getOwnerModule());
assert module != null;
myModuleDependencyManager.importDependency(dependency, module);
}
@@ -284,7 +284,7 @@ public class GradleLocalNodeManageHelper {
final List contentRoots = ContainerUtilRt.newArrayList();
final List dependencies = ContainerUtilRt.newArrayList();
final List jars = ContainerUtilRt.newArrayList();
- IntellijEntityVisitor intellijVisitor = new IntellijEntityVisitor() {
+ IdeEntityVisitor intellijVisitor = new IdeEntityVisitor() {
@Override public void visit(@NotNull Project project) { }
@Override public void visit(@NotNull Module module) { modules.add(module); }
@Override public void visit(@NotNull ModuleAwareContentRoot contentRoot) { contentRoots.add(contentRoot); }
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleProjectImportBuilder.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleProjectImportBuilder.java
index e57379e6cae3..aefb78dbd352 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleProjectImportBuilder.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/manage/GradleProjectImportBuilder.java
@@ -237,7 +237,7 @@ public class GradleProjectImportBuilder extends ProjectImportBuilder
+ * Target use-case: gradle uses gradle version-specific file system directory for holding downloaded library dependencies.
+ * I.e. when we build project info with gradle of version X, it puts all jars into directory Dx. But when gradle version is
+ * changed to Y, it will store all jars into directory Dy (different from Dx). So, following scenario is possible:
+ *
+ *
+ *
A user imports IJ project from gradle v.X;
+ *
All necessary jars are downloaded and stored at Dx;
+ *
A user switched gradle to version Y;
+ *
+ * When the project is refreshed we have a number of changes like 'gradle-local jar with location at Dy' and
+ * 'intellij-local jar with location at Dx';
+ *
+ *
+ *
+ * We want to avoid that by auto-adjusting intellij library path config within the moved jars info.
+ *
+ * Thread-safe.
+ *
+ * @author Denis Zhdanov
+ * @since 1/16/13 6:19 PM
+ */
+public class GradleMovedJarsPostProcessor implements GradleProjectStructureChangesPostProcessor {
+
+ @NotNull private final GradleJarManager myJarManager;
+
+ public GradleMovedJarsPostProcessor(@NotNull GradleJarManager manager) {
+ myJarManager = manager;
+ }
+
+ @Override
+ public void processChanges(@NotNull final Collection changes, @NotNull final Project project) {
+ final Collection toMerge = buildMergeData(changes, project.getComponent(GradleProjectStructureContext.class));
+ if (toMerge == null) {
+ return;
+ }
+
+ Runnable mergeTask = new Runnable() {
+ @Override
+ public void run() {
+ for (MergeInfo info : toMerge) {
+ myJarManager.removeJars(Collections.singleton(info.ideJar), project);
+ myJarManager.importJar(info.gradleJar, project);
+ changes.removeAll(info.changes);
+ }
+ }
+ };
+ doMerge(mergeTask, project);
+ }
+
+ /**
+ * This method is introduced in order to allow to cut 'Execute EDT/Execute under write action' etc stuff during test execution.
+ *
+ * @param mergeTask merge changes function object
+ * @param project target project
+ */
+ public void doMerge(@NotNull final Runnable mergeTask, @NotNull final Project project) {
+ GradleUtil.executeProjectChangeAction(project, mergeTask, true, new Runnable() {
+ @Override
+ public void run() {
+ ProjectRootManagerEx.getInstanceEx(project).mergeRootsChangesDuring(mergeTask);
+ }
+ });
+ }
+
+ @Nullable
+ static Collection buildMergeData(@NotNull Collection changes,
+ @NotNull GradleProjectStructureContext context)
+ {
+ final Map> changesByLibrary = ContainerUtilRt.newHashMap();
+ GradleProjectStructureChangeVisitor visitor = new GradleProjectStructureChangeVisitorAdapter() {
+ @Override
+ public void visit(@NotNull GradleJarPresenceChange change) {
+ GradleJarId id = change.getIdeEntity();
+ if (id == null) {
+ id = change.getGradleEntity();
+ }
+ assert id != null;
+ String libraryName = id.getLibraryId().getLibraryName();
+ Set c = changesByLibrary.get(libraryName);
+ if (c == null) {
+ changesByLibrary.put(libraryName, c = ContainerUtilRt.newHashSet());
+ }
+ c.add(change);
+ }
+ };
+ for (GradleProjectStructureChange change : changes) {
+ change.invite(visitor);
+ }
+
+ final Collection toMerge = ContainerUtilRt.newArrayList();
+ for (Set c : changesByLibrary.values()) {
+ processLibraryJarChanges(c, context, toMerge);
+ }
+ if (toMerge.isEmpty()) {
+ return null;
+ }
+ return toMerge;
+ }
+
+ private static void processLibraryJarChanges(@NotNull Set changes,
+ @NotNull GradleProjectStructureContext context,
+ @NotNull Collection toMerge)
+ {
+ Map> gradleLocalJars = ContainerUtilRt.newHashMap();
+ Map> ideLocalJars = ContainerUtilRt.newHashMap();
+ for (GradleJarPresenceChange change : changes) {
+ Map> storageToUse = gradleLocalJars;
+ GradleJarId entity = change.getGradleEntity();
+ if (entity == null) {
+ entity = change.getIdeEntity();
+ assert entity != null;
+ storageToUse = ideLocalJars;
+ }
+ GradleArtifactInfo artifactInfo = GradleUtil.parseArtifactInfo(entity.getPath());
+ if (artifactInfo != null) {
+ Map m = storageToUse.get(entity.getLibraryPathType());
+ if (m == null) {
+ storageToUse.put(entity.getLibraryPathType(), m = ContainerUtilRt.newHashMap());
+ }
+ m.put(artifactInfo, change);
+ }
+ }
+
+ for (Map.Entry> entry : gradleLocalJars.entrySet()) {
+ for (GradleArtifactInfo info : entry.getValue().keySet()) {
+ Map m = ideLocalJars.get(entry.getKey());
+ if (m == null) {
+ continue;
+ }
+ GradleJarPresenceChange ideLocalJarChange = m.get(info);
+ if (ideLocalJarChange == null) {
+ continue;
+ }
+ GradleJarId ideJarId = ideLocalJarChange.getIdeEntity();
+ assert ideJarId != null;
+ GradleJar ideJar = ideJarId.mapToEntity(context);
+ if (ideJar == null) {
+ continue;
+ }
+
+ GradleJarPresenceChange gradleLocalJarChange = entry.getValue().get(info);
+ GradleJarId gradleJarId = gradleLocalJarChange.getGradleEntity();
+ assert gradleJarId != null;
+ GradleJar gradleJar = gradleJarId.mapToEntity(context);
+ if (gradleJar == null) {
+ continue;
+ }
+
+ toMerge.add(new MergeInfo(gradleJar, ideJar, gradleLocalJarChange, ideLocalJarChange));
+ }
+ }
+ }
+
+ static class MergeInfo {
+
+ @NotNull public final Collection changes = ContainerUtilRt.newArrayList();
+
+ @NotNull public final GradleJar gradleJar;
+ @NotNull public final GradleJar ideJar;
+
+ MergeInfo(@NotNull GradleJar gradleJar, @NotNull GradleJar ideJar, GradleJarPresenceChange... changes) {
+ this.gradleJar = gradleJar;
+ this.ideJar = ideJar;
+ this.changes.addAll(Arrays.asList(changes));
+ }
+
+ @Override
+ public String toString() {
+ return String.format("jar '%s' for library '%s'", gradleJar.getName(), gradleJar.getLibraryId().getLibraryName());
+ }
+ }
+}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureChangesModel.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureChangesModel.java
index e95dab8dc8d5..b1e5eb160a92 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureChangesModel.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureChangesModel.java
@@ -2,14 +2,18 @@ package org.jetbrains.plugins.gradle.sync;
import com.intellij.openapi.components.AbstractProjectComponent;
import com.intellij.openapi.project.Project;
+import com.intellij.util.containers.ContainerUtilRt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
import org.jetbrains.plugins.gradle.diff.GradleChangesCalculationContext;
import org.jetbrains.plugins.gradle.diff.GradleProjectStructureChange;
import org.jetbrains.plugins.gradle.diff.GradleStructureChangesCalculator;
import org.jetbrains.plugins.gradle.config.PlatformFacade;
import org.jetbrains.plugins.gradle.model.gradle.GradleProject;
+import org.jetbrains.plugins.gradle.util.GradleLibraryPathTypeMapper;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
@@ -25,22 +29,29 @@ import java.util.concurrent.atomic.AtomicReference;
*/
public class GradleProjectStructureChangesModel extends AbstractProjectComponent {
- private final Set myListeners = new CopyOnWriteArraySet();
- private final AtomicReference> myChanges
- = new AtomicReference>(new HashSet());
-
- private final AtomicReference myGradleProject = new AtomicReference();
+ private final Set myListeners =
+ new CopyOnWriteArraySet();
+ private final AtomicReference> myChanges =
+ new AtomicReference>(new HashSet());
+
+ private final AtomicReference myGradleProject = new AtomicReference();
+ private final Collection myPostProcessors = ContainerUtilRt.createEmptyCOWList();
@NotNull private final GradleStructureChangesCalculator myChangesCalculator;
- @NotNull private final PlatformFacade myPlatformFacade;
+ @NotNull private final PlatformFacade myPlatformFacade;
+ @NotNull private final GradleLibraryPathTypeMapper myLibraryPathTypeMapper;
public GradleProjectStructureChangesModel(@NotNull Project project,
@NotNull GradleStructureChangesCalculator changesCalculator,
- @NotNull PlatformFacade platformFacade)
+ @NotNull PlatformFacade platformFacade,
+ @NotNull GradleLibraryPathTypeMapper mapper,
+ @NotNull GradleMovedJarsPostProcessor movedJarsPostProcessor)
{
super(project);
myChangesCalculator = changesCalculator;
myPlatformFacade = platformFacade;
+ myLibraryPathTypeMapper = mapper;
+ myPostProcessors.add(movedJarsPostProcessor);
}
/**
@@ -63,7 +74,10 @@ public class GradleProjectStructureChangesModel extends AbstractProjectComponent
*/
public void update(@NotNull GradleProject gradleProject) {
myGradleProject.set(gradleProject);
- GradleChangesCalculationContext context = getCurrentChangesContext(gradleProject);
+ final GradleChangesCalculationContext context = getCurrentChangesContext(gradleProject);
+ for (GradleProjectStructureChangesPostProcessor processor : myPostProcessors) {
+ processor.processChanges(context.getCurrentChanges(), myProject);
+ }
if (!context.hasNewChanges()) {
return;
}
@@ -81,6 +95,12 @@ public class GradleProjectStructureChangesModel extends AbstractProjectComponent
return myGradleProject.get();
}
+ @NotNull
+ @TestOnly
+ public Collection getPostProcessors() {
+ return myPostProcessors;
+ }
+
/**
* Registers given listener within the current model.
*
@@ -94,7 +114,8 @@ public class GradleProjectStructureChangesModel extends AbstractProjectComponent
@NotNull
public GradleChangesCalculationContext getCurrentChangesContext(@NotNull GradleProject gradleProject) {
- GradleChangesCalculationContext context = new GradleChangesCalculationContext(myChanges.get(), myPlatformFacade);
+ GradleChangesCalculationContext context
+ = new GradleChangesCalculationContext(myChanges.get(), myPlatformFacade, myLibraryPathTypeMapper);
myChangesCalculator.calculate(gradleProject, myProject, context);
return context;
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureChangesPostProcessor.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureChangesPostProcessor.java
new file mode 100644
index 000000000000..914aac966adc
--- /dev/null
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureChangesPostProcessor.java
@@ -0,0 +1,46 @@
+/*
+ * 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 org.jetbrains.plugins.gradle.sync;
+
+import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.gradle.diff.GradleProjectStructureChange;
+
+import java.util.Collection;
+
+/**
+ * Defines contract for entity which is eligible to adjust project structure changes.
+ * E.g. resolve changes (auto-import), transform them (build one 'dependency library is outdated from 'gradle-local library' and
+ * 'intellij-local library' changes etc.
+ *
+ * Implementations of this interface are expected to be thread-safe.
+ *
+ * @author Denis Zhdanov
+ * @since 1/16/13 5:24 PM
+ */
+public interface GradleProjectStructureChangesPostProcessor {
+
+ /**
+ * Callback to provide current post processor with information about current changes and ability to adjust them in-place.
+ *
+ * Note: this callback is assumed to be called from EDT, in order to allow synchronous processing such as
+ * given changes collection's modification is immediately visible to the calling code.
+ *
+ * @param changes current changes which might be adjusted
+ * @param project current intellij project
+ */
+ void processChanges(@NotNull Collection changes, @NotNull Project project);
+}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureHelper.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureHelper.java
index b380cafb198b..972fa5ec0707 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureHelper.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureHelper.java
@@ -14,6 +14,7 @@ import org.jetbrains.plugins.gradle.config.PlatformFacade;
import org.jetbrains.plugins.gradle.model.gradle.*;
import org.jetbrains.plugins.gradle.model.id.*;
import org.jetbrains.plugins.gradle.model.intellij.ModuleAwareContentRoot;
+import org.jetbrains.plugins.gradle.util.GradleLibraryPathTypeMapper;
import org.jetbrains.plugins.gradle.util.GradleUtil;
/**
@@ -24,23 +25,26 @@ import org.jetbrains.plugins.gradle.util.GradleUtil;
*/
public class GradleProjectStructureHelper extends AbstractProjectComponent {
- private final GradleProjectStructureChangesModel myModel;
- private final PlatformFacade myFacade;
+ @NotNull private final GradleProjectStructureChangesModel myModel;
+ @NotNull private final PlatformFacade myFacade;
+ @NotNull private final GradleLibraryPathTypeMapper myLibraryPathTypeMapper;
public GradleProjectStructureHelper(@NotNull Project project,
@NotNull GradleProjectStructureChangesModel model,
- @NotNull PlatformFacade facade)
+ @NotNull PlatformFacade facade,
+ @NotNull GradleLibraryPathTypeMapper mapper)
{
super(project);
myModel = model;
myFacade = facade;
+ myLibraryPathTypeMapper = mapper;
}
-
+
@NotNull
public Project getProject() {
return myProject;
}
-
+
/**
* Allows to answer if target library dependency is still available at the target project.
*
@@ -48,8 +52,8 @@ public class GradleProjectStructureHelper extends AbstractProjectComponent {
* @return true if target library dependency is still available at the target project;
* false otherwise
*/
- public boolean isIntellijLibraryDependencyExist(@NotNull final GradleLibraryDependencyId id) {
- return findIntellijLibraryDependency(id.getOwnerModuleName(), id.getDependencyName()) != null;
+ public boolean isIdeLibraryDependencyExist(@NotNull final GradleLibraryDependencyId id) {
+ return findIdeLibraryDependency(id.getOwnerModuleName(), id.getDependencyName()) != null;
}
/**
@@ -63,24 +67,23 @@ public class GradleProjectStructureHelper extends AbstractProjectComponent {
return findGradleLibraryDependency(id.getOwnerModuleName(), id.getDependencyName()) != null;
}
- public boolean isIntellijModuleDependencyExist(@NotNull final GradleModuleDependencyId id) {
- return findIntellijModuleDependency(id.getOwnerModuleName(), id.getDependencyName()) != null;
+ public boolean isIdeModuleDependencyExist(@NotNull final GradleModuleDependencyId id) {
+ return findIdeModuleDependency(id.getOwnerModuleName(), id.getDependencyName()) != null;
}
public boolean isGradleModuleDependencyExist(@NotNull final GradleModuleDependencyId id) {
- return findIntellijModuleDependency(id.getOwnerModuleName(), id.getDependencyName()) != null;
+ return findIdeModuleDependency(id.getOwnerModuleName(), id.getDependencyName()) != null;
}
@Nullable
- public Module findIntellijModule(@NotNull GradleModule module) {
- // TODO den consider 'merged modules' at the registered project structure changes here.
- return findIntellijModule(module.getName());
+ public Module findIdeModule(@NotNull GradleModule module) {
+ return findIdeModule(module.getName());
}
@Nullable
- public Module findIntellijModule(@NotNull String intellijModuleName) {
+ public Module findIdeModule(@NotNull String ideModuleName) {
for (Module module : myFacade.getModules(myProject)) {
- if (intellijModuleName.equals(module.getName())) {
+ if (ideModuleName.equals(module.getName())) {
return module;
}
}
@@ -116,8 +119,8 @@ public class GradleProjectStructureHelper extends AbstractProjectComponent {
}
@Nullable
- public ModuleAwareContentRoot findIntellijContentRoot(@NotNull GradleContentRootId id) {
- final Module module = findIntellijModule(id.getModuleName());
+ public ModuleAwareContentRoot findIdeContentRoot(@NotNull GradleContentRootId id) {
+ final Module module = findIdeModule(id.getModuleName());
if (module == null) {
return null;
}
@@ -131,29 +134,28 @@ public class GradleProjectStructureHelper extends AbstractProjectComponent {
}
@Nullable
- public Library findIntellijLibrary(@NotNull final GradleLibrary library) {
- return findIntellijLibrary(library.getName());
+ public Library findIdeLibrary(@NotNull final GradleLibrary library) {
+ return findIdeLibrary(library.getName());
}
@Nullable
- public Library findIntellijLibrary(@NotNull String libraryName) {
+ public Library findIdeLibrary(@NotNull String libraryName) {
final LibraryTable libraryTable = myFacade.getProjectLibraryTable(myProject);
- for (Library intellijLibrary : libraryTable.getLibraries()) {
- // TODO den consider 'merged libraries' at the registered project structure changes here.
- if (libraryName.equals(GradleUtil.getLibraryName(intellijLibrary))) {
- return intellijLibrary;
+ for (Library ideLibrary : libraryTable.getLibraries()) {
+ if (libraryName.equals(GradleUtil.getLibraryName(ideLibrary))) {
+ return ideLibrary;
}
}
return null;
}
@Nullable
- public Library findIntellijLibrary(@NotNull String libraryName, @NotNull String jarPath) {
- Library library = findIntellijLibrary(libraryName);
+ public Library findIdeLibrary(@NotNull String libraryName, @NotNull OrderRootType jarType, @NotNull String jarPath) {
+ Library library = findIdeLibrary(libraryName);
if (library == null) {
return null;
}
- for (VirtualFile file : library.getFiles(OrderRootType.CLASSES)) {
+ for (VirtualFile file : library.getFiles(jarType)) {
if (jarPath.equals(GradleUtil.getLocalFileSystemPath(file))) {
return library;
}
@@ -162,22 +164,21 @@ public class GradleProjectStructureHelper extends AbstractProjectComponent {
}
@Nullable
- public LibraryOrderEntry findIntellijLibraryDependency(@NotNull final String moduleName, @NotNull final String libraryName) {
- final Module intellijModule = findIntellijModule(moduleName);
- if (intellijModule == null) {
+ public LibraryOrderEntry findIdeLibraryDependency(@NotNull final String moduleName, @NotNull final String libraryName) {
+ final Module ideModule = findIdeModule(moduleName);
+ if (ideModule == null) {
return null;
}
RootPolicy visitor = new RootPolicy() {
@Override
- public LibraryOrderEntry visitLibraryOrderEntry(LibraryOrderEntry intellijDependency, LibraryOrderEntry value) {
- // TODO den consider 'merged libraries' at the registered project structure changes here.
- if (libraryName.equals(intellijDependency.getLibraryName())) {
- return intellijDependency;
+ public LibraryOrderEntry visitLibraryOrderEntry(LibraryOrderEntry ideDependency, LibraryOrderEntry value) {
+ if (libraryName.equals(ideDependency.getLibraryName())) {
+ return ideDependency;
}
return value;
}
};
- for (OrderEntry entry : myFacade.getOrderEntries(intellijModule)) {
+ for (OrderEntry entry : myFacade.getOrderEntries(ideModule)) {
final LibraryOrderEntry result = entry.accept(visitor, null);
if (result != null) {
return result;
@@ -187,8 +188,8 @@ public class GradleProjectStructureHelper extends AbstractProjectComponent {
}
@Nullable
- public LibraryOrderEntry findIntellijLibraryDependency(@NotNull final String libraryName,
- @NotNull ModifiableRootModel model)
+ public LibraryOrderEntry findIdeLibraryDependency(@NotNull final String libraryName,
+ @NotNull ModifiableRootModel model)
{
for (OrderEntry entry : model.getOrderEntries()) {
if (entry instanceof LibraryOrderEntry) {
@@ -221,12 +222,12 @@ public class GradleProjectStructureHelper extends AbstractProjectComponent {
}
@Nullable
- public GradleLibrary findGradleLibrary(@NotNull String libraryName, @NotNull String jarPath) {
+ public GradleLibrary findGradleLibrary(@NotNull String libraryName, @NotNull LibraryPathType jarType, @NotNull String jarPath) {
GradleLibrary library = findGradleLibrary(libraryName);
if (library == null) {
return null;
}
- return library.getPaths(LibraryPathType.BINARY).contains(jarPath) ? library : null;
+ return library.getPaths(jarType).contains(jarPath) ? library : null;
}
@Nullable
@@ -278,28 +279,27 @@ public class GradleProjectStructureHelper extends AbstractProjectComponent {
}
@Nullable
- public ModuleOrderEntry findIntellijModuleDependency(@NotNull final GradleModuleDependency gradleDependency) {
- return findIntellijModuleDependency(gradleDependency.getOwnerModule().getName(), gradleDependency.getTarget().getName());
+ public ModuleOrderEntry findIdeModuleDependency(@NotNull final GradleModuleDependency gradleDependency) {
+ return findIdeModuleDependency(gradleDependency.getOwnerModule().getName(), gradleDependency.getTarget().getName());
}
@Nullable
- public ModuleOrderEntry findIntellijModuleDependency(@NotNull final String ownerModuleName, @NotNull final String dependencyModuleName) {
- final Module intellijOwnerModule = findIntellijModule(ownerModuleName);
- if (intellijOwnerModule == null) {
+ public ModuleOrderEntry findIdeModuleDependency(@NotNull final String ownerModuleName, @NotNull final String dependencyModuleName) {
+ final Module ideOwnerModule = findIdeModule(ownerModuleName);
+ if (ideOwnerModule == null) {
return null;
}
RootPolicy visitor = new RootPolicy() {
@Override
- public ModuleOrderEntry visitModuleOrderEntry(ModuleOrderEntry intellijDependency, ModuleOrderEntry value) {
- // TODO den consider 'merged modules' at the registered project structure changes here.
- if (dependencyModuleName.equals(intellijDependency.getModuleName())) {
- return intellijDependency;
+ public ModuleOrderEntry visitModuleOrderEntry(ModuleOrderEntry ideDependency, ModuleOrderEntry value) {
+ if (dependencyModuleName.equals(ideDependency.getModuleName())) {
+ return ideDependency;
}
return value;
}
};
- for (OrderEntry orderEntry : myFacade.getOrderEntries(intellijOwnerModule)) {
+ for (OrderEntry orderEntry : myFacade.getOrderEntries(ideOwnerModule)) {
final ModuleOrderEntry result = orderEntry.accept(visitor, null);
if (result != null) {
return result;
@@ -309,7 +309,7 @@ public class GradleProjectStructureHelper extends AbstractProjectComponent {
}
@Nullable
- public ModuleOrderEntry findIntellijModuleDependency(@NotNull GradleModuleDependency dependency, @NotNull ModifiableRootModel model) {
+ public ModuleOrderEntry findIdeModuleDependency(@NotNull GradleModuleDependency dependency, @NotNull ModifiableRootModel model) {
for (OrderEntry entry : model.getOrderEntries()) {
if (entry instanceof ModuleOrderEntry) {
ModuleOrderEntry candidate = (ModuleOrderEntry)entry;
@@ -322,14 +322,14 @@ public class GradleProjectStructureHelper extends AbstractProjectComponent {
}
@Nullable
- public GradleJar findIntellijJar(@NotNull GradleJarId jarId) {
- Library library = findIntellijLibrary(jarId.getLibraryId().getLibraryName());
+ public GradleJar findIdeJar(@NotNull GradleJarId jarId) {
+ Library library = findIdeLibrary(jarId.getLibraryId().getLibraryName());
if (library == null) {
return null;
}
- for (VirtualFile file : library.getFiles(OrderRootType.CLASSES)) {
+ for (VirtualFile file : library.getFiles(myLibraryPathTypeMapper.map(jarId.getLibraryPathType()))) {
if (jarId.getPath().equals(GradleUtil.getLocalFileSystemPath(file))) {
- return new GradleJar(jarId.getPath(), library, null);
+ return new GradleJar(jarId.getPath(), jarId.getLibraryPathType(), library, null);
}
}
return null;
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureTreeModel.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureTreeModel.java
index eda055096227..eee849bf55d1 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureTreeModel.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/GradleProjectStructureTreeModel.java
@@ -238,7 +238,7 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
GradleLibraryId libraryId = node.getDescriptor().getElement().getLibraryId();
for (VirtualFile file : library.getFiles(OrderRootType.CLASSES)) {
- GradleJarId jarId = new GradleJarId(GradleUtil.getLocalFileSystemPath(file), libraryId);
+ GradleJarId jarId = new GradleJarId(GradleUtil.getLocalFileSystemPath(file), LibraryPathType.BINARY, libraryId);
GradleProjectStructureNode jarNode = buildNode(jarId, GradleUtil.extractNameFromPath(jarId.getPath()));
jarNode.getDescriptor().setToolTip(jarId.getPath());
node.add(jarNode);
@@ -361,7 +361,7 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
singleRoot = module == null || module.getContentRoots().size() <= 1;
}
else {
- final Module module = myProjectStructureHelper.findIntellijModule(id.getModuleName());
+ final Module module = myProjectStructureHelper.findIdeModule(id.getModuleName());
singleRoot = module == null || myPlatformFacade.getContentRoots(module).size() <= 1;
}
return buildContentRootNode(id, singleRoot);
@@ -502,7 +502,7 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
Map> gradleJarIds = ContainerUtilRt.newHashMap();
GradleLibraryId libraryId = dependencyNode.getDescriptor().getElement().getLibraryId();
for (String path : gradleLibrary.getPaths(LibraryPathType.BINARY)) {
- GradleJarId jarId = new GradleJarId(path, libraryId);
+ GradleJarId jarId = new GradleJarId(path, LibraryPathType.BINARY, libraryId);
GradleProjectStructureNode jarNode = existingJarNodes.get(jarId);
if (jarNode == null) {
jarNode = buildNode(jarId, GradleUtil.extractNameFromPath(jarId.getPath()));
@@ -513,7 +513,7 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
gradleJarIds.put(jarId, jarNode);
}
- Library intellijLibrary = myProjectStructureHelper.findIntellijLibrary(gradleLibrary);
+ Library intellijLibrary = myProjectStructureHelper.findIdeLibrary(gradleLibrary);
if (intellijLibrary == null) {
for (GradleProjectStructureNode> jarNode : dependencyNode) {
jarNode.setAttributes(GradleTextAttributes.GRADLE_LOCAL_CHANGE);
@@ -522,7 +522,7 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
else {
Set intellijJarIds = ContainerUtilRt.newHashSet();
for (VirtualFile jarFile : intellijLibrary.getFiles(OrderRootType.CLASSES)) {
- GradleJarId jarId = new GradleJarId(GradleUtil.getLocalFileSystemPath(jarFile), libraryId);
+ GradleJarId jarId = new GradleJarId(GradleUtil.getLocalFileSystemPath(jarFile), LibraryPathType.BINARY, libraryId);
if (gradleJarIds.remove(jarId) == null) {
intellijJarIds.add(jarId);
}
@@ -543,10 +543,14 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
GradleJarId jarId = change.getGradleEntity();
TextAttributesKey attributes = GradleTextAttributes.GRADLE_LOCAL_CHANGE;
if (jarId == null) {
- jarId = change.getIntellijEntity();
+ jarId = change.getIdeEntity();
attributes = GradleTextAttributes.INTELLIJ_LOCAL_CHANGE;
assert jarId != null;
}
+ if (jarId.getLibraryPathType() != LibraryPathType.BINARY) {
+ // Ignore non-binary paths (docs, sources) as they are not shown at the JetGradle tool window's project structure view.
+ return;
+ }
if (obsolete) {
attributes = GradleTextAttributes.NO_CHANGE;
}
@@ -563,7 +567,7 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
for (GradleProjectStructureNode jarNode : libraryDependencyNode.getChildren(GradleJarId.class)) {
if (jarNode.getDescriptor().getElement().equals(jarId)) {
- if (obsolete && myProjectStructureHelper.findIntellijJar(jarId) == null) {
+ if (obsolete && myProjectStructureHelper.findIdeJar(jarId) == null) {
// It was a gradle-local change which is now obsolete. Remove the jar node then.
jarNode.removeFromParent();
}
@@ -580,7 +584,7 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
// There is a possible case that both gradle and intellij have a library with the same name but different jar sets.
// We don't want to show intellij-local jars for the gradle-local module which uses that library then.
- if (jarId.getOwner() == GradleEntityOwner.INTELLIJ
+ if (jarId.getOwner() == GradleEntityOwner.IDE
&& myModules.get(entry.getKey()).getDescriptor().getAttributes() == GradleTextAttributes.GRADLE_LOCAL_CHANGE)
{
continue;
@@ -609,7 +613,7 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
I id = change.getGradleEntity();
TextAttributesKey attributes = GradleTextAttributes.GRADLE_LOCAL_CHANGE;
if (id == null) {
- id = change.getIntellijEntity();
+ id = change.getIdeEntity();
attributes = GradleTextAttributes.INTELLIJ_LOCAL_CHANGE;
}
assert id != null;
@@ -639,7 +643,7 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
final GradleModuleId id;
final TextAttributesKey key;
if (change.getGradleEntity() == null) {
- id = change.getIntellijEntity();
+ id = change.getIdeEntity();
key = GradleTextAttributes.INTELLIJ_LOCAL_CHANGE;
}
else {
@@ -659,7 +663,7 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
GradleContentRootId id = change.getGradleEntity();
TextAttributesKey key = GradleTextAttributes.GRADLE_LOCAL_CHANGE;
if (id == null) {
- id = change.getIntellijEntity();
+ id = change.getIdeEntity();
key = GradleTextAttributes.INTELLIJ_LOCAL_CHANGE;
}
assert id != null;
@@ -701,9 +705,9 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
GradleLibraryDependencyId id = change.getGradleEntity();
boolean removeNode;
if (id == null) {
- id = change.getIntellijEntity();
+ id = change.getIdeEntity();
assert id != null;
- removeNode = !myProjectStructureHelper.isIntellijLibraryDependencyExist(id);
+ removeNode = !myProjectStructureHelper.isIdeLibraryDependencyExist(id);
}
else {
removeNode = !myProjectStructureHelper.isGradleLibraryDependencyExist(id);
@@ -715,9 +719,9 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
GradleModuleDependencyId id = change.getGradleEntity();
boolean removeNode;
if (id == null) {
- id = change.getIntellijEntity();
+ id = change.getIdeEntity();
assert id != null;
- removeNode = !myProjectStructureHelper.isIntellijModuleDependencyExist(id);
+ removeNode = !myProjectStructureHelper.isIdeModuleDependencyExist(id);
}
else {
removeNode = !myProjectStructureHelper.isGradleModuleDependencyExist(id);
@@ -762,9 +766,9 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
GradleModuleId id = change.getGradleEntity();
boolean removeNode;
if (id == null) {
- id = change.getIntellijEntity();
+ id = change.getIdeEntity();
assert id != null;
- removeNode = myProjectStructureHelper.findIntellijModule(id.getModuleName()) == null;
+ removeNode = myProjectStructureHelper.findIdeModule(id.getModuleName()) == null;
}
else {
removeNode = myProjectStructureHelper.findGradleModule(id.getModuleName()) == null;
@@ -796,9 +800,9 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
GradleContentRootId id = change.getGradleEntity();
final boolean removeNode;
if (id == null) {
- id = change.getIntellijEntity();
+ id = change.getIdeEntity();
assert id != null;
- removeNode = myProjectStructureHelper.findIntellijContentRoot(id) == null;
+ removeNode = myProjectStructureHelper.findIdeContentRoot(id) == null;
}
else {
removeNode = myProjectStructureHelper.findGradleContentRoot(id) == null;
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleCommonDependencyConflictControlFactory.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleCommonDependencyConflictControlFactory.java
index 621b311cd97d..05c7c7bd12f6 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleCommonDependencyConflictControlFactory.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleCommonDependencyConflictControlFactory.java
@@ -72,11 +72,11 @@ public class GradleCommonDependencyConflictControlFactory {
MatrixControlBuilder builder = GradleUtil.getConflictChangeBuilder();
if (scopeChange != null) {
builder.addRow(GradleBundle.message("gradle.sync.change.dependency.scope.text"),
- scopeChange.getGradleValue(), scopeChange.getIntellijValue());
+ scopeChange.getGradleValue(), scopeChange.getIdeValue());
}
if (exportedChange != null) {
builder.addRow(GradleBundle.message("gradle.sync.change.dependency.exported.text"),
- exportedChange.getGradleValue(), exportedChange.getIntellijValue());
+ exportedChange.getGradleValue(), exportedChange.getIdeValue());
}
return builder.build();
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleConflictControlFactory.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleConflictControlFactory.java
index c456da679920..56d18616c509 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleConflictControlFactory.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleConflictControlFactory.java
@@ -9,7 +9,7 @@ import com.intellij.openapi.util.Ref;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.gradle.diff.GradleProjectStructureChange;
-import org.jetbrains.plugins.gradle.model.intellij.IntellijEntityVisitor;
+import org.jetbrains.plugins.gradle.model.intellij.IdeEntityVisitor;
import org.jetbrains.plugins.gradle.model.intellij.ModuleAwareContentRoot;
import org.jetbrains.plugins.gradle.util.GradleUtil;
@@ -51,7 +51,7 @@ public class GradleConflictControlFactory {
@Nullable
public JComponent getDiffControl(@NotNull Object entity, final @NotNull Collection changes) {
final Ref result = new Ref();
- GradleUtil.dispatch(entity, new IntellijEntityVisitor() {
+ GradleUtil.dispatch(entity, new IdeEntityVisitor() {
@Override
public void visit(@NotNull Project project) {
result.set(myProjectFactory.getControl(changes));
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleProjectConflictControlFactory.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleProjectConflictControlFactory.java
index 822b27fcec3f..d23430a30652 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleProjectConflictControlFactory.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/sync/conflict/GradleProjectConflictControlFactory.java
@@ -58,12 +58,12 @@ public class GradleProjectConflictControlFactory {
MatrixControlBuilder builder = GradleUtil.getConflictChangeBuilder();
if (renameChange != null) {
builder.addRow(GradleBundle.message("gradle.import.structure.settings.label.name"),
- renameChange.getGradleValue(), renameChange.getIntellijValue());
+ renameChange.getGradleValue(), renameChange.getIdeValue());
}
if (languageLevelChange != null) {
builder.addRow(GradleBundle.message("gradle.import.structure.settings.label.language.level"),
- getTextToShow(languageLevelChange.getGradleValue()), getTextToShow(languageLevelChange.getIntellijValue()));
+ getTextToShow(languageLevelChange.getGradleValue()), getTextToShow(languageLevelChange.getIdeValue()));
}
return builder.build();
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/ui/GradleProjectStructureNode.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/ui/GradleProjectStructureNode.java
index cd1855181e5d..93a4350107ec 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/ui/GradleProjectStructureNode.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/ui/GradleProjectStructureNode.java
@@ -1,7 +1,7 @@
package org.jetbrains.plugins.gradle.ui;
import com.intellij.openapi.editor.colors.TextAttributesKey;
-import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.ContainerUtilRt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.gradle.config.GradleTextAttributes;
import org.jetbrains.plugins.gradle.diff.GradleProjectStructureChange;
@@ -21,11 +21,13 @@ import java.util.*;
public class GradleProjectStructureNode extends DefaultMutableTreeNode
implements Iterable> {
- private final Set myConflictChanges = new HashSet();
- private final List myListeners = ContainerUtil.createLockFreeCopyOnWriteList();
+ private final Set myConflictChanges = ContainerUtilRt.newHashSet();
+ // TODO den switch to ContainerUtil.createLockFreeCopyOnWriteList() when v.12.1 is going to be released (preserve JetGradle
+ // TODO compatibility with v.12.0 at the moment)
+ private final List myListeners = ContainerUtilRt.createEmptyCOWList();
@NotNull private final Comparator> myComparator;
- @NotNull private final GradleProjectStructureNodeDescriptor myDescriptor;
+ @NotNull private final GradleProjectStructureNodeDescriptor myDescriptor;
private boolean mySkipNotification;
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/ui/GradleProjectStructureNodeComparator.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/ui/GradleProjectStructureNodeComparator.java
index 1506cad2184e..6ed844968cb2 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/ui/GradleProjectStructureNodeComparator.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/ui/GradleProjectStructureNodeComparator.java
@@ -13,8 +13,8 @@ import org.jetbrains.plugins.gradle.model.GradleEntityOwner;
import org.jetbrains.plugins.gradle.model.GradleEntityType;
import org.jetbrains.plugins.gradle.model.gradle.*;
import org.jetbrains.plugins.gradle.model.id.GradleEntityId;
+import org.jetbrains.plugins.gradle.model.intellij.IdeEntityVisitor;
import org.jetbrains.plugins.gradle.util.GradleProjectStructureContext;
-import org.jetbrains.plugins.gradle.model.intellij.IntellijEntityVisitor;
import org.jetbrains.plugins.gradle.model.intellij.ModuleAwareContentRoot;
import org.jetbrains.plugins.gradle.util.GradleUtil;
@@ -55,10 +55,10 @@ public class GradleProjectStructureNodeComparator implements Comparator exte
owner = GradleEntityOwner.GRADLE;
}
else if (attributes == GradleTextAttributes.NO_CHANGE || attributes == GradleTextAttributes.INTELLIJ_LOCAL_CHANGE) {
- owner = GradleEntityOwner.INTELLIJ;
+ owner = GradleEntityOwner.IDE;
}
myId.setOwner(owner);
update();
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleArtifactInfo.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleArtifactInfo.java
new file mode 100644
index 000000000000..4a286cd013bd
--- /dev/null
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleArtifactInfo.java
@@ -0,0 +1,83 @@
+/*
+ * 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 org.jetbrains.plugins.gradle.util;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Denis Zhdanov
+ * @since 1/16/13 6:26 PM
+ */
+public class GradleArtifactInfo {
+
+ @Nullable private final String myName;
+ @Nullable private final String myGroup;
+ @Nullable private final String myVersion;
+
+ public GradleArtifactInfo(@Nullable String name, @Nullable String group, @Nullable String version) {
+ assert name != null || group != null || version != null;
+ myName = name;
+ myGroup = group;
+ myVersion = version;
+ }
+
+ @Nullable
+ public String getName() {
+ return myName;
+ }
+
+ // Commented to apply to green code policy. Un-comment if required.
+
+ //@Nullable
+ //public String getGroup() {
+ // return myGroup;
+ //}
+ //
+ //@Nullable
+ //public String getVersion() {
+ // return myVersion;
+ //}
+
+ @Override
+ public int hashCode() {
+ int result = myName != null ? myName.hashCode() : 0;
+ result = 31 * result + (myGroup != null ? myGroup.hashCode() : 0);
+ result = 31 * result + (myVersion != null ? myVersion.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ GradleArtifactInfo info = (GradleArtifactInfo)o;
+
+ if (myGroup != null ? !myGroup.equals(info.myGroup) : info.myGroup != null) return false;
+ if (myName != null ? !myName.equals(info.myName) : info.myName != null) return false;
+ if (myVersion != null ? !myVersion.equals(info.myVersion) : info.myVersion != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s:%s:%s",
+ myName == null ? "" : myName,
+ myGroup == null ? "" : myGroup,
+ myVersion == null ? "" : myVersion);
+ }
+}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleLibraryPathTypeMapper.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleLibraryPathTypeMapper.java
new file mode 100644
index 000000000000..64c0cb528fc7
--- /dev/null
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleLibraryPathTypeMapper.java
@@ -0,0 +1,38 @@
+/*
+ * 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 org.jetbrains.plugins.gradle.util;
+
+import com.intellij.openapi.roots.JavadocOrderRootType;
+import com.intellij.openapi.roots.OrderRootType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.gradle.model.gradle.LibraryPathType;
+
+/**
+ * Strategy for mapping {@link LibraryPathType gradle library path types} to {@link OrderRootType ide library path types}.
+ *
+ * Is introduced because {@link JavadocOrderRootType#getInstance() 'real ide doc type'} assumes that project IoC is setup thus
+ * make it ineligible for unit testing.
+ *
+ * Implementations of this interface are expected to be thread-safe.
+ *
+ * @author Denis Zhdanov
+ * @since 1/17/13 3:51 PM
+ */
+public interface GradleLibraryPathTypeMapper {
+
+ @NotNull
+ OrderRootType map(@NotNull LibraryPathType type);
+}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleLibraryPathTypeMapperImpl.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleLibraryPathTypeMapperImpl.java
new file mode 100644
index 000000000000..d84b54acfdde
--- /dev/null
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleLibraryPathTypeMapperImpl.java
@@ -0,0 +1,46 @@
+/*
+ * 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 org.jetbrains.plugins.gradle.util;
+
+import com.intellij.openapi.roots.JavadocOrderRootType;
+import com.intellij.openapi.roots.OrderRootType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.gradle.model.gradle.LibraryPathType;
+
+import java.util.EnumMap;
+import java.util.Map;
+
+/**
+ * @author Denis Zhdanov
+ * @since 1/17/13 3:55 PM
+ */
+public class GradleLibraryPathTypeMapperImpl implements GradleLibraryPathTypeMapper {
+
+ private static final Map MAPPINGS = new EnumMap(LibraryPathType.class);
+
+ static {
+ MAPPINGS.put(LibraryPathType.BINARY, OrderRootType.CLASSES);
+ MAPPINGS.put(LibraryPathType.SOURCE, OrderRootType.SOURCES);
+ MAPPINGS.put(LibraryPathType.DOC, JavadocOrderRootType.getInstance());
+ assert LibraryPathType.values().length == MAPPINGS.size();
+ }
+
+ @NotNull
+ @Override
+ public OrderRootType map(@NotNull LibraryPathType type) {
+ return MAPPINGS.get(type);
+ }
+}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleProjectStructureContext.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleProjectStructureContext.java
index b63aa65034dd..9629f29a0a0b 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleProjectStructureContext.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleProjectStructureContext.java
@@ -18,14 +18,17 @@ public class GradleProjectStructureContext {
@NotNull private final GradleProjectStructureHelper myProjectStructureHelper;
@NotNull private final PlatformFacade myPlatformFacade;
@NotNull private final GradleProjectStructureChangesModel myChangesModel;
+ @NotNull private final GradleLibraryPathTypeMapper myLibraryPathTypeMapper;
public GradleProjectStructureContext(@NotNull GradleProjectStructureHelper projectStructureHelper,
@NotNull PlatformFacade platformFacade,
- @NotNull GradleProjectStructureChangesModel changesModel)
+ @NotNull GradleProjectStructureChangesModel changesModel,
+ @NotNull GradleLibraryPathTypeMapper mapper)
{
myProjectStructureHelper = projectStructureHelper;
myPlatformFacade = platformFacade;
myChangesModel = changesModel;
+ myLibraryPathTypeMapper = mapper;
}
@NotNull
@@ -42,4 +45,9 @@ public class GradleProjectStructureContext {
public GradleProjectStructureChangesModel getChangesModel() {
return myChangesModel;
}
+
+ @NotNull
+ public GradleLibraryPathTypeMapper getLibraryPathTypeMapper() {
+ return myLibraryPathTypeMapper;
+ }
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleUtil.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleUtil.java
index e2d5dec5e8e3..4dab960795e9 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleUtil.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/util/GradleUtil.java
@@ -44,7 +44,7 @@ import org.jetbrains.plugins.gradle.manage.GradleProjectEntityChangeListener;
import org.jetbrains.plugins.gradle.model.gradle.GradleProject;
import org.jetbrains.plugins.gradle.model.id.GradleEntityId;
import org.jetbrains.plugins.gradle.model.id.GradleSyntheticId;
-import org.jetbrains.plugins.gradle.model.intellij.IntellijEntityVisitor;
+import org.jetbrains.plugins.gradle.model.intellij.IdeEntityVisitor;
import org.jetbrains.plugins.gradle.model.intellij.ModuleAwareContentRoot;
import org.jetbrains.plugins.gradle.remote.GradleApiException;
import org.jetbrains.plugins.gradle.sync.GradleProjectStructureTreeModel;
@@ -64,6 +64,8 @@ import java.io.StringWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* Holds miscellaneous utility methods.
@@ -73,8 +75,9 @@ import java.util.concurrent.TimeUnit;
*/
public class GradleUtil {
- public static final String PATH_SEPARATOR = "/";
- public static final String SYSTEM_DIRECTORY_PATH_KEY = "GRADLE_USER_HOME";
+ public static final String PATH_SEPARATOR = "/";
+ public static final String SYSTEM_DIRECTORY_PATH_KEY = "GRADLE_USER_HOME";
+ private static final Pattern ARTIFACT_PATTERN = Pattern.compile(".*/(.+?)(?:-([\\d+](?:\\.[\\d]+)*))?(?:\\.[^\\.]+?)?");
private static final NotNullLazyValue INSTALLATION_MANAGER =
new NotNullLazyValue() {
@@ -220,12 +223,15 @@ public class GradleUtil {
return;
}
assert linkedProjectPath != null;
- Ref errorDetailsHolder = new Ref();
+ Ref errorDetailsHolder = new Ref() {
+ @Override
+ public void set(@Nullable String error) {
+ if (!StringUtil.isEmpty(error)) {
+ GradleLog.LOG.warn(error);
+ }
+ }
+ };
refreshProject(project, linkedProjectPath, errorMessageHolder, errorDetailsHolder, true, false);
- final String error = errorDetailsHolder.get();
- if (!StringUtil.isEmpty(error)) {
- GradleLog.LOG.warn(error);
- }
}
/**
@@ -332,7 +338,7 @@ public class GradleUtil {
* @param entity intellij project entity candidate to dispatch
* @param visitor dispatch callback to use for the given entity
*/
- public static void dispatch(@Nullable Object entity, @NotNull IntellijEntityVisitor visitor) {
+ public static void dispatch(@Nullable Object entity, @NotNull IdeEntityVisitor visitor) {
if (entity instanceof Project) {
visitor.visit(((Project)entity));
}
@@ -518,12 +524,30 @@ public class GradleUtil {
public static void executeProjectChangeAction(@NotNull Project project, @NotNull Object entityToChange, @NotNull Runnable task) {
- executeProjectChangeAction(project, Collections.singleton(entityToChange), task);
+ executeProjectChangeAction(project, entityToChange, false, task);
+ }
+
+ public static void executeProjectChangeAction(@NotNull Project project,
+ @NotNull Object entityToChange,
+ boolean synchronous,
+ @NotNull Runnable task)
+ {
+ executeProjectChangeAction(project, Collections.singleton(entityToChange), synchronous, task);
+ }
+
+ public static void executeProjectChangeAction(@NotNull final Project project,
+ @NotNull final Iterable> entitiesToChange,
+ @NotNull final Runnable task)
+ {
+ executeProjectChangeAction(project, entitiesToChange, false, task);
}
- public static void executeProjectChangeAction(@NotNull final Project project, @NotNull final Iterable> entitiesToChange, @NotNull final Runnable task) {
- UIUtil.invokeLaterIfNeeded(new Runnable() {
- @Override
+ public static void executeProjectChangeAction(@NotNull final Project project,
+ @NotNull final Iterable> entitiesToChange,
+ boolean synchronous,
+ @NotNull final Runnable task)
+ {
+ Runnable wrappedTask = new Runnable() {
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
@@ -539,11 +563,27 @@ public class GradleUtil {
for (Object e : entitiesToChange) {
publisher.onChangeEnd(e);
}
- }
+ }
}
});
}
- });
+ };
+
+ if (synchronous) {
+ UIUtil.invokeAndWaitIfNeeded(wrappedTask);
+ }
+ else {
+ UIUtil.invokeLaterIfNeeded(wrappedTask);
+ }
+ }
+
+ @Nullable
+ public static GradleArtifactInfo parseArtifactInfo(@NotNull String fileName) {
+ Matcher matcher = ARTIFACT_PATTERN.matcher(fileName);
+ if (!matcher.matches()) {
+ return null;
+ }
+ return new GradleArtifactInfo(matcher.group(1), null, matcher.group(2));
}
private interface TaskUnderProgress {
diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/manage/GradleLocalNodeManageHelperTest.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/manage/GradleLocalNodeManageHelperTest.groovy
index cc436dad1d4c..7077b657f2d9 100644
--- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/manage/GradleLocalNodeManageHelperTest.groovy
+++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/manage/GradleLocalNodeManageHelperTest.groovy
@@ -3,6 +3,7 @@ package org.jetbrains.plugins.gradle.manage;
import org.jetbrains.plugins.gradle.model.id.GradleEntityIdMapper
import org.jetbrains.plugins.gradle.testutil.AbstractGradleTest
+import org.junit.Before
import org.junit.Test
import org.picocontainer.MutablePicoContainer
@@ -17,13 +18,18 @@ import static org.junit.Assert.fail
public class GradleLocalNodeManageHelperTest extends AbstractGradleTest {
private GradleLocalNodeManageHelper myHelper
+
+ @Before
+ public void setUp() {
+ super.setUp();
+ clearChangePostProcessors()
+ }
@Override
protected void configureContainer(MutablePicoContainer container) {
container.registerComponentImplementation(GradleLocalNodeManageHelper)
container.registerComponentImplementation(GradleModuleManager)
container.registerComponentImplementation(GradleLibraryManager)
- container.registerComponentImplementation(GradleJarManager)
container.registerComponentImplementation(GradleDependencyManager)
container.registerComponentImplementation(GradleContentRootManager)
}
diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/GradleMovedJarsPostProcessorTest.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/GradleMovedJarsPostProcessorTest.groovy
new file mode 100644
index 000000000000..593ef13adc18
--- /dev/null
+++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/GradleMovedJarsPostProcessorTest.groovy
@@ -0,0 +1,71 @@
+/*
+ * 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 org.jetbrains.plugins.gradle.sync
+
+import com.intellij.openapi.roots.libraries.Library
+import org.jetbrains.plugins.gradle.manage.GradleJarManager
+import org.jetbrains.plugins.gradle.model.gradle.GradleJar
+import org.jetbrains.plugins.gradle.model.gradle.GradleLibrary
+import org.jetbrains.plugins.gradle.model.gradle.LibraryPathType
+import org.jetbrains.plugins.gradle.testutil.AbstractGradleTest
+import org.jetbrains.plugins.gradle.util.GradleUtil
+import org.jetbrains.plugins.gradle.util.TestGradleJarManager
+import org.junit.Assert
+import org.junit.Test
+
+/**
+ * @author Denis Zhdanov
+ * @since 1/17/13 4:40 PM
+ */
+class GradleMovedJarsPostProcessorTest extends AbstractGradleTest {
+
+ @Test
+ void "moved jar matched"() {
+ init(
+ gradle: {
+ project {
+ module {
+ dependencies {
+ library('lib1', bin: ['repo1/jar1', 'repo1/jar2'], src: [ 'repo1/zip1', 'repo1/zip2']) }}}},
+ intellij: {
+ project {
+ module {
+ dependencies {
+ library('lib1', bin: ['repo2/jar1', 'repo2/jar2'], src: [ 'repo2/zip1', 'repo2/zip2']) }}}}
+ )
+
+ checkChanges { }
+
+ def gradleLibrary = gradle.libraries['lib1'] as GradleLibrary
+ def ideLibrary = intellij.libraries['lib1'] as Library
+ def expectedImported = [
+ new GradleJar(GradleUtil.toCanonicalPath('repo1/jar1'), LibraryPathType.BINARY, null, gradleLibrary),
+ new GradleJar(GradleUtil.toCanonicalPath('repo1/jar2'), LibraryPathType.BINARY, null, gradleLibrary),
+ new GradleJar(GradleUtil.toCanonicalPath('repo1/zip1'), LibraryPathType.SOURCE, null, gradleLibrary),
+ new GradleJar(GradleUtil.toCanonicalPath('repo1/zip2'), LibraryPathType.SOURCE, null, gradleLibrary),
+ ]
+
+ def expectedRemoved = [
+ new GradleJar(GradleUtil.toCanonicalPath('repo2/jar1'), LibraryPathType.BINARY, ideLibrary, null),
+ new GradleJar(GradleUtil.toCanonicalPath('repo2/jar2'), LibraryPathType.BINARY, ideLibrary, null),
+ new GradleJar(GradleUtil.toCanonicalPath('repo2/zip1'), LibraryPathType.SOURCE, ideLibrary, null),
+ new GradleJar(GradleUtil.toCanonicalPath('repo2/zip2'), LibraryPathType.SOURCE, ideLibrary, null),
+ ]
+ TestGradleJarManager jarManager = container.getComponentInstance(GradleJarManager)
+ Assert.assertEquals(expectedImported.toSet(), jarManager.importedJars.toSet())
+ Assert.assertEquals(expectedRemoved.toSet(), jarManager.removedJars.toSet())
+ }
+}
diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/GradleProjectStructureChangesModelTest.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/GradleProjectStructureChangesModelTest.groovy
index b1836fe4d600..41bae71d576e 100644
--- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/GradleProjectStructureChangesModelTest.groovy
+++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/GradleProjectStructureChangesModelTest.groovy
@@ -5,6 +5,7 @@ import com.intellij.testFramework.SkipInHeadlessEnvironment
import org.jetbrains.plugins.gradle.diff.library.GradleJarPresenceChange
import org.jetbrains.plugins.gradle.diff.module.GradleModulePresenceChange
import org.jetbrains.plugins.gradle.testutil.AbstractGradleTest
+import org.junit.Before
import org.junit.Test
import static org.junit.Assert.assertEquals
@@ -18,6 +19,12 @@ import org.jetbrains.plugins.gradle.config.GradleTextAttributes
@SkipInHeadlessEnvironment
public class GradleProjectStructureChangesModelTest extends AbstractGradleTest {
+ @Before
+ public void setUp() {
+ super.setUp()
+ clearChangePostProcessors()
+ }
+
@Test
public void "obsolete gradle-local modules"() {
// Configure initial projects state.
diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/AbstractGradleTest.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/AbstractGradleTest.groovy
index 878d3c146bb0..e374dbcb2dcf 100644
--- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/AbstractGradleTest.groovy
+++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/AbstractGradleTest.groovy
@@ -15,18 +15,23 @@ import org.jetbrains.plugins.gradle.diff.dependency.GradleModuleDependencyStruct
import org.jetbrains.plugins.gradle.diff.library.GradleLibraryStructureChangesCalculator
import org.jetbrains.plugins.gradle.diff.module.GradleModuleStructureChangesCalculator
import org.jetbrains.plugins.gradle.diff.project.GradleProjectStructureChangesCalculator
+import org.jetbrains.plugins.gradle.manage.GradleJarManager
import org.jetbrains.plugins.gradle.model.GradleEntityOwner
import org.jetbrains.plugins.gradle.model.gradle.GradleLibrary
import org.jetbrains.plugins.gradle.model.gradle.LibraryPathType
import org.jetbrains.plugins.gradle.model.id.GradleEntityIdMapper
import org.jetbrains.plugins.gradle.model.id.GradleJarId
import org.jetbrains.plugins.gradle.model.id.GradleLibraryId
+import org.jetbrains.plugins.gradle.sync.GradleMovedJarsPostProcessor
import org.jetbrains.plugins.gradle.sync.GradleProjectStructureChangesModel
import org.jetbrains.plugins.gradle.sync.GradleProjectStructureHelper
import org.jetbrains.plugins.gradle.sync.GradleProjectStructureTreeModel
import org.jetbrains.plugins.gradle.ui.GradleProjectStructureNodeFilter
+import org.jetbrains.plugins.gradle.util.GradleLibraryPathTypeMapper
import org.jetbrains.plugins.gradle.util.GradleProjectStructureContext
import org.jetbrains.plugins.gradle.util.GradleUtil
+import org.jetbrains.plugins.gradle.util.TestGradleJarManager
+import org.jetbrains.plugins.gradle.util.TestGradleMovedJarsPostProcessor
import org.junit.Before
import org.picocontainer.MutablePicoContainer
import org.picocontainer.defaults.DefaultPicoContainer
@@ -68,7 +73,12 @@ public abstract class AbstractGradleTest {
container.registerComponentImplementation(GradleLibraryStructureChangesCalculator)
container.registerComponentImplementation(GradleEntityIdMapper)
container.registerComponentImplementation(GradleProjectStructureContext)
+ container.registerComponentImplementation(GradleLibraryPathTypeMapper, TestGradleLibraryPathTypeMapper)
+ container.registerComponentImplementation(GradleJarManager, TestGradleJarManager)
+ container.registerComponentImplementation(GradleMovedJarsPostProcessor, TestGradleMovedJarsPostProcessor)
configureContainer(container)
+
+ intellij.projectStub.getComponent = { clazz -> container.getComponentInstance(clazz) }
changesModel = container.getComponentInstance(GradleProjectStructureChangesModel) as GradleProjectStructureChangesModel
@@ -77,6 +87,10 @@ public abstract class AbstractGradleTest {
}
}
+ protected void clearChangePostProcessors() {
+ changesModel.postProcessors.clear()
+ }
+
protected void configureContainer(MutablePicoContainer container) {
}
@@ -155,7 +169,7 @@ public abstract class AbstractGradleTest {
for (GradleLibrary library in (gradle.libraries.values() as Collection)) {
for (libPath in library.getPaths(LibraryPathType.BINARY)) {
if (libPath == pathToUse) {
- return new GradleJarId(pathToUse, new GradleLibraryId(GradleEntityOwner.GRADLE, library.name))
+ return new GradleJarId(pathToUse, LibraryPathType.BINARY, new GradleLibraryId(GradleEntityOwner.GRADLE, library.name))
}
}
}
@@ -163,7 +177,7 @@ public abstract class AbstractGradleTest {
for (Library library in (intellij.libraries.values() as Collection)) {
for (jarFile in library.getFiles(OrderRootType.CLASSES)) {
if (pathToUse == jarFile.path) {
- return new GradleJarId(pathToUse, new GradleLibraryId(GradleEntityOwner.INTELLIJ, library.name))
+ return new GradleJarId(pathToUse, LibraryPathType.BINARY, new GradleLibraryId(GradleEntityOwner.IDE, library.name))
}
}
}
diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/IntellijProjectBuilder.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/IntellijProjectBuilder.groovy
index 7c405f01baf5..18fe8441836d 100644
--- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/IntellijProjectBuilder.groovy
+++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/IntellijProjectBuilder.groovy
@@ -21,7 +21,7 @@ import org.jetbrains.plugins.gradle.util.GradleUtil
*/
class IntellijProjectBuilder extends AbstractProjectBuilder {
- static def LIBRARY_ENTRY_TYPES = [(OrderRootType.CLASSES) : "bin"]
+ static def LIBRARY_ENTRY_TYPES = [(OrderRootType.CLASSES) : "bin", (OrderRootType.SOURCES) : "src"]
static VirtualFile[] DUMMY_VIRTUAL_FILE_ARRAY = new VirtualFile[0]
def projectStub = [getName: { same }]
diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/ProjectStructureChecker.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/ProjectStructureChecker.groovy
index 88df5c10ef4d..6357f1bc4bdd 100644
--- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/ProjectStructureChecker.groovy
+++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/ProjectStructureChecker.groovy
@@ -81,7 +81,7 @@ class ProjectStructureChecker {
assertEquals("node '$descriptor'", expectedMarkup, descriptor.attributes)
if (descriptor.element.type != GradleEntityType.SYNTHETIC) {
- def expectedOwner = expectedMarkup == GradleTextAttributes.GRADLE_LOCAL_CHANGE ? GradleEntityOwner.GRADLE : GradleEntityOwner.INTELLIJ
+ def expectedOwner = expectedMarkup == GradleTextAttributes.GRADLE_LOCAL_CHANGE ? GradleEntityOwner.GRADLE : GradleEntityOwner.IDE
assertEquals("node '$descriptor'", expectedOwner, descriptor.element.owner)
}
}
diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/TestGradleLibraryPathTypeMapper.java b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/TestGradleLibraryPathTypeMapper.java
new file mode 100644
index 000000000000..4b3b8b2cbee7
--- /dev/null
+++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/TestGradleLibraryPathTypeMapper.java
@@ -0,0 +1,46 @@
+/*
+ * 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 org.jetbrains.plugins.gradle.testutil;
+
+import com.intellij.openapi.roots.OrderRootType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.gradle.model.gradle.LibraryPathType;
+import org.jetbrains.plugins.gradle.util.GradleLibraryPathTypeMapper;
+
+import java.util.EnumMap;
+import java.util.Map;
+
+/**
+ * @author Denis Zhdanov
+ * @since 1/17/13 4:07 PM
+ */
+public class TestGradleLibraryPathTypeMapper implements GradleLibraryPathTypeMapper {
+
+ private static final Map MAPPINGS = new EnumMap(LibraryPathType.class);
+
+ static {
+ MAPPINGS.put(LibraryPathType.BINARY, OrderRootType.CLASSES);
+ MAPPINGS.put(LibraryPathType.SOURCE, OrderRootType.SOURCES);
+ MAPPINGS.put(LibraryPathType.DOC, OrderRootType.DOCUMENTATION);
+ assert LibraryPathType.values().length == MAPPINGS.size();
+ }
+
+ @NotNull
+ @Override
+ public OrderRootType map(@NotNull LibraryPathType type) {
+ return MAPPINGS.get(type);
+ }
+}
diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/GradleUtilTest.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/GradleUtilTest.groovy
new file mode 100644
index 000000000000..8d8535e42af9
--- /dev/null
+++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/GradleUtilTest.groovy
@@ -0,0 +1,33 @@
+/*
+ * 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 org.jetbrains.plugins.gradle.util
+
+import junit.framework.Assert
+import org.junit.Test;
+
+/**
+ * @author Denis Zhdanov
+ * @since 1/18/13 1:21 PM
+ */
+class GradleUtilTest {
+
+ @Test
+ void "parsing artifact info"() {
+ Assert.assertEquals(new GradleArtifactInfo('commons-io', null, '1.2'), GradleUtil.parseArtifactInfo("/my/commons-io-1.2.jar"))
+ Assert.assertEquals(new GradleArtifactInfo('c3p0', null, '2'), GradleUtil.parseArtifactInfo("/my/c3p0-2.jar"))
+ Assert.assertEquals(new GradleArtifactInfo('c3p0-sources', null, '2'), GradleUtil.parseArtifactInfo("/my/c3p0-sources-2.zip"))
+ }
+}
diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/TestGradleJarManager.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/TestGradleJarManager.groovy
new file mode 100644
index 000000000000..bd09b312bcef
--- /dev/null
+++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/TestGradleJarManager.groovy
@@ -0,0 +1,47 @@
+/*
+ * 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 org.jetbrains.plugins.gradle.util
+
+import com.intellij.openapi.project.Project
+import org.jetbrains.annotations.NotNull
+import org.jetbrains.plugins.gradle.config.PlatformFacade
+import org.jetbrains.plugins.gradle.manage.GradleJarManager
+import org.jetbrains.plugins.gradle.model.gradle.GradleJar
+
+/**
+ * @author Denis Zhdanov
+ * @since 1/18/13 2:16 PM
+ */
+class TestGradleJarManager extends GradleJarManager {
+
+ def importedJars = []
+ def removedJars = []
+
+ TestGradleJarManager(@NotNull PlatformFacade facade,
+ @NotNull GradleLibraryPathTypeMapper mapper) {
+ super(facade, mapper);
+ }
+
+ @Override
+ void importJar(@NotNull GradleJar jar, @NotNull Project project) {
+ importedJars << jar
+ }
+
+ @Override
+ void removeJars(@NotNull Collection jars, @NotNull Project project) {
+ removedJars.addAll(jars)
+ }
+}
diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/TestGradleMovedJarsPostProcessor.java b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/TestGradleMovedJarsPostProcessor.java
new file mode 100644
index 000000000000..ee3192e048c8
--- /dev/null
+++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/TestGradleMovedJarsPostProcessor.java
@@ -0,0 +1,37 @@
+/*
+ * 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 org.jetbrains.plugins.gradle.util;
+
+import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.gradle.manage.GradleJarManager;
+import org.jetbrains.plugins.gradle.sync.GradleMovedJarsPostProcessor;
+
+/**
+ * @author Denis Zhdanov
+ * @since 1/18/13 2:11 PM
+ */
+public class TestGradleMovedJarsPostProcessor extends GradleMovedJarsPostProcessor {
+
+ public TestGradleMovedJarsPostProcessor(@NotNull GradleJarManager manager) {
+ super(manager);
+ }
+
+ @Override
+ public void doMerge(@NotNull Runnable mergeTask, @NotNull Project project) {
+ mergeTask.run();
+ }
+}
diff --git a/plugins/groovy/jps-plugin/groovy-jps-plugin.iml b/plugins/groovy/jps-plugin/groovy-jps-plugin.iml
index c55d620328f1..9f6a87dfede5 100644
--- a/plugins/groovy/jps-plugin/groovy-jps-plugin.iml
+++ b/plugins/groovy/jps-plugin/groovy-jps-plugin.iml
@@ -10,6 +10,8 @@
+
+
diff --git a/plugins/groovy/jps-plugin/src/META-INF/services/org.jetbrains.jps.model.serialization.JpsModelSerializerExtension b/plugins/groovy/jps-plugin/src/META-INF/services/org.jetbrains.jps.model.serialization.JpsModelSerializerExtension
new file mode 100644
index 000000000000..9ab572fa24cf
--- /dev/null
+++ b/plugins/groovy/jps-plugin/src/META-INF/services/org.jetbrains.jps.model.serialization.JpsModelSerializerExtension
@@ -0,0 +1 @@
+org.jetbrains.jps.incremental.groovy.GroovyModelSerializerExtension
\ No newline at end of file
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 13402d48eeba..09ff15d306b4 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
@@ -22,6 +22,7 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Consumer;
import com.intellij.util.SystemProperties;
+import com.intellij.util.containers.ContainerUtilRt;
import gnu.trove.THashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -84,7 +85,9 @@ public class GroovyBuilder extends ModuleLevelBuilder {
DirtyFilesHolder dirtyFilesHolder,
OutputConsumer outputConsumer) throws ProjectBuildException {
try {
- final List toCompile = collectChangedFiles(context, dirtyFilesHolder);
+ JpsGroovySettings settings = JpsGroovySettings.getSettings(context.getProjectDescriptor().getProject());
+
+ final List toCompile = collectChangedFiles(context, dirtyFilesHolder, settings);
if (toCompile.isEmpty()) {
return ExitCode.NOTHING_DONE;
}
@@ -115,7 +118,7 @@ public class GroovyBuilder extends ModuleLevelBuilder {
final File tempFile = GroovycOSProcessHandler.fillFileWithGroovycParameters(
compilerOutput, toCompilePaths, finalOutput, class2Src, encoding, patchers
);
- final GroovycOSProcessHandler handler = runGroovyc(context, chunk, tempFile);
+ final GroovycOSProcessHandler handler = runGroovyc(context, chunk, tempFile, settings);
Map>
compiled = processCompiledFiles(context, chunk, generationOutputs, compilerOutput, handler);
@@ -154,20 +157,28 @@ public class GroovyBuilder extends ModuleLevelBuilder {
return toCompilePaths;
}
- private GroovycOSProcessHandler runGroovyc(final CompileContext context, ModuleChunk chunk, File tempFile) throws IOException {
- //todo xmx
+ private GroovycOSProcessHandler runGroovyc(final CompileContext context,
+ ModuleChunk chunk,
+ File tempFile,
+ final JpsGroovySettings settings) throws IOException {
ArrayList classpath = new ArrayList(generateClasspath(context, chunk));
if (LOG.isDebugEnabled()) {
LOG.debug("Groovyc classpath: " + classpath);
}
+
+ List programParams = ContainerUtilRt.newArrayList(myForStubs ? "stubs" : "groovyc", tempFile.getPath());
+ if (settings.invokeDynamic) {
+ programParams.add("--indy");
+ }
+
final List cmd = ExternalProcessUtil.buildJavaCommandLine(
getJavaExecutable(chunk),
"org.jetbrains.groovy.compiler.rt.GroovycRunner",
Collections.emptyList(), classpath,
- Arrays.asList("-Xmx384m",
+ Arrays.asList("-Xmx" + settings.heapSize + "m",
"-Dfile.encoding=" + System.getProperty("file.encoding")/*,
"-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5239"*/),
- Arrays.asList(myForStubs ? "stubs" : "groovyc", tempFile.getPath())
+ programParams
);
final Process process = Runtime.getRuntime().exec(ArrayUtil.toStringArray(cmd));
@@ -320,8 +331,8 @@ public class GroovyBuilder extends ModuleLevelBuilder {
return SystemProperties.getJavaHome() + "/bin/java";
}
- private static List collectChangedFiles(CompileContext context,
- DirtyFilesHolder dirtyFilesHolder) throws IOException {
+ private List collectChangedFiles(CompileContext context,
+ DirtyFilesHolder dirtyFilesHolder, final JpsGroovySettings settings) throws IOException {
final ResourcePatterns patterns = ResourcePatterns.KEY.get(context);
assert patterns != null;
final List toCompile = new ArrayList();
@@ -329,6 +340,10 @@ public class GroovyBuilder extends ModuleLevelBuilder {
public boolean apply(ModuleBuildTarget target, File file, JavaSourceRootDescriptor sourceRoot) throws IOException {
final String path = file.getPath();
if (isGroovyFile(path) && !patterns.isResourceFile(file, sourceRoot.root)) { //todo file type check
+ if (myForStubs && settings.isExcludedFromStubGeneration(file)) {
+ return true;
+ }
+
toCompile.add(file);
}
return true;
diff --git a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyModelSerializerExtension.java b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyModelSerializerExtension.java
new file mode 100644
index 000000000000..4fd9b00723a4
--- /dev/null
+++ b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyModelSerializerExtension.java
@@ -0,0 +1,52 @@
+/*
+ * 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 org.jetbrains.jps.incremental.groovy;
+
+import com.intellij.util.xmlb.XmlSerializer;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.jps.model.JpsProject;
+import org.jetbrains.jps.model.serialization.JpsModelSerializerExtension;
+import org.jetbrains.jps.model.serialization.JpsProjectExtensionSerializer;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author peter
+ */
+public class GroovyModelSerializerExtension extends JpsModelSerializerExtension {
+
+ @NotNull
+ @Override
+ public List extends JpsProjectExtensionSerializer> getProjectExtensionSerializers() {
+ return Arrays.asList(new JpsProjectExtensionSerializer("groovyc.xml", "GroovyCompilerProjectConfiguration") {
+ @Override
+ public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
+ JpsGroovySettings configuration = XmlSerializer.deserialize(componentTag, JpsGroovySettings.class);
+ if (configuration == null) {
+ configuration = new JpsGroovySettings();
+ }
+ configuration.initExcludes();
+ project.getContainer().setChild(JpsGroovySettings.ROLE, configuration);
+ }
+
+ @Override
+ public void saveExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
+ }
+ });
+ }
+}
diff --git a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/JpsGroovySettings.java b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/JpsGroovySettings.java
new file mode 100644
index 000000000000..76e76cb7c440
--- /dev/null
+++ b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/JpsGroovySettings.java
@@ -0,0 +1,80 @@
+/*
+ * 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 org.jetbrains.jps.incremental.groovy;
+
+import com.intellij.util.xmlb.annotations.Tag;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.jps.model.JpsElementChildRole;
+import org.jetbrains.jps.model.JpsProject;
+import org.jetbrains.jps.model.ex.JpsElementBase;
+import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
+import org.jetbrains.jps.model.java.compiler.JpsCompilerExcludes;
+import org.jetbrains.jps.model.java.impl.compiler.JpsCompilerExcludesImpl;
+import org.jetbrains.jps.model.serialization.java.compiler.JpsJavaCompilerConfigurationSerializer;
+
+import java.io.File;
+
+/**
+ * @author peter
+ */
+public class JpsGroovySettings extends JpsElementBase {
+ static final JpsElementChildRole ROLE = JpsElementChildRoleBase.create("Groovy Compiler Configuration");
+ public static final String DEFAULT_HEAP_SIZE = "400";
+ public static final boolean DEFAULT_INVOKE_DYNAMIC = false;
+ public static final boolean DEFAULT_TRANSFORMS_OK = false;
+
+ public String heapSize = DEFAULT_HEAP_SIZE;
+ public boolean invokeDynamic = DEFAULT_INVOKE_DYNAMIC;
+
+ @Tag("excludes") public Element excludes = new Element("aaa");
+
+ public boolean transformsOk = DEFAULT_TRANSFORMS_OK;
+ private JpsCompilerExcludes myExcludeFromStubGeneration;
+
+ public JpsGroovySettings() {
+ }
+
+ public JpsGroovySettings(JpsGroovySettings original) {
+ heapSize = original.heapSize;
+ invokeDynamic = original.invokeDynamic;
+ }
+
+ void initExcludes() {
+ myExcludeFromStubGeneration = new JpsCompilerExcludesImpl();
+ JpsJavaCompilerConfigurationSerializer.readExcludes(excludes, myExcludeFromStubGeneration);
+ }
+
+ @NotNull
+ @Override
+ public JpsGroovySettings createCopy() {
+ return new JpsGroovySettings(this);
+ }
+
+ @Override
+ public void applyChanges(@NotNull JpsGroovySettings modified) {
+ }
+
+ @NotNull
+ public static JpsGroovySettings getSettings(@NotNull JpsProject project) {
+ JpsGroovySettings settings = project.getContainer().getChild(ROLE);
+ return settings == null ? new JpsGroovySettings() : settings;
+ }
+
+ public boolean isExcludedFromStubGeneration(File file) {
+ return myExcludeFromStubGeneration != null && myExcludeFromStubGeneration.isExcluded(file);
+ }
+}
diff --git a/plugins/groovy/resources/intentionDescriptions/IndexedExpressionConversionIntention/after.groovy.template b/plugins/groovy/resources/intentionDescriptions/IndexedExpressionConversionIntention/after.groovy.template
index 5a8a95a5f34a..8521c7c6005b 100644
--- a/plugins/groovy/resources/intentionDescriptions/IndexedExpressionConversionIntention/after.groovy.template
+++ b/plugins/groovy/resources/intentionDescriptions/IndexedExpressionConversionIntention/after.groovy.template
@@ -1,2 +1,2 @@
-x = y[z]
+x = y.getAt(z)
diff --git a/plugins/groovy/resources/intentionDescriptions/IndexedExpressionConversionIntention/before.groovy.template b/plugins/groovy/resources/intentionDescriptions/IndexedExpressionConversionIntention/before.groovy.template
index 8521c7c6005b..5a8a95a5f34a 100644
--- a/plugins/groovy/resources/intentionDescriptions/IndexedExpressionConversionIntention/before.groovy.template
+++ b/plugins/groovy/resources/intentionDescriptions/IndexedExpressionConversionIntention/before.groovy.template
@@ -1,2 +1,2 @@
-x = y.getAt(z)
+x = y[z]
diff --git a/plugins/groovy/resources/standardDsls/defaultMethods.gdsl b/plugins/groovy/resources/standardDsls/defaultMethods.gdsl
index 7727e3ecc3cf..60e521aac122 100644
--- a/plugins/groovy/resources/standardDsls/defaultMethods.gdsl
+++ b/plugins/groovy/resources/standardDsls/defaultMethods.gdsl
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -23,7 +23,7 @@ import static standardDsls.Constants.STRING
* @author Maxim.Medvedev
*/
-private interface Constants {
+interface Constants {
String STRING = "java.lang.String"
String WILDCARD_PREFIX = "? extends "
}
diff --git a/plugins/groovy/rt/src/org/jetbrains/groovy/compiler/rt/GroovycRunner.java b/plugins/groovy/rt/src/org/jetbrains/groovy/compiler/rt/GroovycRunner.java
index 758cc10a27aa..7a79ac591e82 100644
--- a/plugins/groovy/rt/src/org/jetbrains/groovy/compiler/rt/GroovycRunner.java
+++ b/plugins/groovy/rt/src/org/jetbrains/groovy/compiler/rt/GroovycRunner.java
@@ -76,8 +76,11 @@ public class GroovycRunner {
*/
if (args.length != 2) {
- System.err.println("There is no arguments for groovy compiler");
- return;
+ if (args.length != 3 || !"--indy".equals(args[2])) {
+ System.err.println("There is no arguments for groovy compiler");
+ System.exit(1);
+ }
+ System.setProperty("groovy.target.indy", "true");
}
final boolean forStubs = "stubs".equals(args[0]);
@@ -85,7 +88,7 @@ public class GroovycRunner {
if (!argsFile.exists()) {
System.err.println("Arguments file for groovy compiler not found");
- return;
+ System.exit(1);
}
try {
diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml
index 16070f00745c..c2a9beb0ae94 100644
--- a/plugins/groovy/src/META-INF/plugin.xml
+++ b/plugins/groovy/src/META-INF/plugin.xml
@@ -459,6 +459,8 @@
+
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/generate/GroovyGenerationInfo.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/generate/GroovyGenerationInfo.java
index 5ed73ac0d33b..8f79de6736cf 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/generate/GroovyGenerationInfo.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/generate/GroovyGenerationInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * 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.
@@ -78,7 +78,12 @@ public class GroovyGenerationInfo extends PsiGenerationInfo
@Override
public PsiElement findInsertionAnchor(@NotNull PsiClass aClass, @NotNull PsiElement leaf) {
+ if (leaf.getParent() == aClass) {
+ return null; // we are not in class body
+ }
+
PsiElement parent = aClass instanceof GroovyScriptClass ? aClass.getContainingFile() : ((GrTypeDefinition)aClass).getBody();
+ if (parent == null) return null;
PsiElement element = PsiTreeUtil.findPrevParent(parent, leaf);
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GrReferenceHighlighter.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GrReferenceHighlighter.java
index 4e958017c951..3d69d7d7011a 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GrReferenceHighlighter.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GrReferenceHighlighter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -43,7 +43,74 @@ import java.util.List;
*/
public class GrReferenceHighlighter extends TextEditorHighlightingPass {
@NotNull private final GroovyFileBase myFile;
- @Nullable private List myInfos = null;
+ private List myInfos = null;
+
+ private final GroovyRecursiveElementVisitor myDeclarationHighlighter = new GroovyRecursiveElementVisitor() {
+ @Override
+ public void visitReferenceExpression(GrReferenceExpression referenceExpression) {
+ super.visitReferenceExpression(referenceExpression);
+ visit(referenceExpression);
+ }
+
+ @Override
+ public void visitCodeReferenceElement(GrCodeReferenceElement refElement) {
+ super.visitCodeReferenceElement(refElement);
+ visit(refElement);
+ }
+
+ @Override
+ public void visitVariable(GrVariable variable) {
+ super.visitVariable(variable);
+
+ if (GroovyRefactoringUtil.isLocalVariable(variable) || variable instanceof GrParameter) {
+ final TextAttributesKey attribute = GrHighlightUtil.getDeclarationHighlightingAttribute(variable, null);
+ if (attribute != null) {
+ final PsiElement nameElement = variable.getNameIdentifierGroovy();
+ assert myInfos != null;
+ myInfos.add(HighlightInfo.createHighlightInfo(HighlightInfoType.INFORMATION, nameElement, null, attribute));
+ }
+ }
+ }
+
+
+ private void visit(GrReferenceElement element) {
+ final PsiElement resolved = element.resolve();
+ final TextAttributesKey attribute = GrHighlightUtil.getDeclarationHighlightingAttribute(resolved, element);
+ if (attribute != null) {
+ final PsiElement refNameElement = GrHighlightUtil.getElementToHighlight(element);
+ assert myInfos != null;
+ myInfos.add(HighlightInfo.createHighlightInfo(HighlightInfoType.INFORMATION, refNameElement, null, attribute));
+ }
+ }
+ };
+
+ private final GroovyRecursiveElementVisitor myResolveHighlighter = new GroovyRecursiveElementVisitor() {
+ @Override
+ public void visitReferenceExpression(GrReferenceExpression referenceExpression) {
+ final int size = myInfos.size();
+ super.visitReferenceExpression(referenceExpression);
+ if (size == myInfos.size()) {
+ HighlightInfo info = GrUnresolvedAccessInspection.checkReferenceExpression(referenceExpression);
+ if (info != null) {
+ assert myInfos != null;
+ myInfos.add(info);
+ }
+ }
+ }
+
+ @Override
+ public void visitCodeReferenceElement(GrCodeReferenceElement refElement) {
+ final int size = myInfos.size();
+ super.visitCodeReferenceElement(refElement);
+ if (size == myInfos.size()) {
+ HighlightInfo info = GrUnresolvedAccessInspection.checkCodeReferenceElement(refElement);
+ if (info != null) {
+ assert myInfos != null;
+ myInfos.add(info);
+ }
+ }
+ }
+ };
public GrReferenceHighlighter(@Nullable Document document, @NotNull GroovyFileBase file) {
super(file.getProject(), document);
@@ -53,53 +120,8 @@ public class GrReferenceHighlighter extends TextEditorHighlightingPass {
@Override
public void doCollectInformation(@NotNull ProgressIndicator progress) {
myInfos = new ArrayList();
- myFile.accept(new GroovyRecursiveElementVisitor() {
- @Override
- public void visitReferenceExpression(GrReferenceExpression referenceExpression) {
- super.visitReferenceExpression(referenceExpression);
-
- visit(referenceExpression);
- HighlightInfo info = GrUnresolvedAccessInspection.checkReferenceExpression(referenceExpression);
- if (info != null) {
- myInfos.add(info);
- }
- }
-
- @Override
- public void visitCodeReferenceElement(GrCodeReferenceElement refElement) {
- super.visitCodeReferenceElement(refElement);
-
- visit(refElement);
-
- HighlightInfo info = GrUnresolvedAccessInspection.checkCodeReferenceElement(refElement);
- if (info != null) {
- myInfos.add(info);
- }
- }
-
- @Override
- public void visitVariable(GrVariable variable) {
- super.visitVariable(variable);
-
- if (GroovyRefactoringUtil.isLocalVariable(variable) || variable instanceof GrParameter) {
- final TextAttributesKey attribute = GrHighlightUtil.getDeclarationHighlightingAttribute(variable, null);
- if (attribute != null) {
- final PsiElement nameElement = variable.getNameIdentifierGroovy();
- myInfos.add(HighlightInfo.createHighlightInfo(HighlightInfoType.INFORMATION, nameElement, null, attribute));
- }
- }
- }
-
-
- private void visit(GrReferenceElement element) {
- final PsiElement resolved = element.resolve();
- final TextAttributesKey attribute = GrHighlightUtil.getDeclarationHighlightingAttribute(resolved, element);
- if (attribute != null) {
- final PsiElement refNameElement = GrHighlightUtil.getElementToHighlight(element);
- myInfos.add(HighlightInfo.createHighlightInfo(HighlightInfoType.INFORMATION, refNameElement, null, attribute));
- }
- }
- });
+ myFile.accept(myDeclarationHighlighter);
+ myFile.accept(myResolveHighlighter);
}
@Override
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
index e5b839f3812c..eb862f4a0e1b 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
@@ -606,27 +606,41 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
}
- final GrVariable toSearchFor = ResolveUtil.isScriptField(variable) ? GrScriptField.createScriptFieldFrom(variable) : variable;
- PsiNamedElement duplicate = ResolveUtil
- .resolveExistingElement(variable, new DuplicateVariablesProcessor(toSearchFor), GrReferenceExpression.class, GrVariable.class);
- if (duplicate == null) {
- if (variable instanceof GrParameter) {
- @SuppressWarnings({"ConstantConditions"})
- final PsiElement context = variable.getContext().getContext();
- if (context instanceof GrClosableBlock) {
- duplicate = ResolveUtil.resolveExistingElement((GroovyPsiElement)context, new DuplicateVariablesProcessor(variable),
- GrVariable.class, GrReferenceExpression.class);
- }
- else if (context instanceof GrMethod && !(context.getParent() instanceof GroovyFile)) {
- duplicate = ResolveUtil.resolveExistingElement(((GroovyPsiElement)context.getParent()), new DuplicateVariablesProcessor(variable),
- GrVariable.class, GrReferenceExpression.class);
+ PsiNamedElement duplicate;
+ if (ResolveUtil.isScriptField(variable)) {
+ final String name = variable.getName();
+
+ int count = 0;
+ final GroovyScriptClass script = (GroovyScriptClass)((GroovyFile)variable.getContainingFile()).getScriptClass();
+ for (GrScriptField field : GrScriptField.getScriptFields(script)) {
+ if (name.equals(field.getName())) count++;
+ }
+
+ duplicate = count > 1 ? GrScriptField.getScriptField(variable) : null;
+ }
+ else {
+ duplicate = ResolveUtil
+ .resolveExistingElement(variable, new DuplicateVariablesProcessor(variable), GrReferenceExpression.class, GrVariable.class);
+ if (duplicate == null) {
+ if (variable instanceof GrParameter) {
+ @SuppressWarnings({"ConstantConditions"})
+ final PsiElement context = variable.getContext().getContext();
+ if (context instanceof GrClosableBlock) {
+ duplicate = ResolveUtil.resolveExistingElement((GroovyPsiElement)context, new DuplicateVariablesProcessor(variable),
+ GrVariable.class, GrReferenceExpression.class);
+ }
+ else if (context instanceof GrMethod && !(context.getParent() instanceof GroovyFile)) {
+ duplicate =
+ ResolveUtil.resolveExistingElement(((GroovyPsiElement)context.getParent()), new DuplicateVariablesProcessor(variable),
+ GrVariable.class, GrReferenceExpression.class);
+ }
}
}
+ if (duplicate instanceof GrLightParameter && "args".equals(duplicate.getName())) {
+ duplicate = null;
+ }
}
- if (duplicate instanceof GrLightParameter && "args".equals(duplicate.getName())) {
- duplicate = null;
- }
if (duplicate instanceof GrVariable) {
if ((variable instanceof GrField || ResolveUtil.isScriptField(variable)) /*&& duplicate instanceof PsiField*/ ||
@@ -638,12 +652,27 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
PsiType type = variable.getDeclaredType();
if (type instanceof PsiEllipsisType && !isLastParameter(variable)) {
- TextRange range = getTypeRange(variable);
- LOG.assertTrue(range != null, variable.getText());
- myHolder.createErrorAnnotation(range, GroovyBundle.message("ellipsis.type.is.not.allowed.here"));
+ TextRange range = getEllipsisRange(variable);
+ if (range == null) {
+ range = getTypeRange(variable);
+ }
+ if (range != null) {
+ myHolder.createErrorAnnotation(range, GroovyBundle.message("ellipsis.type.is.not.allowed.here"));
+ }
}
}
+ @Nullable
+ private static TextRange getEllipsisRange(GrVariable variable) {
+ if (variable instanceof GrParameter) {
+ final PsiElement dots = ((GrParameter)variable).getEllipsisDots();
+ if (dots != null) {
+ return dots.getTextRange();
+ }
+ }
+ return null;
+ }
+
@Nullable
private static TextRange getTypeRange(GrVariable variable) {
GrTypeElement typeElement = variable.getTypeElementGroovy();
@@ -1970,12 +1999,8 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
}
private static boolean hasExplicitVisibilityModifiers(GrVariable variable) {
- final PsiModifierList modifierList = variable.getModifierList();
- if (modifierList instanceof GrModifierList) return ((GrModifierList)modifierList).hasExplicitVisibilityModifiers();
- if (modifierList == null) return false;
- return modifierList.hasExplicitModifier(PUBLIC) ||
- modifierList.hasExplicitModifier(PROTECTED) ||
- modifierList.hasExplicitModifier(PRIVATE);
+ final GrModifierList modifierList = variable.getModifierList();
+ return modifierList != null && modifierList.hasExplicitVisibilityModifiers();
}
@Override
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateClassFix.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateClassFix.java
index e8a23321e8a6..0a5b7d2afb20 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateClassFix.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateClassFix.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -156,17 +156,8 @@ public abstract class CreateClassFix {
}
private void createInnerClass(Project project, final Editor editor, PsiElement qualifier) {
- PsiElement resolved = null;
- if (qualifier instanceof GrCodeReferenceElement) {
- resolved = ((GrCodeReferenceElement)qualifier).resolve();
- }
- else if (qualifier instanceof GrExpression) {
- PsiType type = ((GrExpression)qualifier).getType();
- if (type instanceof PsiClassType) {
- resolved = ((PsiClassType)type).resolve();
- }
- }
-
+ PsiElement resolved = resolveQualifier(qualifier);
+ assert resolved != null;
JVMElementFactory factory = JVMElementFactories.getFactory(resolved.getLanguage(), project);
if (factory == null) return;
@@ -204,6 +195,21 @@ public abstract class CreateClassFix {
}
}
+ @Nullable
+ private PsiElement resolveQualifier(@NotNull PsiElement qualifier) {
+ if (qualifier instanceof GrCodeReferenceElement) {
+ return ((GrCodeReferenceElement)qualifier).resolve();
+ }
+ else if (qualifier instanceof GrExpression) {
+ PsiType type = ((GrExpression)qualifier).getType();
+ if (type instanceof PsiClassType) {
+ return ((PsiClassType)type).resolve();
+ }
+ }
+
+ return null;
+ }
+
@Nullable
private PsiClass createTemplate(JVMElementFactory factory, String name) {
switch (getType()) {
@@ -236,6 +242,18 @@ public abstract class CreateClassFix {
putCursor(project, targetClass.getContainingFile(), targetClass);
}
}
+
+ @Override
+ public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
+ if (!super.isAvailable(project, editor, file)) return false;
+
+ final PsiElement qualifier = myRefElement.getQualifier();
+ if (qualifier != null && resolveQualifier(qualifier) == null) {
+ return false;
+ }
+
+ return true;
+ }
};
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspection.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspection.java
index 70051c8b2956..772cd0554766 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspection.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspection.java
@@ -25,9 +25,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
-import java.util.List;
-
-
public abstract class BaseInspection extends GroovySuppressableInspectionTool {
private final String m_shortName = StringUtil.trimEnd(getClass().getSimpleName(), "Inspection");
@@ -54,7 +51,8 @@ public abstract class BaseInspection extends GroovySuppressableInspectionTool {
return m_shortName;
}
- @Nullable BaseInspectionVisitor buildGroovyVisitor(@NotNull ProblemsHolder problemsHolder, boolean onTheFly) {
+ @NotNull
+ protected BaseInspectionVisitor buildGroovyVisitor(@NotNull ProblemsHolder problemsHolder, boolean onTheFly) {
final BaseInspectionVisitor visitor = buildVisitor();
visitor.setProblemsHolder(problemsHolder);
visitor.setOnTheFly(onTheFly);
@@ -73,12 +71,12 @@ public abstract class BaseInspection extends GroovySuppressableInspectionTool {
}
@Nullable
- protected GroovyFix buildFix(PsiElement location) {
+ protected GroovyFix buildFix(@NotNull PsiElement location) {
return null;
}
@Nullable
- protected GroovyFix[] buildFixes(PsiElement location) {
+ protected GroovyFix[] buildFixes(@NotNull PsiElement location) {
return null;
}
@@ -92,10 +90,10 @@ public abstract class BaseInspection extends GroovySuppressableInspectionTool {
final ProblemsHolder problemsHolder = new ProblemsHolder(inspectionManager, psiFile, isOnTheFly);
final BaseInspectionVisitor visitor = buildGroovyVisitor(problemsHolder, isOnTheFly);
groovyFile.accept(visitor);
- final List problems = problemsHolder.getResults();
- return problems.toArray(new ProblemDescriptor[problems.size()]);
+ return problemsHolder.getResultsArray();
}
+ @NotNull
protected abstract BaseInspectionVisitor buildVisitor();
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspectionVisitor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspectionVisitor.java
index 45930c21bbe4..6ec3be034fd5 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspectionVisitor.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspectionVisitor.java
@@ -16,30 +16,25 @@
package org.jetbrains.plugins.groovy.codeInspection;
import com.intellij.codeInspection.LocalQuickFix;
-import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiModifierList;
-import com.intellij.psi.PsiModifierListOwner;
-import com.intellij.psi.PsiWhiteSpace;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.GroovyRecursiveElementVisitor;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrStatement;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrMethodCallExpression;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
-import java.util.List;
-
public abstract class BaseInspectionVisitor extends GroovyRecursiveElementVisitor {
private BaseInspection inspection = null;
private ProblemsHolder problemsHolder = null;
private boolean onTheFly = false;
- private final List errors = null;
public void setInspection(BaseInspection inspection) {
this.inspection = inspection;
@@ -63,33 +58,13 @@ public abstract class BaseInspectionVisitor extends GroovyRecursiveElementVisito
registerError(statementToken, args);
}
-
- protected void registerVariableError(GrVariable variable) {
- final PsiElement nameIdentifier = variable.getNameIdentifierGroovy();
- registerError(nameIdentifier);
- }
-
- protected void registerModifierError(String modifier,
- PsiModifierListOwner parameter) {
- final PsiModifierList modifiers = parameter.getModifierList();
- if (modifiers == null) {
- return;
- }
- final PsiElement[] children = modifiers.getChildren();
- for (final PsiElement child : children) {
- final String text = child.getText();
- if (modifier.equals(text)) {
- registerError(child);
- }
- }
- }
-
protected void registerError(PsiElement location) {
if (location == null) {
return;
}
final LocalQuickFix[] fix = createFixes(location);
- final String description = inspection.buildErrorString(location);
+ String description = StringUtil.notNullize(inspection.buildErrorString(location));
+
registerError(location, description, fix, ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
}
@@ -97,9 +72,10 @@ public abstract class BaseInspectionVisitor extends GroovyRecursiveElementVisito
if (method == null) {
return;
}
- final LocalQuickFix[] fix = createFixes(method);
- final String description = inspection.buildErrorString(args);
- registerError(method.getNameIdentifierGroovy(), description, fix, ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
+ final LocalQuickFix[] fixes = createFixes(method);
+ String description = StringUtil.notNullize(inspection.buildErrorString(args));
+
+ registerError(method.getNameIdentifierGroovy(), description, fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
}
protected void registerVariableError(GrVariable variable, Object... args) {
@@ -107,7 +83,7 @@ public abstract class BaseInspectionVisitor extends GroovyRecursiveElementVisito
return;
}
final LocalQuickFix[] fix = createFixes(variable);
- final String description = inspection.buildErrorString(args);
+ final String description = StringUtil.notNullize(inspection.buildErrorString(args));
registerError(variable.getNameIdentifierGroovy(), description, fix, ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
}
@@ -115,15 +91,19 @@ public abstract class BaseInspectionVisitor extends GroovyRecursiveElementVisito
if (method == null) {
return;
}
- final LocalQuickFix[] fix = createFixes(method);
- final String description = inspection.buildErrorString(args);
- registerError(((GrReferenceExpression) method.getInvokedExpression()).getReferenceNameElement(), description, fix,
- ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
+ final LocalQuickFix[] fixes = createFixes(method);
+ final String description = StringUtil.notNullize(inspection.buildErrorString(args));
+
+ final GrExpression invoked = method.getInvokedExpression();
+ assert invoked != null;
+ final PsiElement nameElement = ((GrReferenceExpression)invoked).getReferenceNameElement();
+ assert nameElement != null;
+ registerError(nameElement, description, fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
}
protected void registerError(@NotNull PsiElement location,
- String description,
- LocalQuickFix[] fixes,
+ @NotNull String description,
+ @Nullable LocalQuickFix[] fixes,
ProblemHighlightType highlightType) {
problemsHolder.registerProblem(location, description, highlightType, fixes);
}
@@ -136,12 +116,12 @@ public abstract class BaseInspectionVisitor extends GroovyRecursiveElementVisito
ProblemHighlightType highlightType,
Object... args) {
final LocalQuickFix[] fix = createFixes(location);
- final String description = inspection.buildErrorString(args);
+ final String description = StringUtil.notNullize(inspection.buildErrorString(args));
registerError(location, description, fix, highlightType);
}
@Nullable
- private LocalQuickFix[] createFixes(PsiElement location) {
+ private LocalQuickFix[] createFixes(@NotNull PsiElement location) {
if (!onTheFly &&
inspection.buildQuickFixesOnlyForOnTheFlyErrors()) {
return null;
@@ -157,18 +137,7 @@ public abstract class BaseInspectionVisitor extends GroovyRecursiveElementVisito
return new GroovyFix[]{fix};
}
- @Nullable
- public ProblemDescriptor[] getErrors() {
- if (errors == null) {
- return null;
- } else {
- final int numErrors = errors.size();
- return errors.toArray(new ProblemDescriptor[numErrors]);
- }
- }
-
- public void visitWhiteSpace(PsiWhiteSpace space) {
- // none of our inspections need to do anything with white space,
- // so this is a performance optimization
+ public int getErrorCount() {
+ return problemsHolder.getResultCount();
}
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/assignment/GroovyAssignabilityCheckInspection.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/assignment/GroovyAssignabilityCheckInspection.java
index 6b3cc5aa03e2..167ccd04fec8 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/assignment/GroovyAssignabilityCheckInspection.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/assignment/GroovyAssignabilityCheckInspection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -17,10 +17,7 @@
package org.jetbrains.plugins.groovy.codeInspection.assignment;
import com.intellij.codeInsight.intention.IntentionAction;
-import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.LocalQuickFix;
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.codeInspection.ProblemHighlightType;
+import com.intellij.codeInspection.*;
import com.intellij.lang.annotation.Annotation;
import com.intellij.lang.annotation.AnnotationHolder;
import com.intellij.openapi.diagnostic.Logger;
@@ -47,13 +44,13 @@ import org.jetbrains.plugins.groovy.extensions.NamedArgumentDescriptor;
import org.jetbrains.plugins.groovy.findUsages.LiteralConstructorReference;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.psi.GrControlFlowOwner;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap;
import org.jetbrains.plugins.groovy.lang.psi.api.signatures.GrClosureSignature;
import org.jetbrains.plugins.groovy.lang.psi.api.signatures.GrSignature;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrConstructorInvocation;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariableDeclaration;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentList;
@@ -66,7 +63,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.*;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrString;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrIndexProperty;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrMethodCallExpression;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.*;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
import org.jetbrains.plugins.groovy.lang.psi.impl.GrClosureType;
@@ -115,6 +111,7 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
return (String)args[0];
}
+ @NotNull
@Override
protected BaseInspectionVisitor buildVisitor() {
return new MyVisitor();
@@ -163,13 +160,6 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
return true;
}
- @Override
- public void visitMethod(GrMethod method) {
- if (!shouldProcess(method)) return;
-
- super.visitMethod(method);
- }
-
@Override
public void visitReturnStatement(GrReturnStatement returnStatement) {
super.visitReturnStatement(returnStatement);
@@ -196,20 +186,8 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
}
}
- protected boolean shouldProcess(GrMethod method) {
- return !GroovyPsiManager.getInstance(method.getProject()).isCompileStatic(method);
- }
-
- @Override
- public void visitField(GrField field) {
- if (GroovyPsiManager.getInstance(field.getProject()).isCompileStatic(field)) return;
- super.visitField(field);
- }
-
- @Override
- public void visitTypeDefinition(GrTypeDefinition typeDefinition) {
- if (GroovyPsiManager.getInstance(typeDefinition.getProject()).isCompileStatic(typeDefinition)) return;
- super.visitTypeDefinition(typeDefinition);
+ protected boolean shouldProcess(GrMember member) {
+ return !GroovyPsiManager.getInstance(member.getProject()).isCompileStatic(member);
}
@Override
@@ -537,47 +515,9 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
}
@Override
- public void visitReferenceExpression(GrReferenceExpression referenceExpression) {
- super.visitReferenceExpression(referenceExpression);
-
- final PsiElement parent = referenceExpression.getParent();
- if (parent instanceof GrCall) {
- GrCall call = (GrCall)parent;
- GroovyResolveResult resolveResult = call.advancedResolve();
- GroovyResolveResult[] results = call.multiResolve(false); //cached
-
- PsiElement resolved = resolveResult.getElement();
- if (resolved == null) {
- GrExpression qualifier = referenceExpression.getQualifierExpression();
- if (qualifier == null && GrHighlightUtil.isDeclarationAssignment(referenceExpression)) return;
- }
-
- if (!checkCannotInferArgumentTypes(referenceExpression)) return;
-
- final PsiType type = referenceExpression.getType();
- if (resolved != null) {
- if (resolved instanceof PsiMethod && !resolveResult.isInvokedOnProperty()) {
- checkMethodApplicability(resolveResult, referenceExpression, true);
- }
- else {
- checkCallApplicability(type, referenceExpression, true);
- }
- }
- else if (results.length > 0) {
- for (GroovyResolveResult result : results) {
- resolved = result.getElement();
- if (resolved instanceof PsiMethod && !resolveResult.isInvokedOnProperty()) {
- if (!checkMethodApplicability(result, referenceExpression, false)) return;
- }
- else {
- if (!checkCallApplicability(type, referenceExpression, false)) return;
- }
- }
-
- registerError(getElementToHighlight(referenceExpression, PsiUtil.getArgumentsList(referenceExpression)),
- GroovyBundle.message("method.call.is.ambiguous"));
- }
- }
+ public void visitIndexProperty(GrIndexProperty expression) {
+ super.visitIndexProperty(expression);
+ checkMethodCall(expression, expression.getInvokedExpression());
}
private boolean checkCannotInferArgumentTypes(PsiElement referenceExpression) {
@@ -591,13 +531,13 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
@Override
public void visitMethodCallExpression(GrMethodCallExpression methodCallExpression) {
super.visitMethodCallExpression(methodCallExpression);
- checkMethodCall(methodCallExpression);
+ checkMethodCall(methodCallExpression, methodCallExpression.getInvokedExpression());
}
@Override
public void visitApplicationStatement(GrApplicationStatement applicationStatement) {
super.visitApplicationStatement(applicationStatement);
- checkMethodCall(applicationStatement);
+ checkMethodCall(applicationStatement, applicationStatement.getInvokedExpression());
}
@Override
@@ -650,13 +590,49 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
return false;
}
- private void checkMethodCall(GrMethodCall call) {
+ private void checkMethodCall(GrCall call, GrExpression invoked) {
if (hasErrorElements(call.getArgumentList())) return;
- final GrExpression expression = call.getInvokedExpression();
- if (!(expression instanceof GrReferenceExpression)) { //it checks in visitRefExpr(...)
- final PsiType type = expression.getType();
- checkCallApplicability(type, expression, true);
+ if (invoked instanceof GrReferenceExpression) {
+ final GrReferenceExpression referenceExpression = (GrReferenceExpression)invoked;
+ GroovyResolveResult resolveResult = call.advancedResolve();
+ GroovyResolveResult[] results = call.multiResolve(false); //cached
+
+ PsiElement resolved = resolveResult.getElement();
+ if (resolved == null) {
+ GrExpression qualifier = referenceExpression.getQualifierExpression();
+ if (qualifier == null && GrHighlightUtil.isDeclarationAssignment(referenceExpression)) return;
+ }
+
+ if (!checkCannotInferArgumentTypes(referenceExpression)) return;
+
+ final PsiType type = referenceExpression.getType();
+ if (resolved != null) {
+ if (resolved instanceof PsiMethod && !resolveResult.isInvokedOnProperty()) {
+ checkMethodApplicability(resolveResult, referenceExpression, true);
+ }
+ else {
+ checkCallApplicability(type, referenceExpression, true);
+ }
+ }
+ else if (results.length > 0) {
+ for (GroovyResolveResult result : results) {
+ resolved = result.getElement();
+ if (resolved instanceof PsiMethod && !resolveResult.isInvokedOnProperty()) {
+ if (!checkMethodApplicability(result, referenceExpression, false)) return;
+ }
+ else {
+ if (!checkCallApplicability(type, referenceExpression, false)) return;
+ }
+ }
+
+ registerError(getElementToHighlight(referenceExpression, PsiUtil.getArgumentsList(referenceExpression)),
+ GroovyBundle.message("method.call.is.ambiguous"));
+ }
+ }
+ else if (invoked != null) { //it checks in visitRefExpr(...)
+ final PsiType type = invoked.getType();
+ checkCallApplicability(type, invoked, true);
}
checkNamedArgumentsType(call);
@@ -908,14 +884,14 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
private AnnotationHolder myHolder;
@Override
- protected boolean shouldProcess(GrMethod method) {
+ protected boolean shouldProcess(GrMember member) {
return true;
}
@Override
protected void registerError(@NotNull final PsiElement location,
- final String description,
- final LocalQuickFix[] fixes,
+ @NotNull final String description,
+ @NotNull final LocalQuickFix[] fixes,
final ProblemHighlightType highlightType) {
Annotation annotation = myHolder.createErrorAnnotation(location, description);
for (final LocalQuickFix fix : fixes) {
@@ -984,4 +960,41 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
annotatingVisitor.myHolder = oldHolder;
}
}
+
+ @Nullable
+ public ProblemDescriptor[] checkFile(@NotNull PsiFile psiFile, @NotNull InspectionManager inspectionManager, boolean isOnTheFly) {
+ if (!(psiFile instanceof GroovyFileBase)) {
+ return super.checkFile(psiFile, inspectionManager, isOnTheFly);
+ }
+
+
+ final GroovyFileBase groovyFile = (GroovyFileBase)psiFile;
+ final ProblemsHolder problemsHolder = new ProblemsHolder(inspectionManager, psiFile, isOnTheFly);
+ final MyVisitor visitor = (MyVisitor)buildGroovyVisitor(problemsHolder, isOnTheFly);
+
+ processElement(groovyFile, visitor);
+
+ return problemsHolder.getResultsArray();
+ }
+
+ private static void processElement(@NotNull GroovyPsiElement element, @NotNull MyVisitor visitor) {
+ if (element instanceof GrMember && !visitor.shouldProcess((GrMember)element)) {
+ return;
+ }
+
+ final int count = visitor.getErrorCount();
+
+ PsiElement child = element.getFirstChild();
+ while (child != null) {
+ if (child instanceof GroovyPsiElement) {
+ processElement((GroovyPsiElement)child, visitor);
+ }
+ child = child.getNextSibling();
+ }
+
+ if (count == visitor.getErrorCount()) {
+ element.accept(visitor);
+ }
+ }
+
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfiguration.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfiguration.java
index d779fd3d11f7..dc1c4b977b82 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfiguration.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfiguration.java
@@ -21,27 +21,35 @@ import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration;
import com.intellij.openapi.components.*;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
-import com.intellij.util.xmlb.annotations.Tag;
-import org.jdom.Element;
+import org.jetbrains.jps.incremental.groovy.JpsGroovySettings;
/**
* @author peter
*/
@State(
- name = "GroovyCompilerConfiguration",
+ name = "GroovyCompilerProjectConfiguration",
storages = {
- @Storage( file = StoragePathMacros.WORKSPACE_FILE),
+ @Storage( file = StoragePathMacros.PROJECT_FILE),
@Storage( file = StoragePathMacros.PROJECT_CONFIG_DIR + "/groovyc.xml", scheme = StorageScheme.DIRECTORY_BASED)
}
)
-public class GroovyCompilerConfiguration implements PersistentStateComponent, Disposable {
- private String myHeapSize = "400";
- private boolean myInvokeDynamic = false;
- public boolean transformsOk = false;
+public class GroovyCompilerConfiguration implements PersistentStateComponent, Disposable {
+ private String myHeapSize = JpsGroovySettings.DEFAULT_HEAP_SIZE;
+ private boolean myInvokeDynamic = JpsGroovySettings.DEFAULT_INVOKE_DYNAMIC;
+ public boolean transformsOk = JpsGroovySettings.DEFAULT_TRANSFORMS_OK;
private final ExcludedEntriesConfiguration myExcludeFromStubGeneration = new ExcludedEntriesConfiguration();
- public MyStateBean getState() {
- final MyStateBean bean = new MyStateBean();
+ public GroovyCompilerConfiguration(Project project) {
+ GroovyCompilerWorkspaceConfiguration workspaceConfiguration = ServiceManager.getService(project, GroovyCompilerWorkspaceConfiguration.class);
+ loadState(workspaceConfiguration.getState());
+ workspaceConfiguration.myHeapSize = JpsGroovySettings.DEFAULT_HEAP_SIZE;
+ workspaceConfiguration.transformsOk = JpsGroovySettings.DEFAULT_TRANSFORMS_OK;
+ workspaceConfiguration.myInvokeDynamic = JpsGroovySettings.DEFAULT_INVOKE_DYNAMIC;
+ workspaceConfiguration.myExcludeFromStubGeneration.removeAllExcludeEntryDescriptions();
+ }
+
+ public JpsGroovySettings getState() {
+ final JpsGroovySettings bean = new JpsGroovySettings();
bean.heapSize = myHeapSize;
bean.invokeDynamic = myInvokeDynamic;
bean.transformsOk = transformsOk;
@@ -57,7 +65,7 @@ public class GroovyCompilerConfiguration implements PersistentStateComponent, Disposable {
+ String myHeapSize = JpsGroovySettings.DEFAULT_HEAP_SIZE;
+ boolean myInvokeDynamic = JpsGroovySettings.DEFAULT_INVOKE_DYNAMIC;
+ boolean transformsOk = JpsGroovySettings.DEFAULT_TRANSFORMS_OK;
+ final ExcludedEntriesConfiguration myExcludeFromStubGeneration = new ExcludedEntriesConfiguration();
+
+ public JpsGroovySettings getState() {
+ final JpsGroovySettings bean = new JpsGroovySettings();
+ bean.heapSize = myHeapSize;
+ bean.invokeDynamic = myInvokeDynamic;
+ bean.transformsOk = transformsOk;
+ myExcludeFromStubGeneration.writeExternal(bean.excludes);
+ return bean;
+ }
+
+ public void loadState(JpsGroovySettings state) {
+ myHeapSize = state.heapSize;
+ myInvokeDynamic = state.invokeDynamic;
+ transformsOk = state.transformsOk;
+
+ myExcludeFromStubGeneration.readExternal(state.excludes);
+ }
+
+ public void dispose() {
+ Disposer.dispose(myExcludeFromStubGeneration);
+ }
+
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/params/GrParameter.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/params/GrParameter.java
index 0adf0363c2ee..781ba5d9b47f 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/params/GrParameter.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/params/GrParameter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -16,6 +16,7 @@
package org.jetbrains.plugins.groovy.lang.psi.api.statements.params;
+import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiParameter;
import com.intellij.util.ArrayFactory;
import org.jetbrains.annotations.NotNull;
@@ -49,4 +50,10 @@ public interface GrParameter extends PsiParameter, GrVariable, GrCondition {
GrModifierList getModifierList();
boolean isOptional();
+
+ /**
+ * parameter can be vararg while getEllipsisDots() return null
+ */
+ @Nullable
+ PsiElement getEllipsisDots();
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrSwitchStatementImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrSwitchStatementImpl.java
index 42fd57bda948..ff693d0ffe51 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrSwitchStatementImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrSwitchStatementImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -44,7 +44,7 @@ public class GrSwitchStatementImpl extends GroovyPsiElementImpl implements GrSwi
}
public GrExpression getCondition() {
- return findChildByClass(GrExpression.class);
+ return findExpressionChild(this);
}
@NotNull
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrSynchronizedStatementImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrSynchronizedStatementImpl.java
index 173215e1b246..4524ae67bf5a 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrSynchronizedStatementImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrSynchronizedStatementImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -42,7 +42,7 @@ public class GrSynchronizedStatementImpl extends GroovyPsiElementImpl implements
}
public GrExpression getMonitor() {
- return findChildByClass(GrExpression.class);
+ return findExpressionChild(this);
}
public GrOpenBlock getBody() {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrVariableDeclarationImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrVariableDeclarationImpl.java
index dd5d08c1a487..46d2ea6513f7 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrVariableDeclarationImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrVariableDeclarationImpl.java
@@ -1,6 +1,6 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -129,7 +129,7 @@ public class GrVariableDeclarationImpl extends GrStubElementBase impl
@Nullable
@Override
public GrExpression getTupleInitializer() {
- return findChildByClass(GrExpression.class);
+ return GroovyPsiElementImpl.findExpressionChild(this);
}
@Override
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/branch/GrAssertStatementImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/branch/GrAssertStatementImpl.java
index 8116a4e58ac8..a481509a2c4d 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/branch/GrAssertStatementImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/branch/GrAssertStatementImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -42,7 +42,7 @@ public class GrAssertStatementImpl extends GroovyPsiElementImpl implements GrAss
@Nullable
public GrExpression getAssertion() {
- return findChildByClass(GrExpression.class);
+ return findExpressionChild(this);
}
@Override
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/branch/GrThrowStatementImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/branch/GrThrowStatementImpl.java
index cf6efe53e276..2f146eb1d090 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/branch/GrThrowStatementImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/branch/GrThrowStatementImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -42,6 +42,6 @@ public class GrThrowStatementImpl extends GroovyPsiElementImpl implements GrThro
@Nullable
public GrExpression getException() {
- return findChildByClass(GrExpression.class);
+ return findExpressionChild(this);
}
}
\ No newline at end of file
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/clauses/GrCaseLabelImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/clauses/GrCaseLabelImpl.java
index dce2a779b838..f8ef8e719fba 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/clauses/GrCaseLabelImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/clauses/GrCaseLabelImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -44,7 +44,7 @@ public class GrCaseLabelImpl extends GroovyPsiElementImpl implements GrCaseLabel
@Override
public GrExpression getValue() {
- return findChildByClass(GrExpression.class);
+ return findExpressionChild(this);
}
@Override
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/clauses/GrForInClauseImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/clauses/GrForInClauseImpl.java
index c9d74638f77d..8ec040975f41 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/clauses/GrForInClauseImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/clauses/GrForInClauseImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -68,7 +68,7 @@ public class GrForInClauseImpl extends GroovyPsiElementImpl implements GrForInCl
@Nullable
public GrExpression getIteratedExpression() {
- return findChildByClass(GrExpression.class);
+ return findExpressionChild(this);
}
@NotNull
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrParenthesizedExpressionImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrParenthesizedExpressionImpl.java
index 3d59458c11cf..02fade2ebdfa 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrParenthesizedExpressionImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrParenthesizedExpressionImpl.java
@@ -1,4 +1,19 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions;
import com.intellij.lang.ASTNode;
@@ -34,6 +49,6 @@ public class GrParenthesizedExpressionImpl extends GrExpressionImpl implements G
@Nullable
public GrExpression getOperand() {
- return findChildByClass(GrExpression.class);
+ return findExpressionChild(this);
}
}
\ No newline at end of file
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/arithmetic/GrUnaryExpressionImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/arithmetic/GrUnaryExpressionImpl.java
index e00ac9c1ca11..3fd53f405a85 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/arithmetic/GrUnaryExpressionImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/arithmetic/GrUnaryExpressionImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -113,7 +113,7 @@ public class GrUnaryExpressionImpl extends GrExpressionImpl implements GrUnaryEx
}
public GrExpression getOperand() {
- return findChildByClass(GrExpression.class);
+ return findExpressionChild(this);
}
public void accept(GroovyElementVisitor visitor) {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/literals/GrStringInjectionImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/literals/GrStringInjectionImpl.java
index 229e7989e826..c7fd4a9de7ea 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/literals/GrStringInjectionImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/literals/GrStringInjectionImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -35,7 +35,7 @@ public class GrStringInjectionImpl extends GroovyPsiElementImpl implements GrStr
@Nullable
public GrExpression getExpression() {
- final GrExpression expression = findChildByClass(GrExpression.class);
+ final GrExpression expression = findExpressionChild(this);
return expression instanceof GrClosableBlock ? null : expression;
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/types/GrTypeCastExpressionImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/types/GrTypeCastExpressionImpl.java
index 850303e44dba..3d962993a8ad 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/types/GrTypeCastExpressionImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/types/GrTypeCastExpressionImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -56,7 +56,7 @@ public class GrTypeCastExpressionImpl extends GrExpressionImpl implements GrType
}
public GrExpression getOperand() {
- return findChildByClass(GrExpression.class);
+ return findExpressionChild(this);
}
@NotNull
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/params/GrParameterImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/params/GrParameterImpl.java
index 2b39c156554a..54c7d5f5aa22 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/params/GrParameterImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/params/GrParameterImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -185,6 +185,12 @@ public class GrParameterImpl extends GrVariableBaseImpl impleme
return getInitializerGroovy() != null;
}
+ @Nullable
+ @Override
+ public PsiElement getEllipsisDots() {
+ return findChildByType(GroovyTokenTypes.mTRIPLE_DOT);
+ }
+
@NotNull
public SearchScope getUseScope() {
if (!isPhysical()) {
@@ -230,7 +236,7 @@ public class GrParameterImpl extends GrVariableBaseImpl impleme
}
public boolean isVarArgs() {
- PsiElement dots = findChildByType(GroovyTokenTypes.mTRIPLE_DOT);
+ PsiElement dots = getEllipsisDots();
return dots != null;
}
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/ClosureSyntheticParameter.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/ClosureSyntheticParameter.java
index 416c71e9b6aa..2f5102077552 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/ClosureSyntheticParameter.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/ClosureSyntheticParameter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -83,4 +83,10 @@ public class ClosureSyntheticParameter extends GrLightParameter implements Navig
public GrExpression getInitializerGroovy() {
return GroovyPsiElementFactory.getInstance(getProject()).createExpressionFromText("null");
}
+
+ @Nullable
+ @Override
+ public PsiElement getEllipsisDots() {
+ return null;
+ }
}
\ No newline at end of file
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightParameter.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightParameter.java
index 8d722e8e7d22..f88b263c1134 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightParameter.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightParameter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -95,6 +95,12 @@ public class GrLightParameter extends LightVariableBuilder imp
return myOptional;
}
+ @Nullable
+ @Override
+ public PsiElement getEllipsisDots() {
+ return null;
+ }
+
@Override
public void setType(@Nullable PsiType type) throws IncorrectOperationException {
throw new IncorrectOperationException();
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrScriptBindingVariable.groovy b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrScriptBindingVariable.groovy
new file mode 100644
index 000000000000..545b360fba73
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrScriptBindingVariable.groovy
@@ -0,0 +1,22 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.lang.psi.impl.synthetic
+
+/**
+ * @author Max Medvedev
+ */
+class GrScriptBindingVariable {
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrScriptField.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrScriptField.java
index 6bb0b6331ccb..688092597b86 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrScriptField.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrScriptField.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -15,22 +15,34 @@
*/
package org.jetbrains.plugins.groovy.lang.psi.impl.synthetic;
-import com.intellij.openapi.util.Key;
+import com.intellij.openapi.util.Computable;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.RecursionManager;
import com.intellij.psi.PsiModifier;
-import com.intellij.psi.util.CachedValue;
import com.intellij.psi.util.CachedValueProvider;
import com.intellij.psi.util.CachedValuesManager;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyRecursiveElementVisitor;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotation;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariableDeclaration;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrAccessorMethod;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author Max Medvedev
*/
public class GrScriptField extends GrLightField {
- private GrScriptField(GrVariable original, GroovyScriptClass scriptClass) {
+ public static final GrScriptField[] EMPTY_ARRAY = new GrScriptField[0];
+
+ private GrScriptField(@NotNull GrVariable original, @NotNull GroovyScriptClass scriptClass) {
super(scriptClass, original.getName(), original.getType(), original);
mySetterInitialized = true;
@@ -54,23 +66,69 @@ public class GrScriptField extends GrLightField {
}
- private static final Key> KEY = Key.create("script field");
+ @NotNull
+ public static GrScriptField getScriptField(@NotNull final GrVariable original) {
+ final GroovyScriptClass script = (GroovyScriptClass)((GroovyFile)original.getContainingFile()).getScriptClass();
+ assert script != null;
- public static GrScriptField createScriptFieldFrom(final GrVariable original) {
- CachedValue data = original.getUserData(KEY);
- if (data == null) {
- data = CachedValuesManager.getManager(original.getProject()).createCachedValue(new CachedValueProvider() {
- @Override
- public Result compute() {
- final GroovyScriptClass script = (GroovyScriptClass)((GroovyFile)original.getContainingFile()).getScriptClass();
- assert script != null;
- return Result.create(new GrScriptField(original, script), original);
- }
- });
- }
- return data.getValue();
+ final GrScriptField result = ContainerUtil.find(getScriptFields(script), new Condition() {
+ @Override
+ public boolean value(GrScriptField field) {
+ return field.getNavigationElement() == original;
+ }
+ });
+ assert result != null;
+
+ return result;
}
+ @NotNull
+ public static GrScriptField[] getScriptFields(@NotNull final GroovyScriptClass script) {
+ return CachedValuesManager.getManager(script.getProject()).getCachedValue(script, new CachedValueProvider() {
+ @Override
+ public Result compute() {
+ List result = RecursionManager.doPreventingRecursion(script, true, new Computable>() {
+ @Override
+ public List compute() {
+ final List result = new ArrayList();
+ script.getContainingFile().accept(new GroovyRecursiveElementVisitor() {
+ @Override
+ public void visitVariableDeclaration(GrVariableDeclaration element) {
+ if (element.getModifierList().findAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_FIELD) != null) {
+ for (GrVariable variable : element.getVariables()) {
+ result.add(new GrScriptField(variable, script));
+ }
+ }
+ super.visitVariableDeclaration(element);
+ }
+
+ @Override
+ public void visitMethod(GrMethod method) {
+ //skip methods
+ }
+
+ @Override
+ public void visitTypeDefinition(GrTypeDefinition typeDefinition) {
+ //skip type defs
+ }
+
+
+ });
+ return result;
+ }
+ });
+
+ if (result == null) {
+ return Result.create(EMPTY_ARRAY, script.getContainingFile());
+ }
+ else {
+ return Result.create(result.toArray(new GrScriptField[result.size()]), script.getContainingFile());
+ }
+ }
+ });
+ }
+
+ @NotNull
public GrVariable getOriginalVariable() {
return (GrVariable)getNavigationElement();
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GroovyScriptClass.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GroovyScriptClass.java
index c4dffba23b94..b6f594f50be4 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GroovyScriptClass.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GroovyScriptClass.java
@@ -16,9 +16,7 @@
package org.jetbrains.plugins.groovy.lang.psi.impl.synthetic;
import com.intellij.navigation.ItemPresentation;
-import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.RecursionManager;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.impl.*;
@@ -29,7 +27,6 @@ import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.psi.util.CachedValueProvider;
import com.intellij.psi.util.CachedValuesManager;
-import com.intellij.psi.util.PsiModificationTracker;
import com.intellij.ui.RowIcon;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
@@ -37,18 +34,12 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyFileType;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
-import org.jetbrains.plugins.groovy.lang.psi.GroovyRecursiveElementVisitor;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariableDeclaration;
import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
import javax.swing.*;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
/**
@@ -203,7 +194,7 @@ public class GroovyScriptClass extends LightElement implements PsiClass, Synthet
@NotNull
public PsiField[] getFields() {
- return getScriptFields();
+ return GrScriptField.getScriptFields(this);
}
@NotNull
@@ -362,37 +353,6 @@ public class GroovyScriptClass extends LightElement implements PsiClass, Synthet
return false;
}
- private GrField[] getScriptFields() {
- return CachedValuesManager.getManager(getProject()).getCachedValue(this, new CachedValueProvider() {
- @Override
- public Result compute() {
- List result = RecursionManager.doPreventingRecursion(GroovyScriptClass.this, true, new Computable>() {
- @Override
- public List compute() {
- final List result = new ArrayList();
- myFile.accept(new GroovyRecursiveElementVisitor() {
- @Override
- public void visitVariableDeclaration(GrVariableDeclaration element) {
- if (element.getModifierList().findAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_FIELD) != null) {
- for (GrVariable variable : element.getVariables()) {
- result.add(GrScriptField.createScriptFieldFrom(variable));
- }
- }
- super.visitVariableDeclaration(element);
- }
- });
- return result;
- }
- });
-
- if (result == null) {
- result = Collections.emptyList();
- }
- return Result.create(result.toArray(new GrField[result.size()]), PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT, myFile);
- }
- });
- }
-
public boolean processDeclarations(@NotNull final PsiScopeProcessor processor,
@NotNull final ResolveState state,
@Nullable PsiElement lastParent,
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java
index 5aa5913d01b8..5f814fd4069d 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/inline/GroovyInlineMethodUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/inline/GroovyInlineMethodUtil.java
index 07a48fbab1a9..57a0d49fa041 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/inline/GroovyInlineMethodUtil.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/inline/GroovyInlineMethodUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -37,6 +37,7 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.codeInspection.utils.ControlFlowUtils;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory;
+import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap;
import org.jetbrains.plugins.groovy.lang.psi.api.signatures.GrClosureSignature;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrBlockStatement;
@@ -443,7 +444,9 @@ public class GroovyInlineMethodUtil {
Project project = call.getProject();
- GrClosureSignature signature = GrClosureSignatureUtil.createSignature(call);
+ final GroovyResolveResult resolveResult = call.advancedResolve();
+ GrClosureSignature signature = GrClosureSignatureUtil.createSignature(method, resolveResult.getSubstitutor());
+
if (signature == null) {
return;
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/inline/GroovyMethodInliner.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/inline/GroovyMethodInliner.java
index d1a36ef7f77a..46c7daca121a 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/inline/GroovyMethodInliner.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/inline/GroovyMethodInliner.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -35,6 +35,7 @@ import com.intellij.usageView.UsageInfo;
import com.intellij.util.ArrayUtil;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.MultiMap;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.codeInspection.utils.ControlFlowUtils;
import org.jetbrains.plugins.groovy.lang.GrReferenceAdjuster;
@@ -53,6 +54,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrC
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrMethodCallExpression;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrReflectedMethod;
import org.jetbrains.plugins.groovy.lang.psi.api.util.GrStatementOwner;
import org.jetbrains.plugins.groovy.lang.psi.api.util.GrVariableDeclarationOwner;
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
@@ -78,7 +80,7 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
}
@Nullable
- public MultiMap getConflicts(PsiReference reference, PsiElement referenced) {
+ public MultiMap getConflicts(@NotNull PsiReference reference, @NotNull PsiElement referenced) {
PsiElement element = reference.getElement();
assert element instanceof GrExpression && element.getParent() instanceof GrCallExpression;
GrCallExpression call = (GrCallExpression) element.getParent();
@@ -86,7 +88,8 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
return collectConflicts(call, infos);
}
- private static MultiMap collectConflicts(GrCallExpression call, Collection infos) {
+ @NotNull
+ private static MultiMap collectConflicts(@NotNull GrCallExpression call, @NotNull Collection infos) {
MultiMap conflicts = new MultiMap();
for (GroovyInlineMethodUtil.ReferenceExpressionInfo info : infos) {
@@ -115,7 +118,7 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
return conflicts;
}
- public void inlineUsage(UsageInfo usage, PsiElement referenced) {
+ public void inlineUsage(@NotNull UsageInfo usage, @NotNull PsiElement referenced) {
PsiElement element=usage.getElement();
assert element instanceof GrExpression && element.getParent() instanceof GrCallExpression;
@@ -139,7 +142,7 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
}
@Nullable
- private static Editor getCurrentEditorIfApplicable(PsiElement element) {
+ private static Editor getCurrentEditorIfApplicable(@NotNull PsiElement element) {
final Project project = element.getProject();
final Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
@@ -151,11 +154,12 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
return null;
}
- static RangeMarker inlineReferenceImpl(GrCallExpression call,
- GrMethod method,
+ @Nullable
+ static RangeMarker inlineReferenceImpl(@NotNull GrCallExpression call,
+ @NotNull GrMethod method,
boolean resultOfCallExplicitlyUsed,
boolean isTailMethodCall,
- Editor editor) {
+ @Nullable Editor editor) {
try {
GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(call.getProject());
final Project project = call.getProject();
@@ -308,7 +312,8 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
return null;
}
- private static String generateQualifierName(GrCallExpression call, GrMethod method, final Project project, GrExpression qualifier) {
+ @NotNull
+ private static String generateQualifierName(@NotNull GrCallExpression call, @Nullable GrMethod method, @NotNull final Project project, @NotNull GrExpression qualifier) {
String[] possibleNames = GroovyNameSuggestionUtil.suggestVariableNames(qualifier, new NameValidator() {
public String validateName(String name, boolean increaseNumber) {
return name;
@@ -323,7 +328,7 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
return qualName;
}
- private static void reformatOwner(GrVariableDeclarationOwner owner) throws IncorrectOperationException {
+ private static void reformatOwner(@Nullable GrVariableDeclarationOwner owner) throws IncorrectOperationException {
if (owner == null) return;
PsiFile file = owner.getContainingFile();
Project project = file.getProject();
@@ -336,12 +341,17 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
}
- /*
- Prepare temporary method with non-conflicting local names
- */
- private static GrMethod prepareNewMethod(GrCallExpression call, GrMethod method, GrExpression qualifier) throws IncorrectOperationException {
-
+ /**
+ * Prepare temporary method with non-conflicting local names
+ */
+ @NotNull
+ private static GrMethod prepareNewMethod(@NotNull GrCallExpression call, @NotNull GrMethod method, @Nullable GrExpression qualifier) throws IncorrectOperationException {
GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(method.getProject());
+
+ if (method instanceof GrReflectedMethod) {
+ method = ((GrReflectedMethod)method).getBaseMethod();
+ }
+
GrMethod newMethod = factory.createMethodFromText(method.getText());
if (qualifier != null) {
Collection infos = GroovyInlineMethodUtil.collectReferenceInfo(method);
@@ -375,7 +385,7 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
return newMethod;
}
- private static void collectInnerDefinitions(PsiElement element, ArrayList defintions) {
+ private static void collectInnerDefinitions(@Nullable PsiElement element, ArrayList defintions) {
if (element == null) return;
for (PsiElement child : element.getChildren()) {
if (child instanceof GrVariable && !(child instanceof GrParameter)) {
@@ -393,7 +403,7 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
* @return null if method has more or less than one return statement or has void type
*/
@Nullable
- static GrExpression getAloneResultExpression(GrMethod method) {
+ static GrExpression getAloneResultExpression(@NotNull GrMethod method) {
GrOpenBlock body = method.getBlock();
assert body != null;
GrStatement[] statements = body.getStatements();
@@ -415,7 +425,7 @@ public class GroovyMethodInliner implements InlineHandler.Inliner {
Method call is used as expression in some enclosing expression or
is method return result
*/
- private static boolean isOnExpressionOrReturnPlace(GrCallExpression call) {
+ private static boolean isOnExpressionOrReturnPlace(@NotNull GrCallExpression call) {
PsiElement parent = call.getParent();
if (!(parent instanceof GrVariableDeclarationOwner)) {
return true;
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/inline/InlineMethodConflictSolver.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/inline/InlineMethodConflictSolver.java
index 882f24164b8f..176219c8cc7b 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/inline/InlineMethodConflictSolver.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/inline/InlineMethodConflictSolver.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * 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.
@@ -23,6 +23,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrOpenBlock;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrAssignmentExpression;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
@@ -39,7 +40,8 @@ import org.jetbrains.plugins.groovy.refactoring.GroovyRefactoringUtil;
public class InlineMethodConflictSolver {
private InlineMethodConflictSolver() {}
- public static String suggestNewName(@NotNull String startName, @Nullable GrMethod method, PsiElement call, String... otherNames) {
+ @NotNull
+ public static String suggestNewName(@NotNull String startName, @Nullable GrMethod method, @NotNull PsiElement call, String... otherNames) {
String newName;
int i = 1;
PsiElement parent = call.getParent();
@@ -57,7 +59,7 @@ public class InlineMethodConflictSolver {
return newName;
}
- static boolean isValid(String name, String ... otherNames) {
+ static boolean isValid(@Nullable String name, String ... otherNames) {
for (String otherName : otherNames) {
if (otherName.equals(name)) {
return false;
@@ -66,17 +68,18 @@ public class InlineMethodConflictSolver {
return true;
}
- private static boolean isValidNameInMethod(@NotNull String name, GrMethod method) {
+ private static boolean isValidNameInMethod(@NotNull String name, @NotNull GrMethod method) {
for (GrParameter parameter : method.getParameters()) {
if (name.equals(parameter.getName())) return false;
}
- if (method.getBlock() != null) {
- return isValidNameDown(name, method.getBlock(), null);
+ final GrOpenBlock block = method.getBlock();
+ if (block != null) {
+ return isValidNameDown(name, block, null);
}
return true;
}
- public static boolean isValidName(@NotNull String name, PsiElement scopeElement, PsiElement call) {
+ public static boolean isValidName(@NotNull String name, @NotNull PsiElement scopeElement, PsiElement call) {
if (isValidNameDown(name, scopeElement, call)) {
if (!(scopeElement instanceof GroovyFileBase)) {
return isValidNameUp(name, scopeElement, call);
@@ -88,7 +91,7 @@ public class InlineMethodConflictSolver {
}
}
- private static boolean isValidNameDown(@NotNull String name, PsiElement startElement, @Nullable PsiElement call) {
+ private static boolean isValidNameDown(@NotNull String name, @NotNull PsiElement startElement, @Nullable PsiElement call) {
PsiElement child = startElement.getFirstChild();
while (child != null) {
@@ -121,7 +124,7 @@ public class InlineMethodConflictSolver {
return true;
}
- private static boolean isValidNameUp(@NotNull String name, PsiElement startElement, PsiElement call) {
+ private static boolean isValidNameUp(@NotNull String name, @NotNull PsiElement startElement, @Nullable PsiElement call) {
if (startElement instanceof PsiFile) {
return true;
}
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GrAssignabilityTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GrAssignabilityTest.groovy
index eb872ca5c7ce..4b61775ed25e 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GrAssignabilityTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GrAssignabilityTest.groovy
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -469,6 +469,22 @@ def _Boolean(Boolean x) {}
_int(null)
_boolean(null)
_Boolean(null)
+''')
+ }
+
+ void testInnerWarning() {
+ testHighlighting('''\
+public static void main(String[] args) {
+ bar (foo(foo(foo('2'))))
+}
+
+static def T foo(T abc) {
+ abc
+}
+
+static bar(String s) {
+
+}
''')
}
}
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GroovyHighlightingTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GroovyHighlightingTest.groovy
index 2becde825783..741b649dc1c7 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GroovyHighlightingTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GroovyHighlightingTest.groovy
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -128,7 +128,7 @@ public class GroovyHighlightingTest extends GrHighlightingTestBase {
myFixture.configureByText('a.groovy', '''\
class A {
def foo(int... x){}
- def foo(int... x, double y) {}
+ def foo(int... x, double y) {}
}
''')
myFixture.checkHighlighting(true, false, false)
@@ -1052,6 +1052,18 @@ class A {
class B extends A {
def getFoo(){5}
}
+''')
+ }
+
+ void testUnresolvedQualifierHighlighting() {
+ testHighlighting('''\
+Abc.Cde abc
+''')
+ }
+
+ void testVarargParameterWithoutTypeElement() {
+ testHighlighting('''\
+def foo(def ... vararg, def last) {}
''')
}
}
\ No newline at end of file
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/inline/InlineMethodTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/inline/InlineMethodTest.groovy
index a2a29ecb32a7..b2fec60e65ca 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/inline/InlineMethodTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/inline/InlineMethodTest.groovy
@@ -1,5 +1,6 @@
/*
- * Copyright 2000-2007 JetBrains s.r.o.
+ * 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
@@ -52,10 +53,10 @@ public class InlineMethodTest extends LightCodeInsightFixtureTestCase {
public void testClos_arg2() throws Throwable { doTest(); }
public void testClos_arg3() throws Throwable { doTest(); }
public void testCond() throws Throwable { doTest(); }
- public void testExpr1() throws Throwable { doTest(); }
+ public void _testExpr1() throws Throwable { doTest(); }
public void testExpr2() throws Throwable { doTest(); }
public void testExpr3() throws Throwable { doTest(); }
- public void testExpr4() throws Throwable { doTest(); }
+ public void _testExpr4() throws Throwable { doTest(); }
public void testFact() throws Throwable { doTest(); }
public void testFact2() throws Throwable { doTest(); }
public void testInit1() throws Throwable { doTest(); }
diff --git a/plugins/groovy/testdata/highlighting/ClosureCallMethodWithInapplicableArguments.groovy b/plugins/groovy/testdata/highlighting/ClosureCallMethodWithInapplicableArguments.groovy
index be947b78d319..01c677096279 100644
--- a/plugins/groovy/testdata/highlighting/ClosureCallMethodWithInapplicableArguments.groovy
+++ b/plugins/groovy/testdata/highlighting/ClosureCallMethodWithInapplicableArguments.groovy
@@ -1,6 +1,6 @@
def foo={x, y->}
-print foo.call(1)
+print foo.call(1)
def bar={3}
print bar.call()
diff --git a/plugins/javaFX/src/META-INF/plugin.xml b/plugins/javaFX/src/META-INF/plugin.xml
index 71f091fc50ce..b15de6d5cab4 100644
--- a/plugins/javaFX/src/META-INF/plugin.xml
+++ b/plugins/javaFX/src/META-INF/plugin.xml
@@ -10,6 +10,7 @@
-
+
+
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/FxmlConstants.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/FxmlConstants.java
index 9d47e6df6a75..b0a948e98922 100644
--- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/FxmlConstants.java
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/FxmlConstants.java
@@ -17,11 +17,24 @@ package org.jetbrains.plugins.javaFX.fxml;
import org.jetbrains.annotations.NonNls;
+import java.util.Arrays;
+import java.util.List;
+
/**
* User: anna
* Date: 1/14/13
*/
public class FxmlConstants {
@NonNls public static final String FX_CONTROLLER = "fx:controller";
- @NonNls public static final String JAVAFX_ANCHOR_PANE = "javafx.scene.layout.AnchorPane";
+ @NonNls public static final String FX_ID = "fx:id";
+ @NonNls public static final String VALUE = "value";
+ @NonNls public static final String FX_VALUE = "fx:value";
+ @NonNls public static final String FX_FACTORY = "fx:factory";
+ @NonNls public static final String FX_INCLUDE = "fx:include";
+ @NonNls public static final String FX_REFERENCE = "fx:reference";
+ @NonNls public static final String FX_COPY = "fx:copy";
+ @NonNls public static final String FX_DEFINE = "fx:define";
+ @NonNls public static final String FX_SCRIPT = "fx:script";
+
+ public static final List FX_DEFAULT_PROPERTIES = Arrays.asList(FX_ID, FX_CONTROLLER, VALUE, FX_VALUE, FX_FACTORY, FX_INCLUDE, FX_REFERENCE, FX_COPY, FX_DEFINE, FX_SCRIPT);
}
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/FxmlJavaClassReferencesContributor.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/FxmlJavaClassReferencesContributor.java
deleted file mode 100644
index d8b1eb23c5af..000000000000
--- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/FxmlJavaClassReferencesContributor.java
+++ /dev/null
@@ -1,36 +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 org.jetbrains.plugins.javaFX.fxml;
-
-import com.intellij.patterns.XmlPatterns;
-import com.intellij.psi.PsiReferenceContributor;
-import com.intellij.psi.PsiReferenceRegistrar;
-import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider;
-
-/**
- * User: anna
- * Date: 1/14/13
- */
-public class FxmlJavaClassReferencesContributor extends PsiReferenceContributor {
- public static final JavaClassReferenceProvider CLASS_REFERENCE_PROVIDER = new JavaClassReferenceProvider();
-
- @Override
- public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
- registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue()
- .withParent(XmlPatterns.xmlAttribute().withName(FxmlConstants.FX_CONTROLLER)),
- CLASS_REFERENCE_PROVIDER);
- }
-}
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/FxmlReferencesContributor.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/FxmlReferencesContributor.java
new file mode 100644
index 000000000000..9b23e58f214e
--- /dev/null
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/FxmlReferencesContributor.java
@@ -0,0 +1,63 @@
+/*
+ * 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 org.jetbrains.plugins.javaFX.fxml;
+
+import com.intellij.patterns.PatternCondition;
+import com.intellij.patterns.XmlAttributeValuePattern;
+import com.intellij.patterns.XmlPatterns;
+import com.intellij.psi.*;
+import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider;
+import com.intellij.psi.xml.XmlAttributeValue;
+import com.intellij.util.ProcessingContext;
+import org.jetbrains.annotations.NotNull;
+
+import static com.intellij.patterns.StandardPatterns.string;
+
+/**
+ * User: anna
+ * Date: 1/14/13
+ */
+public class FxmlReferencesContributor extends PsiReferenceContributor {
+ public static final JavaClassReferenceProvider CLASS_REFERENCE_PROVIDER = new JavaClassReferenceProvider();
+
+ @Override
+ public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
+ final XmlAttributeValuePattern attributeValueInFxml = XmlPatterns.xmlAttributeValue().with(inFxmlCondition());
+ registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute().withName(FxmlConstants.FX_CONTROLLER))
+ .and(attributeValueInFxml),
+ CLASS_REFERENCE_PROVIDER);
+
+ registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute().withName(FxmlConstants.FX_ID))
+ .and(attributeValueInFxml),
+ new JavaFxFieldIdReferenceProvider());
+
+ registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withValue(string().startsWith("#"))
+ .and(attributeValueInFxml),
+ new JavaFxEventHandlerReferenceProvider());
+
+ registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withValue(string().startsWith("@")).and(attributeValueInFxml),
+ new JavaFxLocationReferenceProvider());
+ }
+
+ private static PatternCondition inFxmlCondition() {
+ return new PatternCondition("inFxmlFile") {
+ @Override
+ public boolean accepts(@NotNull XmlAttributeValue value, ProcessingContext context) {
+ return JavaFxFileTypeFactory.isFxml(value.getContainingFile());
+ }
+ };
+ }
+}
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFXNSDescriptor.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFXNSDescriptor.java
index 8a0a9aac7ec3..dc992b506f78 100644
--- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFXNSDescriptor.java
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFXNSDescriptor.java
@@ -2,7 +2,6 @@ package org.jetbrains.plugins.javaFX.fxml;
import com.intellij.codeInsight.daemon.Validator;
import com.intellij.lang.ASTNode;
-import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.xml.*;
@@ -29,13 +28,16 @@ public class JavaFXNSDescriptor implements XmlNSDescriptor, Validator {
+ private PsiMethod myEventHandler;
+ private final PsiClass myController;
+
+ public JavaFxEventHandlerReference(XmlAttributeValue element, final PsiMethod method, PsiClass controller) {
+ super(element);
+ myEventHandler = method;
+ myController = controller;
+ }
+
+ @Nullable
+ @Override
+ public PsiElement resolve() {
+ return myEventHandler;
+ }
+
+ @NotNull
+ @Override
+ public Object[] getVariants() {
+ if (myController == null) return EMPTY_ARRAY;
+ final List availableHandlers = new ArrayList();
+ for (PsiMethod psiMethod : myController.getMethods()) {
+ if (isHandlerMethod(psiMethod)) {
+ availableHandlers.add(psiMethod);
+ }
+ }
+ return availableHandlers.isEmpty() ? EMPTY_ARRAY : ArrayUtil.toObjectArray(availableHandlers);
+ }
+
+ public static boolean isHandlerMethod(PsiMethod psiMethod) {
+ if (!psiMethod.hasModifierProperty(PsiModifier.STATIC) && PsiType.VOID.equals(psiMethod.getReturnType())) {
+ if (psiMethod.hasModifierProperty(PsiModifier.PUBLIC) || AnnotationUtil.isAnnotated(psiMethod, JavaFxCommonClassNames.JAVAFX_FXML_FXML, false)) {
+ final PsiParameter[] parameters = psiMethod.getParameterList().getParameters();
+ if (parameters.length == 1) {
+ final PsiType parameterType = parameters[0].getType();
+ if (InheritanceUtil.isInheritor(parameterType, JavaFxCommonClassNames.JAVAFX_EVENT)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public TextRange getRangeInElement() {
+ final TextRange range = super.getRangeInElement();
+ return new TextRange(range.getStartOffset() + 1, range.getEndOffset());
+ }
+
+ public static class JavaFxUnresolvedReferenceHandlerQuickfixProvider extends UnresolvedReferenceQuickFixProvider {
+
+ @Override
+ public void registerFixes(final JavaFxEventHandlerReference ref, final QuickFixActionRegistrar registrar) {
+ if (ref.myController != null && ref.myEventHandler == null) {
+ final CreateMethodQuickFix quickFix = CreateMethodQuickFix.createFix(ref.myController, getHandlerSignature(ref), "");
+ if (quickFix != null) {
+ registrar.register(quickFix);
+ }
+ }
+ }
+
+ private static String getHandlerSignature(JavaFxEventHandlerReference ref) {
+ return "public void " + ref.getElement().getValue().substring(1) + "(" + JavaFxCommonClassNames.JAVAFX_EVENT + " e)";
+ }
+
+ @NotNull
+ @Override
+ public Class getReferenceClass() {
+ return JavaFxEventHandlerReference.class;
+ }
+ }
+}
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxEventHandlerReferenceProvider.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxEventHandlerReferenceProvider.java
new file mode 100644
index 000000000000..bf6fa19be092
--- /dev/null
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxEventHandlerReferenceProvider.java
@@ -0,0 +1,70 @@
+/*
+ * 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 org.jetbrains.plugins.javaFX.fxml;
+
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.psi.*;
+import com.intellij.psi.util.InheritanceUtil;
+import com.intellij.psi.xml.XmlAttribute;
+import com.intellij.psi.xml.XmlAttributeValue;
+import com.intellij.psi.xml.XmlTag;
+import com.intellij.util.ProcessingContext;
+import com.intellij.xml.XmlElementDescriptor;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * User: anna
+ * Date: 1/16/13
+ */
+class JavaFxEventHandlerReferenceProvider extends JavaFxControllerBasedReferenceProvider {
+ private static final Logger LOG = Logger.getInstance("#" + JavaFxEventHandlerReferenceProvider.class.getName());
+
+ @Override
+ protected PsiReference[] getReferencesByElement(@NotNull PsiClass controllerClass,
+ XmlAttributeValue xmlAttributeValue,
+ ProcessingContext context) {
+ final String attValueString = xmlAttributeValue.getValue();
+ LOG.assertTrue(attValueString.startsWith("#"));
+
+ final XmlAttribute attribute = (XmlAttribute)xmlAttributeValue.getContext();
+ if (attribute == null) return PsiReference.EMPTY_ARRAY;
+ final String attributeName = attribute.getName();
+ final XmlTag xmlTag = attribute.getParent();
+ final XmlElementDescriptor descriptor = xmlTag.getDescriptor();
+ if (descriptor == null) return PsiReference.EMPTY_ARRAY;
+ final PsiElement currentTagClass = descriptor.getDeclaration();
+ if (!(currentTagClass instanceof PsiClass)) return PsiReference.EMPTY_ARRAY;
+ final PsiField handlerField = ((PsiClass)currentTagClass).findFieldByName(attributeName, true);
+ if (handlerField == null) {
+ return PsiReference.EMPTY_ARRAY;
+ }
+ final PsiClass objectPropertyClass = JavaFxPropertyAttributeDescriptor.getPropertyClass(handlerField);
+ if (objectPropertyClass == null || !InheritanceUtil.isInheritor(objectPropertyClass, JavaFxCommonClassNames.JAVAFX_EVENT_EVENT_HANDLER)) {
+ return PsiReference.EMPTY_ARRAY;
+ }
+ final String eventHandlerName = attValueString.substring(1);
+ final PsiMethod[] methods = controllerClass.findMethodsByName(eventHandlerName, true);
+
+ PsiMethod handlerMethod = null;
+ for (PsiMethod psiMethod : methods) {
+ if (JavaFxEventHandlerReference.isHandlerMethod(psiMethod)) {
+ handlerMethod = psiMethod;
+ break;
+ }
+ }
+ return new PsiReference[]{new JavaFxEventHandlerReference(xmlAttributeValue, handlerMethod, controllerClass)};
+ }
+}
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxFieldIdReferenceProvider.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxFieldIdReferenceProvider.java
new file mode 100644
index 000000000000..824836376181
--- /dev/null
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxFieldIdReferenceProvider.java
@@ -0,0 +1,58 @@
+/*
+ * 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 org.jetbrains.plugins.javaFX.fxml;
+
+import com.intellij.psi.*;
+import com.intellij.psi.xml.XmlAttributeValue;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.ProcessingContext;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+* User: anna
+* Date: 1/17/13
+*/
+class JavaFxFieldIdReferenceProvider extends JavaFxControllerBasedReferenceProvider {
+ @Override
+ protected PsiReference[] getReferencesByElement(@NotNull PsiClass aClass,
+ XmlAttributeValue xmlAttributeValue,
+ ProcessingContext context) {
+ final PsiField field = aClass.findFieldByName(xmlAttributeValue.getValue(), false);
+ return field == null ? PsiReference.EMPTY_ARRAY : new PsiReference[]{new JavaFxIdReference(xmlAttributeValue, field)};
+ }
+
+ private static class JavaFxIdReference extends PsiReferenceBase {
+ private final PsiField myField;
+
+ public JavaFxIdReference(XmlAttributeValue xmlAttributeValue, PsiField field) {
+ super(xmlAttributeValue);
+ myField = field;
+ }
+
+ @Nullable
+ @Override
+ public PsiElement resolve() {
+ return myField;
+ }
+
+ @NotNull
+ @Override
+ public Object[] getVariants() {
+ return ArrayUtil.EMPTY_OBJECT_ARRAY;
+ }
+ }
+}
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxLocationReferenceProvider.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxLocationReferenceProvider.java
new file mode 100644
index 000000000000..f5ce3cc23f3e
--- /dev/null
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxLocationReferenceProvider.java
@@ -0,0 +1,72 @@
+/*
+ * 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 org.jetbrains.plugins.javaFX.fxml;
+
+import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.*;
+import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReference;
+import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet;
+import com.intellij.psi.xml.XmlAttributeValue;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.ProcessingContext;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * User: anna
+ */
+class JavaFxLocationReferenceProvider extends PsiReferenceProvider {
+ @NotNull
+ @Override
+ public PsiReference[] getReferencesByElement(@NotNull final PsiElement element,
+ @NotNull ProcessingContext context) {
+ final String value = ((XmlAttributeValue)element).getValue();
+ final String relativePathToResource = value.substring(1);
+
+ final VirtualFile virtualFile = element.getContainingFile().getOriginalFile().getVirtualFile();
+ if (virtualFile != null) {
+ final VirtualFile parent = virtualFile.getParent();
+ final VirtualFile resourceFile = parent != null ? parent.findFileByRelativePath(relativePathToResource) : null;
+ final PsiReferenceBase.Immediate ref =
+ new PsiReferenceBase.Immediate((XmlAttributeValue)element, resourceFile != null ? element.getManager().findFile(resourceFile) : null) {
+ @NotNull
+ @Override
+ public Object[] getVariants() {
+ if (parent != null) { //todo multilevel completion, filter by resources
+ final PsiDirectory psiDirectory = element.getManager().findDirectory(parent);
+ if (psiDirectory != null) {
+ final PsiElement[] children = psiDirectory.getChildren();
+ final List paths = new ArrayList();
+ for (PsiElement child : children) {
+ if (child instanceof PsiFileSystemItem) {
+ paths.add("@" + ((PsiFileSystemItem)child).getName());
+ }
+ }
+ return ArrayUtil.toStringArray(paths);
+ }
+ }
+ return super.getVariants();
+ }
+ };
+ return new PsiReference[]{ref};
+ }
+ return PsiReference.EMPTY_ARRAY;
+ }
+}
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxPropertyAttributeDescriptor.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxPropertyAttributeDescriptor.java
new file mode 100644
index 000000000000..641188b6eddb
--- /dev/null
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxPropertyAttributeDescriptor.java
@@ -0,0 +1,148 @@
+package org.jetbrains.plugins.javaFX.fxml;
+
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.util.TypeConversionUtil;
+import com.intellij.psi.xml.XmlElement;
+import com.intellij.util.ArrayUtil;
+import com.intellij.xml.XmlAttributeDescriptor;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * User: anna
+ * Date: 1/10/13
+ */
+public class JavaFxPropertyAttributeDescriptor implements XmlAttributeDescriptor {
+ private final String myName;
+ private final PsiClass myPsiClass;
+
+ public JavaFxPropertyAttributeDescriptor(String name, PsiClass psiClass) {
+ myName = name;
+ myPsiClass = psiClass;
+ }
+
+ @Override
+ public boolean isRequired() {
+ return false;
+ }
+
+ @Override
+ public boolean isFixed() {
+ return false;
+ }
+
+ @Override
+ public boolean hasIdType() {
+ return false;
+ }
+
+ @Override
+ public boolean hasIdRefType() {
+ return false;
+ }
+
+ @Nullable
+ @Override
+ public String getDefaultValue() {
+ return null;
+ }
+
+ @Override
+ public boolean isEnumerated() {
+ return getEnum() != null;
+ }
+
+ @Nullable
+ @Override
+ public String[] getEnumeratedValues() {
+ final PsiClass enumClass = getEnum();
+ if (enumClass != null) {
+ final PsiField[] fields = enumClass.getFields();
+ final List enumConstants = new ArrayList();
+ for (PsiField enumField : fields) {
+ if (enumField instanceof PsiEnumConstant) {
+ enumConstants.add(enumField.getName());
+ }
+ }
+ return ArrayUtil.toStringArray(enumConstants);
+ }
+ return null;
+ }
+
+ protected PsiClass getEnum() {
+ final PsiClass aClass = getPropertyClass(getDeclaration());
+ return aClass != null && aClass.isEnum() ? aClass : null;
+ }
+
+ public static PsiClass getPropertyClass(PsiElement field) {
+ if (field instanceof PsiField) {
+ final PsiType type = ((PsiField)field).getType();
+ if (type instanceof PsiClassType) {
+ final PsiClassType.ClassResolveResult resolveResult = ((PsiClassType)type).resolveGenerics();
+ final PsiClass attributeClass = resolveResult.getElement();
+ if (attributeClass != null) {
+ final PsiClass objectProperty = JavaPsiFacade.getInstance(attributeClass.getProject())
+ .findClass(JavaFxCommonClassNames.JAVAFX_BEANS_PROPERTY_OBJECT_PROPERTY, attributeClass.getResolveScope());
+ if (objectProperty != null) {
+ final PsiSubstitutor superClassSubstitutor = TypeConversionUtil
+ .getClassSubstitutor(objectProperty, attributeClass, resolveResult.getSubstitutor());
+ if (superClassSubstitutor != null) {
+ final PsiType propertyType = superClassSubstitutor.substitute(objectProperty.getTypeParameters()[0]);
+ if (propertyType instanceof PsiClassType) {
+ return ((PsiClassType)propertyType).resolve();
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ @Nullable
+ @Override
+ public String validateValue(XmlElement context, String value) {
+ if (isEnumerated()) {
+ final String[] values = getEnumeratedValues();
+ if (values != null && !isWithingBounds(value, values)) {
+ return value + " is not withing its bounds";
+ }
+ }
+ return null;
+ }
+
+ private static boolean isWithingBounds(String value, String[] values) {
+ for (String enumConstant : values) {
+ if (StringUtil.endsWithIgnoreCase(enumConstant, value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public PsiElement getDeclaration() {
+ return myPsiClass != null ? myPsiClass.findFieldByName(myName, true) : null;
+ }
+
+ @Override
+ public String getName(PsiElement context) {
+ return getName();
+ }
+
+ @Override
+ public String getName() {
+ return myName;
+ }
+
+ @Override
+ public void init(PsiElement element) {}
+
+ @Override
+ public Object[] getDependences() {
+ return ArrayUtil.EMPTY_OBJECT_ARRAY;
+ }
+}
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxListPropertyElementDescriptor.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxPropertyElementDescriptor.java
similarity index 79%
rename from plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxListPropertyElementDescriptor.java
rename to plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxPropertyElementDescriptor.java
index a5be70741770..9298a8a0f86e 100644
--- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxListPropertyElementDescriptor.java
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxPropertyElementDescriptor.java
@@ -1,8 +1,8 @@
package org.jetbrains.plugins.javaFX.fxml;
-import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiField;
import com.intellij.psi.xml.XmlAttribute;
import com.intellij.psi.xml.XmlTag;
import com.intellij.util.ArrayUtil;
@@ -17,11 +17,11 @@ import org.jetbrains.annotations.Nullable;
* User: anna
* Date: 1/10/13
*/
-public class JavaFxListPropertyElementDescriptor implements XmlElementDescriptor {
+public class JavaFxPropertyElementDescriptor implements XmlElementDescriptor {
private final PsiClass myPsiClass;
private final String myName;
- public JavaFxListPropertyElementDescriptor(PsiClass psiClass, String name) {
+ public JavaFxPropertyElementDescriptor(PsiClass psiClass, String name) {
myPsiClass = psiClass;
myName = name;
}
@@ -47,12 +47,13 @@ public class JavaFxListPropertyElementDescriptor implements XmlElementDescriptor
@Override
public XmlElementDescriptor getElementDescriptor(XmlTag childTag, XmlTag contextTag) {
final String name = childTag.getName();
- if (StringUtil.isCapitalized(name)) {
+ if (JavaFxClassBackedElementDescriptor.isClassTag(name)) {
return new JavaFxClassBackedElementDescriptor(name, childTag);
}
- else {
- return myPsiClass != null ? new JavaFxListPropertyElementDescriptor(myPsiClass, name) : null;
+ else if (myPsiClass != null) {
+ return new JavaFxPropertyElementDescriptor(myPsiClass, name);
}
+ return null;
}
@Override
@@ -96,7 +97,12 @@ public class JavaFxListPropertyElementDescriptor implements XmlElementDescriptor
@Override
public PsiElement getDeclaration() {
- return myPsiClass.findFieldByName(myName, true);
+ if (myPsiClass == null) return null;
+ final PsiField field = myPsiClass.findFieldByName(myName, true);
+ if (field != null) {
+ return field;
+ }
+ return JavaFxClassBackedElementDescriptor.findPropertySetter(myName, myPsiClass);
}
@Override
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxSetterAttributeDescriptor.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxSetterAttributeDescriptor.java
new file mode 100644
index 000000000000..02f85017626a
--- /dev/null
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxSetterAttributeDescriptor.java
@@ -0,0 +1,111 @@
+/*
+ * 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 org.jetbrains.plugins.javaFX.fxml;
+
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.xml.XmlElement;
+import com.intellij.util.ArrayUtil;
+import com.intellij.xml.XmlAttributeDescriptor;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * User: anna
+ * Date: 1/10/13
+ */
+public class JavaFxSetterAttributeDescriptor implements XmlAttributeDescriptor {
+ private final String myName;
+ private final PsiClass myPsiClass;
+
+ public JavaFxSetterAttributeDescriptor(String name, PsiClass psiClass) {
+ myName = name;
+ myPsiClass = psiClass;
+ }
+
+ @Override
+ public boolean isRequired() {
+ return false;
+ }
+
+ @Override
+ public boolean isFixed() {
+ return false;
+ }
+
+ @Override
+ public boolean hasIdType() {
+ return false;
+ }
+
+ @Override
+ public boolean hasIdRefType() {
+ return false;
+ }
+
+ @Nullable
+ @Override
+ public String getDefaultValue() {
+ return null;
+ }
+
+ @Override
+ public boolean isEnumerated() {
+ return false;
+ }
+
+ @Nullable
+ @Override
+ public String[] getEnumeratedValues() {
+ return null;
+ }
+
+ @Nullable
+ @Override
+ public String validateValue(XmlElement context, String value) {
+ return null;
+ }
+
+ @Override
+ public PsiElement getDeclaration() {
+ if (myPsiClass != null) {
+ final PsiMethod[] methods = myPsiClass.findMethodsByName(myName, false);
+ if (methods.length == 1) { //todo
+ return methods[0];
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getName(PsiElement context) {
+ return getName();
+ }
+
+ @Override
+ public String getName() {
+ return myPsiClass.getName() + "." + StringUtil.decapitalize(myName.substring("set".length()));
+ }
+
+ @Override
+ public void init(PsiElement element) {}
+
+ @Override
+ public Object[] getDependences() {
+ return ArrayUtil.EMPTY_OBJECT_ARRAY;
+ }
+}
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxStaticPropertyAttributeDescriptor.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxStaticPropertyAttributeDescriptor.java
new file mode 100644
index 000000000000..90570bede96d
--- /dev/null
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/JavaFxStaticPropertyAttributeDescriptor.java
@@ -0,0 +1,52 @@
+/*
+ * 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 org.jetbrains.plugins.javaFX.fxml;
+
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiParameter;
+import com.intellij.psi.util.PsiUtil;
+
+/**
+ * User: anna
+ * Date: 1/10/13
+ */
+public class JavaFxStaticPropertyAttributeDescriptor extends JavaFxPropertyAttributeDescriptor {
+ private final PsiMethod mySetter;
+
+ public JavaFxStaticPropertyAttributeDescriptor(PsiMethod setter, String name) {
+ super(name, setter.getContainingClass());
+ mySetter = setter;
+ }
+
+ @Override
+ public PsiElement getDeclaration() {
+ return mySetter;
+ }
+
+ @Override
+ protected PsiClass getEnum() {
+ if (mySetter != null) {
+ final PsiParameter[] parameters = mySetter.getParameterList().getParameters();
+ if (parameters.length == 2) {
+ final PsiClass enumClass = PsiUtil.resolveClassInType(parameters[1].getType());
+ return enumClass != null && enumClass.isEnum() ? enumClass : null;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/javaFX/testData/completion/availablePositions.fxml b/plugins/javaFX/testData/completion/availablePositions.fxml
new file mode 100644
index 000000000000..507a35ad2fcb
--- /dev/null
+++ b/plugins/javaFX/testData/completion/availablePositions.fxml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/javaFX/testData/completion/availablePositions_after.fxml b/plugins/javaFX/testData/completion/availablePositions_after.fxml
new file mode 100644
index 000000000000..cc95a4106905
--- /dev/null
+++ b/plugins/javaFX/testData/completion/availablePositions_after.fxml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/javaFX/testData/completion/staticProperties.fxml b/plugins/javaFX/testData/completion/staticProperties.fxml
new file mode 100644
index 000000000000..50399a15affe
--- /dev/null
+++ b/plugins/javaFX/testData/completion/staticProperties.fxml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+ GridPane.rowIndex="4"/>
+
\ No newline at end of file
diff --git a/plugins/javaFX/testData/completion/staticPropertiesEnumValue.fxml b/plugins/javaFX/testData/completion/staticPropertiesEnumValue.fxml
new file mode 100644
index 000000000000..13fc3befe82a
--- /dev/null
+++ b/plugins/javaFX/testData/completion/staticPropertiesEnumValue.fxml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/javaFX/testData/completion/staticPropertiesEnumValue_after.fxml b/plugins/javaFX/testData/completion/staticPropertiesEnumValue_after.fxml
new file mode 100644
index 000000000000..0db560403195
--- /dev/null
+++ b/plugins/javaFX/testData/completion/staticPropertiesEnumValue_after.fxml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/javaFX/testData/completion/staticProperties_after.fxml b/plugins/javaFX/testData/completion/staticProperties_after.fxml
new file mode 100644
index 000000000000..a7ae79995e4f
--- /dev/null
+++ b/plugins/javaFX/testData/completion/staticProperties_after.fxml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/javaFX/testData/highlighting/ControllerIdRef.fxml b/plugins/javaFX/testData/highlighting/ControllerIdRef.fxml
new file mode 100644
index 000000000000..90b7dcc85280
--- /dev/null
+++ b/plugins/javaFX/testData/highlighting/ControllerIdRef.fxml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/javaFX/testData/highlighting/ControllerIdRefController.java b/plugins/javaFX/testData/highlighting/ControllerIdRefController.java
new file mode 100644
index 000000000000..050f592009d8
--- /dev/null
+++ b/plugins/javaFX/testData/highlighting/ControllerIdRefController.java
@@ -0,0 +1,4 @@
+import javafx.scene.text.Text;
+public class ControllerIdRefController {
+ public Text accessText;
+}
\ No newline at end of file
diff --git a/plugins/javaFX/testData/highlighting/RootTagConstraint.fxml b/plugins/javaFX/testData/highlighting/RootTagConstraint.fxml
deleted file mode 100644
index c275495598d0..000000000000
--- a/plugins/javaFX/testData/highlighting/RootTagConstraint.fxml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-<ArrayList xmlns:fx="http://javafx.com/fxml"/>
\ No newline at end of file
diff --git a/plugins/javaFX/testData/highlighting/appIcon.png b/plugins/javaFX/testData/highlighting/appIcon.png
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/plugins/javaFX/testData/highlighting/enumValues.fxml b/plugins/javaFX/testData/highlighting/enumValues.fxml
new file mode 100644
index 000000000000..c149f40fd8e7
--- /dev/null
+++ b/plugins/javaFX/testData/highlighting/enumValues.fxml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+ "UNKNOWN"/>
+
\ No newline at end of file
diff --git a/plugins/javaFX/testData/highlighting/imageIcon.fxml b/plugins/javaFX/testData/highlighting/imageIcon.fxml
new file mode 100644
index 000000000000..f951ad25d181
--- /dev/null
+++ b/plugins/javaFX/testData/highlighting/imageIcon.fxml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @unknownIcon.png"/>
+
+
+
+
diff --git a/plugins/javaFX/testData/highlighting/loginForm.fxml b/plugins/javaFX/testData/highlighting/loginForm.fxml
index 9c0187415179..5c90c09b90da 100644
--- a/plugins/javaFX/testData/highlighting/loginForm.fxml
+++ b/plugins/javaFX/testData/highlighting/loginForm.fxml
@@ -1,6 +1,6 @@
-
+unknownAttr="val" xmlns:fx="http://javafx.com/fxml">
diff --git a/plugins/javaFX/testData/highlighting/staticProperties.fxml b/plugins/javaFX/testData/highlighting/staticProperties.fxml
new file mode 100644
index 000000000000..047c4a5677b8
--- /dev/null
+++ b/plugins/javaFX/testData/highlighting/staticProperties.fxml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ AnchorPane.leftAnchor1="0.0">
+ 200
+ <AnchorPane1.bottomAnchor>200AnchorPane1.bottomAnchor>
+ 0
+
+
+
diff --git a/plugins/javaFX/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXHighlightingTest.java b/plugins/javaFX/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXHighlightingTest.java
index 4fcef78d029b..170fbad35e6a 100644
--- a/plugins/javaFX/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXHighlightingTest.java
+++ b/plugins/javaFX/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFXHighlightingTest.java
@@ -2,6 +2,8 @@ package org.jetbrains.plugins.javaFX.fxml;
import com.intellij.codeInsight.daemon.DaemonAnalyzerTestCase;
import com.intellij.openapi.application.PluginPathManager;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiReference;
import com.intellij.testFramework.PsiTestUtil;
import org.jetbrains.annotations.NotNull;
@@ -32,14 +34,39 @@ public class JavaFXHighlightingTest extends DaemonAnalyzerTestCase {
doTest();
}
- public void testRootTagConstraint() throws Exception {
+ public void testStaticProperties() throws Exception {
doTest();
}
+ public void testEnumValues() throws Exception {
+ doTest();
+ }
+
+ public void testImageIcon() throws Exception {
+ configureByFiles(null, getTestName(true) + ".fxml", "appIcon.png");
+ doDoTest(false, false);
+ }
+
private void doTest() throws Exception {
doTest(false, false, getTestName(true) + ".fxml");
}
+ public void testControllerIdRef() throws Exception {
+ doTestIdController();
+ }
+
+ private void doTestIdController() throws Exception {
+ final String controllerClassName = getTestName(false) + "Controller";
+ configureByFiles(null, getTestName(true) + ".fxml", controllerClassName + ".java");
+ final PsiClass controllerClass = findClass(controllerClassName);
+ assertNotNull(controllerClass);
+ assertTrue(controllerClass.getFields().length > 0);
+ final int offset = myEditor.getCaretModel().getOffset();
+ final PsiReference reference = myFile.findReferenceAt(offset);
+ assertNotNull(reference);
+ assertEquals(controllerClass.getFields()[0], reference.resolve());
+ }
+
@NotNull
@Override
protected String getTestDataPath() {
diff --git a/plugins/javaFX/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFxCompletionTest.java b/plugins/javaFX/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFxCompletionTest.java
new file mode 100644
index 000000000000..7ccac483a614
--- /dev/null
+++ b/plugins/javaFX/testSrc/org/jetbrains/plugins/javaFX/fxml/JavaFxCompletionTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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 org.jetbrains.plugins.javaFX.fxml;
+
+import com.intellij.codeInsight.completion.CompletionTestCase;
+import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.openapi.application.PluginPathManager;
+import com.intellij.testFramework.PsiTestUtil;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * User: anna
+ * Date: 1/17/13
+ */
+public class JavaFxCompletionTest extends CompletionTestCase {
+
+ @Override
+ protected void setUpModule() {
+ super.setUpModule();
+ PsiTestUtil.addLibrary(getModule(), "javafx", PluginPathManager.getPluginHomePath("javaFX") + "/testData", "jfxrt.jar");
+ }
+
+ public void testAvailablePositions() throws Exception {
+ doTest();
+ }
+
+ public void testStaticProperties() throws Exception {
+ doTest("GridPane.columnIndex");
+ }
+
+ public void testStaticPropertiesEnumValue() throws Exception {
+ doTest();
+ }
+
+ private void doTest() throws Exception {
+ doTest(null);
+ }
+
+ private void doTest(final String selection) throws Exception {
+ configureByFile(getTestName(true) + ".fxml");
+ assertTrue(myItems.length > 0);
+ LookupElement selectionElement = null;
+ for (LookupElement item : myItems) {
+ if (item.getLookupString().equals(selection)) {
+ selectionElement = item;
+ break;
+ }
+ }
+ if (selection != null && selectionElement == null) {
+ fail(selection + " is not suggested");
+ }
+ if (selectionElement == null) {
+ selectionElement = myItems[0];
+ }
+ selectItem(selectionElement);
+ checkResultByFile(getTestName(true) + "_after.fxml");
+ }
+
+ @NotNull
+ @Override
+ protected String getTestDataPath() {
+ return PluginPathManager.getPluginHomePath("javaFX") + "/testData/completion/";
+ }
+}
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/compiler/MavenResourceCompiler.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/compiler/MavenResourceCompiler.java
index f74ac8866cdb..209583b6f731 100644
--- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/compiler/MavenResourceCompiler.java
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/compiler/MavenResourceCompiler.java
@@ -217,7 +217,6 @@ public class MavenResourceCompiler implements ClassPostProcessingCompiler {
private static Properties loadPropertiesAndFilters(CompileContext context, MavenProject mavenProject) {
Properties properties = new Properties();
- properties.putAll(mavenProject.getProperties());
for (String each : mavenProject.getFilters()) {
try {
@@ -234,6 +233,9 @@ public class MavenResourceCompiler implements ClassPostProcessingCompiler {
context.addMessage(CompilerMessageCategory.WARNING, "Maven: Cannot read the filter. " + e.getMessage(), url, -1, -1);
}
}
+
+ properties.putAll(mavenProject.getProperties());
+
return properties;
}
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenDomProjectProcessorUtils.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenDomProjectProcessorUtils.java
index e4a10bf46d98..04fc290b0c7b 100644
--- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenDomProjectProcessorUtils.java
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenDomProjectProcessorUtils.java
@@ -156,8 +156,7 @@ public class MavenDomProjectProcessorUtils {
@NotNull
- public static Set searchDependencyUsages(@NotNull final MavenDomDependency dependency,
- @NotNull final Project project) {
+ public static Set searchDependencyUsages(@NotNull final MavenDomDependency dependency) {
final MavenDomProjectModel model = dependency.getParentOfType(MavenDomProjectModel.class, false);
if (model != null) {
final String artifactId = dependency.getArtifactId().getStringValue();
@@ -206,6 +205,43 @@ public class MavenDomProjectProcessorUtils {
return usages;
}
+ @NotNull
+ public static Collection searchManagedPluginUsages(@NotNull final MavenDomPlugin plugin) {
+ String artifactId = plugin.getArtifactId().getStringValue();
+ if (artifactId == null) return Collections.emptyList();
+
+ String groupId = plugin.getGroupId().getStringValue();
+
+ MavenDomProjectModel model = plugin.getParentOfType(MavenDomProjectModel.class, false);
+ if (model == null) return Collections.emptyList();
+
+ return searchManagedPluginUsages(model, groupId, artifactId);
+ }
+
+ @NotNull
+ public static Collection searchManagedPluginUsages(@NotNull final MavenDomProjectModel model,
+ @Nullable final String groupId,
+ @NotNull final String artifactId) {
+ Project project = model.getManager().getProject();
+
+ final Set usages = new HashSet();
+
+ Processor collectProcessor = new Processor() {
+ public boolean process(MavenDomProjectModel mavenDomProjectModel) {
+ for (MavenDomPlugin domPlugin : mavenDomProjectModel.getBuild().getPlugins().getPlugins()) {
+ if (MavenPluginDomUtil.isPlugin(domPlugin, groupId, artifactId)) {
+ usages.add(domPlugin);
+ }
+ }
+ return false;
+ }
+ };
+
+ processChildrenRecursively(model, collectProcessor, project, new HashSet(), true);
+
+ return usages;
+ }
+
public static void processChildrenRecursively(@Nullable MavenDomProjectModel model,
@NotNull Processor processor) {
processChildrenRecursively(model, processor, true);
@@ -291,48 +327,85 @@ public class MavenDomProjectProcessorUtils {
return processor.myResult;
}
+ @Nullable
+ public static MavenDomPlugin searchManagingPlugin(@NotNull final MavenDomPlugin plugin) {
+ final String artifactId = plugin.getArtifactId().getStringValue();
+ final String groupId = plugin.getGroupId().getStringValue();
+ if (artifactId == null) return null;
+
+ final MavenDomProjectModel model = plugin.getParentOfType(MavenDomProjectModel.class, false);
+ if (model == null) return null;
+
+ SearchProcessor processor = new SearchProcessor() {
+ @Override
+ protected MavenDomPlugin find(MavenDomPlugins mavenDomPlugins) {
+ if (!model.equals(mavenDomPlugins.getParentOfType(MavenDomProjectModel.class, true))) {
+ for (MavenDomPlugin domPlugin : mavenDomPlugins.getPlugins()) {
+ if (MavenPluginDomUtil.isPlugin(domPlugin, groupId, artifactId)) {
+ return domPlugin;
+ }
+ }
+ }
+
+ return null;
+ }
+ };
+
+ Function domProfileFunction = new Function() {
+ public MavenDomPlugins fun(MavenDomProjectModelBase mavenDomProfile) {
+ return mavenDomProfile.getBuild().getPluginManagement().getPlugins();
+ }
+ };
+
+ process(model, processor, model.getManager().getProject(), domProfileFunction, domProfileFunction);
+
+ return processor.myResult;
+ }
+
public static boolean processDependenciesInDependencyManagement(@NotNull MavenDomProjectModel projectDom,
@NotNull final Processor processor,
@NotNull final Project project) {
- Function domProfileFunction = new Function() {
- public MavenDomDependencies fun(MavenDomProfile mavenDomProfile) {
+ Function domFunction = new Function() {
+ public MavenDomDependencies fun(MavenDomProjectModelBase mavenDomProfile) {
return mavenDomProfile.getDependencyManagement().getDependencies();
}
};
- Function projectDomFunction = new Function() {
- public MavenDomDependencies fun(MavenDomProjectModel mavenDomProjectModel) {
- return mavenDomProjectModel.getDependencyManagement().getDependencies();
+
+ return process(projectDom, processor, project, domFunction, domFunction);
+ }
+
+ public static boolean processDependencies(@NotNull MavenDomProjectModel projectDom,
+ @NotNull final Processor processor) {
+
+ Function domFunction = new Function() {
+ public MavenDomDependencies fun(MavenDomProjectModelBase mavenDomProfile) {
+ return mavenDomProfile.getDependencies();
}
};
- return process(projectDom, processor, project, domProfileFunction, projectDomFunction);
+ return process(projectDom, processor, projectDom.getManager().getProject(), domFunction, domFunction);
}
public static boolean processProperties(@NotNull MavenDomProjectModel projectDom,
@NotNull final Processor processor,
@NotNull final Project project) {
- Function domProfileFunction = new Function() {
- public MavenDomProperties fun(MavenDomProfile mavenDomProfile) {
+ Function domFunction = new Function() {
+ public MavenDomProperties fun(MavenDomProjectModelBase mavenDomProfile) {
return mavenDomProfile.getProperties();
}
};
- Function projectDomFunction = new Function() {
- public MavenDomProperties fun(MavenDomProjectModel mavenDomProjectModel) {
- return mavenDomProjectModel.getProperties();
- }
- };
- return process(projectDom, processor, project, domProfileFunction, projectDomFunction);
+ return process(projectDom, processor, project, domFunction, domFunction);
}
public static boolean process(@NotNull MavenDomProjectModel projectDom,
@NotNull final Processor processor,
@NotNull final Project project,
- @NotNull final Function domProfileFunction,
- @NotNull final Function projectDomFunction) {
+ @NotNull final Function super MavenDomProfile , T> domProfileFunction,
+ @NotNull final Function super MavenDomProjectModel, T> projectDomFunction) {
return process(projectDom, processor, project, domProfileFunction, projectDomFunction, new HashSet());
}
@@ -341,8 +414,8 @@ public class MavenDomProjectProcessorUtils {
public static boolean process(@NotNull MavenDomProjectModel projectDom,
@NotNull final Processor processor,
@NotNull final Project project,
- @NotNull final Function domProfileFunction,
- @NotNull final Function projectDomFunction,
+ @NotNull final Function super MavenDomProfile, T> domProfileFunction,
+ @NotNull final Function super MavenDomProjectModel, T> projectDomFunction,
final Set processed) {
if (processed.contains(projectDom)) return true;
processed.add(projectDom);
@@ -358,8 +431,8 @@ public class MavenDomProjectProcessorUtils {
private static boolean processParentProjectFile(MavenDomProjectModel projectDom,
final Processor processor,
final Project project,
- final Function domProfileFunction,
- final Function projectDomFunction,
+ final Function super MavenDomProfile, T> domProfileFunction,
+ final Function super MavenDomProjectModel, T> projectDomFunction,
final Set processed) {
Boolean aBoolean = new DomParentProjectFileProcessor(MavenProjectsManager.getInstance(project)) {
protected Boolean doProcessParent(VirtualFile parentFile) {
@@ -378,7 +451,7 @@ public class MavenDomProjectProcessorUtils {
private static boolean processSettingsXml(@Nullable MavenProject mavenProject,
@NotNull Processor processor,
@NotNull Project project,
- Function domProfileFunction) {
+ Function super MavenDomProfile, T> domProfileFunction) {
MavenGeneralSettings settings = MavenProjectsManager.getInstance(project).getGeneralSettings();
for (VirtualFile each : settings.getEffectiveSettingsFiles()) {
@@ -394,8 +467,8 @@ public class MavenDomProjectProcessorUtils {
MavenProject mavenProjectOrNull,
Processor processor,
Project project,
- Function domProfileFunction,
- Function projectDomFunction) {
+ Function super MavenDomProfile, T> domProfileFunction,
+ Function super MavenDomProjectModel, T> projectDomFunction) {
if (processProfilesXml(MavenDomUtil.getVirtualFile(projectDom), mavenProjectOrNull, processor, project, domProfileFunction)) {
return true;
@@ -411,7 +484,7 @@ public class MavenDomProjectProcessorUtils {
MavenProject mavenProjectOrNull,
Processor processor,
Project project,
- Function f) {
+ Function super MavenDomProfile, T> f) {
VirtualFile profilesFile = MavenUtil.findProfilesXmlFile(projectFile);
if (profilesFile == null) return false;
@@ -424,7 +497,7 @@ public class MavenDomProjectProcessorUtils {
private static boolean processProfiles(MavenDomProfiles profilesDom,
MavenProject mavenProjectOrNull,
Processor processor,
- Function f) {
+ Function super MavenDomProfile, T> f) {
Collection activePropfiles = mavenProjectOrNull == null ? null : mavenProjectOrNull.getActivatedProfilesIds();
for (MavenDomProfile each : profilesDom.getProfiles()) {
XmlTag idTag = each.getId().getXmlTag();
@@ -438,7 +511,7 @@ public class MavenDomProjectProcessorUtils {
private static boolean processProfile(MavenDomProfile profileDom,
Processor processor,
- Function f) {
+ Function super MavenDomProfile, T> f) {
T t = f.fun(profileDom);
return t != null && processor.process(t);
}
@@ -473,7 +546,7 @@ public class MavenDomProjectProcessorUtils {
}
}
- private abstract static class SearchProcessor implements Processor {
+ public abstract static class SearchProcessor implements Processor {
private R myResult;
@@ -490,5 +563,11 @@ public class MavenDomProjectProcessorUtils {
@Nullable
protected abstract R find(T element);
+
+ public R getResult() {
+ return myResult;
+ }
}
+
+
}
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenPluginDomUtil.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenPluginDomUtil.java
index 4233475a5031..2d7e40bec492 100644
--- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenPluginDomUtil.java
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenPluginDomUtil.java
@@ -44,18 +44,22 @@ public class MavenPluginDomUtil {
return MavenDomUtil.getMavenDomModel(p, pluginXmlFile, MavenDomPluginModel.class);
}
- public static boolean isPlugin(@NotNull MavenDomConfiguration configuration, @NotNull String groupId, @NotNull String artifactId) {
+ public static boolean isPlugin(@NotNull MavenDomConfiguration configuration, @Nullable String groupId, @NotNull String artifactId) {
MavenDomPlugin domPlugin = configuration.getParentOfType(MavenDomPlugin.class, true);
if (domPlugin == null) return false;
return isPlugin(domPlugin, groupId, artifactId);
}
- public static boolean isPlugin(@NotNull MavenDomPlugin plugin, @NotNull String groupId, @NotNull String artifactId) {
+ public static boolean isPlugin(@NotNull MavenDomPlugin plugin, @Nullable String groupId, @NotNull String artifactId) {
if (!artifactId.equals(plugin.getArtifactId().getStringValue())) return false;
String pluginGroupId = plugin.getGroupId().getStringValue();
+ if (groupId == null) {
+ return pluginGroupId == null || (pluginGroupId.equals("org.apache.maven.plugins") || pluginGroupId.equals("org.codehaus.mojo"));
+ }
+
if (pluginGroupId == null && (groupId.equals("org.apache.maven.plugins") || groupId.equals("org.codehaus.mojo"))) {
return true;
}
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/annotator/MavenDomGutterAnnotator.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/annotator/MavenDomGutterAnnotator.java
index 7d19bb7340ef..1daf45ba9f17 100644
--- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/annotator/MavenDomGutterAnnotator.java
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/annotator/MavenDomGutterAnnotator.java
@@ -44,7 +44,155 @@ import java.util.Set;
public class MavenDomGutterAnnotator implements Annotator {
- private static final PsiElementListCellRenderer