2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.facet
.impl
.ui
.libraries
;
18 import com
.intellij
.facet
.ui
.libraries
.RemoteRepositoryInfo
;
19 import com
.intellij
.openapi
.project
.ProjectBundle
;
26 public class RemoteRepositoryMirrorPanel
{
27 private JPanel myPanel
;
28 private JComboBox myMirrorComboBox
;
29 private JLabel myFromLabel
;
30 private final RemoteRepositoryInfo myRemoteRepository
;
32 public RemoteRepositoryMirrorPanel(final RemoteRepositoryInfo remoteRepository
, final LibraryDownloadingMirrorsMap mirrorsMap
) {
33 myRemoteRepository
= remoteRepository
;
34 myFromLabel
.setText(ProjectBundle
.message("composing.library.from.repository.label", remoteRepository
.getPresentableName()));
35 updateComboBox(mirrorsMap
);
38 public void updateComboBox(final LibraryDownloadingMirrorsMap mirrorsMap
) {
39 myMirrorComboBox
.removeAllItems();
40 for (String mirror
: myRemoteRepository
.getMirrors()) {
41 myMirrorComboBox
.addItem(mirror
);
43 myMirrorComboBox
.setSelectedItem(mirrorsMap
.getSelectedMirror(myRemoteRepository
));
46 public JPanel
getPanel() {
50 public RemoteRepositoryInfo
getRemoteRepository() {
51 return myRemoteRepository
;
54 public String
getSelectedMirror() {
55 return (String
)myMirrorComboBox
.getSelectedItem();