diff --git a/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java b/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java index cc1fd353a327..6c56b6c2cc8b 100644 --- a/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java +++ b/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java @@ -1,4 +1,4 @@ -/* The following code was generated by JFlex 1.4.3 on 10/28/14 3:07 PM */ +/* The following code was generated by JFlex 1.4.3 on 10/28/14 5:18 PM */ /* It's an automatically generated code. Do not modify it. */ package org.intellij.lang.regexp; @@ -15,7 +15,7 @@ import java.util.EnumSet; /** * This class is a scanner generated by * JFlex 1.4.3 - * on 10/28/14 3:07 PM from the specification file + * on 10/28/14 5:18 PM from the specification file * /Users/bas/Projects/IntelliJ IDEA Ultimate/tools/lexer/../../community/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex */ class _RegExLexer implements FlexLexer { @@ -24,7 +24,7 @@ class _RegExLexer implements FlexLexer { /** lexical states */ public static final int EMBRACED = 4; - public static final int CLASS1PY = 8; + public static final int NEGATE_CLASS1 = 8; public static final int PY_NAMED_GROUP_REF = 22; public static final int QUOTED = 2; public static final int OPTIONS = 14; @@ -730,68 +730,68 @@ class _RegExLexer implements FlexLexer { { yybegin(YYINITIAL); return RegExpTT.GROUP_END; } case 88: break; - case 37: - { yybegin(YYINITIAL); return RegExpTT.COLON; - } - case 89: break; - case 6: - { return RegExpTT.GROUP_END; - } - case 90: break; - case 25: - { assert false : yytext(); - } - case 91: break; - case 18: - { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.CHARACTER; - } - case 92: break; - case 46: - { return commentMode ? RegExpTT.CHARACTER : RegExpTT.REDUNDANT_ESCAPE; - } - case 93: break; - case 23: - { return RegExpTT.NAME; - } - case 94: break; - case 29: - { yypopstate(); return RegExpTT.CLASS_END; - } - case 95: break; - case 34: - { yybegin(YYINITIAL); return RegExpTT.BAD_CHARACTER; - } - case 96: break; - case 52: - { yypushstate(QUOTED); return RegExpTT.QUOTE_BEGIN; - } - case 97: break; - case 21: - { return RegExpTT.NUMBER; - } - case 98: break; - case 4: - { return RegExpTT.DOT; - } - case 99: break; - case 72: - { return RegExpTT.NEG_LOOKBEHIND; - } - case 100: break; - case 33: - { yypopstate(); if (allowCategoryShorthand) return RegExpTT.CATEGORY_SHORT_HAND; else yypushback(1); - } - case 101: break; - case 44: - { return (allowOctalNoLeadingZero ? RegExpTT.OCT_CHAR : RegExpTT.BAD_OCT_VALUE); - } - case 102: break; case 41: // lookahead expression with fixed base length zzMarkedPos = zzStartRead + 1; - { yypushstate(CLASS1); + { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(CLASS1); return RegExpTT.CLASS_BEGIN; } + case 89: break; + case 37: + { yybegin(YYINITIAL); return RegExpTT.COLON; + } + case 90: break; + case 6: + { return RegExpTT.GROUP_END; + } + case 91: break; + case 25: + { assert false : yytext(); + } + case 92: break; + case 18: + { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.CHARACTER; + } + case 93: break; + case 46: + { return commentMode ? RegExpTT.CHARACTER : RegExpTT.REDUNDANT_ESCAPE; + } + case 94: break; + case 23: + { return RegExpTT.NAME; + } + case 95: break; + case 29: + { yypopstate(); return RegExpTT.CLASS_END; + } + case 96: break; + case 34: + { yybegin(YYINITIAL); return RegExpTT.BAD_CHARACTER; + } + case 97: break; + case 52: + { yypushstate(QUOTED); return RegExpTT.QUOTE_BEGIN; + } + case 98: break; + case 21: + { return RegExpTT.NUMBER; + } + case 99: break; + case 4: + { return RegExpTT.DOT; + } + case 100: break; + case 72: + { return RegExpTT.NEG_LOOKBEHIND; + } + case 101: break; + case 33: + { yypopstate(); if (allowCategoryShorthand) return RegExpTT.CATEGORY_SHORT_HAND; else yypushback(1); + } + case 102: break; + case 44: + { return (allowOctalNoLeadingZero ? RegExpTT.OCT_CHAR : RegExpTT.BAD_OCT_VALUE); + } case 103: break; case 63: { return RegExpTT.NEG_LOOKAHEAD; @@ -809,18 +809,6 @@ class _RegExLexer implements FlexLexer { { yybegin(QUOTED_NAMED_GROUP); return RegExpTT.RUBY_QUOTED_NAMED_GROUP; } case 107: break; - case 66: - // lookahead expression with fixed base length - zzMarkedPos = zzStartRead + 1; - { if (allowEmptyCharacterClass) { - yypushstate(CLASS1PY); - } - else { - yypushstate(CLASS2); - } - return RegExpTT.CLASS_BEGIN; - } - case 108: break; case 28: { if (allowNestedCharacterClasses) { yypushstate(CLASS2); @@ -828,24 +816,24 @@ class _RegExLexer implements FlexLexer { } return RegExpTT.CHARACTER; } - case 109: break; + case 108: break; case 19: { if (commentMode) { yypushstate(COMMENT); return RegExpTT.COMMENT; } else return RegExpTT.CHARACTER; } - case 110: break; + case 109: break; case 51: { yypushstate(PROP); return RegExpTT.PROPERTY; } - case 111: break; + case 110: break; case 8: { yypushstate(CLASS2); return RegExpTT.CLASS_BEGIN; } - case 112: break; + case 111: break; case 71: { return RegExpTT.POS_LOOKBEHIND; } - case 113: break; + case 112: break; case 20: { if (allowDanglingMetacharacters) { yypopstate(); yypushback(1); @@ -853,15 +841,15 @@ class _RegExLexer implements FlexLexer { return RegExpTT.BAD_CHARACTER; } } - case 114: break; + case 113: break; case 73: { return RegExpTT.HEX_CHAR; } - case 115: break; + case 114: break; case 1: { handleOptions(); return RegExpTT.OPTIONS_ON; } - case 116: break; + case 115: break; case 43: { if (yystate() == CLASS2) return RegExpTT.ESC_CHARACTER; while (yylength() > 2 && Integer.parseInt(yytext().toString().substring(1)) > capturingGroupCount) { @@ -869,55 +857,55 @@ class _RegExLexer implements FlexLexer { } return RegExpTT.BACKREF; } - case 117: break; + case 116: break; case 59: { return allowNestedCharacterClasses ? RegExpTT.ANDAND : RegExpTT.CHARACTER; } - case 118: break; + case 117: break; case 2: { yypopstate(); return RegExpTT.COMMENT; } - case 119: break; + case 118: break; case 17: { return RegExpTT.MINUS; } - case 120: break; + case 119: break; case 47: { return RegExpTT.ESC_CTRL_CHARACTER; } - case 121: break; + case 120: break; case 32: { yypopstate(); yypushstate(EMBRACED); return RegExpTT.LBRACE; } - case 122: break; + case 121: break; case 13: { return RegExpTT.QUEST; } - case 123: break; + case 122: break; case 5: { capturingGroupCount++; return RegExpTT.GROUP_BEGIN; } - case 124: break; + case 123: break; case 15: { return RegExpTT.PLUS; } - case 125: break; + case 124: break; case 67: { return RegExpTT.OCT_CHAR; } - case 126: break; + case 125: break; case 39: { yybegin(YYINITIAL); return RegExpTT.QUOTE; } - case 127: break; + case 126: break; case 31: { yypopstate(); yypushback(1); } - case 128: break; + case 127: break; case 27: { yybegin(CLASS1); return RegExpTT.CARET; } - case 129: break; + case 128: break; case 57: // lookahead expression with fixed base length zzMarkedPos = zzStartRead + 1; @@ -927,71 +915,78 @@ class _RegExLexer implements FlexLexer { } return RegExpTT.CHARACTER; } - case 130: break; + case 129: break; case 58: { if (!allowNestedCharacterClasses) return RegExpTT.CHARACTER; return RegExpTT.REDUNDANT_ESCAPE; } - case 131: break; + case 130: break; case 38: { yybegin(YYINITIAL); return RegExpTT.GT; } - case 132: break; + case 131: break; case 69: { yybegin(PY_NAMED_GROUP_REF); return RegExpTT.PYTHON_NAMED_GROUP_REF; } - case 133: break; + case 132: break; case 16: { return RegExpTT.UNION; } - case 134: break; + case 133: break; case 3: { return RegExpTT.CHARACTER; } - case 135: break; + case 134: break; case 64: { yybegin(NAMED_GROUP); return RegExpTT.RUBY_NAMED_GROUP; } - case 136: break; + case 135: break; case 40: { yybegin(OPTIONS); return RegExpTT.SET_OPTIONS; } - case 137: break; + case 136: break; case 26: { yybegin(CLASS2); return RegExpTT.CHARACTER; } - case 138: break; + case 137: break; case 68: { if (xmlSchemaMode) { yypushback(1); return RegExpTT.CHAR_CLASS; } else return RegExpTT.CTRL; } - case 139: break; + case 138: break; case 30: { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.ESC_CHARACTER; } - case 140: break; + case 139: break; case 12: { return RegExpTT.DOLLAR; } - case 141: break; + case 140: break; case 50: { if (xmlSchemaMode) return RegExpTT.CHAR_CLASS; else return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN; } - case 142: break; + case 141: break; case 42: { return RegExpTT.REDUNDANT_ESCAPE; } - case 143: break; + case 142: break; case 55: { return (allowHexDigitClass || allowHorizontalWhitespaceClass ? RegExpTT.CHAR_CLASS : StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN); } - case 144: break; + case 143: break; case 48: { return yystate() != CLASS2 ? RegExpTT.BOUNDARY : RegExpTT.ESC_CHARACTER; } - case 145: break; + case 144: break; case 22: { yypopstate(); return RegExpTT.RBRACE; } + case 145: break; + case 66: + // lookahead expression with fixed base length + zzMarkedPos = zzStartRead + 1; + { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(NEGATE_CLASS1); + return RegExpTT.CLASS_BEGIN; + } case 146: break; case 54: { return StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN; diff --git a/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex b/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex index 2d5daf7f65ab..e722b9516310 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex +++ b/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex @@ -75,7 +75,7 @@ import java.util.EnumSet; %xstate QUOTED %xstate EMBRACED %xstate CLASS1 -%xstate CLASS1PY +%xstate NEGATE_CLASS1 %state CLASS2 %state PROP %xstate OPTIONS @@ -228,18 +228,11 @@ HEX_CHAR=[0-9a-fA-F] } } -{LBRACKET} / {RBRACKET} { yypushstate(CLASS1); +{LBRACKET} / {RBRACKET} { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(CLASS1); return RegExpTT.CLASS_BEGIN; } -/* Python understands that, Java doesn't */ -{LBRACKET} / "^" {RBRACKET} { if (allowEmptyCharacterClass) { - yypushstate(CLASS1PY); - } - else { - yypushstate(CLASS2); - } - return RegExpTT.CLASS_BEGIN; - } +{LBRACKET} / "^" {RBRACKET} { if (allowEmptyCharacterClass) yypushstate(CLASS2); else yypushstate(NEGATE_CLASS1); + return RegExpTT.CLASS_BEGIN; } {LBRACKET} { yypushstate(CLASS2); return RegExpTT.CLASS_BEGIN; } @@ -250,7 +243,7 @@ HEX_CHAR=[0-9a-fA-F] . { assert false : yytext(); } } - { + { "^" { yybegin(CLASS1); return RegExpTT.CARET; } . { assert false : yytext(); } } diff --git a/RegExpSupport/testData/RETest.xml b/RegExpSupport/testData/RETest.xml index f42b9af45c51..470851e4bda8 100644 --- a/RegExpSupport/testData/RETest.xml +++ b/RegExpSupport/testData/RETest.xml @@ -296,6 +296,10 @@ a[]b ERR + + [^] + ERR + [abhgefdc]ij OK @@ -583,11 +587,11 @@ \x4a OK - + \x{0} OK - + \x{2011F} OK @@ -1043,7 +1047,7 @@ - + \h \H \v \V OK diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java b/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java index c262c65dc497..1ed63531e18f 100644 --- a/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java +++ b/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java @@ -104,7 +104,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements @Nullable private String myBytecodeTargetLevel = null; // null means compiler default - private final Map myModuleBytecodeTarget = new java.util.HashMap(); + private final Map myModuleBytecodeTarget = new HashMap(); public CompilerConfigurationImpl(Project project) { myProject = project; @@ -112,28 +112,78 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements Disposer.register(project, myExcludedEntriesConfiguration); MessageBusConnection connection = project.getMessageBus().connect(project); connection.subscribe(ProjectTopics.MODULES, new ModuleAdapter() { + @Override public void beforeModuleRemoved(Project project, Module module) { getAnnotationProcessingConfiguration(module).removeModuleName(module.getName()); } + @Override public void moduleAdded(Project project, Module module) { myProcessorsProfilesMap = null; // clear cache } }); } + @Override public Element getState() { + Element state = new Element("state"); try { - @NonNls final Element e = new Element("state"); - writeExternal(e); - return e; + DefaultJDOMExternalizer.writeExternal(this, state); } - catch (WriteExternalException e1) { - LOG.error(e1); + catch (WriteExternalException e) { + LOG.error(e); return null; } + + if (!myAddNotNullAssertions) { + addChild(state, JpsJavaCompilerConfigurationSerializer.ADD_NOTNULL_ASSERTIONS).setAttribute( + JpsJavaCompilerConfigurationSerializer.ENABLED, String.valueOf(myAddNotNullAssertions)); + } + + if (myExcludedEntriesConfiguration.getExcludeEntryDescriptions().length > 0) { + myExcludedEntriesConfiguration.writeExternal(addChild(state, JpsJavaCompilerConfigurationSerializer.EXCLUDE_FROM_COMPILE)); + } + + final Element newChild = addChild(state, JpsJavaCompilerConfigurationSerializer.RESOURCE_EXTENSIONS); + for (final String pattern : getRegexpPatterns()) { + addChild(newChild, JpsJavaCompilerConfigurationSerializer.ENTRY).setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, pattern); + } + + if (myWildcardPatternsInitialized || !myWildcardPatterns.isEmpty()) { + final Element wildcardPatterns = addChild(state, JpsJavaCompilerConfigurationSerializer.WILDCARD_RESOURCE_PATTERNS); + for (final String wildcardPattern : myWildcardPatterns) { + addChild(wildcardPatterns, JpsJavaCompilerConfigurationSerializer.ENTRY).setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, wildcardPattern); + } + } + + final Element annotationProcessingSettings = addChild(state, JpsJavaCompilerConfigurationSerializer.ANNOTATION_PROCESSING); + final Element defaultProfileElem = addChild(annotationProcessingSettings, "profile").setAttribute("default", "true"); + AnnotationProcessorProfileSerializer.writeExternal(myDefaultProcessorsProfile, defaultProfileElem); + for (ProcessorConfigProfile profile : myModuleProcessorProfiles) { + final Element profileElem = addChild(annotationProcessingSettings, "profile").setAttribute("default", "false"); + AnnotationProcessorProfileSerializer.writeExternal(profile, profileElem); + } + + if (!StringUtil.isEmpty(myBytecodeTargetLevel) || !myModuleBytecodeTarget.isEmpty()) { + final Element bytecodeTarget = addChild(state, JpsJavaCompilerConfigurationSerializer.BYTECODE_TARGET_LEVEL); + if (!StringUtil.isEmpty(myBytecodeTargetLevel)) { + bytecodeTarget.setAttribute(JpsJavaCompilerConfigurationSerializer.TARGET_ATTRIBUTE, myBytecodeTargetLevel); + } + if (!myModuleBytecodeTarget.isEmpty()) { + final List moduleNames = new ArrayList(myModuleBytecodeTarget.keySet()); + Collections.sort(moduleNames, String.CASE_INSENSITIVE_ORDER); + for (String name : moduleNames) { + final Element moduleElement = addChild(bytecodeTarget, JpsJavaCompilerConfigurationSerializer.MODULE); + moduleElement.setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, name); + final String value = myModuleBytecodeTarget.get(name); + moduleElement.setAttribute(JpsJavaCompilerConfigurationSerializer.TARGET_ATTRIBUTE, value != null ? value : ""); + } + } + } + return state; } + @Override public void loadState(Element state) { try { readExternal(state); @@ -162,6 +212,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements return myModuleBytecodeTarget; } + @Override public void setBytecodeTargetLevel(Module module, String level) { final String previous; if (StringUtil.isEmpty(level)) { @@ -229,11 +280,14 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements } } + @Override public void disposeComponent() { } + @Override public void initComponent() { } + @Override public void projectClosed() { } @@ -242,6 +296,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements return JAVAC_EXTERNAL_BACKEND; } + @Override public void projectOpened() { createCompilers(); } @@ -304,6 +359,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements return ArrayUtil.toStringArray(myWildcardPatterns); } + @Override public void addResourceFilePattern(String namePattern) throws MalformedPatternException { addWildcardResourcePattern(namePattern); } @@ -321,6 +377,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements return myExcludedEntriesConfiguration; } + @Override public boolean isExcludedFromCompilation(final VirtualFile virtualFile) { return myExcludedEntriesConfiguration.isExcluded(virtualFile); } @@ -505,6 +562,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements return wildcardPattern.length() > 1 && wildcardPattern.charAt(0) == '!'; } + @Override public boolean isResourceFile(String name) { return isResourceFile(name, null); } @@ -647,7 +705,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements final Element bytecodeTargetElement = parentNode.getChild(JpsJavaCompilerConfigurationSerializer.BYTECODE_TARGET_LEVEL); if (bytecodeTargetElement != null) { myBytecodeTargetLevel = bytecodeTargetElement.getAttributeValue(JpsJavaCompilerConfigurationSerializer.TARGET_ATTRIBUTE); - for (Element elem : (Collection)bytecodeTargetElement.getChildren(JpsJavaCompilerConfigurationSerializer.MODULE)) { + for (Element elem : bytecodeTargetElement.getChildren(JpsJavaCompilerConfigurationSerializer.MODULE)) { final String name = elem.getAttributeValue(JpsJavaCompilerConfigurationSerializer.NAME); if (name == null) { continue; @@ -746,56 +804,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements } } - private void writeExternal(Element parentNode) throws WriteExternalException { - DefaultJDOMExternalizer.writeExternal(this, parentNode); - - if (myAddNotNullAssertions != true) { - addChild(parentNode, JpsJavaCompilerConfigurationSerializer.ADD_NOTNULL_ASSERTIONS).setAttribute( - JpsJavaCompilerConfigurationSerializer.ENABLED, String.valueOf(myAddNotNullAssertions)); - } - - if(myExcludedEntriesConfiguration.getExcludeEntryDescriptions().length > 0) { - myExcludedEntriesConfiguration.writeExternal(addChild(parentNode, JpsJavaCompilerConfigurationSerializer.EXCLUDE_FROM_COMPILE)); - } - - final Element newChild = addChild(parentNode, JpsJavaCompilerConfigurationSerializer.RESOURCE_EXTENSIONS); - for (final String pattern : getRegexpPatterns()) { - addChild(newChild, JpsJavaCompilerConfigurationSerializer.ENTRY).setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, pattern); - } - - if (myWildcardPatternsInitialized || !myWildcardPatterns.isEmpty()) { - final Element wildcardPatterns = addChild(parentNode, JpsJavaCompilerConfigurationSerializer.WILDCARD_RESOURCE_PATTERNS); - for (final String wildcardPattern : myWildcardPatterns) { - addChild(wildcardPatterns, JpsJavaCompilerConfigurationSerializer.ENTRY).setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, wildcardPattern); - } - } - - final Element annotationProcessingSettings = addChild(parentNode, JpsJavaCompilerConfigurationSerializer.ANNOTATION_PROCESSING); - final Element defaultProfileElem = addChild(annotationProcessingSettings, "profile").setAttribute("default", "true"); - AnnotationProcessorProfileSerializer.writeExternal(myDefaultProcessorsProfile, defaultProfileElem); - for (ProcessorConfigProfile profile : myModuleProcessorProfiles) { - final Element profileElem = addChild(annotationProcessingSettings, "profile").setAttribute("default", "false"); - AnnotationProcessorProfileSerializer.writeExternal(profile, profileElem); - } - - if (!StringUtil.isEmpty(myBytecodeTargetLevel) || !myModuleBytecodeTarget.isEmpty()) { - final Element bytecodeTarget = addChild(parentNode, JpsJavaCompilerConfigurationSerializer.BYTECODE_TARGET_LEVEL); - if (!StringUtil.isEmpty(myBytecodeTargetLevel)) { - bytecodeTarget.setAttribute(JpsJavaCompilerConfigurationSerializer.TARGET_ATTRIBUTE, myBytecodeTargetLevel); - } - if (!myModuleBytecodeTarget.isEmpty()) { - final List moduleNames = new ArrayList(myModuleBytecodeTarget.keySet()); - Collections.sort(moduleNames, String.CASE_INSENSITIVE_ORDER); - for (String name : moduleNames) { - final Element moduleElement = addChild(bytecodeTarget, JpsJavaCompilerConfigurationSerializer.MODULE); - moduleElement.setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, name); - final String value = myModuleBytecodeTarget.get(name); - moduleElement.setAttribute(JpsJavaCompilerConfigurationSerializer.TARGET_ATTRIBUTE, value != null? value : ""); - } - } - } - } - + @Override @NotNull @NonNls public String getComponentName() { return "CompilerConfiguration"; @@ -839,9 +848,11 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements ); final String wildcardPatterns = Messages.showInputDialog( myProject, message, CompilerBundle.message("pattern.conversion.dialog.title"), Messages.getWarningIcon(), initialPatternString, new InputValidator() { + @Override public boolean checkInput(String inputString) { return true; } + @Override public boolean canClose(String inputString) { final StringTokenizer tokenizer = new StringTokenizer(inputString, ";", false); StringBuilder malformedPatterns = new StringBuilder(); @@ -925,6 +936,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements return extensionsString.toString(); } + @Override public boolean isCompilableResourceFile(final Project project, final VirtualFile file) { if (!isResourceFile(file)) { return false; @@ -938,7 +950,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements @Nullable final Pattern dir; @Nullable final Pattern srcRoot; - private CompiledPattern(Pattern fileName, Pattern dir, Pattern srcRoot) { + private CompiledPattern(@NotNull Pattern fileName, @Nullable Pattern dir, @Nullable Pattern srcRoot) { this.fileName = fileName; this.dir = dir; this.srcRoot = srcRoot; diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java index 61bd5d4df803..c19b0e8ec027 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java @@ -32,7 +32,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; -import java.util.Arrays; import java.util.Collections; import java.util.Iterator; @@ -176,7 +175,7 @@ public class JavaExecutionStack extends XExecutionStack { } if (first || DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES || (!frame.getDescriptor().isSynthetic() && !frame.getDescriptor().isInLibraryContent())) { if (++myAdded > mySkip) { - myContainer.addStackFrames(Arrays.asList(frame), false); + myContainer.addStackFrames(Collections.singletonList(frame), false); } } myDebugProcess.getManagerThread().schedule( diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/ImageObjectRenderer.java b/java/debugger/impl/src/com/intellij/debugger/settings/ImageObjectRenderer.java index 8f48ae93b995..fa332a347794 100644 --- a/java/debugger/impl/src/com/intellij/debugger/settings/ImageObjectRenderer.java +++ b/java/debugger/impl/src/com/intellij/debugger/settings/ImageObjectRenderer.java @@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; -import java.util.Arrays; +import java.util.Collections; import java.util.List; /** @@ -88,7 +88,7 @@ class ImageObjectRenderer extends CompoundReferenceRenderer implements FullValue if (cls != null) { List methods = cls.methodsByName(methodName); if (!methods.isEmpty()) { - return process.invokeMethod(evaluationContext, cls, methods.get(0), Arrays.asList(obj)); + return process.invokeMethod(evaluationContext, cls, methods.get(0), Collections.singletonList(obj)); } } return null; diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluator.java index 90df15380b3f..8900db300cf1 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluator.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluator.java @@ -50,10 +50,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes; import javax.tools.*; import java.io.ByteArrayOutputStream; import java.net.URI; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; +import java.util.*; /** * @author egor @@ -250,9 +247,9 @@ public class CompilingEvaluator implements ExpressionEvaluator { StringReference url = proxy.mirrorOf("file:a"); keep(url, context); ObjectReference reference = classType.newInstance(threadReference, classType.concreteMethodByName("", "(Ljava/lang/String;)V"), - Arrays.asList(url), ClassType.INVOKE_SINGLE_THREADED); + Collections.singletonList(url), ClassType.INVOKE_SINGLE_THREADED); keep(reference, context); - arrayRef.setValues(Arrays.asList(reference)); + arrayRef.setValues(Collections.singletonList(reference)); return arrayRef; } @@ -290,7 +287,7 @@ public class CompilingEvaluator implements ExpressionEvaluator { diagnostic, options, null, - Arrays.asList(new SourceFileObject(getMainClassName(), JavaFileObject.Kind.SOURCE, getClassCode())) + Collections.singletonList(new SourceFileObject(getMainClassName(), JavaFileObject.Kind.SOURCE, getClassCode())) ).call()) { StringBuilder res = new StringBuilder("Compilation failed:\n"); for (Diagnostic d : diagnostic.getDiagnostics()) { diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/MethodsTracker.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/MethodsTracker.java index 40435a0f14a7..3f526b7066c3 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/MethodsTracker.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/MethodsTracker.java @@ -19,9 +19,7 @@ import com.sun.jdi.Method; import org.jetbrains.annotations.Nullable; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; -import java.util.Set; /** * @author Eugene Zhuravlev @@ -29,7 +27,7 @@ import java.util.Set; */ public class MethodsTracker { private final Map myMethodToOccurrenceMap = new HashMap(); - private final Set myProcessedFrames = new HashSet(); + private final Map myInitialOccurence = new HashMap(); public final class MethodOccurrence { private final Method myMethod; @@ -54,12 +52,13 @@ public class MethodsTracker { } public MethodOccurrence getMethodOccurrence(int frameIndex, @Nullable Method method) { - int occurenceIndex = getOccurrenceCount(method); - if (!myProcessedFrames.contains(frameIndex)) { - myMethodToOccurrenceMap.put(method, occurenceIndex + 1); - myProcessedFrames.add(frameIndex); + Integer initial = myInitialOccurence.get(frameIndex); + if (initial == null) { + initial = getOccurrenceCount(method); + myMethodToOccurrenceMap.put(method, initial + 1); + myInitialOccurence.put(frameIndex, initial); } - return new MethodOccurrence(method, occurenceIndex); + return new MethodOccurrence(method, initial); } private int getOccurrenceCount(Method method) { diff --git a/java/java-impl/src/com/intellij/psi/RefResolveServiceImpl.java b/java/java-impl/src/com/intellij/psi/RefResolveServiceImpl.java index 38388235ae69..bb2a71953af3 100644 --- a/java/java-impl/src/com/intellij/psi/RefResolveServiceImpl.java +++ b/java/java-impl/src/com/intellij/psi/RefResolveServiceImpl.java @@ -26,7 +26,10 @@ import com.intellij.openapi.application.ex.ApplicationUtil; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.module.Module; -import com.intellij.openapi.progress.*; +import com.intellij.openapi.progress.ProcessCanceledException; +import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.progress.ProgressManager; +import com.intellij.openapi.progress.Task; import com.intellij.openapi.progress.impl.BackgroundableProcessIndicator; import com.intellij.openapi.progress.impl.ProgressManagerImpl; import com.intellij.openapi.progress.util.ProgressIndicatorBase; @@ -105,12 +108,20 @@ public class RefResolveServiceImpl extends RefResolveService implements Runnable myApplication = application; myProjectFileIndex = projectFileIndex; if (ENABLED) { - File indexFile = new File(getStorageDirectory(), "index"); File dataFile = new File(getStorageDirectory(), "data"); fileIsResolved = ConcurrentBitSet.readFrom(new File(getStorageDirectory(), "bitSet")); - final boolean initial = !indexFile.exists() || !dataFile.exists(); - storage = new PersistentIntList(indexFile, dataFile, initial); + int maxId = FSRecords.getMaxId(); + PersistentIntList list = new PersistentIntList(dataFile, dataFile.exists() ? 0 : maxId); + if (list.getSize() == maxId) { + storage = list; + } + else { + // just to be safe, re-resolve all if VFS files count changes since last restart + list.dispose(); + storage = new PersistentIntList(dataFile, maxId); + fileIsResolved.clear(); + } Disposer.register(this, storage); if (!application.isUnitTestMode()) { startupManager.runWhenProjectIsInitialized(new Runnable() { @@ -716,10 +727,8 @@ public class RefResolveServiceImpl extends RefResolveService implements Runnable if (myProject.isDisposed()) throw new ProcessCanceledException(); if (fileCount.incrementAndGet() % 100 == 0) { PsiManager.getInstance(myProject).dropResolveCaches(); - synchronized (storage) { - storage.flush(); - } try { + storage.flush(); log.flush(); } catch (IOException e) { diff --git a/java/java-psi-impl/src/com/intellij/psi/PsiDiamondTypeImpl.java b/java/java-psi-impl/src/com/intellij/psi/PsiDiamondTypeImpl.java index 5f3eee5c6be3..a9522c333b3d 100644 --- a/java/java-psi-impl/src/com/intellij/psi/PsiDiamondTypeImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/PsiDiamondTypeImpl.java @@ -206,6 +206,11 @@ public class PsiDiamondTypeImpl extends PsiDiamondType { protected PsiClass getContainingClass(PsiMethod method) { return containingClass; } + + @Override + protected boolean acceptVarargs() { + return true; + } }; processor.setArgumentList(argumentList); diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/diamond/Varargs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/diamond/Varargs.java index 9afe7e792e3e..516e12cd6935 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/diamond/Varargs.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/diamond/Varargs.java @@ -24,3 +24,12 @@ class A { bar(s(get(), "")); } } + +class B { + public B(T entity) {} + public B(T entity, Integer... error){} + + void foo(final Integer generalError){ + B value = new B<>("", generalError); + } +} \ No newline at end of file diff --git a/java/jsp-spi/src/com/intellij/jsp/impl/JspElementDescriptor.java b/java/jsp-spi/src/com/intellij/jsp/impl/JspElementDescriptor.java index b9cbbd1e302d..5f32dbe8b8c2 100644 --- a/java/jsp-spi/src/com/intellij/jsp/impl/JspElementDescriptor.java +++ b/java/jsp-spi/src/com/intellij/jsp/impl/JspElementDescriptor.java @@ -21,4 +21,22 @@ import com.intellij.xml.XmlElementDescriptor; * @author Maxim.Mossienko */ public interface JspElementDescriptor extends XmlElementDescriptor { + + /** + * The body of the tag contains nested JSP syntax. + * @see #getContentType() + */ + int CONTENT_TYPE_JSP = CONTENT_TYPE_MIXED; + + /** + * The body accepts only template text, EL Expressions, and JSP action elements. + * No scripting elements are allowed. + */ + int CONTENT_TYPE_SCRIPTLESS = 101; + + /** + * The body of the tag is interpreted by the tag implementation itself, + * and is most likely in a different "language", e.g embedded SQL statements. + */ + int CONTENT_TYPE_TAG_DEPENDENT = 102; } diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java b/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java index e4a8c1a64826..188f3ff77a91 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java @@ -256,6 +256,13 @@ public class PushController implements Disposable { } private boolean isPushAllowed(@NotNull PushSupport pushSupport) { + if (mySingleRepoProject) { + MyRepoModel repoModel = ContainerUtil.getFirstItem(myView2Model.values()); + assert repoModel != null; + return hasSomethingToPush(myView2Model.keySet()) || + !repoModel.getLoadedCommits().isEmpty() || + myDialog.getAdditionalOptionValue(pushSupport) != null; + } Collection nodes = getNodesForSupport(pushSupport); if (pushSupport.getRepositoryManager().isSyncEnabled()) { return hasSomethingToPush(nodes) || (hasCheckedNode(nodes) && allNodesAreLoaded(nodes)); @@ -330,6 +337,7 @@ public class PushController implements Disposable { boolean shouldBeSelected; if (!errors.isEmpty()) { shouldBeSelected = false; + model.setLoadedCommits(outgoing.getCommits()); myPushLog.setChildren(node, ContainerUtil.map(errors, new Function() { @Override public DefaultMutableTreeNode fun(final VcsError error) { diff --git a/platform/indexing-impl/src/com/intellij/psi/impl/PersistentIntList.java b/platform/indexing-impl/src/com/intellij/psi/impl/PersistentIntList.java index aa5998364db4..8306cda2bfe1 100644 --- a/platform/indexing-impl/src/com/intellij/psi/impl/PersistentIntList.java +++ b/platform/indexing-impl/src/com/intellij/psi/impl/PersistentIntList.java @@ -16,371 +16,286 @@ package com.intellij.psi.impl; import com.intellij.openapi.Disposable; -import com.intellij.openapi.util.Ref; -import com.intellij.openapi.util.io.FileUtil; import com.intellij.util.ArrayUtil; -import com.intellij.util.io.Bits; -import com.intellij.util.io.IntToIntBtree; -import com.intellij.util.io.PagedFileStorage; -import com.intellij.util.io.RandomAccessDataFile; import gnu.trove.TIntHashSet; -import gnu.trove.TIntIntHashMap; -import gnu.trove.TIntIntProcedure; import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.IOException; +import java.io.RandomAccessFile; +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import java.nio.channels.FileChannel; import java.util.Arrays; /** - * the (int -> int[]) map which is persisted to the specified file. + * the (int -> int[]) map which is persisted to the specified file.

+ * File layout:

+ * + *

(to edit the diagram go to www.draw.io, "Import from", this PersistentIntList.png)

*/ public class PersistentIntList implements Disposable { public static final int MAX_DATA_BYTES = 500000000; - public static final int MAX_LIST_LENGTH = 100000; - private final IntToIntBtree index; - private RandomAccessDataFile data; + public static final int MAX_LIST_LENGTH = 10000000; + private final FileChannel data; public int gap; // bytes lost due to fragmentation - private final int dataStart; // offset of real data; the bytes before are reserved for 'index' meta information, see persistsVarsTo() + private IntArray pointers; - public PersistentIntList(@NotNull File indexFile, @NotNull File dataFile, boolean initial) throws IOException { - if (initial) { - FileUtil.writeToFile(dataFile, ArrayUtil.EMPTY_BYTE_ARRAY); + public PersistentIntList(@NotNull File dataFile, int initialSize) throws IOException { + data = new RandomAccessFile(dataFile, "rw").getChannel(); + int pointersBase; + int initialCapacity = initialSize + 256; + if (initialSize != 0) { + writeInt(data, 0, 4); // base of the pointers array + writeInt(data, 4, initialSize); + writeInt(data, 8, initialCapacity); + fillWithZeros(data, 4 + 8, initialCapacity *4); + pointersBase = 4; } - PagedFileStorage.StorageLockContext context = new PagedFileStorage.StorageLockContext(true); - context.lock(); - try { - data = new RandomAccessDataFile(dataFile); - index = new IntToIntBtree(4096, indexFile, context, initial); - dataStart = persistsVarsTo(data, initial); + else { + pointersBase = readInt(data, 0); } - finally { - context.unlock(); + pointers = new IntArray(data, pointersBase); + if (initialSize != 0) { + assert pointers.size == initialSize; + assert pointers.capacity == initialCapacity; + assert pointers.base == 4; + } + EMPTY = new Empty(data); + } + + public synchronized int getSize() { + return pointers.size; + } + + private static void fillWithZeros(FileChannel data, int from, int length) throws IOException { + ByteBuffer zeros = ByteBuffer.allocateDirect(Math.min(8192, length)); + + while (length > 0) { + ByteBuffer toWrite = length < zeros.limit() ? ByteBuffer.allocateDirect(length) : zeros; + toWrite.position(0); + int written = data.write(toWrite, from); + length -= written; + from += written; } } - private int persistsVarsTo(@NotNull final RandomAccessDataFile data, boolean toDisk) { - return index.persistVars(new IntToIntBtree.BtreeDataStorage() { - @Override - public int persistInt(int offset, int value, boolean toDisk) { - if (toDisk) { - data.putInt(offset, value); - return value; + private static void writeInt(FileChannel data, int off, int value) throws IOException { + ByteBuffer b = ByteBuffer.allocate(4); + b.putInt(0,value); + data.write(b, off); + } + private static int readInt(FileChannel data, int off) throws IOException { + ByteBuffer b = ByteBuffer.allocate(4); + int read = data.read(b, off); + if (read != 4) throw new IOException(read + " bytes instead of 4"); + return b.getInt(0); + } + + private static class Empty extends IntArray{ + public Empty(FileChannel data) { + super(data); + } + + @Override + public int[] toArray() { + return ArrayUtil.EMPTY_INT_ARRAY; + } + + @Override + void assertListLength() { + } + } + + private final Empty EMPTY; + + private static class IntArray { + private final FileChannel data; + private final int base; + private int size; + private final int capacity; + + public IntArray(FileChannel data, int base) throws IOException { + this.data = data; + this.base = base; + size = readInt(data, base); + capacity = readInt(data, base + 4); + assertListLength(); + } + + private IntArray(FileChannel data) { + this.data = data; + base = 0; + size = 0; + capacity = 0; + } + + public int get(int i) throws IOException { + if (i < 0 || i >= size) throw new IndexOutOfBoundsException("i="+i+"; size="+size); + return readInt(data, base + 8 + i*4); + } + + public void put(int i, int value) throws IOException { + if (i < 0 || i >= size) throw new IndexOutOfBoundsException("i="+i+"; size="+size); + writeInt(data, base + 8 + i * 4, value); + } + + public IntArray addAll(int[] values) throws IOException { + int[] old = toArray(); + assertSorted(old); + assertListLength(); + + ByteBuffer mergedBytes = ByteBuffer.allocateDirect(size*4 + values.length * 4); + int i = 0; + int j = 0; + while (i < size || j < values.length) { + int stored = i < size ? old[i] : Integer.MAX_VALUE; + int value = j < values.length ? values[j] : Integer.MAX_VALUE; + if (stored < value) { + mergedBytes.putInt(stored); + i++; + } + else if (stored > value) { + mergedBytes.putInt(value); + j++; } else { - return data.getInt(offset); + mergedBytes.putInt(value); + j++; + i++; } } - }, toDisk); + mergedBytes.limit(mergedBytes.position()); + mergedBytes.position(0); + + int[] mergedInts = fromBytes(mergedBytes); + assertSorted(mergedInts); + + int newSize = mergedInts.length; + if (newSize > capacity) { + IntArray realloc = reallocWith(mergedBytes, newSize); + assert realloc.size == newSize; + return realloc; + } + data.write(mergedBytes, base + 8); + writeInt(data, base, newSize); + size = newSize; + assertListLength(); + + return null; + } + + private IntArray reallocWith(ByteBuffer bytes, int maxSize) throws IOException { + assert maxSize > 0 && maxSize < MAX_LIST_LENGTH : maxSize; + int newSize = Math.max(maxSize, bytes.limit() / 4); + int newCapacity = newSize < 10 ? (newSize + 1) * 2 : newSize * 3 / 2; + int newBase = (int)data.size(); + writeInt(data, newBase, newSize); + writeInt(data, newBase + 4, newCapacity); + bytes.position(0); + data.write(bytes, newBase + 8); + fillWithZeros(data, newBase + 8 + newSize * 4, (newCapacity - newSize) * 4); + IntArray array = new IntArray(data, newBase); + assert array.size == newSize; + assert array.capacity == newCapacity; + assert array.base == newBase; + array.assertListLength(); + return array; + } + + + public int[] toArray() throws IOException { + return fromBytes(toBuffer()); + } + + private ByteBuffer toBuffer() throws IOException { + assertListLength(); + int listLength = size; + ByteBuffer bytes = ByteBuffer.allocateDirect(listLength * 4); + int read = data.read(bytes, base+8); + if (read != listLength*4) throw new IOException(read +" instead of "+listLength*4); + bytes.position(0); + assert bytes.limit() == listLength * 4; + return bytes; + } + + void assertListLength() { + int listLength = size; + assert 0 <= listLength && listLength <= MAX_LIST_LENGTH : "size = "+listLength + ", capacity=" + capacity; + assert 0 < capacity && capacity <= MAX_LIST_LENGTH : "size = "+listLength + ", capacity=" + capacity; + assert capacity >= listLength : "size = "+listLength + ", capacity=" + capacity; + assert listLength == 0 || capacity <= (listLength+1)*2 : "size = "+listLength + ", capacity=" + capacity; + } } @Override public void dispose() { - index.withStorageLock(new Runnable() { - @Override - public void run() { - try { - persistsVarsTo(data, true); - index.doClose(); - } - catch (IOException e) { - throw new RuntimeException(e); - } - data.dispose(); - } - }); + try { + data.close(); + } + catch (IOException e) { + throw new RuntimeException(e); + } } @NotNull - public int[] get(final int id) { - final Ref res = new Ref(); - - index.withStorageLock(new Runnable() { - @Override - public void run() { - final int[] ptrPtr = new int[1]; - boolean exists = index.get(id, ptrPtr); - if (!exists) { - ptrPtr[0] = 0; - } - int pointer = ptrPtr[0]; - if (pointer == 0) { - res.set(ArrayUtil.EMPTY_INT_ARRAY); - } - else { - assertPointer(pointer); - int listLength = data.getInt(pointer); - int capacity = data.getInt(pointer + 4); - assertListLength(listLength, capacity); - int[] result = new int[listLength]; - byte[] bytes = new byte[listLength * 4]; - data.get(pointer + 8, bytes, 0, bytes.length); - for (int i = 0; i < listLength; i++) { - result[i] = Bits.getInt(bytes, i*4); - } - res.set(result); - } - } - }); - return res.get(); + public synchronized int[] get(final int id) { + assertPointer(id); + try { + int arrayBase = pointers.get(id); + IntArray array = arrayBase == 0 ? EMPTY : new IntArray(data, arrayBase); + return array.toArray(); + } + catch (IOException e) { + throw new RuntimeException(e); + } } - // return true if was added - public boolean add(final int id, final int value) { - assert value > 0; - assert id > 0; - final boolean[] added = new boolean[1]; - index.withStorageLock(new Runnable() { - @Override - public void run() { - int[] ptrPtr = new int[1]; - index.get(id, ptrPtr); - final int pointer = ptrPtr[0]; - int[] stored; - int capacity; - final int listLength; - if (pointer == 0) { - stored = ArrayUtil.EMPTY_INT_ARRAY; - listLength = 0; - capacity = 2; - } - else { - assertPointer(pointer); - listLength = data.getInt(pointer); - capacity = data.getInt(pointer+4); - assertListLength(listLength,capacity); - stored = new int[listLength]; - for (int i = 0; i < listLength; i++) { - int v = data.getInt(pointer + (i + 2) * 4); - stored[i] = v; - if (v == value) return; - } - // append - if (capacity > listLength /*|| data.length() == pointer + 4 + 4 + 4*capacity*/) { - data.putInt(pointer + (listLength + 2) * 4, value); - data.putInt(pointer, listLength + 1); - if (capacity <= listLength) { - data.putInt(pointer+4, capacity + 1); - } - added[0] = true; - return; - } - // reallocate - gap += 4 + 4 + 4 * capacity; - } - - int storePointer = (int)data.length(); - data.putInt(storePointer, stored.length + 1); - int newCapacity = capacity < 10 ? capacity * 2 : (int)(capacity * 1.5); - assert newCapacity > stored.length + 1; - data.putInt(storePointer+4, newCapacity); - for (int i = 0; i < stored.length; i++) { - int v = stored[i]; - data.putInt(storePointer + (i+2)*4, v); - } - data.putInt(storePointer + (stored.length+2)*4, value); - for (int i = stored.length + 1; i < newCapacity; i++) { - data.putInt(storePointer + (i+2)*4, 0); // gap - } - index.put(id, storePointer); - if (storePointer > 10000000) { - int i = 0; - } - added[0] = true; - } - }); - - return added[0]; - } - - private static void assertListLength(int listLength, int capacity) { - assert 0 < listLength && listLength <= MAX_LIST_LENGTH : listLength; - assert 0 < capacity && capacity <= MAX_LIST_LENGTH : capacity; - assert capacity >= listLength : listLength + ", " + capacity; - assert capacity <= (listLength+1)*2 : listLength + ", " + capacity; - } - - public void addAll(final int id, @NotNull final int[] values) { - assertListLength(values.length, values.length); + public synchronized void addAll(final int id, @NotNull final int[] values) { + assert 0 < values.length && values.length <= MAX_LIST_LENGTH : values.length; assert id > 0; Arrays.sort(values); - - index.withStorageLock(new Runnable() { - @Override - public void run() { - int[] ptrPtr = new int[1]; - index.get(id, ptrPtr); - final int pointer = ptrPtr[0]; - int capacity; - final int newListLength; - byte[] mergedBytes; - - if (pointer == 0) { - mergedBytes = toBytes(values); - newListLength = values.length; - capacity = 0; - } - else { - int[] oldIds = get(id); - checkSorted(oldIds); - - assertPointer(pointer); - int storedListLength = data.getInt(pointer); - capacity = data.getInt(pointer + 4); - assertListLength(storedListLength, capacity); - // try to merge inplace and if failed, reallocate at the end - byte[] storedBytes = new byte[storedListLength * 4]; - data.get(pointer + 8, storedBytes, 0, storedListLength * 4); - - mergedBytes = new byte[storedBytes.length + values.length * 4]; - int outPtr = 0; - int i = 0; - int j = 0; - while (i < storedListLength || j < values.length) { - int stored = i < storedListLength ? Bits.getInt(storedBytes, i * 4) : Integer.MAX_VALUE; - int value = j < values.length ? values[j] : Integer.MAX_VALUE; - if (stored < value) { - Bits.putInt(mergedBytes, outPtr, stored); - outPtr += 4; - i++; - } - else if (stored > value) { - Bits.putInt(mergedBytes, outPtr, value); - outPtr += 4; - j++; - } - else { - Bits.putInt(mergedBytes, outPtr, value); - outPtr += 4; - j++; - i++; - } - } - int[] mergedInts = fromBytes(mergedBytes, outPtr); - checkSorted(mergedInts); - - newListLength = outPtr / 4; - assertListLength(newListLength, newListLength); - if (newListLength <= capacity) { - storeArray(data, pointer, newListLength, capacity, mergedBytes); - return; - } - gap += capacity * 4 + 8; - } - // reallocate at the end - - int storePointer = (int)data.length(); - assertPointer(storePointer); - int oldCapacity = Math.max(capacity, newListLength); - int newCapacity = oldCapacity < 10 ? (oldCapacity + 1) * 2 : (int)(oldCapacity * 1.5); - assert newCapacity > newListLength + 1; - storeArray(data, storePointer, newListLength, newCapacity, mergedBytes); - index.put(id, storePointer); + try { + if (id >= pointers.size) { + pointers = pointers.reallocWith(pointers.toBuffer(), id+1); + writeInt(data, 0, pointers.base); + assert pointers.size > id : id + " > " + pointers.size; } - }); + int arrayBase = pointers.get(id); + IntArray array = arrayBase == 0 ? EMPTY : new IntArray(data, arrayBase); + IntArray newArray = array.addAll(values); + if (newArray != null) { + pointers.put(id, newArray.base); + } + } + catch (IOException e) { + throw new RuntimeException(e); + } int[] ids = get(id); - checkSorted(ids); + assertSorted(ids); TIntHashSet set = new TIntHashSet(ids); assert set.containsAll(values): "ids: "+Arrays.toString(ids)+";\n values:"+Arrays.toString(values); } - private static void checkSorted(int[] oldIds) { + private static void assertSorted(int[] oldIds) { for (int i = 1; i < oldIds.length; i++) { assert oldIds[i - 1] < oldIds[i] : oldIds[i-1] + ", " + oldIds[i]; } } - private static byte[] toBytes(@NotNull int[] values) { - byte[] mergedBytes = new byte[4 * values.length]; - for (int i = 0; i < values.length; i++) { - int value = values[i]; - Bits.putInt(mergedBytes, i * 4, value); - } - return mergedBytes; - } - - private static int[] fromBytes(@NotNull byte[] bytes, int length) { - assert length % 4 == 0; - int[] ints = new int[length/4]; - for (int i = 0; i < length; i+=4) { - int value = Bits.getInt(bytes, i); - ints[i/4] = value; - } - return ints; - } - - private static void storeArray(@NotNull RandomAccessDataFile data, - int storePointer, - int newListLength, - int newCapacity, - @NotNull byte[] mergedBytes) { - assertListLength(newListLength, newCapacity); - data.putInt(storePointer, newListLength); - data.putInt(storePointer + 4, newCapacity); - data.put(storePointer + 8, mergedBytes, 0, newListLength * 4); - byte[] fill = new byte[(newCapacity - newListLength) * 4]; - Arrays.fill(fill, (byte)-1); - data.put(storePointer + 8 + newListLength * 4, fill, 0, fill.length); + private static int[] fromBytes(@NotNull ByteBuffer bytes) { + IntBuffer intBuffer = bytes.asIntBuffer(); + int[] result = new int[intBuffer.limit()]; + intBuffer.get(result); + return result; } private static void assertPointer(int pointer) { assert 0 < pointer && pointer <= MAX_DATA_BYTES : pointer; } - public void flush() { - index.withStorageLock(new Runnable() { - @Override - public void run() { - persistsVarsTo(data, true); - index.doFlush(); - data.sync(); - //data.force(); - } - }); - } - - private void compactIfNecessary() { - if (gap < data.length() / 2) return; - index.withStorageLock(new Runnable() { - @Override - public void run() { - persistsVarsTo(data, true); - index.doFlush(); - data.sync(); - - try { - final RandomAccessDataFile newData = new RandomAccessDataFile(new File(data.getFile().getParentFile(), "newData")); - persistsVarsTo(newData, true); - final TIntIntHashMap map = new TIntIntHashMap(); - index.processMappings(new IntToIntBtree.KeyValueProcessor() { - @Override - public boolean process(int key, int value) throws IOException { - map.put(key, value); - return true; - } - }); - map.forEachEntry(new TIntIntProcedure() { - @Override - public boolean execute(int key, int value) { - int[] ids = get(key); - int pointer = (int)newData.length(); - byte[] bytes = toBytes(ids); - storeArray(newData, pointer, ids.length, (int)(ids.length * 1.3), bytes); - index.put(key, pointer); - return true; - } - }); - - data.dispose(); - data = newData; - gap = 0; - flush(); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - }); + public synchronized void flush() throws IOException { + data.force(true); } } diff --git a/platform/indexing-impl/src/com/intellij/psi/impl/PersistentIntList.png b/platform/indexing-impl/src/com/intellij/psi/impl/PersistentIntList.png new file mode 100644 index 000000000000..954b8410c1a6 Binary files /dev/null and b/platform/indexing-impl/src/com/intellij/psi/impl/PersistentIntList.png differ diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java index 450b684d2980..5b5ae579d0ae 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,6 +42,7 @@ import com.intellij.openapi.ui.popup.JBPopup; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.ex.WindowManagerEx; import com.intellij.pom.Navigatable; import com.intellij.psi.PsiElement; @@ -54,6 +55,7 @@ import com.intellij.ui.components.JBLayeredPane; import com.intellij.ui.components.JBScrollPane; import com.intellij.util.Consumer; import com.intellij.util.containers.HashMap; +import com.intellij.util.io.URLUtil; import com.intellij.util.ui.GraphicsUtil; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NonNls; @@ -66,8 +68,11 @@ import javax.swing.event.ChangeListener; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import javax.swing.text.*; +import javax.swing.text.html.HTMLDocument; +import javax.swing.text.html.HTMLEditorKit; import java.awt.*; import java.awt.event.*; +import java.net.MalformedURLException; import java.net.URL; import java.util.*; import java.util.List; @@ -155,6 +160,11 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr myIsShown = false; myEditorPane = new JEditorPane(UIUtil.HTML_MIME, "") { + @Override + public EditorKit getEditorKit() { + return new HTMLEditorKit(); + } + @Override public Dimension getPreferredScrollableViewportSize() { if (getWidth() == 0 || getHeight() == 0) { @@ -529,7 +539,6 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr } private void setDataInternal(SmartPsiElementPointer element, String text, final Rectangle viewRect, boolean skip) { - myElement = element; boolean justShown = false; @@ -549,6 +558,21 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr myText = text; } + Document document = myEditorPane.getDocument(); + if (document instanceof HTMLDocument && element != null) { + // set base URL for this javadoc to resolve relative images correctly + VirtualFile virtualFile = element.getVirtualFile(); + VirtualFile directory = virtualFile == null ? null : virtualFile.getParent(); + String path = directory == null ? "" : directory.getPath()+"/"; + + try { + URL url = new URL(URLUtil.FILE_PROTOCOL, null, path); + ((HTMLDocument)document).setBase(url); + } + catch (MalformedURLException ignored) { + } + } + //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { @Override diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/UrlUtil.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/UrlUtil.java index 400620fc4644..7eb88034c6e3 100644 --- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/UrlUtil.java +++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/UrlUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,9 +36,9 @@ import java.util.zip.ZipFile; * Date: 3/25/11 */ public class UrlUtil { - private static final String JAR_SEPARATOR = "!/"; + private static final String JAR_SEPARATOR = URLUtil.JAR_SEPARATOR; private static final String URL_PATH_SEPARATOR = "/"; - private static final String FILE_PROTOCOL = "file"; + private static final String FILE_PROTOCOL = URLUtil.FILE_PROTOCOL; private static final String FILE_PROTOCOL_PREFIX = FILE_PROTOCOL + ":"; public static String loadText(URL url) throws IOException { @@ -56,7 +56,7 @@ public class UrlUtil { if ("jar".equalsIgnoreCase(protocol)) { return getChildPathsFromJar(root); } - if ("file".equalsIgnoreCase(protocol)){ + if (FILE_PROTOCOL.equalsIgnoreCase(protocol)){ return getChildPathsFromFile(root); } return Collections.emptyList(); diff --git a/platform/lang-impl/src/com/intellij/openapi/editor/actions/ToggleShowImportPopupsAction.java b/platform/lang-impl/src/com/intellij/openapi/editor/actions/ToggleShowImportPopupsAction.java index b4be4d7ab4ac..64ce70e972e2 100644 --- a/platform/lang-impl/src/com/intellij/openapi/editor/actions/ToggleShowImportPopupsAction.java +++ b/platform/lang-impl/src/com/intellij/openapi/editor/actions/ToggleShowImportPopupsAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,46 +16,39 @@ package com.intellij.openapi.editor.actions; +import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonDataKeys; -import com.intellij.openapi.actionSystem.LangDataKeys; -import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.actionSystem.ToggleAction; import com.intellij.openapi.editor.Editor; import com.intellij.psi.PsiFile; -import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * @author Dmitry Avdeev */ public class ToggleShowImportPopupsAction extends ToggleAction { - @Override public boolean isSelected(AnActionEvent e) { - return getAnalyzer(e).isImportHintsEnabled(getFile(e)); + PsiFile file = getFile(e); + return file != null && DaemonCodeAnalyzer.getInstance(file.getProject()).isImportHintsEnabled(file); } @Override public void setSelected(AnActionEvent e, boolean state) { - getAnalyzer(e).setImportHintsEnabled(getFile(e), state); + PsiFile file = getFile(e); + if (file != null) { + DaemonCodeAnalyzer.getInstance(file.getProject()).setImportHintsEnabled(file, state); + } } @Override - public void update(AnActionEvent e) { - if (getFile(e) == null) { - e.getPresentation().setEnabled(false); - e.getPresentation().setVisible(false); - } - else { - e.getPresentation().setEnabled(true); - e.getPresentation().setVisible(true); - super.update(e); - } - } - - private DaemonCodeAnalyzer getAnalyzer(AnActionEvent e) { - return DaemonCodeAnalyzer.getInstance(e.getData(CommonDataKeys.PROJECT)); + public void update(@NotNull AnActionEvent e) { + boolean works = getFile(e) != null; + e.getPresentation().setEnabled(works); + e.getPresentation().setVisible(works); + super.update(e); } @Nullable diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/ToggleAction.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/ToggleAction.java index d82ad10626b2..ac53e4038b64 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/ToggleAction.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/ToggleAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ package com.intellij.openapi.actionSystem; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -23,8 +24,8 @@ import javax.swing.*; * An action which has a selected state, and which toggles its selected state when performed. * Can be used to represent a menu item with a checkbox, or a toolbar button which keeps its pressed state. */ +@SuppressWarnings("StaticInheritance") public abstract class ToggleAction extends AnAction implements Toggleable { - public ToggleAction(){ } @@ -37,7 +38,7 @@ public abstract class ToggleAction extends AnAction implements Toggleable { } @Override - public final void actionPerformed(final AnActionEvent e){ + public final void actionPerformed(@NotNull final AnActionEvent e){ final boolean state = !isSelected(e); setSelected(e, state); final Boolean selected = state ? Boolean.TRUE : Boolean.FALSE; @@ -60,8 +61,8 @@ public abstract class ToggleAction extends AnAction implements Toggleable { public abstract void setSelected(AnActionEvent e, boolean state); @Override - public void update(final AnActionEvent e){ - final Boolean selected = isSelected(e) ? Boolean.TRUE : Boolean.FALSE; + public void update(@NotNull final AnActionEvent e){ + boolean selected = isSelected(e); final Presentation presentation = e.getPresentation(); presentation.putClientProperty(SELECTED_PROPERTY, selected); } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java index 17c37d822fe2..b65a147fa0ef 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java @@ -76,7 +76,6 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse private static final int FREE_PAINTERS_AREA_WIDTH = 5; private static final int GAP_BETWEEN_ICONS = 3; private static final TooltipGroup GUTTER_TOOLTIP_GROUP = new TooltipGroup("GUTTER_TOOLTIP_GROUP", 0); - private static final Color COLOR_F0F0 = new Color(0xF0F0F0); public static final TIntFunction ID = new TIntFunction() { @Override public int execute(int value) { @@ -96,7 +95,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse private TIntArrayList myTextAnnotationGutterSizes = new TIntArrayList(); private ArrayList myTextAnnotationGutters = new ArrayList(); private final Map myProviderToListener = new HashMap(); - private static final int GAP_BETWEEN_ANNOTATIONS = 6; + private static final int GAP_BETWEEN_ANNOTATIONS = 5; private Color myBackgroundColor = null; private String myLastGutterToolTip = null; private int myLastPreferredHeight = -1; @@ -227,7 +226,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse private void paintEditorBackgrounds(Graphics g, Rectangle clip, int firstVisibleOffset, int lastVisibleOffset) { Color defaultBackgroundColor = myEditor.getBackgroundColor(); - int startX = getWhitespaceSeparatorOffset() + 1; + int startX = getWhitespaceSeparatorOffset() + (isFoldingOutlineShown() ? 1 : 0); IterationState state = new IterationState(myEditor, firstVisibleOffset, lastVisibleOffset, false, true); while (!state.atEnd()) { VisualPosition visualStart = myEditor.offsetToVisualPosition(state.getStartOffset()); @@ -329,19 +328,12 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse x += myTextAnnotationGutterSizes.get(i); } - - if (!myEditor.isInDistractionFreeMode()) { - UIUtil.drawVDottedLine((Graphics2D)g, getAnnotationsAreaOffset() + w - 1, clip.y, clip.y + clip.height, null, getOutlineColor(false)); - } } private void paintFoldingTree(Graphics g, Rectangle clip, int firstVisibleOffset, int lastVisibleOffset) { if (isFoldingOutlineShown()) { doPaintFoldingTree((Graphics2D)g, clip, firstVisibleOffset, lastVisibleOffset); } - else { - UIUtil.drawVDottedLine((Graphics2D)g, clip.x + clip.width - 1, clip.y, clip.y + clip.height, null, getOutlineColor(false)); - } } private void paintLineMarkers(Graphics g, Rectangle clip, int firstVisibleOffset, int lastVisibleOffset) { @@ -378,8 +370,6 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse private void paintLineNumbers(Graphics g, Rectangle clip) { if (isLineNumbersShown()) { - int x = getLineNumberAreaOffset() + getLineNumberAreaWidth() - 2; - UIUtil.drawVDottedLine((Graphics2D)g, x, clip.y, clip.y + clip.height, null, getOutlineColor(false)); doPaintLineNumbers(g, clip); } } @@ -396,7 +386,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse EditorColorsScheme colorsScheme = myEditor.getColorsScheme(); boolean distractionMode = myEditor.isInDistractionFreeMode(); Color color = distractionMode ? colorsScheme.getDefaultBackground() : colorsScheme.getColor(EditorColors.GUTTER_BACKGROUND); - myBackgroundColor = color == null ? COLOR_F0F0 : color; + myBackgroundColor = color == null ? EditorColors.GUTTER_BACKGROUND.getDefaultColor() : color; } return myBackgroundColor; } @@ -648,9 +638,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse } }); - myLineMarkerAreaWidth = myIconsAreaWidth + FREE_PAINTERS_AREA_WIDTH + - // if folding outline is shown, there will be enough place for change markers, otherwise add place for it. - (isFoldingOutlineShown() ? 0 : getFoldingAnchorWidth() / 2); + myLineMarkerAreaWidth = myIconsAreaWidth + FREE_PAINTERS_AREA_WIDTH; } private void paintGutterRenderers(final Graphics g, int firstVisibleOffset, int lastVisibleOffset) { @@ -739,7 +727,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse int height = endY - startY; int w = FREE_PAINTERS_AREA_WIDTH; - int x = getLineMarkerAreaOffset() + myIconsAreaWidth; + int x = getLineMarkerAreaOffset() + myIconsAreaWidth - 1; return new Rectangle(x, startY, w, height); } @@ -770,7 +758,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse final int leftSize = x - getLineMarkerAreaOffset(); - x = getLineMarkerAreaOffset() + myIconsAreaWidth; + x = getLineMarkerAreaOffset() + myIconsAreaWidth - 2; // because of 2px LineMarkerRenderers for (GutterMark r : row) { if (((GutterIconRenderer)r).getAlignment() == GutterIconRenderer.Alignment.RIGHT) { Icon icon = r.getIcon(); @@ -780,7 +768,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse } } - int rightSize = myIconsAreaWidth + getLineMarkerAreaOffset() - x; + int rightSize = myIconsAreaWidth + getLineMarkerAreaOffset() - x + 1; if (middleCount > 0) { middleSize -= GAP_BETWEEN_ICONS; @@ -845,7 +833,9 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse private void paintFoldingLines(final Graphics2D g, final Rectangle clip) { if (!isFoldingOutlineShown()) return; - UIUtil.drawVDottedLine(g, getWhitespaceSeparatorOffset(), clip.y, clip.y + clip.height, null, getOutlineColor(false)); + g.setColor(getOutlineColor(false)); + int x = getWhitespaceSeparatorOffset(); + UIUtil.drawLine(g, x, clip.y, x, clip.y + clip.height); final int anchorX = getFoldingAreaOffset(); final int width = getFoldingAnchorWidth(); @@ -981,14 +971,11 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse } public int getFoldingAreaOffset() { - return getLineMarkerAreaOffset() + - getLineMarkerAreaWidth(); + return getLineMarkerAreaOffset() + getLineMarkerAreaWidth(); } public int getFoldingAreaWidth() { - return isFoldingOutlineShown() - ? getFoldingAnchorWidth() + 2 - : 0; + return getFoldingAnchorWidth() + (isFoldingOutlineShown() ? 2 : 0); } @Override @@ -1347,7 +1334,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse } @Override - public void actionPerformed(AnActionEvent e) { + public void actionPerformed(@NotNull AnActionEvent e) { closeAllAnnotations(); } } 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 5179512af245..484191e67b07 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 @@ -303,7 +303,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi private final TIntFunction myLineNumberAreaWidthFunction = new TIntFunction() { @Override public int execute(int lineNumber) { - return getFontMetrics(Font.PLAIN).stringWidth(Integer.toString(lineNumber + 1)) + 6; + return getFontMetrics(Font.PLAIN).stringWidth(Integer.toString(lineNumber + 1)) + 5; } }; @@ -6771,10 +6771,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi g.setColor(ButtonlessScrollBarUI.getTrackBackground()); g.fillRect(0, 0, width, height); - int shortner = 0; - if (myGutterComponent.isFoldingOutlineShown()) { - shortner = myGutterComponent.getFoldingAreaWidth() / 2; - } + int shortner = myGutterComponent.getFoldingAreaWidth() / 2; g.setColor(myGutterComponent.getBackground()); g.fillRect(0, 0, width - shortner, height); diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorComposite.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorComposite.java index d8a704d891bf..87668ba25ea0 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorComposite.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorComposite.java @@ -36,7 +36,6 @@ import com.intellij.openapi.util.Pair; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.FocusWatcher; import com.intellij.ui.PrevNextActionsDescriptor; -import com.intellij.ui.SideBorder; import com.intellij.ui.TabbedPaneWrapper; import com.intellij.ui.tabs.UiDecorator; import com.intellij.util.SmartList; @@ -351,7 +350,7 @@ public abstract class EditorComposite implements Disposable { if (remove) { container.remove(component.getParent()); } else { - container.add(new TopBottomComponentWrapper(component, top)); + container.add(new TopBottomComponentWrapper(component)); } container.revalidate(); } @@ -474,19 +473,10 @@ public abstract class EditorComposite implements Disposable { private static class TopBottomComponentWrapper extends JPanel { private final JComponent myWrappee; - public TopBottomComponentWrapper(JComponent component, boolean top) { + public TopBottomComponentWrapper(JComponent component) { super(new BorderLayout()); myWrappee = component; setOpaque(false); - - setBorder(new SideBorder(null, top ? SideBorder.BOTTOM : SideBorder.TOP, true) { - @Override - public Color getLineColor() { - Color result = EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.TEARLINE_COLOR); - return result == null ? Color.black : result; - } - }); - add(component); } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/ToolWindowsWidget.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/ToolWindowsWidget.java index 4609acf0fd4b..dac743069bd0 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/ToolWindowsWidget.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/ToolWindowsWidget.java @@ -59,7 +59,7 @@ class ToolWindowsWidget extends JLabel implements CustomStatusBarWidget, StatusB private JBPopup popup; private boolean wasExited = false; - ToolWindowsWidget(Disposable parent) { + ToolWindowsWidget(@NotNull Disposable parent) { new BaseButtonBehavior(this, TimedDeadzone.NULL) { @Override protected void execute(MouseEvent e) { diff --git a/platform/platform-resources/src/DefaultColorSchemesManager.xml b/platform/platform-resources/src/DefaultColorSchemesManager.xml index 42ab4dcb3abc..ad7511a69f82 100644 --- a/platform/platform-resources/src/DefaultColorSchemesManager.xml +++ b/platform/platform-resources/src/DefaultColorSchemesManager.xml @@ -18,10 +18,10 @@