Unused code

This commit is contained in:
Rustam Vishnyakov
2017-07-01 17:23:54 +03:00
parent c6c10d6851
commit e66bd30345
2 changed files with 0 additions and 140 deletions
@@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.ImportSourceChooserDialog">
<grid id="cbd77" binding="myContentPane" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="48" y="54" width="436" height="297"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="e3588" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="200" height="200"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<scrollpane id="89ab8" class="com.intellij.ui.components.JBScrollPane">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="5063d" class="com.intellij.ui.components.JBList" binding="mySourceList">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
</children>
</grid>
</children>
</grid>
</form>
@@ -1,102 +0,0 @@
/*
* Copyright 2000-2013 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.application.options;
import com.intellij.openapi.application.ApplicationBundle;
import com.intellij.openapi.options.Scheme;
import com.intellij.openapi.options.SchemeImporterEP;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.ui.components.JBList;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class ImportSourceChooserDialog <S extends Scheme> extends DialogWrapper {
private JPanel myContentPane;
private JBList mySourceList;
private String mySelectedSourceName;
private final ListModel myListModel;
private final static String SHARED_IMPORT_SOURCE = ApplicationBundle.message("import.scheme.shared");
public ImportSourceChooserDialog(JComponent parent, Class<S> schemeClass) {
super(parent, true);
setTitle(ApplicationBundle.message("title.import.scheme.from"));
myListModel = new SourceListModel(SchemeImporterEP.getExtensions(schemeClass));
initSourceList();
init();
}
private void initSourceList() {
mySourceList.setModel(myListModel);
mySourceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
mySourceList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
int index = mySourceList.getSelectedIndex();
if (index >= 0) {
setSelectedSourceName((String)myListModel.getElementAt(index));
}
}
});
mySourceList.setSelectedIndex(0);
}
@Nullable
@Override
protected JComponent createCenterPanel() {
return myContentPane;
}
private void setSelectedSourceName(String name) {
mySelectedSourceName = name;
}
@Nullable
public String getSelectedSourceName() {
return mySelectedSourceName;
}
public boolean isImportFromSharedSelected() {
return SHARED_IMPORT_SOURCE.equals(mySelectedSourceName);
}
private class SourceListModel extends DefaultListModel {
private final List<String> mySourceNames = new ArrayList<>();
public SourceListModel(Collection<SchemeImporterEP<S>> extensions) {
for (SchemeImporterEP extension : extensions) {
mySourceNames.add(extension.name);
}
}
@Override
public int getSize() {
return mySourceNames.size();
}
@Override
public Object getElementAt(int index) {
return mySourceNames.get(index);
}
}
}