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