mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
@@ -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);
|
||||
|
||||
+5
@@ -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 {
|
||||
|
||||
-1
@@ -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 {
|
||||
|
||||
+8
-6
@@ -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<String> 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) {
|
||||
|
||||
+2
-3
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-4
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<String> actual = new ArrayList<String>();
|
||||
|
||||
getRootManager(moduleName).processOrder(new RootPolicy<Object>() {
|
||||
|
||||
+4
-77
@@ -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("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<dependencies>" +
|
||||
" <dependency>" +
|
||||
" <groupId>group</groupId>" +
|
||||
" <artifactId>lib1</artifactId>" +
|
||||
" <version>1</version>" +
|
||||
" </dependency>" +
|
||||
" <dependency>" +
|
||||
" <groupId>group</groupId>" +
|
||||
" <artifactId>lib2</artifactId>" +
|
||||
" <version>1</version>" +
|
||||
" <optional>true</optional>" +
|
||||
" </dependency>" +
|
||||
"</dependencies>");
|
||||
|
||||
assertModules("project");
|
||||
assertExportedModuleDeps("project", "Maven: group:lib1:1");
|
||||
}
|
||||
|
||||
public void testOptionalModuleDependencyIsNotExportable() throws Exception {
|
||||
public void testDependenciesAreNotExported() throws Exception {
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<packaging>pom</packaging>" +
|
||||
@@ -558,7 +534,6 @@ public class DependenciesImportingTest extends MavenImportingTestCase {
|
||||
"<modules>" +
|
||||
" <module>m1</module>" +
|
||||
" <module>m2</module>" +
|
||||
" <module>m3</module>" +
|
||||
"</modules>");
|
||||
|
||||
createModulePom("m1", "<groupId>test</groupId>" +
|
||||
@@ -572,10 +547,9 @@ public class DependenciesImportingTest extends MavenImportingTestCase {
|
||||
" <version>1</version>" +
|
||||
" </dependency>" +
|
||||
" <dependency>" +
|
||||
" <groupId>test</groupId>" +
|
||||
" <artifactId>m3</artifactId>" +
|
||||
" <groupId>lib</groupId>" +
|
||||
" <artifactId>lib</artifactId>" +
|
||||
" <version>1</version>" +
|
||||
" <optional>true</optional>" +
|
||||
" </dependency>" +
|
||||
"</dependencies>");
|
||||
|
||||
@@ -583,55 +557,8 @@ public class DependenciesImportingTest extends MavenImportingTestCase {
|
||||
"<artifactId>m2</artifactId>" +
|
||||
"<version>1</version>");
|
||||
|
||||
createModulePom("m3", "<groupId>test</groupId>" +
|
||||
"<artifactId>m3</artifactId>" +
|
||||
"<version>1</version>");
|
||||
|
||||
importProject();
|
||||
|
||||
assertExportedModuleDeps("m1", "m2");
|
||||
}
|
||||
|
||||
public void testOnlyCompileAndRuntimeDependenciesAreExported() throws Exception {
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<dependencies>" +
|
||||
" <dependency>" +
|
||||
" <groupId>test</groupId>" +
|
||||
" <artifactId>compile</artifactId>" +
|
||||
" <scope>compile</scope>" +
|
||||
" <version>1</version>" +
|
||||
" </dependency>" +
|
||||
" <dependency>" +
|
||||
" <groupId>test</groupId>" +
|
||||
" <artifactId>runtime</artifactId>" +
|
||||
" <scope>runtime</scope>" +
|
||||
" <version>1</version>" +
|
||||
" </dependency>" +
|
||||
" <dependency>" +
|
||||
" <groupId>test</groupId>" +
|
||||
" <artifactId>test</artifactId>" +
|
||||
" <scope>test</scope>" +
|
||||
" <version>1</version>" +
|
||||
" </dependency>" +
|
||||
" <dependency>" +
|
||||
" <groupId>test</groupId>" +
|
||||
" <artifactId>provided</artifactId>" +
|
||||
" <scope>provided</scope>" +
|
||||
" <version>1</version>" +
|
||||
" </dependency>" +
|
||||
" <dependency>" +
|
||||
" <groupId>test</groupId>" +
|
||||
" <artifactId>system</artifactId>" +
|
||||
" <scope>system</scope>" +
|
||||
" <systemPath>${java.home}/lib/tools.jar</systemPath>" +
|
||||
" <version>1</version>" +
|
||||
" </dependency>" +
|
||||
"</dependencies>");
|
||||
|
||||
assertExportedModuleDeps("project", "Maven: test:compile:1", "Maven: test:runtime:1");
|
||||
assertExportedDeps("m1");
|
||||
}
|
||||
|
||||
public void testTransitiveDependencies() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user