From 192c77766bee50dce315bc2d87ad2bdf7afaf59b Mon Sep 17 00:00:00 2001 From: nik Date: Tue, 28 Sep 2010 14:56:30 +0400 Subject: [PATCH] old libraries downloading panel replaced by new one from redesigned framework support dialog --- .../ui/libraries/ChooseLibrariesDialog.java | 72 ------- .../FacetLibrariesValidatorImpl.java | 10 +- .../LibraryCompositionOptionsPanel.form | 189 ---------------- .../LibraryCompositionOptionsPanel.java | 202 ------------------ .../libraries/LibraryCompositionSettings.java | 10 +- .../ui/libraries/LibraryOptionsPanel.form | 84 +++++--- .../ui/libraries/LibraryOptionsPanel.java | 66 +++--- .../RemoteRepositoryMirrorPanel.form | 30 --- .../RemoteRepositoryMirrorPanel.java | 57 ----- .../AddSupportForFrameworksPanel.java | 2 +- .../FrameworkSupportNode.java | 2 +- .../src/messages/ProjectBundle.properties | 11 - 12 files changed, 98 insertions(+), 637 deletions(-) delete mode 100644 java/idea-ui/src/com/intellij/facet/impl/ui/libraries/ChooseLibrariesDialog.java delete mode 100644 java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryCompositionOptionsPanel.form delete mode 100644 java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryCompositionOptionsPanel.java delete mode 100644 java/idea-ui/src/com/intellij/facet/impl/ui/libraries/RemoteRepositoryMirrorPanel.form delete mode 100644 java/idea-ui/src/com/intellij/facet/impl/ui/libraries/RemoteRepositoryMirrorPanel.java diff --git a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/ChooseLibrariesDialog.java b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/ChooseLibrariesDialog.java deleted file mode 100644 index 1e54e93103c6..000000000000 --- a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/ChooseLibrariesDialog.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2000-2009 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.facet.impl.ui.libraries; - -import com.intellij.ide.util.ElementsChooser; -import com.intellij.openapi.project.ProjectBundle; -import com.intellij.openapi.roots.libraries.Library; -import com.intellij.openapi.roots.ui.util.OrderEntryCellAppearanceUtils; -import com.intellij.openapi.ui.DialogWrapper; -import com.intellij.util.Icons; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; - -import javax.swing.*; -import java.awt.*; -import java.util.Collection; -import java.util.List; - -/** - * @author nik - */ -public class ChooseLibrariesDialog extends DialogWrapper { - private final LibraryElementChooser myChooser; - - public ChooseLibrariesDialog(final Component parent, final List libraries) { - super(parent, true); - setTitle(ProjectBundle.message("dialog.title.select.libraries")); - setModal(true); - myChooser = new LibraryElementChooser(libraries); - init(); - } - - @Nullable - protected JComponent createCenterPanel() { - return myChooser; - } - - public void markElements(final Collection elements) { - myChooser.markElements(elements); - } - - public List getMarkedLibraries() { - return myChooser.getMarkedElements(); - } - - static class LibraryElementChooser extends ElementsChooser { - LibraryElementChooser(final List elements) { - super(elements, false); - } - - protected Icon getItemIcon(final Library value) { - return Icons.LIBRARY_ICON; - } - - protected String getItemText(@NotNull final Library value) { - return OrderEntryCellAppearanceUtils.forLibrary(value).getText(); - } - } -} diff --git a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/FacetLibrariesValidatorImpl.java b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/FacetLibrariesValidatorImpl.java index e57bf843a7ac..cb568d1c4e1c 100644 --- a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/FacetLibrariesValidatorImpl.java +++ b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/FacetLibrariesValidatorImpl.java @@ -141,7 +141,7 @@ public class FacetLibrariesValidatorImpl extends FacetLibrariesValidator { } } } - LibraryCompositionOptionsPanel panel = new LibraryCompositionOptionsPanel(myContext.getLibrariesContainer(), myLibrarySettings, mirrorsMap); + LibraryOptionsPanel panel = new LibraryOptionsPanel(myLibrarySettings, myContext.getLibrariesContainer(), false); LibraryCompositionDialog dialog = new LibraryCompositionDialog(place, panel, mirrorsMap); dialog.show(); onChange(); @@ -149,10 +149,10 @@ public class FacetLibrariesValidatorImpl extends FacetLibrariesValidator { } private class LibraryCompositionDialog extends DialogWrapper { - private final LibraryCompositionOptionsPanel myPanel; + private final LibraryOptionsPanel myPanel; private final LibraryDownloadingMirrorsMap myMirrorsMap; - private LibraryCompositionDialog(final JComponent parent, final LibraryCompositionOptionsPanel panel, + private LibraryCompositionDialog(final JComponent parent, final LibraryOptionsPanel panel, final LibraryDownloadingMirrorsMap mirrorsMap) { super(parent, true); setTitle(IdeBundle.message("specify.libraries.dialog.title")); @@ -167,9 +167,9 @@ public class FacetLibrariesValidatorImpl extends FacetLibrariesValidator { protected void doOKAction() { myPanel.apply(); - final LibraryCompositionSettings settings = myPanel.getLibraryCompositionSettings(); + final LibraryCompositionSettings settings = myPanel.getSettings(); final LibrariesContainer librariesContainer = myContext.getLibrariesContainer(); - if (settings.downloadFiles(myMirrorsMap, librariesContainer, myPanel.getMainPanel(), false)) { + if (settings.downloadFiles(myMirrorsMap, myPanel.getMainPanel(), false)) { ModifiableRootModel rootModel = myContext.getModifiableRootModel(); if (rootModel == null) { final ModifiableRootModel model = ModuleRootManager.getInstance(myContext.getModule()).getModifiableModel(); diff --git a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryCompositionOptionsPanel.form b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryCompositionOptionsPanel.form deleted file mode 100644 index 5508344c68a6..000000000000 --- a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryCompositionOptionsPanel.form +++ /dev/null @@ -1,189 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryCompositionOptionsPanel.java b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryCompositionOptionsPanel.java deleted file mode 100644 index 70a78ebb15ca..000000000000 --- a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryCompositionOptionsPanel.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright 2000-2009 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.facet.impl.ui.libraries; - -import com.intellij.facet.ui.libraries.LibraryDownloadInfo; -import com.intellij.facet.ui.libraries.LibraryInfo; -import com.intellij.facet.ui.libraries.RemoteRepositoryInfo; -import com.intellij.ide.IdeBundle; -import com.intellij.openapi.fileChooser.FileChooser; -import com.intellij.openapi.fileChooser.FileChooserDescriptor; -import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; -import com.intellij.openapi.project.ProjectBundle; -import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer; -import com.intellij.openapi.ui.TextFieldWithBrowseButton; -import com.intellij.openapi.ui.VerticalFlowLayout; -import com.intellij.openapi.util.MutualMap; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.vfs.LocalFileSystem; -import com.intellij.openapi.vfs.VfsUtil; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.ui.UIUtil; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * @author nik -*/ -public class LibraryCompositionOptionsPanel { - private final MutualMap myLibraryLevels = new MutualMap(true); - private JPanel myMainPanel; - private JButton myAddJarsButton; - private JCheckBox myDownloadMissingJarsCheckBox; - private TextFieldWithBrowseButton myDirectoryField; - private JComboBox myLibraryLevelComboBox; - private JTextField myLibraryNameField; - private JPanel myMissingLibrariesPanel; - private JPanel myNewLibraryPanel; - private JPanel myLibraryPropertiesPanel; - private JPanel myMirrorsPanel; - private JLabel myMissingLibrariesLabel; - private JLabel myHiddenLabel; - private final List myAddedJars = new ArrayList(); - private final LibraryCompositionSettings myLibraryCompositionSettings; - private final LibraryDownloadingMirrorsMap myMirrorsMap; - private List myMirrorPanelsList; - - public LibraryCompositionOptionsPanel(final @NotNull LibrariesContainer librariesContainer, - final @NotNull LibraryCompositionSettings libraryCompositionSettings, - final @NotNull LibraryDownloadingMirrorsMap mirrorsMap) { - - myLibraryCompositionSettings = libraryCompositionSettings; - myMirrorsMap = mirrorsMap; - addMirrorsPanels(); - - myDirectoryField.addBrowseFolderListener(ProjectBundle.message("file.chooser.directory.for.downloaded.libraries.title"), - ProjectBundle.message("file.chooser.directory.for.downloaded.libraries.description"), null, - FileChooserDescriptorFactory.createSingleFolderDescriptor()); - myAddJarsButton.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - showFileChooser(); - } - }); - myDownloadMissingJarsCheckBox.setSelected(myLibraryCompositionSettings.isDownloadLibraries()); - myDownloadMissingJarsCheckBox.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - updateAll(); - } - }); - - myLibraryLevels.put(LibrariesContainer.LibraryLevel.GLOBAL, ProjectBundle.message("combobox.item.global.library")); - myLibraryLevels.put(LibrariesContainer.LibraryLevel.PROJECT, ProjectBundle.message("combobox.item.project.library")); - myLibraryLevels.put(LibrariesContainer.LibraryLevel.MODULE, ProjectBundle.message("combobox.item.module.library")); - for (String level : myLibraryLevels.getValues()) { - myLibraryLevelComboBox.addItem(level); - } - myLibraryLevelComboBox.setSelectedItem(myLibraryLevels.getValue(myLibraryCompositionSettings.getLibraryLevel())); - myLibraryNameField.setText(myLibraryCompositionSettings.getLibraryName()); - - myDirectoryField.setText(FileUtil.toSystemDependentName(myLibraryCompositionSettings.getDirectoryForDownloadedLibrariesPath())); - String jars = RequiredLibrariesInfo.getLibrariesPresentableText(myLibraryCompositionSettings.getLibraryInfos()); - - myHiddenLabel.setText(UIUtil.toHtml(ProjectBundle.message("label.text.libraries.are.missing", jars))); - - updateAll(); - myMissingLibrariesPanel.getPreferredSize(); - myMainPanel.validate(); - } - - public LibraryCompositionSettings getLibraryCompositionSettings() { - return myLibraryCompositionSettings; - } - - private void addMirrorsPanels() { - myMirrorsPanel.setLayout(new VerticalFlowLayout()); - myMirrorPanelsList = new ArrayList(); - Set repositories = new HashSet(); - LibraryInfo[] libraryInfos = myLibraryCompositionSettings.getLibraryInfos(); - for (LibraryInfo libraryInfo : libraryInfos) { - LibraryDownloadInfo downloadingInfo = libraryInfo.getDownloadingInfo(); - if (downloadingInfo != null) { - RemoteRepositoryInfo repositoryInfo = downloadingInfo.getRemoteRepository(); - if (repositoryInfo != null && repositories.add(repositoryInfo.getId())) { - RemoteRepositoryMirrorPanel mirrorPanel = new RemoteRepositoryMirrorPanel(repositoryInfo, myMirrorsMap); - myMirrorPanelsList.add(mirrorPanel); - myMirrorsPanel.add(mirrorPanel.getPanel()); - } - } - } - } - - private void showFileChooser() { - final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, false, true, false, false, true); - descriptor.setTitle(IdeBundle.message("file.chooser.select.paths.title")); - descriptor.setDescription(IdeBundle.message("file.chooser.multiselect.description")); - final VirtualFile[] files = FileChooser.chooseFiles(myAddJarsButton, descriptor, getBaseDirectory()); - ContainerUtil.addAll(myAddedJars, files); - updateAll(); - } - - @Nullable - private VirtualFile getBaseDirectory() { - String path = myLibraryCompositionSettings.getBaseDirectoryForDownloadedFiles(); - VirtualFile dir = LocalFileSystem.getInstance().findFileByPath(path); - if (dir == null) { - path = path.substring(0, path.lastIndexOf('/')); - dir = LocalFileSystem.getInstance().findFileByPath(path); - } - return dir; - } - - private void updateAll() { - String missingJarsText; - List roots = new ArrayList(); - roots.addAll(myAddedJars); - RequiredLibrariesInfo.RequiredClassesNotFoundInfo info = new RequiredLibrariesInfo(myLibraryCompositionSettings.getLibraryInfos()).checkLibraries( - VfsUtil.toVirtualFileArray(roots), false); - if (info != null) { - missingJarsText = ProjectBundle.message("label.text.libraries.are.missing", info.getMissingJarsText()); - } - else { - missingJarsText = ProjectBundle.message("label.text.all.library.files.found"); - } - myMissingLibrariesLabel.setText(UIUtil.toHtml(missingJarsText)); - ((CardLayout)myMissingLibrariesPanel.getLayout()).show(myMissingLibrariesPanel, "shown"); - if (info == null) { - myDownloadMissingJarsCheckBox.setSelected(false); - } - - - myNewLibraryPanel.setVisible(info != null || !myAddedJars.isEmpty()); - myLibraryPropertiesPanel.setVisible(!myAddedJars.isEmpty() || myDownloadMissingJarsCheckBox.isSelected()); - myDownloadMissingJarsCheckBox.setEnabled(info != null); - myDirectoryField.setEnabled(myDownloadMissingJarsCheckBox.isSelected()); - UIUtil.setEnabled(myMirrorsPanel, myDownloadMissingJarsCheckBox.isSelected(), true); - } - - public void saveSelectedRepositoriesMirrors(final LibraryDownloadingMirrorsMap mirrorsMap) { - for (RemoteRepositoryMirrorPanel mirrorPanel : myMirrorPanelsList) { - mirrorsMap.setMirror(mirrorPanel.getRemoteRepository(), mirrorPanel.getSelectedMirror()); - } - } - - public void apply() { - saveSelectedRepositoriesMirrors(myMirrorsMap); - if (myDownloadMissingJarsCheckBox.isSelected()) { - myLibraryCompositionSettings.setDownloadLibraries(true); - myLibraryCompositionSettings.setDirectoryForDownloadedLibrariesPath(FileUtil.toSystemIndependentName(myDirectoryField.getText())); - } - else { - myLibraryCompositionSettings.setDownloadLibraries(false); - } - myLibraryCompositionSettings.setLibraryLevel(myLibraryLevels.getKey((String)myLibraryLevelComboBox.getSelectedItem())); - myLibraryCompositionSettings.setLibraryName(myLibraryNameField.getText()); - } - - public JPanel getMainPanel() { - return myMainPanel; - } -} diff --git a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryCompositionSettings.java b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryCompositionSettings.java index 0dbdaefd1e94..d0e2c70d3f08 100644 --- a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryCompositionSettings.java +++ b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryCompositionSettings.java @@ -24,21 +24,18 @@ import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor; import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer; import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainerFactory; -import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; -import java.util.ArrayList; import java.util.List; /** * @author nik */ public class LibraryCompositionSettings implements Disposable { - @NonNls private static final String DEFAULT_LIB_FOLDER = "lib"; private final LibraryInfo[] myLibraryInfos; private final String myBaseDirectoryForDownloadedFiles; @@ -116,14 +113,11 @@ public class LibraryCompositionSettings implements Disposable { return myTitle; } - public boolean downloadFiles(final @NotNull LibraryDownloadingMirrorsMap mirrorsMap, - @NotNull LibrariesContainer librariesContainer, final @NotNull JComponent parent, - boolean all) { + public boolean downloadFiles(final @NotNull LibraryDownloadingMirrorsMap mirrorsMap, final @NotNull JComponent parent, boolean all) { if (myDownloadLibraries) { RequiredLibrariesInfo requiredLibraries = new RequiredLibrariesInfo(getLibraryInfos()); - List roots = new ArrayList(); - VirtualFile[] jars = VfsUtil.toVirtualFileArray(roots); + VirtualFile[] jars = myLibraryEditor != null ? myLibraryEditor.getFiles(OrderRootType.CLASSES) : VirtualFile.EMPTY_ARRAY; RequiredLibrariesInfo.RequiredClassesNotFoundInfo info = requiredLibraries.checkLibraries(jars, all); if (info != null) { LibraryDownloadInfo[] downloadingInfos = LibraryDownloader.getDownloadingInfos(info.getLibraryInfos()); diff --git a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryOptionsPanel.form b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryOptionsPanel.form index 987a5032f8f9..f72f6a42294a 100644 --- a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryOptionsPanel.form +++ b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryOptionsPanel.form @@ -21,7 +21,7 @@ - + @@ -37,38 +37,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -104,6 +72,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryOptionsPanel.java b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryOptionsPanel.java index 7ebe3c2edaa7..5c6e48e6df28 100644 --- a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryOptionsPanel.java +++ b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryOptionsPanel.java @@ -32,6 +32,7 @@ import com.intellij.ui.ColoredListCellRenderer; import com.intellij.ui.SortedComboBoxModel; import com.intellij.util.PathUtil; import com.intellij.util.ui.RadioButtonEnumModel; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -52,11 +53,13 @@ public class LibraryOptionsPanel { private JButton myConfigureButton; private JComboBox myExistingLibraryComboBox; private JRadioButton myUseExistingLibraryRadioButton; + private JRadioButton myDoNotCreateRadioButton; + private JPanel myConfigurationPanel; private ButtonGroup myButtonGroup; - private LibraryCompositionSettings mySettings; - private LibrariesContainer myLibrariesContainer; - private List myLibraries; + private final LibraryCompositionSettings mySettings; + private final LibrariesContainer myLibrariesContainer; + private final List myLibraries; private enum Choice { USE_EXISTING, @@ -67,7 +70,9 @@ public class LibraryOptionsPanel { private RadioButtonEnumModel myButtonEnumModel; - public LibraryOptionsPanel(LibraryCompositionSettings settings, LibrariesContainer librariesContainer) { + public LibraryOptionsPanel(@NotNull LibraryCompositionSettings settings, + @NotNull LibrariesContainer librariesContainer, + final boolean showDoNotCreateOption) { mySettings = settings; myLibrariesContainer = librariesContainer; myLibraries = calculateSuitableLibraries(); @@ -81,6 +86,7 @@ public class LibraryOptionsPanel { }); final boolean librariesFound = !myLibraries.isEmpty(); + myDoNotCreateRadioButton.setVisible(showDoNotCreateOption); myUseExistingLibraryRadioButton.setVisible(librariesFound); myExistingLibraryComboBox.setVisible(librariesFound); if (librariesFound) { @@ -103,14 +109,14 @@ public class LibraryOptionsPanel { public void actionPerformed(final ActionEvent e) { switch (myButtonEnumModel.getSelected()) { case DOWNLOAD: - new DownloadingOptionsDialog(myConfigureButton, mySettings).show(); + new DownloadingOptionsDialog(myPanel, mySettings).show(); break; case PICK_FILES: if (mySettings.getLibraryEditor() == null) { VirtualFile[] files = showFileChooser(); mySettings.addFilesToLibrary(files, OrderRootType.CLASSES); } - EditLibraryDialog dialog = new EditLibraryDialog(myConfigureButton, mySettings); + EditLibraryDialog dialog = new EditLibraryDialog(myPanel, mySettings); dialog.show(); break; default: @@ -142,7 +148,7 @@ public class LibraryOptionsPanel { final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, false, true, false, false, true); descriptor.setTitle(IdeBundle.message("file.chooser.select.paths.title")); descriptor.setDescription(IdeBundle.message("file.chooser.multiselect.description")); - return FileChooser.chooseFiles(myConfigureButton, descriptor, getBaseDirectory()); + return FileChooser.chooseFiles(myPanel, descriptor, getBaseDirectory()); } @Nullable @@ -158,34 +164,18 @@ public class LibraryOptionsPanel { private void updateState() { myMessageLabel.setForeground(Color.black); - myMessageLabel.setVisible(true); - myConfigureButton.setVisible(true); String message = ""; - + boolean showConfigurePanel = true; switch (myButtonEnumModel.getSelected()) { case DOWNLOAD: - final String downloadPath = mySettings.getDirectoryForDownloadedLibrariesPath(); - final String basePath = mySettings.getBaseDirectoryForDownloadedFiles(); - String path; - if (FileUtil.startsWith(downloadPath, basePath)) { - path = FileUtil.getRelativePath(basePath, downloadPath, File.separatorChar); - } - else { - path = PathUtil.getFileName(downloadPath); - } - message = MessageFormat.format("{0} jar(s) will be downloaded into {1} directory
" + - "{2} library {3} will be created", - mySettings.getLibraryInfos().length, - path, - mySettings.getLibraryLevel(), - mySettings.getLibraryName()); + message = getDownloadFilesMessage(); break; case PICK_FILES: NewLibraryEditor libraryEditor = mySettings.getLibraryEditor(); if (libraryEditor == null) { myMessageLabel.setForeground(Color.red); - message = "Press Configure button to add classes to the library"; + message = "Press 'Configure' button to add classes to the library"; } else { message = MessageFormat.format("{0} level library {1}" + @@ -196,13 +186,33 @@ public class LibraryOptionsPanel { } break; default: - myMessageLabel.setVisible(false); - myConfigureButton.setVisible(false); + //show the longest message on the hidden card to ensure that dialog won't jump if user selects another option + message = getDownloadFilesMessage(); + showConfigurePanel = false; } + ((CardLayout)myConfigurationPanel.getLayout()).show(myConfigurationPanel, showConfigurePanel ? "configure" : "empty"); myMessageLabel.setText("" + message + ""); } + private String getDownloadFilesMessage() { + final String downloadPath = mySettings.getDirectoryForDownloadedLibrariesPath(); + final String basePath = mySettings.getBaseDirectoryForDownloadedFiles(); + String path; + if (FileUtil.startsWith(downloadPath, basePath)) { + path = FileUtil.getRelativePath(basePath, downloadPath, File.separatorChar); + } + else { + path = PathUtil.getFileName(downloadPath); + } + return MessageFormat.format("{0} jar(s) will be downloaded into {1} directory
" + + "{2} library {3} will be created", + mySettings.getLibraryInfos().length, + path, + mySettings.getLibraryLevel(), + mySettings.getLibraryName()); + } + public LibraryCompositionSettings getSettings() { return mySettings; } diff --git a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/RemoteRepositoryMirrorPanel.form b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/RemoteRepositoryMirrorPanel.form deleted file mode 100644 index 925a00ff2c77..000000000000 --- a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/RemoteRepositoryMirrorPanel.form +++ /dev/null @@ -1,30 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/RemoteRepositoryMirrorPanel.java b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/RemoteRepositoryMirrorPanel.java deleted file mode 100644 index df118eda84c6..000000000000 --- a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/RemoteRepositoryMirrorPanel.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2000-2009 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.facet.impl.ui.libraries; - -import com.intellij.facet.ui.libraries.RemoteRepositoryInfo; -import com.intellij.openapi.project.ProjectBundle; - -import javax.swing.*; - -/** - * @author nik -*/ -public class RemoteRepositoryMirrorPanel { - private JPanel myPanel; - private JComboBox myMirrorComboBox; - private JLabel myFromLabel; - private final RemoteRepositoryInfo myRemoteRepository; - - public RemoteRepositoryMirrorPanel(final RemoteRepositoryInfo remoteRepository, final LibraryDownloadingMirrorsMap mirrorsMap) { - myRemoteRepository = remoteRepository; - myFromLabel.setText(ProjectBundle.message("composing.library.from.repository.label", remoteRepository.getPresentableName())); - updateComboBox(mirrorsMap); - } - - public void updateComboBox(final LibraryDownloadingMirrorsMap mirrorsMap) { - myMirrorComboBox.removeAllItems(); - for (String mirror : myRemoteRepository.getMirrors()) { - myMirrorComboBox.addItem(mirror); - } - myMirrorComboBox.setSelectedItem(mirrorsMap.getSelectedMirror(myRemoteRepository)); - } - - public JPanel getPanel() { - return myPanel; - } - - public RemoteRepositoryInfo getRemoteRepository() { - return myRemoteRepository; - } - - public String getSelectedMirror() { - return (String)myMirrorComboBox.getSelectedItem(); - } -} diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java index 6918dfc79187..26476b5bdfda 100644 --- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java +++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java @@ -249,7 +249,7 @@ public class AddSupportForFrameworksPanel implements Disposable { applyLibraryOptionsForSelected(); List list = getLibrariesCompositionSettingsList(); for (LibraryCompositionSettings compositionSettings : list) { - if (!compositionSettings.downloadFiles(myMirrorsMap, myLibrariesContainer, myMainPanel, true)) return false; + if (!compositionSettings.downloadFiles(myMirrorsMap, myMainPanel, true)) return false; } return true; } diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportNode.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportNode.java index dacc5f229ee1..28f06bdd6410 100644 --- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportNode.java +++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportNode.java @@ -80,7 +80,7 @@ public class FrameworkSupportNode extends CheckedTreeNode { final LibraryCompositionSettings libraryCompositionSettings = getLibraryCompositionSettings(); if (myLibraryCompositionOptionsPanel == null || !myLibraryCompositionOptionsPanel.getSettings().equals(libraryCompositionSettings)) { if (libraryCompositionSettings != null) { - myLibraryCompositionOptionsPanel = new LibraryOptionsPanel(libraryCompositionSettings, librariesContainer); + myLibraryCompositionOptionsPanel = new LibraryOptionsPanel(libraryCompositionSettings, librariesContainer, true); } else { myLibraryCompositionOptionsPanel = null; diff --git a/platform/platform-resources-en/src/messages/ProjectBundle.properties b/platform/platform-resources-en/src/messages/ProjectBundle.properties index 6d1534f2badf..e5abfccfaffd 100644 --- a/platform/platform-resources-en/src/messages/ProjectBundle.properties +++ b/platform/platform-resources-en/src/messages/ProjectBundle.properties @@ -456,10 +456,6 @@ project.new.wizard.module.file.title=Module &file location: label.text.please.select.desired.technologies=Please select the desired technologies label.text.framework.support.description=This will download all needed libraries and create Facets in project configuration -label.text.libraries.will.be.downloaded.by.default=All needed libraries will be downloaded into ''lib'' folder by default -button.text.change.downloading.policy=&Change... -label.text.libraries.are.missing=The following files are missing: {0}. -label.text.all.library.files.found=All needed files found. file.chooser.directory.for.downloaded.libraries.title=Directory for Downloaded Libraries file.chooser.directory.for.downloaded.libraries.description=Downloaded libraries will be copied to selected directory dialog.title.library.downloading.settings=Library Downloading Settings @@ -467,14 +463,7 @@ directory.roots.copy.label=Copy library content to directory (optional): combobox.item.global.library=global library combobox.item.project.library=project library combobox.item.module.library=module library -dialog.title.select.libraries=Select Libraries -composing.library.use.library.button=Use &Libraries... -composing.library.add.jars.button=&Pick files from disk... -composing.library.level.label=L&evel: -composing.library.name.label=&Name: composing.library.download.missing.jars.to=&Download missing files to: -composing.liibrary.new.library.label=The following library will be created -composing.library.from.repository.label=&from {0} dialog.title.add.frameworks.support=Add Frameworks Support warning.message.some.required.libraries.wasn.t.downloaded=Some required library wasn't downloaded. Do you want to proceed without it?