From c6e263beb9e9af681813e0c31bfac95b83c8fa6d Mon Sep 17 00:00:00 2001 From: anna Date: Wed, 24 Mar 2010 13:23:00 +0300 Subject: [PATCH 1/5] annotate externally: annotations root should be a folder (19334) --- .../ui/configuration/libraryEditor/LibraryTableEditor.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryTableEditor.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryTableEditor.java index 255e8c0388d6..51324effc560 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryTableEditor.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryTableEditor.java @@ -674,6 +674,11 @@ public class LibraryTableEditor implements Disposable, LibraryEditorListener { protected OrderRootType getRootType() { return AnnotationOrderRootType.getInstance(); } + + @Override + protected FileChooserDescriptor createDescriptor() { + return new FileChooserDescriptor(false, true, false, false, false, false); + } } private class AttachJavadocAction extends AttachItemAction { From 7d28d0cd87afa09a67c551489c5189c4862e6455 Mon Sep 17 00:00:00 2001 From: anna Date: Wed, 24 Mar 2010 14:11:13 +0300 Subject: [PATCH 2/5] inline to anonymous: multiple interfaces are disabled by next condition (19213) --- .../refactoring/inline/InlineToAnonymousClassProcessor.java | 1 - 1 file changed, 1 deletion(-) diff --git a/java/java-impl/src/com/intellij/refactoring/inline/InlineToAnonymousClassProcessor.java b/java/java-impl/src/com/intellij/refactoring/inline/InlineToAnonymousClassProcessor.java index 07b674caefaa..21940971ba96 100644 --- a/java/java-impl/src/com/intellij/refactoring/inline/InlineToAnonymousClassProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/inline/InlineToAnonymousClassProcessor.java @@ -290,7 +290,6 @@ public class InlineToAnonymousClassProcessor extends BaseRefactoringProcessor { PsiClass superClass = aClass.getSuperClass(); PsiClassType[] interfaceTypes = aClass.getImplementsListTypes(); if (interfaceTypes.length > 0 && !InlineToAnonymousClassHandler.isRedundantImplements(superClass, interfaceTypes [0])) { - assert interfaceTypes.length == 1; superType = interfaceTypes [0]; } else { From af67f2c37e7354d829eab76a6344b51a3b8e0a56 Mon Sep 17 00:00:00 2001 From: anna Date: Wed, 24 Mar 2010 14:42:42 +0300 Subject: [PATCH 3/5] eclipse: do not check twice for current module (18651) --- .../eclipse/conversion/EclipseClasspathReader.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathReader.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathReader.java index 997b5985acef..1bf5f9832ca2 100644 --- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathReader.java +++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathReader.java @@ -167,11 +167,11 @@ public class EclipseClasspathReader { final Library library = rootModel.getModuleLibraryTable().getModifiableModel().createLibrary(libName); final Library.ModifiableModel modifiableModel = library.getModifiableModel(); - modifiableModel.addRoot(getUrl(path), OrderRootType.CLASSES); + modifiableModel.addRoot(getUrl(path, rootModel), OrderRootType.CLASSES); final String sourcePath = element.getAttributeValue(EclipseXml.SOURCEPATH_ATTR); if (sourcePath != null) { - modifiableModel.addRoot(getUrl(sourcePath), OrderRootType.SOURCES); + modifiableModel.addRoot(getUrl(sourcePath, rootModel), OrderRootType.SOURCES); } final List docPaths = getJavadocAttribute(element); @@ -208,7 +208,8 @@ public class EclipseClasspathReader { } usedVariables.add(clsVar); - final String url = getUrl(PathMacroManager.getInstance(rootModel.getModule()).expandPath(getVariableRelatedPath(clsVar, clsPath))); + final String url = getUrl(PathMacroManager.getInstance(rootModel.getModule()).expandPath(getVariableRelatedPath(clsVar, clsPath)), + rootModel); EclipseModuleManager.getInstance(rootModel.getModule()).registerEclipseVariablePath(url, path); modifiableModel.addRoot(url, OrderRootType.CLASSES); @@ -228,7 +229,8 @@ public class EclipseClasspathReader { srcPath = null; } usedVariables.add(srcVar); - final String srcUrl = getUrl(PathMacroManager.getInstance(rootModel.getModule()).expandPath(getVariableRelatedPath(srcVar, srcPath))); + final String srcUrl = getUrl(PathMacroManager.getInstance(rootModel.getModule()).expandPath(getVariableRelatedPath(srcVar, srcPath)), + rootModel); EclipseModuleManager.getInstance(rootModel.getModule()).registerEclipseSrcVariablePath(srcUrl, srcPathAttr); modifiableModel.addRoot(srcUrl, OrderRootType.SOURCES); } @@ -356,7 +358,7 @@ public class EclipseClasspathReader { return var == null ? null : ("$" + var + "$" + (path == null ? "" : ("/" + path))); } - private String getUrl(final String path) { + private String getUrl(final String path, ModifiableRootModel model) { String url = null; if (path.startsWith("/")) { final String relativePath = new File(myRootPath).getParent() + "/" + path; @@ -371,7 +373,7 @@ public class EclipseClasspathReader { final String relativeToRootPath = getRelativeToRootPath(path); final Module otherModule = ModuleManager.getInstance(myProject).findModuleByName(rootPath); - if (otherModule != null) { + if (otherModule != null && otherModule != model.getModule()) { url = relativeToOtherModule(otherModule, relativeToRootPath); } else if (myCurrentRoots != null) { From dbf2d8bce3f434ddd4c799512ed9822dda93423d Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Wed, 24 Mar 2010 15:49:55 +0300 Subject: [PATCH 4/5] Maven: do not export Maven dependencies (IDEA-53170, IDEA-51298) --- .../maven/importing/MavenModuleImporter.java | 5 +- .../importing/MavenRootModelAdapter.java | 5 +- .../idea/maven/MavenImportingTestCase.java | 2 +- .../importing/DependenciesImportingTest.java | 81 +------------------ 4 files changed, 8 insertions(+), 85 deletions(-) diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenModuleImporter.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenModuleImporter.java index 61cbe9521080..0161d147559a 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenModuleImporter.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenModuleImporter.java @@ -107,14 +107,13 @@ public class MavenModuleImporter { private void configDependencies() { for (MavenArtifact artifact : myMavenProject.getDependencies()) { - boolean isExportable = artifact.isExportable(); DependencyScope scope = selectScope(artifact.getScope()); MavenProject depProject = myMavenTree.findProject(artifact.getMavenId()); if (depProject != null) { - myRootModelAdapter.addModuleDependency(myMavenProjectToModuleName.get(depProject), isExportable, scope); + myRootModelAdapter.addModuleDependency(myMavenProjectToModuleName.get(depProject), scope); } else if (myMavenProject.isSupportedDependency(artifact)) { - myRootModelAdapter.addLibraryDependency(artifact, isExportable, scope, myModifiableModelsProvider, myMavenProject); + myRootModelAdapter.addLibraryDependency(artifact, scope, myModifiableModelsProvider, myMavenProject); } } } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java index 6f26888d6275..c4b35c9ee506 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java @@ -194,7 +194,7 @@ public class MavenRootModelAdapter { return new Path(path); } - public void addModuleDependency(String moduleName, boolean isExportable, DependencyScope scope) { + public void addModuleDependency(String moduleName, DependencyScope scope) { Module m = findModuleByName(moduleName); ModuleOrderEntry e; @@ -205,7 +205,6 @@ public class MavenRootModelAdapter { e = myRootModel.addInvalidModuleEntry(moduleName); } - e.setExported(isExportable); e.setScope(scope); } @@ -215,7 +214,6 @@ public class MavenRootModelAdapter { } public void addLibraryDependency(MavenArtifact artifact, - boolean isExportable, DependencyScope scope, MavenModifiableModelsProvider provider, MavenProject project) { @@ -234,7 +232,6 @@ public class MavenRootModelAdapter { } LibraryOrderEntry e = myRootModel.addLibraryEntry(library); - e.setExported(isExportable); e.setScope(scope); } diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java index 07d0ff2eeeb1..3dafecaf1177 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java @@ -201,7 +201,7 @@ public abstract class MavenImportingTestCase extends MavenTestCase { assertModuleDeps(moduleName, LibraryOrderEntry.class, expectedDeps); } - protected void assertExportedModuleDeps(String moduleName, String... expectedDeps) { + protected void assertExportedDeps(String moduleName, String... expectedDeps) { final List actual = new ArrayList(); getRootManager(moduleName).processOrder(new RootPolicy() { diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/DependenciesImportingTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/DependenciesImportingTest.java index 5278c6c029a1..1c81148600e5 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/DependenciesImportingTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/DependenciesImportingTest.java @@ -21,7 +21,6 @@ import com.intellij.openapi.roots.impl.libraries.ProjectLibraryTable; import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.libraries.LibraryTable; import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar; -import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.idea.maven.MavenImportingTestCase; @@ -526,30 +525,7 @@ public class DependenciesImportingTest extends MavenImportingTestCase { assertModuleModuleDepScope("m1", "m4", DependencyScope.TEST); } - public void testOptionalLibraryDependencyIsNotExportable() throws Exception { - importProject("test" + - "project" + - "1" + - - "" + - " " + - " group" + - " lib1" + - " 1" + - " " + - " " + - " group" + - " lib2" + - " 1" + - " true" + - " " + - ""); - - assertModules("project"); - assertExportedModuleDeps("project", "Maven: group:lib1:1"); - } - - public void testOptionalModuleDependencyIsNotExportable() throws Exception { + public void testDependenciesAreNotExported() throws Exception { createProjectPom("test" + "project" + "pom" + @@ -558,7 +534,6 @@ public class DependenciesImportingTest extends MavenImportingTestCase { "" + " m1" + " m2" + - " m3" + ""); createModulePom("m1", "test" + @@ -572,10 +547,9 @@ public class DependenciesImportingTest extends MavenImportingTestCase { " 1" + " " + " " + - " test" + - " m3" + + " lib" + + " lib" + " 1" + - " true" + " " + ""); @@ -583,55 +557,8 @@ public class DependenciesImportingTest extends MavenImportingTestCase { "m2" + "1"); - createModulePom("m3", "test" + - "m3" + - "1"); - importProject(); - - assertExportedModuleDeps("m1", "m2"); - } - - public void testOnlyCompileAndRuntimeDependenciesAreExported() throws Exception { - importProject("test" + - "project" + - "1" + - - "" + - " " + - " test" + - " compile" + - " compile" + - " 1" + - " " + - " " + - " test" + - " runtime" + - " runtime" + - " 1" + - " " + - " " + - " test" + - " test" + - " test" + - " 1" + - " " + - " " + - " test" + - " provided" + - " provided" + - " 1" + - " " + - " " + - " test" + - " system" + - " system" + - " ${java.home}/lib/tools.jar" + - " 1" + - " " + - ""); - - assertExportedModuleDeps("project", "Maven: test:compile:1", "Maven: test:runtime:1"); + assertExportedDeps("m1"); } public void testTransitiveDependencies() throws Exception { From e23de95da07175aa9ae76948afc21b5cf1701e4e Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 24 Mar 2010 16:11:50 +0300 Subject: [PATCH 5/5] "add to watches" action fixed for java debugger --- .../actions/AddToWatchActionHandler.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/AddToWatchActionHandler.java b/java/debugger/impl/src/com/intellij/debugger/actions/AddToWatchActionHandler.java index e1df811cee25..c4e82a0cb116 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/AddToWatchActionHandler.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/AddToWatchActionHandler.java @@ -32,10 +32,8 @@ import com.intellij.debugger.ui.impl.MainWatchPanel; import com.intellij.debugger.ui.impl.VariablesPanel; import com.intellij.debugger.ui.impl.WatchDebuggerTree; import com.intellij.debugger.ui.impl.watch.*; -import com.intellij.ide.DataManager; import com.intellij.idea.ActionsBundle; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; @@ -47,15 +45,10 @@ import org.jetbrains.annotations.NotNull; public class AddToWatchActionHandler extends DebuggerActionHandler { @Override public boolean isEnabled(@NotNull Project project, AnActionEvent event) { - DataContext context = DataManager.getInstance().getDataContext(); - if (context == null) { - return false; - } - - DebuggerTreeNodeImpl[] selectedNodes = DebuggerAction.getSelectedNodes(context); + DebuggerTreeNodeImpl[] selectedNodes = DebuggerAction.getSelectedNodes(event.getDataContext()); boolean enabled = false; if (selectedNodes != null && selectedNodes.length > 0) { - if (DebuggerAction.getPanel(context) instanceof VariablesPanel) { + if (DebuggerAction.getPanel(event.getDataContext()) instanceof VariablesPanel) { enabled = true; for (DebuggerTreeNodeImpl node : selectedNodes) { NodeDescriptorImpl descriptor = node.getDescriptor(); @@ -75,10 +68,7 @@ public class AddToWatchActionHandler extends DebuggerActionHandler { @Override public void perform(@NotNull Project project, AnActionEvent event) { - DataContext context = DataManager.getInstance().getDataContext(); - if (context == null) return; - - final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(context); + final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(event.getDataContext()); if(debuggerContext == null) return; @@ -92,7 +82,7 @@ public class AddToWatchActionHandler extends DebuggerActionHandler { return; } - final DebuggerTreeNodeImpl[] selectedNodes = DebuggerAction.getSelectedNodes(context); + final DebuggerTreeNodeImpl[] selectedNodes = DebuggerAction.getSelectedNodes(event.getDataContext()); if(selectedNodes != null && selectedNodes.length > 0) { addFromNodes(debuggerContext, watchPanel, selectedNodes);