mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Migration to cell appearance services
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,9 +25,12 @@ import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryEx;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.ui.configuration.ProjectStructureDialogCellAppearanceUtils;
|
||||
import com.intellij.openapi.roots.ui.OrderEntryAppearanceService;
|
||||
import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription;
|
||||
import com.intellij.openapi.roots.ui.configuration.libraries.LibraryPresentationManager;
|
||||
import com.intellij.openapi.roots.ui.configuration.libraries.NewLibraryConfiguration;
|
||||
@@ -41,7 +44,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.ColoredListCellRenderer;
|
||||
import com.intellij.ui.HtmlListCellRenderer;
|
||||
import com.intellij.ui.SortedComboBoxModel;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
@@ -66,6 +69,7 @@ import java.util.List;
|
||||
*/
|
||||
public class LibraryOptionsPanel implements Disposable {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.facet.impl.ui.libraries.LibraryOptionsPanel");
|
||||
|
||||
private JLabel myMessageLabel;
|
||||
private JPanel myPanel;
|
||||
private JButton myConfigureButton;
|
||||
@@ -85,7 +89,7 @@ public class LibraryOptionsPanel implements Disposable {
|
||||
private SortedComboBoxModel<LibraryEditor> myLibraryComboBoxModel;
|
||||
private boolean myDisposed;
|
||||
|
||||
private enum Choice {
|
||||
private static enum Choice {
|
||||
USE_LIBRARY,
|
||||
DOWNLOAD,
|
||||
SETUP_LIBRARY_LATER
|
||||
@@ -93,8 +97,10 @@ public class LibraryOptionsPanel implements Disposable {
|
||||
|
||||
private RadioButtonEnumModel<Choice> myButtonEnumModel;
|
||||
|
||||
public LibraryOptionsPanel(final @NotNull CustomLibraryDescription libraryDescription, final @NotNull String baseDirectoryPath,
|
||||
@Nullable final FrameworkVersion currentFrameworkVersion, @NotNull final LibrariesContainer librariesContainer,
|
||||
public LibraryOptionsPanel(@NotNull final CustomLibraryDescription libraryDescription,
|
||||
@NotNull final String baseDirectoryPath,
|
||||
@Nullable final FrameworkVersion currentFrameworkVersion,
|
||||
@NotNull final LibrariesContainer librariesContainer,
|
||||
final boolean showDoNotCreateOption) {
|
||||
myLibrariesContainer = librariesContainer;
|
||||
final DownloadableLibraryDescription description = getDownloadableDescription(libraryDescription);
|
||||
@@ -183,7 +189,24 @@ public class LibraryOptionsPanel implements Disposable {
|
||||
updateState();
|
||||
}
|
||||
});
|
||||
myExistingLibraryComboBox.setRenderer(new LibraryListCellRenderer());
|
||||
myExistingLibraryComboBox.setRenderer(new HtmlListCellRenderer(myExistingLibraryComboBox.getRenderer()) {
|
||||
@Override
|
||||
protected void doCustomize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
|
||||
if (value == null) {
|
||||
append("[No library selected]");
|
||||
}
|
||||
else if (value instanceof ExistingLibraryEditor) {
|
||||
final Library library = ((ExistingLibraryEditor)value).getLibrary();
|
||||
final boolean invalid = !((LibraryEx)library).getInvalidRootUrls(OrderRootType.CLASSES).isEmpty();
|
||||
OrderEntryAppearanceService.getInstance(getProject()).forLibrary(library, invalid).customize(this);
|
||||
}
|
||||
else if (value instanceof NewLibraryEditor) {
|
||||
setIcon(PlatformIcons.LIBRARY_ICON);
|
||||
final String name = ((NewLibraryEditor)value).getName();
|
||||
append(name != null ? name : "<unnamed>");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
boolean canDownload = mySettings.getDownloadSettings() != null;
|
||||
myDownloadRadioButton.setVisible(canDownload);
|
||||
@@ -213,6 +236,14 @@ public class LibraryOptionsPanel implements Disposable {
|
||||
showCard("editing");
|
||||
}
|
||||
|
||||
private Project getProject() {
|
||||
Project project = myLibrariesContainer.getProject();
|
||||
if (project == null) {
|
||||
project = ProjectManager.getInstance().getDefaultProject();
|
||||
}
|
||||
return project;
|
||||
}
|
||||
|
||||
private void doConfigure() {
|
||||
switch (myButtonEnumModel.getSelected()) {
|
||||
case DOWNLOAD:
|
||||
@@ -401,21 +432,4 @@ public class LibraryOptionsPanel implements Disposable {
|
||||
public void dispose() {
|
||||
myDisposed = true;
|
||||
}
|
||||
|
||||
private static class LibraryListCellRenderer extends ColoredListCellRenderer {
|
||||
@Override
|
||||
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
|
||||
if (value == null) {
|
||||
append("[No library selected]");
|
||||
}
|
||||
else if (value instanceof ExistingLibraryEditor) {
|
||||
ProjectStructureDialogCellAppearanceUtils.forLibrary(((ExistingLibraryEditor)value).getLibrary(), null).customize(this);
|
||||
}
|
||||
else if (value instanceof NewLibraryEditor) {
|
||||
setIcon(PlatformIcons.LIBRARY_ICON);
|
||||
final String name = ((NewLibraryEditor)value).getName();
|
||||
append(name != null ? name : "<unnamed>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,6 +34,7 @@ import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import gnu.trove.TIntArrayList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -52,13 +53,13 @@ public class JdkChooserPanel extends JPanel {
|
||||
private final Project myProject;
|
||||
private SdkType[] myAllowedJdkTypes = null;
|
||||
|
||||
public JdkChooserPanel(Project project) {
|
||||
public JdkChooserPanel(@NotNull final Project project) {
|
||||
super(new BorderLayout());
|
||||
myProject = project;
|
||||
myListModel = new DefaultListModel();
|
||||
myList = new JBList(myListModel);
|
||||
myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
myList.setCellRenderer(new ProjectJdkListRenderer(myList.getCellRenderer()));
|
||||
myList.setCellRenderer(new ProjectJdkListRenderer(myList.getCellRenderer(), project));
|
||||
//noinspection HardCodedStringLiteral
|
||||
myList.setPrototypeCellValue("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,26 +15,31 @@
|
||||
*/
|
||||
package com.intellij.ide.util.projectWizard;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.ui.util.OrderEntryCellAppearanceUtils;
|
||||
import com.intellij.openapi.roots.ui.OrderEntryAppearanceService;
|
||||
import com.intellij.ui.HtmlListCellRenderer;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: May 18, 2005
|
||||
* @since May 18, 2005
|
||||
*/
|
||||
public class ProjectJdkListRenderer extends HtmlListCellRenderer {
|
||||
public ProjectJdkListRenderer(final ListCellRenderer listCellRenderer) {
|
||||
private final Project myProject;
|
||||
|
||||
public ProjectJdkListRenderer(final ListCellRenderer listCellRenderer, @NotNull final Project project) {
|
||||
super(listCellRenderer);
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCustomize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
|
||||
if (value == null || value instanceof Sdk) {
|
||||
render(OrderEntryCellAppearanceUtils.forJdk((Sdk)value, false, selected, index != -1));
|
||||
OrderEntryAppearanceService.getInstance(myProject).forJdk((Sdk)value, false, selected, index != -1).customize(this);
|
||||
}
|
||||
else {
|
||||
final String str = value.toString();
|
||||
|
||||
+4
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -60,6 +60,9 @@ public class ProjectWizardStepFactoryImpl extends ProjectWizardStepFactory {
|
||||
return new SourcePathsStep(builder, icon, helpId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public ModuleWizardStep createProjectJdkStep(WizardContext context,
|
||||
final JavaModuleBuilder builder,
|
||||
final Computable<Boolean> isVisible,
|
||||
|
||||
+1
-33
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,13 +20,9 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.roots.AnnotationOrderRootType;
|
||||
import com.intellij.openapi.roots.ui.util.CellAppearance;
|
||||
import com.intellij.openapi.roots.ui.util.CellAppearanceUtils;
|
||||
import com.intellij.openapi.roots.ui.util.SimpleTextCellAppearance;
|
||||
import com.intellij.openapi.ui.PanelWithText;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.ui.ColoredTableCellRenderer;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.TableUtil;
|
||||
@@ -170,34 +166,6 @@ public class AnnotationsEditor extends ModuleElementsEditor {
|
||||
}
|
||||
}
|
||||
|
||||
private static class TableItem {
|
||||
private final String myUrl;
|
||||
private final CellAppearance myCellAppearance;
|
||||
public TableItem(VirtualFile file) {
|
||||
myUrl = file.getUrl();
|
||||
myCellAppearance = CellAppearanceUtils.forVirtualFile(file);
|
||||
}
|
||||
|
||||
public TableItem(String url) {
|
||||
myUrl = url;
|
||||
final VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
|
||||
if (file != null) {
|
||||
myCellAppearance = CellAppearanceUtils.forVirtualFile(file);
|
||||
}
|
||||
else {
|
||||
myCellAppearance = SimpleTextCellAppearance.invalid(url, CellAppearanceUtils.INVALID_ICON);
|
||||
}
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return myUrl;
|
||||
}
|
||||
|
||||
public CellAppearance getCellAppearance() {
|
||||
return myCellAppearance;
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyTableModel extends DefaultTableModel implements ItemRemovable{
|
||||
public String getColumnName(int column) {
|
||||
return null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,13 +21,9 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.projectRoots.ui.Util;
|
||||
import com.intellij.openapi.roots.JavadocOrderRootType;
|
||||
import com.intellij.openapi.roots.ui.util.CellAppearance;
|
||||
import com.intellij.openapi.roots.ui.util.CellAppearanceUtils;
|
||||
import com.intellij.openapi.roots.ui.util.SimpleTextCellAppearance;
|
||||
import com.intellij.openapi.ui.PanelWithText;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.ui.ColoredTableCellRenderer;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.TableUtil;
|
||||
@@ -177,34 +173,6 @@ public class JavadocEditor extends ModuleElementsEditor {
|
||||
}
|
||||
}
|
||||
|
||||
private static class TableItem {
|
||||
private final String myUrl;
|
||||
private final CellAppearance myCellAppearance;
|
||||
public TableItem(VirtualFile file) {
|
||||
myUrl = file.getUrl();
|
||||
myCellAppearance = CellAppearanceUtils.forVirtualFile(file);
|
||||
}
|
||||
|
||||
public TableItem(String url) {
|
||||
myUrl = url;
|
||||
final VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
|
||||
if (file != null) {
|
||||
myCellAppearance = CellAppearanceUtils.forVirtualFile(file);
|
||||
}
|
||||
else {
|
||||
myCellAppearance = SimpleTextCellAppearance.invalid(url, CellAppearanceUtils.INVALID_ICON);
|
||||
}
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return myUrl;
|
||||
}
|
||||
|
||||
public CellAppearance getCellAppearance() {
|
||||
return myCellAppearance;
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyTableModel extends DefaultTableModel implements ItemRemovable{
|
||||
public String getColumnName(int column) {
|
||||
return null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,6 +31,7 @@ import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.ui.ScreenUtil;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.util.Consumer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -43,14 +44,14 @@ import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: May 18, 2005
|
||||
* @since May 18, 2005
|
||||
*/
|
||||
class JdkComboBox extends ComboBoxWithWidePopup {
|
||||
private final JButton myEditButton = new JButton(ApplicationBundle.message("button.edit"));
|
||||
|
||||
public JdkComboBox(final ProjectSdksModel jdksModel) {
|
||||
super(new JdkComboBoxModel(jdksModel));
|
||||
setRenderer(new ProjectJdkListRenderer(getRenderer()) {
|
||||
public JdkComboBox(@NotNull final ProjectSdksModel jdkModel, @NotNull final Project project) {
|
||||
super(new JdkComboBoxModel(jdkModel));
|
||||
setRenderer(new ProjectJdkListRenderer(getRenderer(), project) {
|
||||
@Override
|
||||
public void doCustomize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
|
||||
if (JdkComboBox.this.isEnabled()) {
|
||||
@@ -59,7 +60,7 @@ class JdkComboBox extends ComboBoxWithWidePopup {
|
||||
append(str, SimpleTextAttributes.ERROR_ATTRIBUTES);
|
||||
}
|
||||
else if (value instanceof ProjectJdkComboBoxItem){
|
||||
final Sdk jdk = jdksModel.getProjectSdk();
|
||||
final Sdk jdk = jdkModel.getProjectSdk();
|
||||
if (jdk != null){
|
||||
setIcon(jdk.getSdkType().getIcon());
|
||||
append(ProjectBundle.message("project.roots.project.jdk.inherited"), SimpleTextAttributes.REGULAR_ATTRIBUTES);
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -101,7 +101,7 @@ public abstract class ModuleJdkConfigurable implements Disposable {
|
||||
|
||||
private void init() {
|
||||
myJdkPanel = new JPanel(new GridBagLayout());
|
||||
myCbModuleJdk = new JdkComboBox(myJdksModel);
|
||||
myCbModuleJdk = new JdkComboBox(myJdksModel, myModuleEditor.myProject);
|
||||
myCbModuleJdk.insertItemAt(new JdkComboBox.ProjectJdkComboBoxItem(), 0);
|
||||
myCbModuleJdk.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -103,7 +103,7 @@ public class ProjectJdkConfigurable implements UnnamedConfigurable {
|
||||
|
||||
private void init() {
|
||||
myJdkPanel = new JPanel(new GridBagLayout());
|
||||
myCbProjectJdk = new JdkComboBox(myJdksModel);
|
||||
myCbProjectJdk = new JdkComboBox(myJdksModel, myProject);
|
||||
myCbProjectJdk.insertItemAt(new JdkComboBox.NoneJdkComboBoxItem(), 0);
|
||||
myCbProjectJdk.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.openapi.roots.LibraryOrderEntry;
|
||||
import com.intellij.openapi.roots.OrderEntry;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryEx;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.ui.configuration.libraries.LibraryPresentationManager;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
|
||||
import com.intellij.openapi.roots.ui.util.CellAppearance;
|
||||
import com.intellij.openapi.roots.ui.util.OrderEntryCellAppearanceUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
//todo[nik] extract service from OrderEntryCellAppearanceUtils and use this class as its implementation for idea-ui
|
||||
public class ProjectStructureDialogCellAppearanceUtils {
|
||||
|
||||
private ProjectStructureDialogCellAppearanceUtils() {
|
||||
}
|
||||
|
||||
public static CellAppearance forOrderEntry(OrderEntry orderEntry, StructureConfigurableContext context, boolean selected) {
|
||||
if (orderEntry instanceof LibraryOrderEntry) {
|
||||
final Library library = ((LibraryOrderEntry)orderEntry).getLibrary();
|
||||
if (orderEntry.isValid()) {
|
||||
return forLibrary(library, context);
|
||||
}
|
||||
}
|
||||
return OrderEntryCellAppearanceUtils.forOrderEntry(orderEntry, selected);
|
||||
}
|
||||
|
||||
public static CellAppearance forLibrary(Library library, StructureConfigurableContext context) {
|
||||
final Icon icon = LibraryPresentationManager.getInstance().getCustomIcon(library, context);
|
||||
final boolean invalid = !((LibraryEx)library).getInvalidRootUrls(OrderRootType.CLASSES).isEmpty();
|
||||
if (icon != null) {
|
||||
final String name = library.getName();
|
||||
if (name != null) {
|
||||
return OrderEntryCellAppearanceUtils.normalOrRedWaved(name, icon, invalid);
|
||||
}
|
||||
}
|
||||
return OrderEntryCellAppearanceUtils.forLibrary(library, invalid);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.openapi.roots.ui.FileAppearanceService;
|
||||
import com.intellij.openapi.roots.ui.util.CellAppearance;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class TableItem {
|
||||
private final String myUrl;
|
||||
private final CellAppearance myCellAppearance;
|
||||
|
||||
public TableItem(@NotNull final VirtualFile file) {
|
||||
myUrl = file.getUrl();
|
||||
myCellAppearance = FileAppearanceService.getInstance().forVirtualFile(file);
|
||||
}
|
||||
|
||||
public TableItem(@NotNull final String url) {
|
||||
myUrl = url;
|
||||
|
||||
final VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
|
||||
if (file != null) {
|
||||
myCellAppearance = FileAppearanceService.getInstance().forVirtualFile(file);
|
||||
}
|
||||
else {
|
||||
myCellAppearance = FileAppearanceService.getInstance().forInvalidUrl(url);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getUrl() {
|
||||
return myUrl;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CellAppearance getCellAppearance() {
|
||||
return myCellAppearance;
|
||||
}
|
||||
}
|
||||
+7
-5
@@ -27,6 +27,7 @@ import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTablePresentation;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
|
||||
import com.intellij.openapi.roots.ui.OrderEntryAppearanceService;
|
||||
import com.intellij.openapi.roots.ui.configuration.*;
|
||||
import com.intellij.openapi.roots.ui.configuration.dependencyAnalysis.AnalyzeDependenciesDialog;
|
||||
import com.intellij.openapi.roots.ui.configuration.libraries.LibraryEditingUtil;
|
||||
@@ -39,7 +40,6 @@ import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProj
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.SdkProjectStructureElement;
|
||||
import com.intellij.openapi.roots.ui.util.CellAppearance;
|
||||
import com.intellij.openapi.roots.ui.util.OrderEntryCellAppearanceUtils;
|
||||
import com.intellij.openapi.ui.ComboBoxTableRenderer;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.popup.JBPopup;
|
||||
@@ -625,15 +625,17 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
|
||||
return elements;
|
||||
}
|
||||
|
||||
|
||||
private static CellAppearance getCellAppearance(final ClasspathTableItem<?> item,
|
||||
StructureConfigurableContext context,
|
||||
final StructureConfigurableContext context,
|
||||
final boolean selected) {
|
||||
final OrderEntryAppearanceService service = OrderEntryAppearanceService.getInstance(context.getProject());
|
||||
if (item instanceof InvalidJdkItem) {
|
||||
return OrderEntryCellAppearanceUtils.forJdk(null, false, selected);
|
||||
return service.forJdk(null, false, selected, true);
|
||||
}
|
||||
else {
|
||||
return ProjectStructureDialogCellAppearanceUtils.forOrderEntry(item.getEntry(), context, selected);
|
||||
final OrderEntry entry = item.getEntry();
|
||||
assert entry != null : item;
|
||||
return service.forOrderEntry(entry, selected);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,9 +27,9 @@ import com.intellij.openapi.roots.ModuleRootEvent;
|
||||
import com.intellij.openapi.roots.ModuleRootListener;
|
||||
import com.intellij.openapi.roots.ModuleSourceOrderEntry;
|
||||
import com.intellij.openapi.roots.OrderEntry;
|
||||
import com.intellij.openapi.roots.ui.OrderEntryAppearanceService;
|
||||
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
|
||||
import com.intellij.openapi.roots.ui.util.CellAppearance;
|
||||
import com.intellij.openapi.roots.ui.util.OrderEntryCellAppearanceUtils;
|
||||
import com.intellij.openapi.ui.MasterDetailsComponent;
|
||||
import com.intellij.openapi.ui.NamedConfigurable;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
@@ -629,10 +629,10 @@ public class AnalyzeDependenciesComponent extends MasterDetailsComponent {
|
||||
};
|
||||
}
|
||||
else {
|
||||
return OrderEntryCellAppearanceUtils.forModule(e.getOwnerModule());
|
||||
return OrderEntryAppearanceService.getInstance(myModule.getProject()).forModule(e.getOwnerModule());
|
||||
}
|
||||
}
|
||||
return OrderEntryCellAppearanceUtils.forOrderEntry(myExplanation.entry(), selected);
|
||||
return OrderEntryAppearanceService.getInstance(myModule.getProject()).forOrderEntry(myExplanation.entry(), selected);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -678,8 +678,7 @@ public class AnalyzeDependenciesComponent extends MasterDetailsComponent {
|
||||
* The constructor
|
||||
*/
|
||||
public SdkFilterAction() {
|
||||
super("Include SDK", "If selected, the SDK classes are included",
|
||||
IconLoader.findIcon("/general/jdk.png")); //To change body of overridden methods use File | Settings | File Templates.
|
||||
super("Include SDK", "If selected, the SDK classes are included", IconLoader.findIcon("/general/jdk.png"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,8 +18,8 @@ package com.intellij.openapi.roots.ui.configuration.dependencyAnalysis;
|
||||
import com.intellij.ide.presentation.VirtualFilePresentation;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.roots.ui.OrderEntryAppearanceService;
|
||||
import com.intellij.openapi.roots.ui.util.CellAppearance;
|
||||
import com.intellij.openapi.roots.ui.util.OrderEntryCellAppearanceUtils;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
@@ -369,7 +369,7 @@ public class ModuleDependenciesAnalyzer {
|
||||
@NotNull
|
||||
@Override
|
||||
public CellAppearance getAppearance(boolean isSelected) {
|
||||
return OrderEntryCellAppearanceUtils.forOrderEntry(myEntry, isSelected);
|
||||
return OrderEntryAppearanceService.getInstance(myEntry.getOwnerModule().getProject()).forOrderEntry(myEntry, isSelected);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user