本文整理汇总了Java中com.intellij.openapi.ui.ComponentWithBrowseButton.BrowseFolderActionListener方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentWithBrowseButton.BrowseFolderActionListener方法的具体用法?Java ComponentWithBrowseButton.BrowseFolderActionListener怎么用?Java ComponentWithBrowseButton.BrowseFolderActionListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.ui.ComponentWithBrowseButton
的用法示例。
在下文中一共展示了ComponentWithBrowseButton.BrowseFolderActionListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupScriptPathField
import com.intellij.openapi.ui.ComponentWithBrowseButton; //导入方法依赖的package包/类
private void setupScriptPathField(@NotNull final Project project) {
final ComponentWithBrowseButton.BrowseFolderActionListener<JTextField> listener =
new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
"Select Script",
"",
myScriptPathField,
project,
FileChooserDescriptorFactory.createSingleFileDescriptor(TheRFileType.INSTANCE),
TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT
) {
@Override
protected void onFileChosen(@NotNull final VirtualFile chosenFile) {
super.onFileChosen(chosenFile);
TheRRunConfigurationUtils.setSuggestedWorkingDirectoryPathIfNotSpecified(TheRRunConfigurationForm.this);
}
};
myScriptPathField.addActionListener(listener);
}
示例2: PythonRunConfigurationForm
import com.intellij.openapi.ui.ComponentWithBrowseButton; //导入方法依赖的package包/类
public PythonRunConfigurationForm(PythonRunConfiguration configuration) {
myCommonOptionsForm = PyCommonOptionsFormFactory.getInstance().createForm(configuration.getCommonOptionsFormData());
myCommonOptionsPlaceholder.add(myCommonOptionsForm.getMainPanel(), BorderLayout.CENTER);
myProject = configuration.getProject();
FileChooserDescriptor chooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
return file.isDirectory() || file.getExtension() == null || Comparing.equal(file.getExtension(), "py");
}
};
//chooserDescriptor.setRoot(s.getProject().getBaseDir());
ComponentWithBrowseButton.BrowseFolderActionListener<JTextField> listener =
new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>("Select Script", "", myScriptTextField, myProject,
chooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
@Override
protected void onFileChosen(@NotNull VirtualFile chosenFile) {
super.onFileChosen(chosenFile);
myCommonOptionsForm.setWorkingDirectory(chosenFile.getParent().getPath());
}
};
myScriptTextField.addActionListener(listener);
setAnchor(myCommonOptionsForm.getAnchor());
}
示例3: LocalAndServerPathsForm
import com.intellij.openapi.ui.ComponentWithBrowseButton; //导入方法依赖的package包/类
public LocalAndServerPathsForm() {
Disposer.register(this, myServerPathForm);
myServerPathForm.addListener(new TfsTreeForm.SelectionListener() {
@Override
public void selectionChanged() {
myEventDispatcher.getMulticaster().stateChanged(new ChangeEvent(this));
}
});
myLocalPathLabel.setLabelFor(myLocalPathField.getChildComponent());
myLocalPathField.getChildComponent().getDocument().addDocumentListener(new DocumentAdapter() {
protected void textChanged(final DocumentEvent e) {
myEventDispatcher.getMulticaster().stateChanged(new ChangeEvent(this));
}
});
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
ComponentWithBrowseButton.BrowseFolderActionListener<JTextField> listener =
new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(TFSBundle.message("choose.local.path.title"),
TFSBundle.message("choose.local.path.description"),
myLocalPathField, null, descriptor,
TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
myServerPathLabel.setLabelFor(myServerPathForm.getPreferredFocusedComponent());
myLocalPathField.addActionListener(listener);
myMessageLabel.setIcon(UIUtil.getBalloonWarningIcon());
}
示例4: addSourcePath
import com.intellij.openapi.ui.ComponentWithBrowseButton; //导入方法依赖的package包/类
private void addSourcePath(SettingsStep settingsStep) {
Project project = settingsStep.getContext().getProject();
ComponentWithBrowseButton.BrowseFolderActionListener<JTextField> listener =
new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
IdeBundle.message("prompt.select.source.directory"), null, mySourcePath, project, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT)
{
@Override
protected void onFileChoosen(VirtualFile chosenFile) {
String contentEntryPath = myModuleBuilder.getContentEntryPath();
String path = chosenFile.getPath();
if (contentEntryPath != null) {
int i = StringUtil.commonPrefixLength(contentEntryPath, path);
mySourcePath.setText(path.substring(i));
}
else {
mySourcePath.setText(path);
}
}
};
mySourcePath.addBrowseFolderListener(project, listener);
myCreateSourceRoot.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mySourcePath.setEnabled(myCreateSourceRoot.isSelected());
}
});
settingsStep.addExpertPanel(myPanel);
}
示例5: LocationNameFieldsBinding
import com.intellij.openapi.ui.ComponentWithBrowseButton; //导入方法依赖的package包/类
public LocationNameFieldsBinding(@Nullable Project project, final TextFieldWithBrowseButton locationTextField,
final JTextField nameTextField, String baseDir, final String browseFolderTitle) {
myBaseDir = baseDir;
File suggestedProjectDirectory = FileUtil.findSequentNonexistentFile(new File(baseDir), "untitled", "");
locationTextField.setText(suggestedProjectDirectory.toString());
nameTextField.setDocument(new NameFieldDocument(nameTextField, locationTextField));
mySuggestedProjectName = suggestedProjectDirectory.getName();
nameTextField.setText(mySuggestedProjectName);
nameTextField.selectAll();
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
ComponentWithBrowseButton.BrowseFolderActionListener<JTextField> listener =
new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(browseFolderTitle, "", locationTextField,
project,
descriptor,
TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
protected void onFileChoosen(VirtualFile chosenFile) {
myBaseDir = chosenFile.getPath();
if (isProjectNameChanged(nameTextField.getText()) && !nameTextField.getText().equals(chosenFile.getName())) {
myExternalModify = true;
locationTextField.setText(new File(chosenFile.getPath(), nameTextField.getText()).toString());
myExternalModify = false;
}
else {
myExternalModify = true;
locationTextField.setText(chosenFile.getPath());
nameTextField.setText(chosenFile.getName());
myExternalModify = false;
}
}
};
locationTextField.addActionListener(listener);
locationTextField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
if (myExternalModify) {
return;
}
myModifyingLocation = true;
String path = locationTextField.getText().trim();
if (path.endsWith(File.separator)) {
path = path.substring(0, path.length() - File.separator.length());
}
int ind = path.lastIndexOf(File.separator);
if (ind != -1) {
String projectName = path.substring(ind + 1, path.length());
if (!nameTextField.getText().trim().isEmpty()) {
myBaseDir = path.substring(0, ind);
}
if (!projectName.equals(nameTextField.getText())) {
if (!myModifyingProjectName) {
nameTextField.setText(projectName);
}
}
}
myModifyingLocation = false;
}
});
}