mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-76142: Gradle support - cannot update IDEA projects once one of build.gradle files changes
Expanding 'dependencies' node by default
This commit is contained in:
+13
@@ -11,6 +11,8 @@ import org.jetbrains.plugins.gradle.diff.PlatformFacade;
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.awt.*;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -50,6 +52,7 @@ public class GradleProjectStructureChangesPanel extends GradleToolWindowPanel {
|
||||
myContent = new JPanel(new GridBagLayout());
|
||||
myTreeModel = new GradleProjectStructureTreeModel(getProject(), getProjectStructureHelper());
|
||||
Tree tree = new Tree(myTreeModel);
|
||||
applyInitialAppearance(tree, (DefaultMutableTreeNode)myTreeModel.getRoot());
|
||||
|
||||
GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.fill = GridBagConstraints.BOTH;
|
||||
@@ -71,4 +74,14 @@ public class GradleProjectStructureChangesPanel extends GradleToolWindowPanel {
|
||||
int i = 1;
|
||||
}
|
||||
|
||||
private static void applyInitialAppearance(@NotNull Tree tree, @NotNull DefaultMutableTreeNode node) {
|
||||
if (node.getUserObject() == GradleProjectStructureTreeModel.DEPENDENCIES_NODE_DESCRIPTOR) {
|
||||
tree.expandPath(new TreePath(node.getPath()));
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < node.getChildCount(); i++) {
|
||||
applyInitialAppearance(tree, (DefaultMutableTreeNode)node.getChildAt(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-5
@@ -36,7 +36,12 @@ import java.util.Map;
|
||||
* @since 1/30/12 4:20 PM
|
||||
*/
|
||||
public class GradleProjectStructureTreeModel extends DefaultTreeModel {
|
||||
|
||||
|
||||
public static final GradleProjectStructureNodeDescriptor<Object> DEPENDENCIES_NODE_DESCRIPTOR = buildDescriptor(
|
||||
GradleBundle.message("gradle.project.structure.tree.node.dependencies"),
|
||||
null
|
||||
);
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* ...
|
||||
@@ -136,12 +141,10 @@ public class GradleProjectStructureTreeModel extends DefaultTreeModel {
|
||||
myModules.put(moduleName, moduleNode);
|
||||
}
|
||||
|
||||
DefaultMutableTreeNode result = new DefaultMutableTreeNode(buildDescriptor(
|
||||
GradleBundle.message("gradle.project.structure.tree.node.dependencies"),
|
||||
null
|
||||
));
|
||||
DefaultMutableTreeNode result = new DefaultMutableTreeNode(DEPENDENCIES_NODE_DESCRIPTOR);
|
||||
moduleNode.add(result);
|
||||
myModuleDependencies.put(moduleName, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user