mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-10 13:17:09 +07:00
cleanup
This commit is contained in:
-8
@@ -19,8 +19,6 @@ import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStr
|
||||
import com.intellij.openapi.ui.NamedConfigurable;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
@@ -34,10 +32,4 @@ public abstract class ProjectStructureElementConfigurable<T> extends NamedConfig
|
||||
|
||||
@Nullable
|
||||
public abstract ProjectStructureElement getProjectStructureElement();
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Icon getIcon(boolean open) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ public class LanguageExtension<T> extends KeyedExtensionCollector<T, Language> {
|
||||
return key.getID();
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public T forLanguage(@NotNull Language l) {
|
||||
T cached = l.getUserData(IN_LANGUAGE_CACHE);
|
||||
if (cached != null) return cached;
|
||||
|
||||
@@ -91,10 +91,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
|
||||
protected final MasterDetailsState myState;
|
||||
|
||||
protected Runnable TREE_UPDATER;
|
||||
|
||||
{
|
||||
TREE_UPDATER = new Runnable() {
|
||||
protected final Runnable TREE_UPDATER = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final TreePath selectionPath = myTree.getSelectionPath();
|
||||
@@ -109,7 +106,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
fireItemsChangedExternally();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
protected MyNode myRoot = new MyRootNode();
|
||||
protected Tree myTree = new Tree();
|
||||
@@ -454,7 +451,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
protected void clearChildren() {
|
||||
TreeUtil.traverseDepth(myRoot, node -> {
|
||||
if (node instanceof MyNode) {
|
||||
final MyNode treeNode = ((MyNode)node);
|
||||
final MyNode treeNode = (MyNode)node;
|
||||
treeNode.getConfigurable().disposeUIResources();
|
||||
if (!(treeNode instanceof MyRootNode)) {
|
||||
treeNode.setUserObject(null);
|
||||
@@ -479,7 +476,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
TreeUtil.installActions(myTree);
|
||||
myTree.setCellRenderer(new ColoredTreeCellRenderer() {
|
||||
@Override
|
||||
public void customizeCellRenderer(JTree tree,
|
||||
public void customizeCellRenderer(@NotNull JTree tree,
|
||||
Object value,
|
||||
boolean selected,
|
||||
boolean expanded,
|
||||
@@ -487,7 +484,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
int row,
|
||||
boolean hasFocus) {
|
||||
if (value instanceof MyNode) {
|
||||
final MyNode node = ((MyNode)value);
|
||||
final MyNode node = (MyNode)value;
|
||||
setIcon(node.getIcon(expanded));
|
||||
final Font font = UIUtil.getTreeFont();
|
||||
if (node.isDisplayInBold()) {
|
||||
@@ -524,7 +521,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
return null;
|
||||
}
|
||||
|
||||
public void fireItemsChangeListener(final Object editableObject) {
|
||||
private void fireItemsChangeListener(final Object editableObject) {
|
||||
for (ItemsChangeListener listener : myListeners) {
|
||||
listener.itemChanged(editableObject);
|
||||
}
|
||||
@@ -546,7 +543,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"NonStaticInitializer"})
|
||||
@SuppressWarnings("NonStaticInitializer")
|
||||
public JToolTip createToolTip() {
|
||||
final JToolTip toolTip = new JToolTip() {
|
||||
{
|
||||
@@ -584,16 +581,12 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
|
||||
public ActionCallback selectNodeInTree(final DefaultMutableTreeNode nodeToSelect, boolean center, final boolean requestFocus) {
|
||||
if (requestFocus) {
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
|
||||
IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
|
||||
});
|
||||
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(myTree, true));
|
||||
}
|
||||
if (nodeToSelect != null) {
|
||||
return TreeUtil.selectInTree(nodeToSelect, requestFocus, myTree, center);
|
||||
}
|
||||
else {
|
||||
return TreeUtil.selectFirstNode(myTree);
|
||||
}
|
||||
return TreeUtil.selectFirstNode(myTree);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -700,7 +693,8 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
return null;
|
||||
}
|
||||
|
||||
protected @Nullable String getEmptySelectionString() {
|
||||
@Nullable
|
||||
protected String getEmptySelectionString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -709,7 +703,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #checkForEmptyAndDuplicatedNames(String, String, Class} instead
|
||||
* @deprecated use {@link #checkForEmptyAndDuplicatedNames(String, String, Class)} instead
|
||||
*/
|
||||
protected void checkApply(Set<MyNode> rootNodes, String prefix, String title) throws ConfigurationException {
|
||||
for (MyNode rootNode : rootNodes) {
|
||||
@@ -734,7 +728,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
|
||||
if (configurableClass.isInstance(scopeConfigurable)) {
|
||||
final String name = scopeConfigurable.getDisplayName();
|
||||
if (name.trim().length() == 0) {
|
||||
if (name.trim().isEmpty()) {
|
||||
selectNodeInTree(node);
|
||||
throw new ConfigurationException("Name should contain non-space characters");
|
||||
}
|
||||
@@ -791,13 +785,16 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
if (idx > 0 && parentNode.getChildCount() > 0) {
|
||||
if (idx - 1 < parentNode.getChildCount()) {
|
||||
toSelect = (DefaultMutableTreeNode) parentNode.getChildAt(idx - 1);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
toSelect = (DefaultMutableTreeNode) parentNode.getFirstChild();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (parentNode.isRoot() && myTree.isRootVisible()) {
|
||||
toSelect = parentNode;
|
||||
} else if (parentNode.getChildCount() > 0) {
|
||||
}
|
||||
else if (parentNode.getChildCount() > 0) {
|
||||
toSelect = (DefaultMutableTreeNode) parentNode.getFirstChild();
|
||||
}
|
||||
}
|
||||
@@ -835,7 +832,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
presentation.setEnabled(false);
|
||||
final TreePath[] selectionPath = myTree.getSelectionPaths();
|
||||
if (selectionPath != null) {
|
||||
Object[] nodes = ContainerUtil.map2Array(selectionPath, treePath -> treePath.getLastPathComponent());
|
||||
Object[] nodes = ContainerUtil.map2Array(selectionPath, TreePath::getLastPathComponent);
|
||||
if (!myCondition.value(nodes)) return;
|
||||
presentation.setEnabled(true);
|
||||
}
|
||||
@@ -870,7 +867,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
final NamedConfigurable configurable = ((NamedConfigurable)getUserObject());
|
||||
final NamedConfigurable configurable = (NamedConfigurable)getUserObject();
|
||||
LOG.assertTrue(configurable != null, "Tree was already disposed");
|
||||
return configurable.getDisplayName();
|
||||
}
|
||||
@@ -902,7 +899,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"ConstantConditions"})
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
protected static class MyRootNode extends MyNode {
|
||||
public MyRootNode() {
|
||||
super(new NamedConfigurable(false, null) {
|
||||
@@ -925,13 +922,6 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
@NonNls
|
||||
public String getHelpTopic() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent createOptionsPanel() {
|
||||
return null;
|
||||
@@ -943,7 +933,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() throws ConfigurationException {
|
||||
public void apply() {
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
@@ -962,7 +952,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom
|
||||
}
|
||||
|
||||
protected class MyActionGroupWrapper extends AnAction implements DumbAware {
|
||||
private ActionGroup myActionGroup;
|
||||
private final ActionGroup myActionGroup;
|
||||
private ActionGroupWithPreselection myPreselection;
|
||||
|
||||
public MyActionGroupWrapper(final ActionGroupWithPreselection actionGroup) {
|
||||
|
||||
Reference in New Issue
Block a user