本文整理匯總了Java中com.intellij.openapi.fileChooser.FileChooserDescriptor.setShowFileSystemRoots方法的典型用法代碼示例。如果您正苦於以下問題:Java FileChooserDescriptor.setShowFileSystemRoots方法的具體用法?Java FileChooserDescriptor.setShowFileSystemRoots怎麽用?Java FileChooserDescriptor.setShowFileSystemRoots使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.fileChooser.FileChooserDescriptor
的用法示例。
在下文中一共展示了FileChooserDescriptor.setShowFileSystemRoots方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDirectory
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
public static PsiDirectory createDirectory(Project project, String title, String description) {
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
descriptor.setTitle(title);
descriptor.setShowFileSystemRoots(false);
descriptor.setDescription(description);
descriptor.setHideIgnored(true);
descriptor.setRoots(project.getBaseDir());
descriptor.setForcedToUseIdeaFileChooser(true);
VirtualFile file = FileChooser.chooseFile(descriptor, project, project.getBaseDir());
if(Objects.isNull(file)){
Messages.showInfoMessage("Cancel " + title, "Error");
return null;
}
PsiDirectory psiDirectory = PsiDirectoryFactory.getInstance(project).createDirectory(file);
if(PsiDirectoryFactory.getInstance(project).isPackage(psiDirectory)){
return psiDirectory;
}else {
Messages.showInfoMessage("請選擇正確的 package 路徑。", "Error");
return createDirectory(project, title, description);
}
}
示例2: TemplateLanguagePanel
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
public TemplateLanguagePanel() {
super(new BorderLayout());
add(myMainPanel, BorderLayout.CENTER);
myTemplatesFolderLabel.setLabelFor(myTemplatesFolder);
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
descriptor.withTreeRootVisible(true);
descriptor.setShowFileSystemRoots(true);
List<String> templateConfigurations = TemplatesService.getAllTemplateLanguages();
for (String configuration : templateConfigurations) {
if (!configuration.equals(TemplatesService.WEB2PY)) {
myTemplateLanguage.addItem(configuration);
}
}
myTemplatesFolder.setText(DEFAULT_TEMPLATES_FOLDER);
myTemplatesFolder.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
final int dot = myTemplatesFolder.getCaret().getDot();
final int index = myTemplatesFolder.getText().indexOf(File.separator);
if (index >= dot) {
myTemplateFolderModified = true;
}
}
});
}
示例3: actionPerformed
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
@Override
public void actionPerformed(final AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
if (project == null) {
project = ProjectManager.getInstance().getDefaultProject();
}
FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
fcd.setShowFileSystemRoots(true);
fcd.setTitle(GitBundle.getString("init.destination.directory.title"));
fcd.setDescription(GitBundle.getString("init.destination.directory.description"));
fcd.setHideIgnored(false);
VirtualFile baseDir = e.getData(CommonDataKeys.VIRTUAL_FILE);
if (baseDir == null) {
baseDir = project.getBaseDir();
}
doInit(project, fcd, baseDir, baseDir);
}
示例4: selectFile
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
@Nullable
private File selectFile(String title, String description) {
FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
fcd.setShowFileSystemRoots(true);
fcd.setTitle(title);
fcd.setDescription(description);
fcd.setHideIgnored(false);
VirtualFile file = FileChooser.chooseFile(fcd, myProject, null);
if (file == null) {
return null;
}
final String path = file.getPath();
if (path.endsWith(":")) { // workaround for VFS oddities with drive root (IDEADEV-20870)
return new File(path + "/");
}
return new File(path);
}
示例5: chooseFolder
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
public static VirtualFile chooseFolder(@Nullable Project project, String title, String description, boolean showFileSystemRoots, boolean hideIgnored, @Nullable VirtualFile toSelect){
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
descriptor.setTitle(title);
descriptor.setDescription(description);
descriptor.setShowFileSystemRoots(showFileSystemRoots);
descriptor.setHideIgnored(hideIgnored);
return FileChooser.chooseFile(descriptor, project, toSelect);
}
示例6: chooseFile
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
public static VirtualFile chooseFile(@Nullable Project project, String title, String description, boolean showFileSystemRoots, boolean hideIgnored, @Nullable VirtualFile toSelect){
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileDescriptor();
descriptor.setTitle(title);
descriptor.setDescription(description);
descriptor.setShowFileSystemRoots(showFileSystemRoots);
descriptor.setHideIgnored(hideIgnored);
return FileChooser.chooseFile(descriptor, project, toSelect);
}
示例7: selectFile
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
@Nullable
private File selectFile(String title, String description) {
FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor();
fcd.setShowFileSystemRoots(true);
fcd.setTitle(title);
fcd.setDescription(description);
fcd.setHideIgnored(false);
VirtualFile file = FileChooser.chooseFile(fcd, myBrowser, myProject, null);
if (file == null) {
return null;
}
return new File(file.getPath());
}
示例8: actionPerformed
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
public void actionPerformed(ActionEvent e) {
// choose directory here/
FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
fcd.setShowFileSystemRoots(true);
fcd.setTitle("Checkout Directory");
fcd.setDescription("Select directory to checkout from subversion");
fcd.setHideIgnored(false);
VirtualFile file = FileChooser.chooseFile(fcd, getContentPane(), myProject, null);
if (file == null) {
return;
}
myPathField.setText(file.getPath().replace('/', File.separatorChar));
}
示例9: actionPerformed
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
public void actionPerformed(ActionEvent e) {
// choose directory here/
FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
fcd.setShowFileSystemRoots(true);
fcd.setTitle("Export Directory");
fcd.setDescription("Select directory to export from subversion");
fcd.setHideIgnored(false);
VirtualFile file = FileChooser.chooseFile(fcd, getContentPane(), myProject, null);
if (file == null) {
return;
}
myPathField.setText(file.getPath().replace('/', File.separatorChar));
}