use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-plugins by JetBrains.
the class DartTestConfigurationEditorForm method applyEditorTo.
@Override
protected void applyEditorTo(@NotNull final DartTestRunConfiguration configuration) throws ConfigurationException {
final DartTestRunnerParameters parameters = configuration.getRunnerParameters();
final DartTestRunnerParameters.Scope scope = (DartTestRunnerParameters.Scope) myScopeCombo.getSelectedItem();
parameters.setScope(scope);
TextFieldWithBrowseButton pathSource = scope == FOLDER ? myDirField : myFileField;
parameters.setFilePath(StringUtil.nullize(FileUtil.toSystemIndependentName(pathSource.getText().trim())));
parameters.setTestName(scope == GROUP_OR_TEST_BY_NAME ? StringUtil.nullize(myTestNameField.getText().trim()) : null);
parameters.setTargetName(scope == FOLDER ? StringUtil.nullize(myTargetNameField.getText().trim()) : null);
parameters.setTestRunnerOptions(StringUtil.nullize(myTestRunnerOptionsField.getText().trim()));
parameters.setEnvs(myEnvironmentVariables.getEnvs());
parameters.setIncludeParentEnvs(myEnvironmentVariables.isPassParentEnvs());
}
use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-plugins by JetBrains.
the class FilesToPackageForm method initTable.
private void initTable() {
myFilesToPackageTable = new JBTable();
// otherwise model is not in sync with view
myFilesToPackageTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
myFilesToPackageTable.setPreferredScrollableViewportSize(JBUI.size(400, 150));
myFilesToPackageTable.setRowHeight(new JTextField("Fake").getPreferredSize().height + myFilesToPackageTable.getRowMargin());
myFilesToPackageTable.setModel(new DefaultTableModel() {
public int getColumnCount() {
return Column.values().length;
}
public int getRowCount() {
return myFilesToPackage.size();
}
public String getColumnName(int column) {
return Column.values()[column].getColumnName();
}
public Class<?> getColumnClass(int column) {
return Column.values()[column].getColumnClass();
}
public Object getValueAt(int row, int column) {
return Column.values()[column].getValue(myFilesToPackage.get(row));
}
public void setValueAt(Object aValue, int row, int column) {
Column.values()[column].setValue(myFilesToPackage, row, aValue);
}
});
myFilesToPackageTable.getColumnModel().getColumn(0).setCellEditor(new AbstractTableCellEditor() {
private CellEditorComponentWithBrowseButton<JTextField> myComponent;
public Component getTableCellEditorComponent(final JTable table, Object value, boolean isSelected, int row, int column) {
final ActionListener listener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileChooserDescriptor d = new FileChooserDescriptor(true, true, false, true, false, false);
VirtualFile initialFile = LocalFileSystem.getInstance().findFileByPath((String) getCellEditorValue());
VirtualFile file = FileChooser.chooseFile(d, myProject, initialFile);
if (file != null) {
myComponent.getChildComponent().setText(file.getPresentableUrl());
}
}
};
myComponent = new CellEditorComponentWithBrowseButton<>(new TextFieldWithBrowseButton(listener), this);
myComponent.getChildComponent().setText((String) value);
return myComponent;
}
public Object getCellEditorValue() {
return myComponent.getChildComponent().getText();
}
});
}
use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project android by JetBrains.
the class NewModuleDialogFixture method setFileName.
@NotNull
public NewModuleDialogFixture setFileName(String name) {
TextFieldWithBrowseButton panel = robot().finder().findByLabel(target(), "File name:", TextFieldWithBrowseButton.class);
new JTextComponentFixture(robot(), robot().finder().findByType(panel, JTextField.class)).deleteText().enterText(name);
return this;
}
use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-community by JetBrains.
the class DomGenPanel method createUIComponents.
private void createUIComponents() {
mySchemaLocation = new TextFieldWithBrowseButton();
final String title = "Choose XSD or DTD schema";
mySchemaLocation.addBrowseFolderListener(title, "Make sure there are only necessary schemes in directory where your XSD or DTD schema is located", myProject, new FileTypeDescriptor(title, "xsd", "dtd"));
mySchemaLocation.getTextField().setEditable(false);
mySchemaLocation.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final File file = new File(mySchemaLocation.getText());
if (file.exists() && file.getName().toLowerCase().endsWith(".xsd")) {
final VirtualFile vf = LocalFileSystem.getInstance().findFileByIoFile(file);
if (vf != null) {
final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(vf);
if (psiFile instanceof XmlFile) {
final XmlDocument xml = ((XmlFile) psiFile).getDocument();
if (xml != null) {
final XmlTag rootTag = xml.getRootTag();
if (rootTag != null) {
String target = null;
ArrayList<String> ns = new ArrayList<>();
for (XmlAttribute attr : rootTag.getAttributes()) {
if ("targetNamespace".equals(attr.getName())) {
target = attr.getValue();
} else if (attr.getName().startsWith("xmlns")) {
ns.add(attr.getValue());
}
}
ns.remove(target);
if (target != null) {
myNamespace.setText(target);
}
mySkipSchemas.setText(StringUtil.join(ArrayUtil.toStringArray(ns), "\n"));
}
}
}
}
}
}
});
myOutputDir = new TextFieldWithBrowseButton();
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
myOutputDir.addBrowseFolderListener("Select Output Directory For Generated Files", "", myProject, descriptor);
}
use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-community by JetBrains.
the class ShowUpdateInfoDialogAction method getUserText.
@NotNull
private static Pair<String, VirtualFile> getUserText(@NotNull Project project, @NotNull String title) {
JTextArea textArea = new JTextArea(10, 50);
UIUtil.addUndoRedoActions(textArea);
textArea.setWrapStyleWord(true);
textArea.setLineWrap(true);
JPanel panel = new JPanel(new BorderLayout(0, 10));
panel.add(ScrollPaneFactory.createScrollPane(textArea), BorderLayout.CENTER);
Disposable disposable = Disposer.newDisposable();
FileTextField fileField = FileChooserFactory.getInstance().createFileTextField(BrowseFilesListener.SINGLE_FILE_DESCRIPTOR, disposable);
TextFieldWithBrowseButton fileCompo = new TextFieldWithBrowseButton(fileField.getField());
FileChooserDescriptor fileDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
fileCompo.addBrowseFolderListener("Patch File", "Patch file", project, fileDescriptor);
panel.add(LabeledComponent.create(fileCompo, "Patch file:"), BorderLayout.SOUTH);
DialogBuilder builder = new DialogBuilder(project);
builder.addDisposable(disposable);
builder.setCenterPanel(panel);
builder.setPreferredFocusComponent(textArea);
builder.setTitle(title);
builder.addOkAction();
builder.addCancelAction();
return builder.showAndGet() ? Pair.create(textArea.getText(), fileField.getSelectedFile()) : Pair.empty();
}
Aggregations