mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
remove obsolete dialog
This commit is contained in:
-79
@@ -1,79 +0,0 @@
|
||||
package com.jetbrains.edu.coursecreator.ui;
|
||||
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.fileTypes.impl.FileTypeRenderer;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.ui.DoubleClickListener;
|
||||
import com.intellij.ui.ScrollingUtil;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.jetbrains.edu.learning.courseFormat.Course;
|
||||
import com.jetbrains.edu.coursecreator.CCLanguageManager;
|
||||
import com.jetbrains.edu.coursecreator.CCUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
public class CreateTaskFileDialog extends DialogWrapper {
|
||||
private final Course myCourse;
|
||||
private JPanel myPanel;
|
||||
private JBList myList;
|
||||
private JTextField myTextField;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public CreateTaskFileDialog(@Nullable Project project, String generatedFileName, @NotNull final Course course) {
|
||||
super(project);
|
||||
myCourse = course;
|
||||
FileType[] fileTypes = FileTypeManager.getInstance().getRegisteredFileTypes();
|
||||
|
||||
DefaultListModel model = new DefaultListModel();
|
||||
for (FileType type : fileTypes) {
|
||||
if (!type.isReadOnly() && !type.getDefaultExtension().isEmpty()) {
|
||||
model.addElement(type);
|
||||
}
|
||||
}
|
||||
myList.setModel(model);
|
||||
myTextField.setText(generatedFileName);
|
||||
setTitle("Create New Task File");
|
||||
init();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected JComponent createCenterPanel() {
|
||||
myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
myList.setCellRenderer(new FileTypeRenderer());
|
||||
|
||||
new DoubleClickListener() {
|
||||
@Override
|
||||
protected boolean onDoubleClick(MouseEvent e) {
|
||||
doOKAction();
|
||||
return true;
|
||||
}
|
||||
}.installOn(myList);
|
||||
|
||||
CCLanguageManager manager = CCUtils.getStudyLanguageManager(myCourse);
|
||||
if (manager != null) {
|
||||
String extension = manager.getDefaultTaskFileExtension();
|
||||
ScrollingUtil.selectItem(myList, FileTypeManager.getInstance().getFileTypeByExtension(extension != null ? extension : "txt"));
|
||||
}
|
||||
return myPanel;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
return myTextField;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return myTextField.getText();
|
||||
}
|
||||
|
||||
public FileType getFileType() {
|
||||
return (FileType)myList.getSelectedValue();
|
||||
}
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.jetbrains.edu.coursecreator.ui.CreateTaskFileDialog">
|
||||
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="e3f" class="com.intellij.ui.components.JBLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="File Name:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="1f196" class="javax.swing.JTextField" binding="myTextField" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<scrollpane id="2c770" class="com.intellij.ui.components.JBScrollPane">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="f5bb6" class="com.intellij.ui.components.JBList" binding="myList">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<layoutOrientation value="0"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</scrollpane>
|
||||
<grid id="22a58" 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="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="ff15e" class="com.intellij.ui.components.JBLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Select File Type:"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
Reference in New Issue
Block a user