diff --git a/.idea/misc.xml b/.idea/misc.xml
index 0b3844b53da6..a79bafffabe3 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkClasspath.java b/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkClasspath.java
index d9ff911ebcb3..203d7b0e9f9b 100644
--- a/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkClasspath.java
+++ b/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkClasspath.java
@@ -24,6 +24,7 @@ import com.intellij.openapi.roots.*;
import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.util.ArrayUtil;
+import com.intellij.util.Processor;
import com.intellij.util.containers.OrderedSet;
import gnu.trove.TObjectHashingStrategy;
@@ -85,116 +86,103 @@ public class ModuleChunkClasspath extends Path {
processedModules.add(module);
final ProjectEx project = (ProjectEx)chunk.getProject();
final File baseDir = BuildProperties.getProjectBaseDir(project);
- for (final OrderEntry orderEntry : ModuleRootManager.getInstance(module).getOrderEntries()) {
- if (!orderEntry.isValid()) {
- continue;
- }
- if (orderEntry instanceof ExportableOrderEntry) {
- ExportableOrderEntry e = (ExportableOrderEntry)orderEntry;
- switch (e.getScope()) {
- case COMPILE:
- break;
- case PROVIDED:
- if (generateRuntimeClasspath && !generateTestClasspath) {
- continue;
- }
- break;
- case RUNTIME:
- if (!generateRuntimeClasspath) {
- continue;
- }
- break;
- case TEST:
- if (!generateTestClasspath) {
- continue;
- }
- break;
- }
- }
- if (!generateRuntimeClasspath) {
- // needed for compilation classpath only
- if ((orderEntry instanceof ModuleSourceOrderEntry)) {
- // this is the entry for outpath of the currently processed module
- if (!generateTestClasspath && (dependencyLevel == 0 || chunk.contains(module))) {
- // the root module is never included
- continue;
- }
- }
- else {
- final boolean isExported = (orderEntry instanceof ExportableOrderEntry) && ((ExportableOrderEntry)orderEntry).isExported();
- if (dependencyLevel > 0 && !isExported) {
- if (!(orderEntry instanceof ModuleOrderEntry)) {
- // non-exported dependencies are excluded and not processed
- continue;
- }
- }
- }
- }
- if (orderEntry instanceof JdkOrderEntry) {
- if (genOptions.forceTargetJdk && !generateRuntimeClasspath) {
- pathItems
- .add(new PathRefItem(BuildProperties.propertyRef(BuildProperties.getModuleChunkJdkClasspathProperty(chunk.getName()))));
- }
- }
- else if (orderEntry instanceof ModuleOrderEntry) {
- final ModuleOrderEntry moduleOrderEntry = (ModuleOrderEntry)orderEntry;
- final Module dependentModule = moduleOrderEntry.getModule();
- if (!chunk.contains(dependentModule)) {
- if (generateRuntimeClasspath && !genOptions.inlineRuntimeClasspath) {
- // in case of runtime classpath, just an referenced to corresponding classpath is created
- final ModuleChunk depChunk = genOptions.getChunkByModule(dependentModule);
- if (!processedChunks.contains(depChunk)) {
- // chunk references are included in the runtime classpath only once
- processedChunks.add(depChunk);
- String property = generateTestClasspath ? BuildProperties.getTestRuntimeClasspathProperty(depChunk.getName())
- : BuildProperties.getRuntimeClasspathProperty(depChunk.getName());
- pathItems.add(new PathRefItem(property));
- }
- }
- else {
- // in case of compile classpath or inlined runtime classpath,
- // the referenced module is processed recursively
- processModule(dependentModule, dependencyLevel + 1, moduleOrderEntry.isExported());
- }
- }
- }
- else if (orderEntry instanceof LibraryOrderEntry) {
- final LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry)orderEntry;
- final String libraryName = libraryOrderEntry.getLibraryName();
- if (((LibraryOrderEntry)orderEntry).isModuleLevel()) {
- CompositeGenerator gen = new CompositeGenerator();
- gen.setHasLeadingNewline(false);
- LibraryDefinitionsGeneratorFactory.genLibraryContent(project, genOptions, libraryOrderEntry.getLibrary(), baseDir, gen);
- pathItems.add(new GeneratorItem(libraryName, gen));
- }
- else {
- pathItems.add(new PathRefItem(BuildProperties.getLibraryPathId(libraryName)));
- }
- }
- else if (orderEntry instanceof ModuleSourceOrderEntry) {
- // Module source entry?
- for (String url : getCompilationClasses(orderEntry, ((GenerationOptionsImpl)genOptions), generateRuntimeClasspath,
- generateTestClasspath, dependencyLevel == 0)) {
- if (url.endsWith(JarFileSystem.JAR_SEPARATOR)) {
- url = url.substring(0, url.length() - JarFileSystem.JAR_SEPARATOR.length());
- }
- final String propertyRef = genOptions.getPropertyRefForUrl(url);
- if (propertyRef != null) {
- pathItems.add(new PathElementItem(propertyRef));
- }
- else {
- final String path = VirtualFileManager.extractPath(url);
- pathItems.add(new PathElementItem(
- GenerationUtils.toRelativePath(path, chunk.getBaseDir(), moduleChunkBasedirProperty, genOptions)));
- }
- }
- }
- else {
- // Unknown order entry type. If it is actually encountered, extension point should be implemented
- pathItems.add(new GeneratorItem(orderEntry.getClass().getName(),
- new Comment("Unknown OrderEntryType: " + orderEntry.getClass().getName())));
+ OrderEnumerator enumerator = ModuleRootManager.getInstance(module).orderEntries();
+ if (generateRuntimeClasspath) {
+ enumerator = enumerator.runtimeOnly();
+ }
+ else {
+ enumerator = enumerator.compileOnly();
+ if (!generateTestClasspath && (dependencyLevel == 0 || chunk.contains(module))) {
+ // this is the entry for outpath of the currently processed module
+ // the root module is never included
+ enumerator = enumerator.withoutModuleSourceEntries();
}
}
+ if (!generateTestClasspath) {
+ enumerator = enumerator.productionOnly();
+ }
+ enumerator.forEach(new Processor() {
+ @Override
+ public boolean process(OrderEntry orderEntry) {
+ if (!orderEntry.isValid()) {
+ return true;
+ }
+
+ if (!generateRuntimeClasspath && !(orderEntry instanceof ModuleOrderEntry)) {
+ // needed for compilation classpath only
+ final boolean isExported = (orderEntry instanceof ExportableOrderEntry) && ((ExportableOrderEntry)orderEntry).isExported();
+ if (dependencyLevel > 0 && !isExported) {
+ // non-exported dependencies are excluded and not processed
+ return true;
+ }
+ }
+
+ if (orderEntry instanceof JdkOrderEntry) {
+ if (genOptions.forceTargetJdk && !generateRuntimeClasspath) {
+ pathItems.add(new PathRefItem(BuildProperties.propertyRef(BuildProperties.getModuleChunkJdkClasspathProperty(chunk.getName()))));
+ }
+ }
+ else if (orderEntry instanceof ModuleOrderEntry) {
+ final ModuleOrderEntry moduleOrderEntry = (ModuleOrderEntry)orderEntry;
+ final Module dependentModule = moduleOrderEntry.getModule();
+ if (!chunk.contains(dependentModule)) {
+ if (generateRuntimeClasspath && !genOptions.inlineRuntimeClasspath) {
+ // in case of runtime classpath, just an referenced to corresponding classpath is created
+ final ModuleChunk depChunk = genOptions.getChunkByModule(dependentModule);
+ if (!processedChunks.contains(depChunk)) {
+ // chunk references are included in the runtime classpath only once
+ processedChunks.add(depChunk);
+ String property = generateTestClasspath ? BuildProperties.getTestRuntimeClasspathProperty(depChunk.getName())
+ : BuildProperties.getRuntimeClasspathProperty(depChunk.getName());
+ pathItems.add(new PathRefItem(property));
+ }
+ }
+ else {
+ // in case of compile classpath or inlined runtime classpath,
+ // the referenced module is processed recursively
+ processModule(dependentModule, dependencyLevel + 1, moduleOrderEntry.isExported());
+ }
+ }
+ }
+ else if (orderEntry instanceof LibraryOrderEntry) {
+ final LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry)orderEntry;
+ final String libraryName = libraryOrderEntry.getLibraryName();
+ if (((LibraryOrderEntry)orderEntry).isModuleLevel()) {
+ CompositeGenerator gen = new CompositeGenerator();
+ gen.setHasLeadingNewline(false);
+ LibraryDefinitionsGeneratorFactory.genLibraryContent(project, genOptions, libraryOrderEntry.getLibrary(), baseDir, gen);
+ pathItems.add(new GeneratorItem(libraryName, gen));
+ }
+ else {
+ pathItems.add(new PathRefItem(BuildProperties.getLibraryPathId(libraryName)));
+ }
+ }
+ else if (orderEntry instanceof ModuleSourceOrderEntry) {
+ // Module source entry?
+ for (String url : getCompilationClasses(module, ((GenerationOptionsImpl)genOptions), generateRuntimeClasspath,
+ generateTestClasspath, dependencyLevel == 0)) {
+ if (url.endsWith(JarFileSystem.JAR_SEPARATOR)) {
+ url = url.substring(0, url.length() - JarFileSystem.JAR_SEPARATOR.length());
+ }
+ final String propertyRef = genOptions.getPropertyRefForUrl(url);
+ if (propertyRef != null) {
+ pathItems.add(new PathElementItem(propertyRef));
+ }
+ else {
+ final String path = VirtualFileManager.extractPath(url);
+ pathItems.add(new PathElementItem(
+ GenerationUtils.toRelativePath(path, chunk.getBaseDir(), moduleChunkBasedirProperty, genOptions)));
+ }
+ }
+ }
+ else {
+ // Unknown order entry type. If it is actually encountered, extension point should be implemented
+ pathItems.add(new GeneratorItem(orderEntry.getClass().getName(),
+ new Comment("Unknown OrderEntryType: " + orderEntry.getClass().getName())));
+ }
+ return true;
+ }
+ });
}
}.processModule(module, 0, false);
}
@@ -225,24 +213,26 @@ public class ModuleChunkClasspath extends Path {
}
}
- private static String[] getCompilationClasses(final OrderEntry orderEntry,
+ private static String[] getCompilationClasses(final Module module,
final GenerationOptionsImpl options,
final boolean forRuntime,
final boolean forTest,
final boolean firstLevel) {
+ final CompilerModuleExtension extension = CompilerModuleExtension.getInstance(module);
+ if (extension == null) return ArrayUtil.EMPTY_STRING_ARRAY;
+
if (!forRuntime) {
if (forTest) {
- return orderEntry.getUrls(firstLevel ? OrderRootType.PRODUCTION_COMPILATION_CLASSES : OrderRootType.COMPILATION_CLASSES);
+ return extension.getOutputRootUrls(!firstLevel);
}
else {
- return firstLevel ? new String[0] : orderEntry.getUrls(OrderRootType.PRODUCTION_COMPILATION_CLASSES);
+ return firstLevel ? ArrayUtil.EMPTY_STRING_ARRAY : extension.getOutputRootUrls(false);
}
}
final Set jdkUrls = options.getAllJdkUrls();
final OrderedSet urls = new OrderedSet();
- urls.addAll(Arrays.asList(orderEntry.getUrls(forTest ? OrderRootType.COMPILATION_CLASSES
- : OrderRootType.PRODUCTION_COMPILATION_CLASSES)));
+ urls.addAll(Arrays.asList(extension.getOutputRootUrls(forTest)));
urls.removeAll(jdkUrls);
return ArrayUtil.toStringArray(urls);
}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/RmicCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/RmicCompiler.java
index 04972a1e68f3..7b25a94add96 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/RmicCompiler.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/RmicCompiler.java
@@ -31,7 +31,10 @@ import com.intellij.openapi.module.Module;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.*;
+import com.intellij.openapi.roots.ModuleRootManager;
+import com.intellij.openapi.roots.OrderEnumerator;
+import com.intellij.openapi.roots.ProjectFileIndex;
+import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
@@ -39,8 +42,7 @@ import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
-import com.intellij.util.PathUtil;
-import com.intellij.util.StringBuilderSpinAllocator;
+import com.intellij.util.PathsList;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -385,35 +387,9 @@ public class RmicCompiler implements ClassPostProcessingCompiler{
}
private static String getCompilationClasspath(Module module) {
- final StringBuilder classpathBuffer = StringBuilderSpinAllocator.alloc();
- try {
- final OrderEntry[] orderEntries = ModuleRootManager.getInstance(module).getOrderEntries();
- final Set processedFiles = new HashSet();
- for (final OrderEntry orderEntry : orderEntries) {
- if (orderEntry instanceof JdkOrderEntry) {
- continue;
- }
- final VirtualFile[] files = orderEntry.getFiles(OrderRootType.COMPILATION_CLASSES);
- for (VirtualFile file : files) {
- if (processedFiles.contains(file)) {
- continue;
- }
- processedFiles.add(file);
- final String path = PathUtil.getLocalPath(file);
- if (path == null) {
- continue;
- }
- if (classpathBuffer.length() > 0) {
- classpathBuffer.append(File.pathSeparatorChar);
- }
- classpathBuffer.append(path);
- }
- }
- return classpathBuffer.toString();
- }
- finally {
- StringBuilderSpinAllocator.dispose(classpathBuffer);
- }
+ final OrderEnumerator enumerator = ModuleRootManager.getInstance(module).orderEntries().withoutSdk().compileOnly().recursively().exportedOnly();
+ final PathsList pathsList = enumerator.getPathsList();
+ return pathsList.getPathsString();
}
private static final class RemoteClassValidityState implements ValidityState {
diff --git a/java/java-impl/src/com/intellij/openapi/roots/impl/CompilerModuleExtensionImpl.java b/java/java-impl/src/com/intellij/openapi/roots/impl/CompilerModuleExtensionImpl.java
index 07493a68eeba..bebc8d23bd9e 100644
--- a/java/java-impl/src/com/intellij/openapi/roots/impl/CompilerModuleExtensionImpl.java
+++ b/java/java-impl/src/com/intellij/openapi/roots/impl/CompilerModuleExtensionImpl.java
@@ -299,40 +299,50 @@ public class CompilerModuleExtensionImpl extends CompilerModuleExtension {
if (OrderRootType.CLASSES_AND_OUTPUT.equals(type) ||
OrderRootType.COMPILATION_CLASSES.equals(type) ||
OrderRootType.PRODUCTION_COMPILATION_CLASSES.equals(type)) {
- final ArrayList result = new ArrayList();
-
- final VirtualFile outputPathForTests = OrderRootType.PRODUCTION_COMPILATION_CLASSES.equals(type) ? null : getCompilerOutputPathForTests();
- if (outputPathForTests != null) {
- result.add(outputPathForTests);
- }
-
- VirtualFile outputRoot = getCompilerOutputPath();
- if (outputRoot != null && !outputRoot.equals(outputPathForTests)) {
- result.add(outputRoot);
- }
- return VfsUtil.toVirtualFileArray(result);
+ return getOutputRoots(!OrderRootType.PRODUCTION_COMPILATION_CLASSES.equals(type));
}
return null;
}
+ @Override
+ public VirtualFile[] getOutputRoots(final boolean includeTests) {
+ final ArrayList result = new ArrayList();
+
+ final VirtualFile outputPathForTests = includeTests ? getCompilerOutputPathForTests() : null;
+ if (outputPathForTests != null) {
+ result.add(outputPathForTests);
+ }
+
+ VirtualFile outputRoot = getCompilerOutputPath();
+ if (outputRoot != null && !outputRoot.equals(outputPathForTests)) {
+ result.add(outputRoot);
+ }
+ return VfsUtil.toVirtualFileArray(result);
+ }
+
@Override
public String[] getRootUrls(final OrderRootType type) {
if (OrderRootType.CLASSES_AND_OUTPUT.equals(type) ||
OrderRootType.COMPILATION_CLASSES.equals(type) ||
OrderRootType.PRODUCTION_COMPILATION_CLASSES.equals(type)) {
- final List result = new ArrayList();
-
- final String outputPathForTests = OrderRootType.PRODUCTION_COMPILATION_CLASSES.equals(type) ? null : getCompilerOutputUrlForTests();
- if (outputPathForTests != null) {
- result.add(outputPathForTests);
- }
-
- String outputRoot = getCompilerOutputUrl();
- if (outputRoot != null && !outputRoot.equals(outputPathForTests)) {
- result.add(outputRoot);
- }
- return ArrayUtil.toStringArray(result);
+ return getOutputRootUrls(!OrderRootType.PRODUCTION_COMPILATION_CLASSES.equals(type));
}
return null;
}
+
+ @Override
+ public String[] getOutputRootUrls(final boolean includeTests) {
+ final List result = new ArrayList();
+
+ final String outputPathForTests = includeTests ? getCompilerOutputUrlForTests() : null;
+ if (outputPathForTests != null) {
+ result.add(outputPathForTests);
+ }
+
+ String outputRoot = getCompilerOutputUrl();
+ if (outputRoot != null && !outputRoot.equals(outputPathForTests)) {
+ result.add(outputRoot);
+ }
+ return ArrayUtil.toStringArray(result);
+ }
}
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/parsing/DeclarationParsing.java b/java/java-impl/src/com/intellij/psi/impl/source/parsing/DeclarationParsing.java
index 2c15cf9eacae..95219c560609 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/parsing/DeclarationParsing.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/parsing/DeclarationParsing.java
@@ -592,6 +592,19 @@ public class DeclarationParsing extends Parsing {
return pair;
}
+ public TreeElement parseAnnotationMemberValue(PsiManager manager, CharSequence text) {
+ Lexer originalLexer = new JavaLexer(myContext.getLanguageLevel());
+ FilterLexer lexer = new FilterLexer(originalLexer, new FilterLexer.SetFilter(StdTokenSets.WHITE_SPACE_OR_COMMENT_BIT_SET));
+ lexer.start(text);
+ final TreeElement result = parseAnnotationMemberValue(lexer);
+
+ final FileElement dummyRoot = DummyHolderFactory.createHolder(manager, null, myContext.getCharTable()).getTreeElement();
+ dummyRoot.rawAddChildren(result);
+ ParseUtil.insertMissingTokens(dummyRoot, originalLexer, 0, text.length(), -1, WhiteSpaceAndCommentsProcessor.INSTANCE, myContext);
+
+ return result;
+ }
+
private TreeElement parseAnnotationMemberValue(Lexer lexer) {
TreeElement result;
if (lexer.getTokenType() == JavaTokenType.AT) {
diff --git a/java/java-impl/src/com/intellij/refactoring/extractSuperclass/JavaExtractSuperBaseDialog.java b/java/java-impl/src/com/intellij/refactoring/extractSuperclass/JavaExtractSuperBaseDialog.java
index 9692c7ab597d..c63f2d2c3988 100644
--- a/java/java-impl/src/com/intellij/refactoring/extractSuperclass/JavaExtractSuperBaseDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/extractSuperclass/JavaExtractSuperBaseDialog.java
@@ -76,6 +76,7 @@ public abstract class JavaExtractSuperBaseDialog extends ExtractSuperBaseDialog<
return directories[0];
}
+
@Override
protected void preparePackage() throws OperationFailedException {
final PsiPackage aPackage = JavaPsiFacade.getInstance(myProject).findPackage(getTargetPackageName());
@@ -108,4 +109,4 @@ public abstract class JavaExtractSuperBaseDialog extends ExtractSuperBaseDialog<
? null
: RefactoringMessageUtil.getIncorrectIdentifierMessage(name);
}
-}
+}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/intention/ConvertToBasicLatinTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/intention/ConvertToBasicLatinTest.java
index 68a7eebb6085..3f9cc1c6907e 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/intention/ConvertToBasicLatinTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/intention/ConvertToBasicLatinTest.java
@@ -14,18 +14,11 @@
* limitations under the License.
*/
-/*
- * Created by IntelliJ IDEA.
- * User: mike
- * Date: Aug 22, 2002
- * Time: 2:58:42 PM
- * To change template for new class use
- * Code Style | Class Templates options (Tools | IDE Options).
- */
package com.intellij.codeInsight.intention;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.CodeInsightBundle;
+import com.intellij.openapi.vfs.encoding.EncodingProjectManager;
import com.intellij.testFramework.fixtures.CodeInsightTestUtil;
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
@@ -38,6 +31,7 @@ public class ConvertToBasicLatinTest extends JavaCodeInsightFixtureTestCase {
public void setUp() throws Exception {
super.setUp();
myIntention = CodeInsightBundle.message("intention.convert.to.basic.latin");
+ EncodingProjectManager.getInstance().setDefaultCharsetName("UTF-8");
}
public void testConvertCharLiteral() throws Exception {
diff --git a/java/java-tests/testSrc/com/intellij/roots/DependencyScopeTest.java b/java/java-tests/testSrc/com/intellij/roots/DependencyScopeTest.java
index f4286ff0f794..5bb5646847db 100644
--- a/java/java-tests/testSrc/com/intellij/roots/DependencyScopeTest.java
+++ b/java/java-tests/testSrc/com/intellij/roots/DependencyScopeTest.java
@@ -10,6 +10,7 @@ import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl;
import com.intellij.util.PathsList;
import java.io.IOException;
+import java.util.Collection;
/**
* @author yole
@@ -38,10 +39,10 @@ public class DependencyScopeTest extends ModuleTestCase {
assertFalse(moduleA.getModuleWithDependenciesAndLibrariesScope(false).contains(classB));
assertFalse(moduleA.getModuleWithDependenciesAndLibrariesScope(false).isSearchInModuleContent(moduleB));
- final VirtualFile[] compilationClasspath = ModuleRootManager.getInstance(moduleA).getFiles(OrderRootType.COMPILATION_CLASSES);
- assertEquals(1, compilationClasspath.length);
- final VirtualFile[] productionCompilationClasspath = ModuleRootManager.getInstance(moduleA).getFiles(OrderRootType.PRODUCTION_COMPILATION_CLASSES);
- assertEquals(0, productionCompilationClasspath.length);
+ final Collection compilationClasspath = getCompilationClasspath(moduleA);
+ assertEquals(1, compilationClasspath.size());
+ final Collection productionCompilationClasspath = getProductionCompileClasspath(moduleA);
+ assertEmpty(productionCompilationClasspath);
final PathsList pathsList = OrderEnumerator.orderEntries(moduleA).recursively().getPathsList();
assertEquals(1, pathsList.getPathList().size());
@@ -77,35 +78,34 @@ public class DependencyScopeTest extends ModuleTestCase {
assertTrue(m.getModuleWithDependenciesAndLibrariesScope(true).contains(libraryClass));
assertFalse(m.getModuleWithDependenciesAndLibrariesScope(false).contains(libraryClass));
- final VirtualFile[] compilationClasspath = ModuleRootManager.getInstance(m).getFiles(OrderRootType.COMPILATION_CLASSES);
- assertEquals(1, compilationClasspath.length);
- final VirtualFile[] productionCompilationClasspath = ModuleRootManager.getInstance(m).getFiles(OrderRootType.PRODUCTION_COMPILATION_CLASSES);
- assertEquals(0, productionCompilationClasspath.length);
+ final Collection compilationClasspath = getCompilationClasspath(m);
+ assertEquals(1, compilationClasspath.size());
+ final Collection productionCompilationClasspath = getProductionCompileClasspath(m);
+ assertEmpty(productionCompilationClasspath);
}
public void testRuntimeModuleDependency() throws IOException {
Module moduleA = createModule("a.iml", StdModuleTypes.JAVA);
addDependentModule(moduleA, DependencyScope.RUNTIME);
- final VirtualFile[] runtimeClasspath = ModuleRootManager.getInstance(moduleA).getFiles(OrderRootType.CLASSES_AND_OUTPUT);
- assertEquals(1, runtimeClasspath.length);
- final VirtualFile[] compilationClasspath = ModuleRootManager.getInstance(moduleA).getFiles(OrderRootType.COMPILATION_CLASSES);
- assertEquals(1, compilationClasspath.length);
- VirtualFile[] production = ModuleRootManager.getInstance(moduleA).getFiles(OrderRootType.PRODUCTION_COMPILATION_CLASSES);
- assertEquals(0, production.length);
+ final Collection runtimeClasspath = getRuntimeClasspath(moduleA);
+ assertEquals(1, runtimeClasspath.size());
+ final Collection compilationClasspath = getCompilationClasspath(moduleA);
+ assertEquals(1, compilationClasspath.size());
+ Collection production = getProductionCompileClasspath(moduleA);
+ assertEmpty(production);
}
public void testRuntimeLibraryDependency() throws IOException {
Module m = createModule("a.iml", StdModuleTypes.JAVA);
VirtualFile libraryRoot = addLibrary(m, DependencyScope.RUNTIME);
- final VirtualFile[] runtimeClasspath = ModuleRootManager.getInstance(m).getFiles(OrderRootType.CLASSES_AND_OUTPUT);
- assertEquals(1, runtimeClasspath.length);
- assertEquals(libraryRoot, runtimeClasspath [0]);
+ final Collection runtimeClasspath = getRuntimeClasspath(m);
+ assertOrderedEquals(runtimeClasspath, libraryRoot);
- final VirtualFile[] compilationClasspath = ModuleRootManager.getInstance(m).getFiles(OrderRootType.COMPILATION_CLASSES);
- assertEquals(1, compilationClasspath.length);
- VirtualFile[] production = ModuleRootManager.getInstance(m).getFiles(OrderRootType.PRODUCTION_COMPILATION_CLASSES);
- assertEquals(0, production.length);
+ final Collection compilationClasspath = getCompilationClasspath(m);
+ assertEquals(1, compilationClasspath.size());
+ Collection production = getProductionCompileClasspath(m);
+ assertEmpty(production);
VirtualFile libraryClass = myFixture.createFile("lib/Test.java", "public class Test { }");
assertTrue(m.getModuleWithDependenciesAndLibrariesScope(true).contains(libraryClass));
@@ -115,28 +115,39 @@ public class DependencyScopeTest extends ModuleTestCase {
public void testProvidedModuleDependency() throws IOException {
Module moduleA = createModule("a.iml", StdModuleTypes.JAVA);
addDependentModule(moduleA, DependencyScope.PROVIDED);
- final VirtualFile[] runtimeClasspath = ModuleRootManager.getInstance(moduleA).getFiles(OrderRootType.CLASSES_AND_OUTPUT);
- assertEquals(0, runtimeClasspath.length);
- final VirtualFile[] compilationClasspath = ModuleRootManager.getInstance(moduleA).getFiles(OrderRootType.COMPILATION_CLASSES);
- assertEquals(1, compilationClasspath.length);
+ Collection runtimeClasspath = getRuntimeClasspath(moduleA);
+ assertEmpty(runtimeClasspath);
+ final Collection compilationClasspath = getCompilationClasspath(moduleA);
+ assertEquals(1, compilationClasspath.size());
}
public void testProvidedLibraryDependency() throws IOException {
Module m = createModule("a.iml", StdModuleTypes.JAVA);
VirtualFile libraryRoot = addLibrary(m, DependencyScope.PROVIDED);
- final VirtualFile[] runtimeClasspath = ModuleRootManager.getInstance(m).getFiles(OrderRootType.CLASSES_AND_OUTPUT);
- assertEquals(0, runtimeClasspath.length);
+ final Collection runtimeClasspath = getRuntimeClasspath(m);
+ assertEmpty(runtimeClasspath);
- final VirtualFile[] compilationClasspath = ModuleRootManager.getInstance(m).getFiles(OrderRootType.COMPILATION_CLASSES);
- assertEquals(1, compilationClasspath.length);
- assertEquals(libraryRoot, compilationClasspath [0]);
+ final Collection compilationClasspath = getCompilationClasspath(m);
+ assertOrderedEquals(compilationClasspath, libraryRoot);
VirtualFile libraryClass = myFixture.createFile("lib/Test.java", "public class Test { }");
assertTrue(m.getModuleWithDependenciesAndLibrariesScope(true).contains(libraryClass));
assertTrue(m.getModuleWithDependenciesAndLibrariesScope(false).contains(libraryClass));
}
+ private static Collection getRuntimeClasspath(Module m) {
+ return ModuleRootManager.getInstance(m).orderEntries().productionOnly().runtimeOnly().recursively().getClassesRoots();
+ }
+
+ private static Collection getProductionCompileClasspath(Module moduleA) {
+ return ModuleRootManager.getInstance(moduleA).orderEntries().productionOnly().compileOnly().recursively().exportedOnly().getClassesRoots();
+ }
+
+ private static Collection getCompilationClasspath(Module m) {
+ return ModuleRootManager.getInstance(m).orderEntries().recursively().exportedOnly().getClassesRoots();
+ }
+
private VirtualFile addLibrary(Module m, final DependencyScope scope) {
VirtualFile libraryRoot = myFixture.findOrCreateDir("lib");
diff --git a/java/java-tests/testSrc/com/intellij/roots/OrderEntriesTest.java b/java/java-tests/testSrc/com/intellij/roots/OrderEntriesTest.java
index bb36326f98f8..f9412ed323ec 100644
--- a/java/java-tests/testSrc/com/intellij/roots/OrderEntriesTest.java
+++ b/java/java-tests/testSrc/com/intellij/roots/OrderEntriesTest.java
@@ -98,7 +98,7 @@ public class OrderEntriesTest extends ModuleRootManagerTestCase {
return base.recursively().exportedOnly().getPathsList();
}
if (type == OrderRootType.PRODUCTION_COMPILATION_CLASSES) {
- return base.productionOnly().recursively().exportedOnly().getPathsList();
+ return base.productionOnly().compileOnly().recursively().exportedOnly().getPathsList();
}
if (type == OrderRootType.CLASSES) {
return base.withoutModuleSourceEntries().recursively().exportedOnly().getPathsList();
diff --git a/java/jsp-spi/src/com/intellij/psi/jsp/JspSpiUtil.java b/java/jsp-spi/src/com/intellij/psi/jsp/JspSpiUtil.java
index 35e5b4080a67..542fdd95908e 100644
--- a/java/jsp-spi/src/com/intellij/psi/jsp/JspSpiUtil.java
+++ b/java/jsp-spi/src/com/intellij/psi/jsp/JspSpiUtil.java
@@ -19,7 +19,7 @@ import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.roots.OrderRootType;
+import com.intellij.openapi.roots.OrderEnumerator;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
@@ -138,37 +138,41 @@ public abstract class JspSpiUtil {
}
public static List buildUrls(@Nullable final VirtualFile virtualFile, @Nullable final Module module) {
- return buildUrls(virtualFile, module, OrderRootType.CLASSES_AND_OUTPUT);
+ return buildUrls(virtualFile, module, true);
}
- public static List buildUrls(@Nullable final VirtualFile virtualFile, @Nullable final Module module, OrderRootType rootType) {
+ public static List buildUrls(@Nullable final VirtualFile virtualFile, @Nullable final Module module, boolean includeModuleOutput) {
final List urls = new ArrayList();
processClassPathItems(virtualFile, module, new Consumer() {
public void consume(final VirtualFile file) {
addUrl(urls, file);
}
- }, rootType);
+ }, includeModuleOutput);
return urls;
}
public static void processClassPathItems(final VirtualFile virtualFile, final Module module, final Consumer consumer) {
- processClassPathItems(virtualFile, module, consumer, OrderRootType.CLASSES_AND_OUTPUT);
+ processClassPathItems(virtualFile, module, consumer, true);
}
public static void processClassPathItems(final VirtualFile virtualFile, final Module module, final Consumer consumer,
- OrderRootType rootType) {
+ boolean includeModuleOutput) {
if (isJarFile(virtualFile)){
consumer.consume(virtualFile);
}
if (module != null) {
- for (VirtualFile file1 : ModuleRootManager.getInstance(module).getFiles(rootType)) {
+ OrderEnumerator enumerator = ModuleRootManager.getInstance(module).orderEntries().recursively();
+ if (!includeModuleOutput) {
+ enumerator = enumerator.withoutModuleSourceEntries();
+ }
+ for (VirtualFile root : enumerator.getClassesRoots()) {
final VirtualFile file;
- if (file1.getFileSystem().getProtocol().equals(JarFileSystem.PROTOCOL)) {
- file = JarFileSystem.getInstance().getVirtualFileForJar(file1);
+ if (root.getFileSystem().getProtocol().equals(JarFileSystem.PROTOCOL)) {
+ file = JarFileSystem.getInstance().getVirtualFileForJar(root);
}
else {
- file = file1;
+ file = root;
}
consumer.consume(file);
}
diff --git a/platform/lang-api/src/com/intellij/openapi/roots/CompilerModuleExtension.java b/platform/lang-api/src/com/intellij/openapi/roots/CompilerModuleExtension.java
index 76d277992d06..110f7eded5ac 100644
--- a/platform/lang-api/src/com/intellij/openapi/roots/CompilerModuleExtension.java
+++ b/platform/lang-api/src/com/intellij/openapi/roots/CompilerModuleExtension.java
@@ -97,4 +97,8 @@ public abstract class CompilerModuleExtension extends ModuleExtension {
public abstract void setExcludeOutput(boolean exclude);
public abstract boolean isExcludeOutput();
+
+ public abstract VirtualFile[] getOutputRoots(boolean includeTests);
+
+ public abstract String[] getOutputRootUrls(boolean includeTests);
}
\ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/formatting/BlockDebugUtil.java b/platform/lang-impl/src/com/intellij/formatting/BlockDebugUtil.java
index f76e2eb14be1..b1269b9cac32 100644
--- a/platform/lang-impl/src/com/intellij/formatting/BlockDebugUtil.java
+++ b/platform/lang-impl/src/com/intellij/formatting/BlockDebugUtil.java
@@ -15,9 +15,7 @@
*/
package com.intellij.formatting;
-import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper;
import com.intellij.lang.ASTNode;
-import com.intellij.psi.formatter.common.AbstractBlock;
import java.io.PrintStream;
import java.util.List;
diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/CommonShortcuts.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/CommonShortcuts.java
index 92839d4c3540..115fa90883b9 100644
--- a/platform/platform-api/src/com/intellij/openapi/actionSystem/CommonShortcuts.java
+++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/CommonShortcuts.java
@@ -32,7 +32,8 @@ public class CommonShortcuts {
SystemInfo.isMac
? KeyEvent.META_DOWN_MASK
: KeyEvent.CTRL_DOWN_MASK));
- public static final ShortcutSet INSERT = new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0));
+ public static final ShortcutSet INSERT = new CustomShortcutSet(SystemInfo.isMac ? KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK)
+ : KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0));
public static final ShortcutSet DELETE = new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));
public static final ShortcutSet ESCAPE = new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
diff --git a/platform/platform-api/src/com/intellij/openapi/ui/ThreeComponentsSplitter.java b/platform/platform-api/src/com/intellij/openapi/ui/ThreeComponentsSplitter.java
index 9215dff4a070..3df31fa81e07 100644
--- a/platform/platform-api/src/com/intellij/openapi/ui/ThreeComponentsSplitter.java
+++ b/platform/platform-api/src/com/intellij/openapi/ui/ThreeComponentsSplitter.java
@@ -455,19 +455,27 @@ public class ThreeComponentsSplitter extends JPanel {
}
private boolean isInside(Point p) {
+ if (!isVisible()) return false;
+
if (myVerticalSplit) {
- if (getHeight() > 0) {
- return p.y >= 0 && p.y < getHeight();
- } else {
- return p.y >= -myDividerZone / 2 && p.y <= myDividerZone / 2;
+ if (p.x >= 0 && p.x < getWidth()) {
+ if (getHeight() > 0) {
+ return p.y >= 0 && p.y < getHeight();
+ } else {
+ return p.y >= -myDividerZone / 2 && p.y <= myDividerZone / 2;
+ }
}
} else {
- if (getWidth() > 0) {
- return p.x >= 0 && p.x < getWidth();
- } else {
- return p.x >= -myDividerZone / 2 && p.x <= myDividerZone / 2;
+ if (p.y >= 0 && p.y < getHeight()) {
+ if (getWidth() > 0) {
+ return p.x >= 0 && p.x < getWidth();
+ } else {
+ return p.x >= -myDividerZone / 2 && p.x <= myDividerZone / 2;
+ }
}
}
+
+ return false;
}
private void init() {
diff --git a/platform/platform-api/src/com/intellij/ui/components/JBScrollPane.java b/platform/platform-api/src/com/intellij/ui/components/JBScrollPane.java
index d91f1555447f..13a91ca6d0ad 100644
--- a/platform/platform-api/src/com/intellij/ui/components/JBScrollPane.java
+++ b/platform/platform-api/src/com/intellij/ui/components/JBScrollPane.java
@@ -18,6 +18,7 @@ package com.intellij.ui.components;
import com.intellij.util.ui.ButtonlessScrollBarUI;
import javax.swing.*;
+import javax.swing.border.EmptyBorder;
import javax.swing.plaf.ScrollPaneUI;
import java.awt.*;
@@ -46,6 +47,9 @@ public class JBScrollPane extends JScrollPane {
*/
public void setUI(ScrollPaneUI ui) {
super.setUI(ui);
+
+ setViewportBorder(new EmptyBorder(1, 1, 1, 1));
+
// We need to set color of viewport later because UIManager
// updates UI of scroll pane and only after that updates UI
// of its children. To be the last in this sequence we need
diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/TabsBorder.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/TabsBorder.java
index 24ab9afb0239..284b5af47d20 100644
--- a/platform/platform-api/src/com/intellij/ui/tabs/impl/TabsBorder.java
+++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/TabsBorder.java
@@ -45,7 +45,7 @@ public class TabsBorder {
myEffectiveBorder = null;
- myTabs.revalidateAndRepaint(false);
+ myTabs.relayout(true, false);
return myTabs;
}
@@ -77,7 +77,6 @@ public class TabsBorder {
myPosition == JBTabsPosition.bottom ? myTabBorderSize : myBorderSize.bottom,
myPosition == JBTabsPosition.right ? myTabBorderSize : myBorderSize.right
);
-
return (Insets)myEffectiveBorder.clone();
}
}
diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayout.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayout.java
index d2f8096a0b84..876b06f794e2 100644
--- a/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayout.java
+++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayout.java
@@ -17,6 +17,7 @@ package com.intellij.ui.tabs.impl.singleRow;
import com.intellij.ui.tabs.TabInfo;
import com.intellij.ui.tabs.impl.*;
+import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/table/TableLayout.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/table/TableLayout.java
index b710c582b7dc..2efd1ec0d6b3 100644
--- a/platform/platform-api/src/com/intellij/ui/tabs/impl/table/TableLayout.java
+++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/table/TableLayout.java
@@ -128,6 +128,8 @@ public class TableLayout extends TabLayout {
toAjust = true;
}
+ toAjust |= myTabs.myForcedRelayout;
+
for (int i = 0; i < eachRow.myColumns.size(); i++) {
TabInfo tabInfo = eachRow.myColumns.get(i);
final TabLabel label = myTabs.myInfo2Label.get(tabInfo);
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeGlassPaneImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeGlassPaneImpl.java
index 87938804d619..e6b386221a79 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeGlassPaneImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeGlassPaneImpl.java
@@ -136,9 +136,14 @@ public class IdeGlassPaneImpl extends JPanel implements IdeGlassPaneEx, IdeEvent
if (target != null) {
if (myLastCursorComponent != target) {
myLastCursorComponent = target;
- myLastOriginalCursor = target.getCursor();
+ if (target.isCursorSet()) {
+ myLastOriginalCursor = target.getCursor();
+ }
+ }
+
+ if (cursor != null && !cursor.equals(target.getCursor())) {
+ target.setCursor(cursor);
}
- target.setCursor(cursor);
}
getRootPane().setCursor(cursor);
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/InternalDecorator.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/InternalDecorator.java
index 2c59cb33fc98..f86abc0c1b11 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/InternalDecorator.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/InternalDecorator.java
@@ -463,7 +463,7 @@ public final class InternalDecorator extends JPanel implements Queryable, TypeSa
}
if (insets.bottom > 0) {
- UIUtil.drawLine(g, x + 1, y + height - 1, x + width - 1, y + height - 1);
+ UIUtil.drawLine(g, x, y + height - 1, x + width - 1, y + height - 1);
}
}
diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
index a0cc7aea358c..1b97a5b626e9 100644
--- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
+++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
@@ -1030,7 +1030,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
assertInitialized();
try {
final OutputStream outputStream = copy.getOutputStream(null, 0, 0);
- outputStream.write(loader.newFileText.getBytes());
+ outputStream.write(loader.newFileText.getBytes(copy.getCharset()));
outputStream.close();
}
catch (IOException e) {
diff --git a/plugins/java-i18n/src/com/intellij/spellchecker/DocCommentTokenizer.java b/plugins/java-i18n/src/com/intellij/spellchecker/DocCommentTokenizer.java
index 5cd12f478bec..a661ec6957a4 100644
--- a/plugins/java-i18n/src/com/intellij/spellchecker/DocCommentTokenizer.java
+++ b/plugins/java-i18n/src/com/intellij/spellchecker/DocCommentTokenizer.java
@@ -22,12 +22,13 @@ import com.intellij.spellchecker.inspections.CommentSplitter;
import com.intellij.spellchecker.inspections.SplitterFactory;
import com.intellij.spellchecker.tokenizer.Token;
import com.intellij.spellchecker.tokenizer.Tokenizer;
+import com.intellij.util.containers.hash.HashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
+import java.util.Set;
/**
* Created by IntelliJ IDEA.
@@ -36,8 +37,13 @@ import java.util.List;
*/
public class DocCommentTokenizer extends Tokenizer {
-
- private final String[] excludedTags = new String[]{"author", "link"};
+ private static final Set excludedTags = new HashSet();
+ {
+ excludedTags.add("author");
+ excludedTags.add("see");
+ excludedTags.add("by");
+ excludedTags.add("link");
+ }
@Nullable
@Override
@@ -48,7 +54,7 @@ public class DocCommentTokenizer extends Tokenizer {
for (PsiElement el : comment.getChildren()) {
if (el instanceof PsiDocTag) {
PsiDocTag tag = (PsiDocTag)el;
- if (!Arrays.asList(excludedTags).contains(tag.getName())) {
+ if (!excludedTags.contains(tag.getName())) {
for (PsiElement data : tag.getDataElements()) {
result.add(new Token(data, splitter));
}
diff --git a/plugins/java-i18n/src/com/intellij/spellchecker/JavaSpellcheckingStrategy.java b/plugins/java-i18n/src/com/intellij/spellchecker/JavaSpellcheckingStrategy.java
index 43e35f2bbbeb..31b09c1a58b5 100644
--- a/plugins/java-i18n/src/com/intellij/spellchecker/JavaSpellcheckingStrategy.java
+++ b/plugins/java-i18n/src/com/intellij/spellchecker/JavaSpellcheckingStrategy.java
@@ -22,8 +22,8 @@ import com.intellij.psi.PsiLiteralExpression;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiNamedElement;
import com.intellij.psi.javadoc.PsiDocComment;
-import com.intellij.spellchecker.tokenizer.Tokenizer;
import com.intellij.spellchecker.tokenizer.SpellcheckingStrategy;
+import com.intellij.spellchecker.tokenizer.Tokenizer;
import org.jetbrains.annotations.NotNull;
/**
diff --git a/plugins/java-i18n/src/com/intellij/spellchecker/PsiTypeTokenizer.java b/plugins/java-i18n/src/com/intellij/spellchecker/PsiTypeTokenizer.java
index c34df9034d4b..c7a7eeaea5a4 100644
--- a/plugins/java-i18n/src/com/intellij/spellchecker/PsiTypeTokenizer.java
+++ b/plugins/java-i18n/src/com/intellij/spellchecker/PsiTypeTokenizer.java
@@ -17,6 +17,7 @@ package com.intellij.spellchecker;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiTypeElement;
@@ -49,6 +50,16 @@ public class PsiTypeTokenizer extends Tokenizer {
final boolean isInSource = (virtualFile != null) && fileIndex.isInContent(virtualFile);
- return !isInSource ? null : new Token[]{new Token(element, element.getText(), true, SplitterFactory.getInstance().getIdentifierSplitter())};
+ return !isInSource
+ ? null
+ : new Token[]{
+ new Token(element, element.getText(), true, 0, getRangeToCheck(element.getText(), psiClass.getName()),
+ SplitterFactory.getInstance().getIdentifierSplitter())};
+ }
+
+ @NotNull
+ private TextRange getRangeToCheck(@NotNull String text, @NotNull String name) {
+ final int i = text.indexOf(name);
+ return new TextRange(i, i + name.length());
}
}
\ No newline at end of file
diff --git a/plugins/properties/src/com/intellij/psi/impl/search/PropertyReferenceViaLastWordSearcher.java b/plugins/properties/src/com/intellij/psi/impl/search/PropertyReferenceViaLastWordSearcher.java
index 34dea465eb47..54dd87a04e46 100644
--- a/plugins/properties/src/com/intellij/psi/impl/search/PropertyReferenceViaLastWordSearcher.java
+++ b/plugins/properties/src/com/intellij/psi/impl/search/PropertyReferenceViaLastWordSearcher.java
@@ -16,66 +16,45 @@
package com.intellij.psi.impl.search;
import com.intellij.lang.properties.psi.Property;
-import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.application.QueryExecutorBase;
import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiManager;
import com.intellij.psi.PsiReference;
-import com.intellij.psi.ReferenceRange;
-import com.intellij.psi.search.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.psi.search.UsageSearchContext;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.util.Processor;
-import com.intellij.util.QueryExecutor;
import java.util.List;
/**
* @author ven
*/
-public class PropertyReferenceViaLastWordSearcher implements QueryExecutor {
+public class PropertyReferenceViaLastWordSearcher extends QueryExecutorBase {
+ public PropertyReferenceViaLastWordSearcher() {
+ super(true);
+ }
+
// add to the search results occurences in JSPs of the last word in the property name, since this stuff is possible:
// Testt {
+
+ public void a( GenTestt> obj ) {
+
+ }
+
+ public void b( AnotherGenTestt> obj ) {
+
+ }
+
+ public void c( Predicatte> obj ) {
+
+ }
+
+ public void d( AnotherPredicatte> obj ) {
+
+ }
+
+ public class GenTestt {
+
+ }
+
+ public class AnotherGenTestt {
+
+ }
+
+ public interface Predicatte {
+
+ }
+
+ public interface AnotherPredicatte {
+
+ }
+
+}
diff --git a/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/JavaSpellcheckingTest.java b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/JavaSpellcheckingTest.java
new file mode 100644
index 000000000000..3d6ce4142f05
--- /dev/null
+++ b/plugins/spellchecker/testSrc/com/intellij/spellchecker/inspection/JavaSpellcheckingTest.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-2009 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.spellchecker.inspection;
+
+import com.intellij.spellchecker.inspections.SpellCheckerInspectionToolProvider;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Ekaterina Shliakhovetskaja
+ */
+public class JavaSpellcheckingTest extends SpellcheckerInspectionTestCase {
+
+
+ protected String getBasePath() {
+ return getSpellcheckerTestDataPath() + "/inspection/java";
+ }
+
+ public void testCorrectJava() throws Throwable {
+ doTest("GenericTest.java", SpellCheckerInspectionToolProvider.getInspectionTools());
+ }
+
+ public void testTypoInJava() throws Throwable {
+ doTest("GenericTestt.java", SpellCheckerInspectionToolProvider.getInspectionTools());
+ }
+}
diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/context/XsltNamespaceContext.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/context/XsltNamespaceContext.java
index 82ce00cf94e5..01c015df6cfc 100644
--- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/context/XsltNamespaceContext.java
+++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/context/XsltNamespaceContext.java
@@ -97,7 +97,7 @@ public class XsltNamespaceContext implements NamespaceContext {
final XmlAttribute attribute = parent.getAttribute(name, null);
if (attribute != null) {
final TextRange textRange = TextRange.from("xmlns:".length(), prefix.length());
- return new SchemaPrefix(attribute, textRange, prefix) {
+ return new SchemaPrefix(attribute, textRange, prefix, attribute) {
@Override
public boolean equals(Object obj) {
if (obj instanceof SchemaPrefix) {
diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltImplicitUsagesProvider.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltImplicitUsagesProvider.java
index c54c6154ad1a..d79cfc81cbd4 100644
--- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltImplicitUsagesProvider.java
+++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltImplicitUsagesProvider.java
@@ -52,7 +52,7 @@ public final class XsltImplicitUsagesProvider implements ImplicitUsageProvider {
// BTW: Almost the same logic applies to other XML dialects (RELAX-NG).
// Pull this class into the platform?
final String prefix = attr.getLocalName();
- final SchemaPrefix target = new SchemaPrefix(attr, TextRange.from("xmlns:".length(), prefix.length()), prefix);
+ final SchemaPrefix target = new SchemaPrefix(attr, TextRange.from("xmlns:".length(), prefix.length()), prefix, attr);
final Query q = ReferencesSearch.search(target, new LocalSearchScope(attr.getParent()));
return !q.forEach(new Processor() {
public boolean process(PsiReference psiReference) {
@@ -71,4 +71,4 @@ public final class XsltImplicitUsagesProvider implements ImplicitUsageProvider {
public boolean isImplicitWrite(PsiElement element) {
return false;
}
-}
\ No newline at end of file
+}
diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/AbstractSyntheticBlock.java b/xml/impl/src/com/intellij/psi/formatter/xml/AbstractSyntheticBlock.java
index 055093e59822..5bb57c207c35 100644
--- a/xml/impl/src/com/intellij/psi/formatter/xml/AbstractSyntheticBlock.java
+++ b/xml/impl/src/com/intellij/psi/formatter/xml/AbstractSyntheticBlock.java
@@ -29,7 +29,7 @@ import com.intellij.psi.xml.XmlTag;
import java.util.List;
-public abstract class AbstractSyntheticBlock implements Block{
+public abstract class AbstractSyntheticBlock implements Block {
protected final Indent myIndent;
protected final XmlFormattingPolicy myXmlFormattingPolicy;
protected final ASTNode myEndTreeNode;
@@ -41,7 +41,15 @@ public abstract class AbstractSyntheticBlock implements Block{
myStartTreeNode = getFirstNode(subBlocks);
myIndent = indent;
myXmlFormattingPolicy = policy;
- myTag = ((AbstractXmlBlock)parent).getTag();
+ if (parent instanceof AbstractXmlBlock) {
+ myTag = ((AbstractXmlBlock)parent).getTag();
+ }
+ else if (parent instanceof AbstractSyntheticBlock) {
+ myTag = ((AbstractSyntheticBlock)parent).getTag();
+ } else {
+ throw new IllegalStateException("Parent should be AbstractXmlBlock or AbstractSyntheticBlock, but it is " + parent.getClass());
+ }
+
}
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.formatter.xml.AbstractSyntheticBlock");
@@ -51,7 +59,8 @@ public abstract class AbstractSyntheticBlock implements Block{
final Block firstBlock = subBlocks.get(0);
if (firstBlock instanceof AbstractBlock) {
return ((AbstractBlock)firstBlock).getNode();
- } else {
+ }
+ else {
return getFirstNode(firstBlock.getSubBlocks());
}
}
@@ -61,7 +70,8 @@ public abstract class AbstractSyntheticBlock implements Block{
final Block lastBlock = subBlocks.get(subBlocks.size() - 1);
if (lastBlock instanceof AbstractBlock) {
return ((AbstractBlock)lastBlock).getNode();
- } else {
+ }
+ else {
return getLastNode(lastBlock.getSubBlocks());
}
}
@@ -90,7 +100,8 @@ public abstract class AbstractSyntheticBlock implements Block{
}
public boolean endsWithText() {
- return myEndTreeNode.getElementType() == XmlElementType.XML_TEXT || myEndTreeNode.getElementType() == XmlElementType.XML_DATA_CHARACTERS;
+ return myEndTreeNode.getElementType() == XmlElementType.XML_TEXT ||
+ myEndTreeNode.getElementType() == XmlElementType.XML_DATA_CHARACTERS;
}
public boolean isTagDescription() {
@@ -99,11 +110,13 @@ public abstract class AbstractSyntheticBlock implements Block{
}
private static boolean isTagDescription(final ASTNode startTreeNode) {
- return startTreeNode.getElementType() == XmlElementType.XML_START_TAG_START || startTreeNode.getElementType() == XmlElementType.XML_END_TAG_START;
+ return startTreeNode.getElementType() == XmlElementType.XML_START_TAG_START ||
+ startTreeNode.getElementType() == XmlElementType.XML_END_TAG_START;
}
public boolean startsWithText() {
- return myStartTreeNode.getElementType() == XmlElementType.XML_TEXT || myStartTreeNode.getElementType() == XmlElementType.XML_DATA_CHARACTERS;
+ return myStartTreeNode.getElementType() == XmlElementType.XML_TEXT ||
+ myStartTreeNode.getElementType() == XmlElementType.XML_DATA_CHARACTERS;
}
public boolean endsWithTextElement() {
@@ -136,7 +149,7 @@ public abstract class AbstractSyntheticBlock implements Block{
protected static TextRange calculateTextRange(final List subBlocks) {
return new TextRange(subBlocks.get(0).getTextRange().getStartOffset(),
- subBlocks.get(subBlocks.size()- 1).getTextRange().getEndOffset());
+ subBlocks.get(subBlocks.size() - 1).getTextRange().getEndOffset());
}
public boolean isIncomplete() {
@@ -148,14 +161,14 @@ public abstract class AbstractSyntheticBlock implements Block{
}
public XmlTag getStartTag() {
- return (XmlTag)myStartTreeNode.getPsi();
+ return (XmlTag)myStartTreeNode.getPsi();
}
public boolean endsWithTag() {
return isXmlTag(myEndTreeNode);
}
-
+
public boolean isJspTextBlock() {
return false;
}
@@ -166,6 +179,7 @@ public abstract class AbstractSyntheticBlock implements Block{
/**
* Checks if the block contains a single node which belongs to the outer (template) language.
+ *
* @return True if it does, False otherwise.
*/
public boolean isOuterLanguageBlock() {
diff --git a/xml/impl/src/com/intellij/psi/impl/source/xml/SchemaPrefix.java b/xml/impl/src/com/intellij/psi/impl/source/xml/SchemaPrefix.java
index 6d2edf4e65cd..ea463ed5c450 100644
--- a/xml/impl/src/com/intellij/psi/impl/source/xml/SchemaPrefix.java
+++ b/xml/impl/src/com/intellij/psi/impl/source/xml/SchemaPrefix.java
@@ -18,6 +18,7 @@ package com.intellij.psi.impl.source.xml;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.psi.impl.RenameableFakePsiElement;
+import com.intellij.psi.xml.XmlAttribute;
import com.intellij.psi.xml.XmlElement;
import com.intellij.util.Icons;
@@ -26,47 +27,53 @@ import javax.swing.*;
/**
* @author Konstantin Bulenkov
*/
- public class SchemaPrefix extends RenameableFakePsiElement {
- private final XmlElement myParent;
- private final TextRange myRange;
- private final String myName;
+public class SchemaPrefix extends RenameableFakePsiElement {
+ private final XmlElement myParent;
+ private final TextRange myRange;
+ private final String myName;
+ private final XmlAttribute myDeclaration;
- public SchemaPrefix(final XmlElement parent, TextRange range, String name) {
- super(parent);
- myParent = parent;
- myRange = range;
- myName = name;
- }
-
- public String getTypeName() {
- return "XML Namespace Prefix";
- }
-
- public Icon getIcon() {
- return Icons.VARIABLE_ICON;
- }
-
- @Override
- public int getTextOffset() {
- return myParent.getTextRange().getStartOffset() + myRange.getStartOffset();
- }
-
- @Override
- public int getTextLength() {
- return myName.length();
- }
-
- @Override
- public String getName() {
- return myName;
- }
-
- public PsiElement getParent() {
- return myParent;
- }
-
- @Override
- public TextRange getTextRange() {
- return TextRange.from(getTextOffset(), getTextLength());
- }
+ public SchemaPrefix(final XmlElement parent, TextRange range, String name, XmlAttribute nsDeclaration) {
+ super(parent);
+ myParent = parent;
+ myRange = range;
+ myName = name;
+ myDeclaration = nsDeclaration;
}
+
+ public String getTypeName() {
+ return "XML Namespace Prefix";
+ }
+
+ public Icon getIcon() {
+ return Icons.VARIABLE_ICON;
+ }
+
+ @Override
+ public int getTextOffset() {
+ return myParent.getTextRange().getStartOffset() + myRange.getStartOffset();
+ }
+
+ @Override
+ public int getTextLength() {
+ return myName.length();
+ }
+
+ @Override
+ public String getName() {
+ return myName;
+ }
+
+ public PsiElement getParent() {
+ return myParent;
+ }
+
+ public XmlAttribute getDeclaration() {
+ return myDeclaration;
+ }
+
+ @Override
+ public TextRange getTextRange() {
+ return TextRange.from(getTextOffset(), getTextLength());
+ }
+}
diff --git a/xml/impl/src/com/intellij/psi/impl/source/xml/SchemaPrefixReference.java b/xml/impl/src/com/intellij/psi/impl/source/xml/SchemaPrefixReference.java
index b5bedaba0587..4a2d8ee29fc3 100644
--- a/xml/impl/src/com/intellij/psi/impl/source/xml/SchemaPrefixReference.java
+++ b/xml/impl/src/com/intellij/psi/impl/source/xml/SchemaPrefixReference.java
@@ -33,20 +33,23 @@ public class SchemaPrefixReference extends PsiReferenceBase {
private final SchemaPrefix myPrefix;
private final PsiElement myElement;
private final String myName;
+ private XmlElement myDeclaration = null;
public SchemaPrefixReference(XmlElement element, TextRange range, String name) {
super(element, range, true);
myElement = element;
myName = name;
if (myElement instanceof XmlAttribute && ((XmlAttribute)myElement).isNamespaceDeclaration()) {
- myPrefix = new SchemaPrefix(element, range, name);
+ myPrefix = new SchemaPrefix(element, range, name, (XmlAttribute)element);
+ myDeclaration = element;
} else {
- final PsiElement declaration = XmlUtil.findNamespaceDeclaration(element.getContainingFile(), name);
+ final PsiElement declaration = XmlUtil.findNamespaceDeclaration(element, name);
if (declaration instanceof XmlAttribute) {
final XmlAttribute attribute = (XmlAttribute)declaration;
final String prefix = attribute.getNamespacePrefix();
final TextRange textRange = TextRange.from(prefix.length() + 1, name.length());
- myPrefix = new SchemaPrefix(attribute, textRange, name);
+ myPrefix = new SchemaPrefix(attribute, textRange, name, (XmlAttribute)declaration);
+ myDeclaration = (XmlElement)declaration;
} else {
myPrefix = null;
}
@@ -66,6 +69,7 @@ public class SchemaPrefixReference extends PsiReferenceBase {
public boolean isReferenceTo(PsiElement element) {
return element instanceof SchemaPrefix
&& element.getContainingFile() == myElement.getContainingFile()
+ && ((SchemaPrefix)element).getDeclaration() == myDeclaration
&& myName.equals(((SchemaPrefix)element).getName())
&& myName.length() > 0;
}
diff --git a/xml/impl/src/com/intellij/xml/util/XmlUtil.java b/xml/impl/src/com/intellij/xml/util/XmlUtil.java
index 503d5c09874d..4ee3c87690ee 100644
--- a/xml/impl/src/com/intellij/xml/util/XmlUtil.java
+++ b/xml/impl/src/com/intellij/xml/util/XmlUtil.java
@@ -530,18 +530,21 @@ public class XmlUtil {
}
@Nullable
- public static PsiElement findNamespaceDeclaration(PsiFile xmlFile, String nsName) {
- if (xmlFile instanceof XmlFile) {
- final XmlDocument document = ((XmlFile)xmlFile).getDocument();
- if (document != null) {
- final XmlTag rootTag = document.getRootTag();
- if (rootTag != null) {
- for (XmlAttribute attribute : rootTag.getAttributes()) {
- if (attribute.isNamespaceDeclaration() && attribute.getLocalName().equals(nsName)) {
- return attribute;
- }
+ public static PsiElement findNamespaceDeclaration(XmlElement xmlElement, String nsName) {
+ while (! (xmlElement instanceof XmlTag) && xmlElement != null) {
+ final PsiElement parent = xmlElement.getParent();
+ if (!(parent instanceof XmlElement)) return null;
+ xmlElement = (XmlElement)parent;
+ }
+ if (xmlElement != null) {
+ XmlTag tag = (XmlTag)xmlElement;
+ while (tag != null) {
+ for (XmlAttribute attribute : tag.getAttributes()) {
+ if (attribute.isNamespaceDeclaration() && attribute.getLocalName().equals(nsName)) {
+ return attribute;
}
}
+ tag = tag.getParentTag();
}
}
return null;