Removed open/closed icon on module types. API left untouched for compatibility reasons

This commit is contained in:
Maxim Shafirov
2012-09-03 17:40:27 +04:00
parent 5a22188c4f
commit 764e847210
40 changed files with 62 additions and 61 deletions
@@ -427,7 +427,7 @@ public class ProcessedModulesTable extends JPanel {
}
component.setEnabled(ProcessedModulesTable.this.isEnabled());
if (component instanceof JLabel) {
final Icon icon = module != null ? ModuleType.get(module).getNodeIcon(false) : null;
final Icon icon = module != null ? ModuleType.get(module).getIcon() : null;
JLabel label = (JLabel)component;
label.setIcon(icon);
label.setDisabledIcon(icon);
@@ -330,7 +330,7 @@ public class TargetOptionsComponent extends JPanel {
finally {
final Module module = (Module)value;
setText(module.getName());
setIcon(ModuleType.get(module).getNodeIcon(false));
setIcon(ModuleType.get(module).getIcon());
}
}
}
@@ -15,7 +15,6 @@
*/
package com.intellij.packaging.impl.artifacts;
import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.project.Project;
@@ -28,6 +27,7 @@ import com.intellij.packaging.elements.PackagingElementResolvingContext;
import com.intellij.packaging.impl.elements.ManifestFileUtil;
import com.intellij.ui.ComboboxSpeedSearch;
import com.intellij.ui.DocumentAdapter;
import com.intellij.ui.ListCellRendererWrapper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -166,7 +166,7 @@ public class JarArtifactFromModulesDialog extends DialogWrapper {
@Override
public void customize(JList list, Module value, int index, boolean selected, boolean hasFocus) {
if (value != null) {
setIcon(ModuleType.get(value).getNodeIcon(false));
setIcon(ModuleType.get(value).getIcon());
setText(value.getName());
}
else {
@@ -71,7 +71,7 @@ public class ModuleElementPresentation extends TreeNodePresentation {
presentationData.setIcon(PlatformIcons.TEST_SOURCE_FOLDER);
}
else if (module != null) {
presentationData.setIcon(ModuleType.get(module).getNodeIcon(false));
presentationData.setIcon(ModuleType.get(module).getIcon());
}
String moduleName;
if (module != null) {
@@ -17,7 +17,6 @@ package com.intellij.execution.ui;
import com.intellij.execution.configurations.JavaRunConfigurationModule;
import com.intellij.execution.configurations.ModuleBasedConfiguration;
import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.ModuleType;
@@ -25,6 +24,7 @@ import com.intellij.openapi.module.ModuleTypeManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiClass;
import com.intellij.ui.ComboboxSpeedSearch;
import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.ui.SortedComboBoxModel;
import org.jetbrains.annotations.Nullable;
@@ -72,7 +72,7 @@ public class ConfigurationModuleSelector {
public void customize(final JList list, final Object value, final int index, final boolean selected, final boolean hasFocus) {
if (value instanceof Module) {
final Module module = (Module)value;
setIcon(ModuleType.get(module).getNodeIcon(true));
setIcon(ModuleType.get(module).getIcon());
setText(module.getName());
}
else if (value == null) {
@@ -184,7 +184,7 @@ abstract class ProjectLayoutPanel<T> extends JPanel {
@Nullable
protected Icon getElementIcon(Object element) {
if (element instanceof ModuleDescriptor) {
return ((ModuleDescriptor)element).getModuleType().getNodeIcon(false);
return ((ModuleDescriptor)element).getModuleType().getIcon();
}
if (element instanceof LibraryDescriptor) {
return PlatformIcons.LIBRARY_ICON;
@@ -81,7 +81,7 @@ public class OrderEntryAppearanceServiceImpl extends OrderEntryAppearanceService
return new SimpleTextCellAppearance(presentableName, icon, SimpleTextAttributes.SYNTHETIC_ATTRIBUTES);
}
else if (orderEntry instanceof ModuleOrderEntry) {
final Icon icon = ModuleType.get(((ModuleOrderEntry)orderEntry).getModule()).getNodeIcon(false);
final Icon icon = ModuleType.get(((ModuleOrderEntry)orderEntry).getModule()).getIcon();
return SimpleTextCellAppearance.regular(orderEntry.getPresentableName(), icon);
}
else {
@@ -169,7 +169,7 @@ public class OrderEntryAppearanceServiceImpl extends OrderEntryAppearanceService
@NotNull
@Override
public CellAppearanceEx forModule(@NotNull final Module module) {
return SimpleTextCellAppearance.regular(module.getName(), ModuleType.get(module).getNodeIcon(false));
return SimpleTextCellAppearance.regular(module.getName(), ModuleType.get(module).getIcon());
}
@NotNull
@@ -123,7 +123,7 @@ public class ModuleSourceItemGroup extends PackagingSourceItem {
@Override
public void render(@NotNull PresentationData presentationData, SimpleTextAttributes mainAttributes,
SimpleTextAttributes commentAttributes) {
presentationData.setIcon(ModuleType.get(myModule).getNodeIcon(false));
presentationData.setIcon(ModuleType.get(myModule).getIcon());
presentationData.addText(myModule.getName(), mainAttributes);
}
@@ -37,7 +37,7 @@ class AddModuleDependencyAction extends AddItemPopupAction<Module> {
int actionIndex,
StructureConfigurableContext context) {
super(classpathPanel, actionIndex, ProjectBundle.message("classpath.add.module.dependency.action"),
StdModuleTypes.JAVA.getNodeIcon(false));
StdModuleTypes.JAVA.getIcon());
myContext = context;
myClasspathPanel = classpathPanel;
}
@@ -608,7 +608,7 @@ public class AnalyzeDependenciesComponent extends MasterDetailsComponent {
return new CellAppearanceEx() {
@Override
public void customize(@NotNull SimpleColoredComponent component) {
component.setIcon(ModuleType.get(myModule).getNodeIcon(false));
component.setIcon(ModuleType.get(myModule).getIcon());
component.append("<This Module>", SimpleTextAttributes.SYNTHETIC_ATTRIBUTES);
}
@@ -94,7 +94,7 @@ public class ModuleConfigurable extends ProjectStructureElementConfigurable<Modu
}
public Icon getIcon(final boolean open) {
return ModuleType.get(myModule).getNodeIcon(open);
return ModuleType.get(myModule).getIcon();
}
public Module getModule() {
@@ -65,7 +65,7 @@ public class UsageInModuleClasspath extends ProjectStructureElementUsage {
@Override
public Icon getIcon() {
return ModuleType.get(myModule).getNodeIcon(false);
return ModuleType.get(myModule).getIcon();
}
@Override
@@ -302,7 +302,7 @@ public abstract class ChooseLibrariesDialogBase extends DialogWrapper {
protected ModuleDescriptor(final Project project, final NodeDescriptor parentDescriptor, final Module element) {
super(project, parentDescriptor, element);
final PresentationData templatePresentation = getTemplatePresentation();
templatePresentation.setIcon(ModuleType.get(element).getNodeIcon(false));
templatePresentation.setIcon(ModuleType.get(element).getIcon());
templatePresentation.addText(notEmpty(element.getName()), SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
@@ -56,7 +56,7 @@ public class JavaDirectoryIconProvider extends IconProvider implements DumbAware
else if (isContentRoot) {
Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(vFile);
if (module != null) {
symbolIcon = ModuleType.get(module).getNodeIcon(false);
symbolIcon = ModuleType.get(module).getIcon();
}
else {
symbolIcon = PlatformIcons.CONTENT_ROOT_ICON_CLOSED;
@@ -33,7 +33,7 @@ public class IconUtilEx {
return ((PsiElement)object).getIcon(flags);
}
if (object instanceof Module) {
return ModuleType.get((Module)object).getNodeIcon(false);
return ModuleType.get((Module)object).getIcon();
}
if (object instanceof VirtualFile) {
VirtualFile file = (VirtualFile)object;
@@ -39,7 +39,13 @@ public abstract class ModuleType<T extends ModuleBuilder> {
public abstract String getName();
public abstract String getDescription();
public abstract Icon getBigIcon();
public abstract Icon getNodeIcon(boolean isOpened);
public Icon getIcon() {
return getNodeIcon(false);
}
public abstract Icon getNodeIcon(@Deprecated boolean isOpened);
public ModuleWizardStep[] createWizardSteps(WizardContext wizardContext, T moduleBuilder, ModulesProvider modulesProvider) {
return ModuleWizardStep.EMPTY_ARRAY;
@@ -49,7 +49,7 @@ public class ElementLocationUtil {
if (module != null) {
label.setText(module.getName());
label.setIcon(ModuleType.get(module).getNodeIcon(false));
label.setIcon(ModuleType.get(module).getIcon());
}
else {
final List<OrderEntry> entries = fileIndex.getOrderEntriesForFile(vfile);
@@ -58,7 +58,7 @@ public class RefModuleImpl extends RefEntityImpl implements RefModule {
}
public Icon getIcon(final boolean expanded) {
return ModuleType.get(getModule()).getNodeIcon(expanded);
return ModuleType.get(getModule()).getIcon();
}
@Nullable
@@ -17,7 +17,7 @@ public class InspectionModuleNode extends InspectionTreeNode{
}
public Icon getIcon(boolean expanded) {
return myModule.isDisposed() ? null : ModuleType.get(myModule).getNodeIcon(expanded);
return myModule.isDisposed() ? null : ModuleType.get(myModule).getIcon();
}
public String getName(){
@@ -65,7 +65,7 @@ public class NavBarPresentation {
public static Icon getIcon(final Object object, final boolean open) {
if (!NavBarModel.isValid(object)) return null;
if (object instanceof Project) return AllIcons.Nodes.Project;
if (object instanceof Module) return ModuleType.get(((Module)object)).getNodeIcon(false);
if (object instanceof Module) return ModuleType.get(((Module)object)).getIcon();
try {
if (object instanceof PsiElement) {
Icon icon = ApplicationManager.getApplication().runReadAction(new Computable<Icon>() {
@@ -88,7 +88,7 @@ public class NavBarPresentation {
return ((SdkType) sdkType).getIcon();
}
if (object instanceof LibraryOrderEntry) return AllIcons.Nodes.PpLibFolder;
if (object instanceof ModuleOrderEntry) return ModuleType.get(((ModuleOrderEntry)object).getModule()).getNodeIcon(false);
if (object instanceof ModuleOrderEntry) return ModuleType.get(((ModuleOrderEntry)object).getModule()).getIcon();
return null;
}
@@ -49,7 +49,7 @@ public abstract class AbstractModuleNode extends ProjectViewNode<Module> impleme
presentation.addText(getValue().getName(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
}
presentation.setIcon(ModuleType.get(getValue()).getNodeIcon(false));
presentation.setIcon(ModuleType.get(getValue()).getIcon());
}
protected boolean showModuleNameInBold() {
@@ -97,7 +97,7 @@ public class ModuleToDoNode extends BaseToDoNode<Module> implements HighlightedR
EditorColorsScheme colorsScheme = UsageTreeColorsScheme.getInstance().getScheme();
myHighlightedRegions.add(
new HighlightedRegion(nameEndOffset, newName.length(), colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES)));
presentation.setIcon(ModuleType.get(getValue()).getNodeIcon(false));
presentation.setIcon(ModuleType.get(getValue()).getIcon());
presentation.setPresentableText(newName);
}
@@ -239,7 +239,7 @@ public class DirectoryChooserModuleTreeView implements DirectoryChooserView {
else if (value instanceof Module) {
final Module module = (Module)value;
append(module.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
setIcon(ModuleType.get(module).getNodeIcon(false));
setIcon(ModuleType.get(module).getIcon());
} else if (value instanceof ModuleGroup) {
append(value.toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
setIcon(PlatformIcons.CLOSED_MODULE_GROUP_ICON);
@@ -103,7 +103,7 @@ public class PsiElementModuleRenderer extends DefaultListCellRenderer{
setIcon(AllIcons.Nodes.TestSourceFolder);
}
else {
setIcon(ModuleType.get(module).getNodeIcon(false));
setIcon(ModuleType.get(module).getIcon());
}
}
@@ -533,7 +533,7 @@ public class ModulesDependenciesPanel extends JPanel implements ModuleRootListen
}
MyUserObject node = (MyUserObject)userObject;
Module module = node.getModule();
setIcon(ModuleType.get(module).getNodeIcon(expanded));
setIcon(ModuleType.get(module).getIcon());
if (node.isInCycle()){
append(module.getName(), SimpleTextAttributes.ERROR_ATTRIBUTES);
} else {
@@ -49,11 +49,11 @@ public class UnknownModuleType extends ModuleType {
}
public Icon getNodeIcon(boolean isOpened) {
return myModuleType.getNodeIcon(isOpened);
return myModuleType.getIcon();
}
public ModuleWizardStep[] createWizardSteps(final WizardContext wizardContext, final ModuleBuilder moduleBuilder, final ModulesProvider modulesProvider) {
return myModuleType.createWizardSteps(wizardContext, moduleBuilder, modulesProvider);
}
}
}
@@ -22,10 +22,10 @@
*/
package com.intellij.openapi.roots.ui.configuration;
import com.intellij.ide.util.ChooseElementsDialog;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.project.Project;
import com.intellij.ide.util.ChooseElementsDialog;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -51,10 +51,10 @@ public class ChooseModulesDialog extends ChooseElementsDialog<Module> {
}
protected Icon getItemIcon(final Module item) {
return ModuleType.get(item).getNodeIcon(false);
return ModuleType.get(item).getIcon();
}
protected String getItemText(final Module item) {
return item.getName();
}
}
}
@@ -15,13 +15,13 @@
*/
package com.intellij.openapi.roots.ui.configuration;
import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComboBox;
import com.intellij.ui.ComboboxSpeedSearch;
import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.ui.SortedComboBoxModel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -57,7 +57,7 @@ public class ModulesCombobox extends ComboBox {
public void customize(JList list, Module value, int index, boolean selected, boolean hasFocus) {
if (value != null) {
setText(value.getName());
setIcon(ModuleType.get(value).getNodeIcon(false));
setIcon(ModuleType.get(value).getIcon());
}
else {
setText("[none]");
@@ -18,10 +18,10 @@ package com.intellij.openapi.vcs.changes.ui;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.FilePathImpl;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.ui.SimpleTextAttributes;
/**
@@ -39,9 +39,9 @@ public class ChangesBrowserModuleNode extends ChangesBrowserNode<Module> {
renderer.append(module.isDisposed() ? "" : module.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
appendCount(renderer);
if (module.isDisposed()) {
renderer.setIcon(ModuleType.EMPTY.getNodeIcon(expanded));
renderer.setIcon(ModuleType.EMPTY.getIcon());
} else {
renderer.setIcon(ModuleType.get(module).getNodeIcon(expanded));
renderer.setIcon(ModuleType.get(module).getIcon());
}
}
@@ -70,4 +70,4 @@ public class ChangesBrowserModuleNode extends ChangesBrowserNode<Module> {
}
return result;
}
}
}
@@ -60,7 +60,7 @@ public class ModuleNode extends PackageDependenciesNode implements NavigatableWi
}
public Icon getIcon() {
return myModule == null || myModule.isDisposed() ? super.getIcon() : ModuleType.get(myModule).getNodeIcon(false);
return myModule == null || myModule.isDisposed() ? super.getIcon() : ModuleType.get(myModule).getIcon();
}
public String toString() {
@@ -147,7 +147,7 @@ public class ModuleGroupingRule implements UsageGroupingRule {
@Override
public Icon getIcon(boolean isOpen) {
return myModule.isDisposed() ? null : ModuleType.get(myModule).getNodeIcon(isOpen);
return myModule.isDisposed() ? null : ModuleType.get(myModule).getIcon();
}
@Override
@@ -16,12 +16,12 @@
package org.jetbrains.android.exportSignedPackage;
import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.ide.wizard.CommitStepException;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleType;
import com.intellij.ui.CollectionComboBoxModel;
import com.intellij.ui.ListCellRendererWrapper;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.util.AndroidBundle;
@@ -63,7 +63,7 @@ class ChooseModuleStep extends ExportSignedPackageWizardStep {
public void customize(JList list, AndroidFacet value, int index, boolean selected, boolean hasFocus) {
final Module module = value.getModule();
setText(module.getName());
setIcon(ModuleType.get(module).getNodeIcon(false));
setIcon(ModuleType.get(module).getIcon());
}
});
myModuleCombo.addActionListener(new ActionListener() {
@@ -15,11 +15,11 @@
*/
package org.jetbrains.android.newProject;
import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.project.Project;
import com.intellij.ui.ListCellRendererWrapper;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.annotations.NotNull;
@@ -38,7 +38,7 @@ public class AndroidModulesComboBox extends JComboBox {
if (value instanceof Module) {
final Module module = (Module)value;
setText(module.getName());
setIcon(ModuleType.get(module).getNodeIcon(false));
setIcon(ModuleType.get(module).getIcon());
}
else {
setText("<html><font color='red'>[none]</font></html>");
@@ -32,6 +32,6 @@ public class ModuleListCellRendererWrapper extends ListCellRendererWrapper<Modul
@Override
public void customize(JList list, Module module, int index, boolean selected, boolean hasFocus) {
setText(module.getName());
setIcon(ModuleType.get(module).getNodeIcon(false));
setIcon(ModuleType.get(module).getIcon());
}
}
@@ -178,7 +178,7 @@ public class ChooseModulesDialog extends DialogWrapper {
myCellRenderer = new ColoredListCellRenderer() {
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
final Module module = ((Module)value);
setIcon(ModuleType.get(module).getNodeIcon(false));
setIcon(ModuleType.get(module).getIcon());
append(module.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
final XmlFile pluginXml = PluginModuleType.getPluginXml(module);
@@ -15,9 +15,9 @@
*/
package org.jetbrains.plugins.groovy.mvc.util;
import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleType;
import com.intellij.ui.ListCellRendererWrapper;
import javax.swing.*;
@@ -32,7 +32,7 @@ public class ModuleCellRenderer extends ListCellRendererWrapper<Module> {
@Override
public void customize(JList list, Module module, int index, boolean selected, boolean hasFocus) {
if (module != null) {
setIcon(ModuleType.get(module).getNodeIcon(false));
setIcon(ModuleType.get(module).getIcon());
setText(module.getName());
}
}
@@ -17,7 +17,6 @@
package org.jetbrains.plugins.groovy.runner;
import com.intellij.execution.configuration.EnvironmentVariablesComponent;
import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.ide.util.BrowseFilesListener;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.module.Module;
@@ -26,10 +25,7 @@ import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.roots.ui.configuration.ModulesAlphaComparator;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.ComboboxSpeedSearch;
import com.intellij.ui.FieldPanel;
import com.intellij.ui.PanelWithAnchor;
import com.intellij.ui.RawCommandLineEditor;
import com.intellij.ui.*;
import com.intellij.ui.components.JBLabel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.GroovyFileType;
@@ -127,7 +123,7 @@ public class GroovyRunConfigurationEditor extends SettingsEditor<GroovyScriptRun
@Override
public void customize(JList list, Module module, int index, boolean selected, boolean hasFocus) {
if (module != null) {
setIcon(ModuleType.get(module).getNodeIcon(false));
setIcon(ModuleType.get(module).getIcon());
setText(module.getName());
}
}
@@ -16,7 +16,6 @@
package org.intellij.lang.xpath.xslt.run;
import com.intellij.icons.AllIcons;
import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
@@ -281,7 +280,7 @@ class XsltRunSettingsEditor extends SettingsEditor<XsltRunConfiguration> {
return module.getName();
}
}));
setIcon(ModuleType.get(module).getNodeIcon(true));
setIcon(ModuleType.get(module).getIcon());
}
else if (value instanceof String) {
setText((String)value);
@@ -15,7 +15,6 @@
*/
package org.intellij.plugins.xpathView.search;
import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.ide.util.scopeChooser.ScopeChooserCombo;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
@@ -28,6 +27,7 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.Disposer;
import com.intellij.ui.ComboboxWithBrowseButton;
import com.intellij.ui.DocumentAdapter;
import com.intellij.ui.ListCellRendererWrapper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -96,7 +96,7 @@ public class ScopePanel extends JPanel implements Disposable{
@Override
public void customize(JList list, Module m, int index, boolean selected, boolean hasFocus) {
if (m != null) {
setIcon(ModuleType.get(m).getNodeIcon(true));
setIcon(ModuleType.get(m).getIcon());
setText(m.getName());
}
}
@@ -134,7 +134,7 @@ public class ConfigFilesTreeBuilder {
final Object object = ((DefaultMutableTreeNode)value).getUserObject();
if (object instanceof Module) {
final Module module = (Module)object;
final Icon icon = ModuleType.get(module).getNodeIcon(expanded);
final Icon icon = ModuleType.get(module).getIcon();
renderer.setIcon(icon);
final String moduleName = module.getName();
renderer.append(moduleName, SimpleTextAttributes.REGULAR_ATTRIBUTES);