Skip to content

Commit

Permalink
Code cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
gbevin committed Jul 20, 2024
1 parent 32029d1 commit 187c0fe
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,25 @@ public boolean isAlwaysLeaf(@NotNull Object element) {
@NotNull
public BldNodeDescriptor createDescriptor(@NotNull Object element, NodeDescriptor parentDescriptor) {
if (element == root_) {
return new BldRootNodeDescriptor(project_, parentDescriptor, root_);
return new BldNodeDescriptorRoot(project_, parentDescriptor, root_);
}
if (element == commandsFolder_) {
return new BldFolderNodeDescriptor(project_, parentDescriptor, commandsFolder_, BldBundle.message("bld.project.commands"));
return new BldNodeDescriptorFolder(project_, parentDescriptor, commandsFolder_, BldBundle.message("bld.project.commands"));
}
if (element == dependenciesFolder_) {
return new BldFolderNodeDescriptor(project_, parentDescriptor, dependenciesFolder_, BldBundle.message("bld.project.dependencies"));
return new BldNodeDescriptorFolder(project_, parentDescriptor, dependenciesFolder_, BldBundle.message("bld.project.dependencies"));
}

if (element instanceof BldBuildCommand) {
return new BldCommandNodeDescriptor(project_, parentDescriptor, (BldBuildCommand)element);
return new BldNodeDescriptorCommand(project_, parentDescriptor, (BldBuildCommand)element);
}

if (element instanceof String) {
return new BldTextNodeDescriptor(project_, parentDescriptor, (String) element);
return new BldNodeDescriptorText(project_, parentDescriptor, (String) element);
}

LOG.error("Unknown element for this tree structure " + element);
return new BldTextNodeDescriptor(project_, parentDescriptor, String.valueOf(element));
return new BldNodeDescriptorText(project_, parentDescriptor, String.valueOf(element));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

import java.awt.*;

public final class BldCommandNodeDescriptor extends BldNodeDescriptor {
public final class BldNodeDescriptorCommand extends BldNodeDescriptor {
private final BldBuildCommand command_;
private CompositeAppearance highlightedText_;

public BldCommandNodeDescriptor(final Project project, final NodeDescriptor parentDescriptor, final BldBuildCommand command) {
public BldNodeDescriptorCommand(final Project project, final NodeDescriptor parentDescriptor, final BldBuildCommand command) {
super(project, parentDescriptor);
command_ = command;
highlightedText_ = new CompositeAppearance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,18 @@
import com.intellij.openapi.roots.ui.CellAppearanceEx;
import com.intellij.openapi.roots.ui.util.CompositeAppearance;
import com.intellij.openapi.util.Comparing;
import com.intellij.ui.JBColor;
import com.intellij.ui.SimpleColoredComponent;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import rife.bld.idea.config.BldBuildCommand;

import java.awt.*;

public final class BldFolderNodeDescriptor extends BldNodeDescriptor {
public final class BldNodeDescriptorFolder extends BldNodeDescriptor {
private final Object folder_;
private final String name_;
private CompositeAppearance highlightedText_;

public BldFolderNodeDescriptor(final Project project, final NodeDescriptor parentDescriptor, final Object folder, final String name) {
public BldNodeDescriptorFolder(final Project project, final NodeDescriptor parentDescriptor, final Object folder, final String name) {
super(project, parentDescriptor);
folder_ = folder;
name_ = name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import com.intellij.ide.util.treeView.NodeDescriptor;
import com.intellij.openapi.project.Project;

public final class BldRootNodeDescriptor extends BldNodeDescriptor {
public final class BldNodeDescriptorRoot extends BldNodeDescriptor {
private final Object root_;

public BldRootNodeDescriptor(Project project, NodeDescriptor parentDescriptor, Object root) {
public BldNodeDescriptorRoot(Project project, NodeDescriptor parentDescriptor, Object root) {
super(project, parentDescriptor);
root_ = root;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import com.intellij.ui.JBColor;
import org.jetbrains.annotations.Nls;

public final class BldTextNodeDescriptor extends BldNodeDescriptor {
public BldTextNodeDescriptor(Project project, NodeDescriptor parentDescriptor, @Nls String text) {
public final class BldNodeDescriptorText extends BldNodeDescriptor {
public BldNodeDescriptorText(Project project, NodeDescriptor parentDescriptor, @Nls String text) {
super(project, parentDescriptor);
myName = text;
myColor = JBColor.blue;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/rife/bld/idea/project/BldProjectWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.jetbrains.annotations.NotNull;
import rife.bld.idea.config.BldBuildCommand;
import rife.bld.idea.config.BldConfigurationListener;
import rife.bld.idea.config.explorer.nodeDescriptors.BldCommandNodeDescriptor;
import rife.bld.idea.config.explorer.nodeDescriptors.BldNodeDescriptorCommand;
import rife.bld.idea.console.BldConsoleManager;
import rife.bld.idea.execution.BldExecution;
import rife.bld.idea.config.BldConfiguration;
Expand Down Expand Up @@ -195,7 +195,7 @@ boolean canRunSelection() {
for (final TreePath path : paths) {
final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
final Object userObject = node.getUserObject();
return userObject instanceof BldCommandNodeDescriptor;
return userObject instanceof BldNodeDescriptorCommand;
}
return true;
}
Expand All @@ -207,10 +207,10 @@ private static List<String> getCommandNamesFromPaths(TreePath[] paths) {
final List<String> targets = new ArrayList<>();
for (final TreePath path : paths) {
final Object userObject = ((DefaultMutableTreeNode)path.getLastPathComponent()).getUserObject();
if (!(userObject instanceof BldCommandNodeDescriptor)) {
if (!(userObject instanceof BldNodeDescriptorCommand)) {
continue;
}
final BldBuildCommand target = ((BldCommandNodeDescriptor)userObject).getCommand();
final BldBuildCommand target = ((BldNodeDescriptorCommand)userObject).getCommand();
targets.add(target.name());
}
return targets;
Expand Down

0 comments on commit 187c0fe

Please sign in to comment.