本文整理匯總了Java中com.intellij.openapi.fileChooser.FileChooserDescriptor.setDescription方法的典型用法代碼示例。如果您正苦於以下問題:Java FileChooserDescriptor.setDescription方法的具體用法?Java FileChooserDescriptor.setDescription怎麽用?Java FileChooserDescriptor.setDescription使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.fileChooser.FileChooserDescriptor
的用法示例。
在下文中一共展示了FileChooserDescriptor.setDescription方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: selectSdk
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
@Nullable public static MuleSdk selectSdk(@NotNull JComponent parentComponent)
{
final VirtualFile initial = findFile(System.getenv("MULE_HOME"));
final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false)
{
@Override
public boolean isFileSelectable(VirtualFile file)
{
return super.isFileSelectable(file) && MuleSdk.isValidMuleHome(file.getCanonicalPath());
}
};
descriptor.setTitle("Mule SDK");
descriptor.setDescription("Choose a directory containing Mule distribution");
final VirtualFile dir = FileChooser.chooseFile(descriptor, parentComponent, null, initial);
if (dir == null || !MuleSdk.isValidMuleHome(dir.getCanonicalPath()))
{
return null;
}
return new MuleSdk(dir.getCanonicalPath());
}
示例3: setupUrlField
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
public static void setupUrlField(@NotNull TextFieldWithBrowseButton field, @NotNull final Project project) {
FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
@Override
public boolean isFileSelectable(VirtualFile file) {
return HtmlUtil.isHtmlFile(file) || virtualFileToUrl(file, project) != null;
}
};
descriptor.setTitle(XmlBundle.message("javascript.debugger.settings.choose.file.title"));
descriptor.setDescription(XmlBundle.message("javascript.debugger.settings.choose.file.subtitle"));
descriptor.setRoots(ProjectRootManager.getInstance(project).getContentRoots());
field.addBrowseFolderListener(new TextBrowseFolderListener(descriptor, project) {
@NotNull
@Override
protected String chosenFileToResultingText(@NotNull VirtualFile chosenFile) {
if (chosenFile.isDirectory()) {
return chosenFile.getPath();
}
Url url = virtualFileToUrl(chosenFile, project);
return url == null ? chosenFile.getUrl() : url.toDecodedForm();
}
});
}
示例4: createFileChooserDescriptor
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
@NotNull
protected FileChooserDescriptor createFileChooserDescriptor() {
FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, true, true, false, false) {
FileChooserDescriptor myDelegate = new OpenProjectFileChooserDescriptor(true);
@Override
public Icon getIcon(VirtualFile file) {
Icon icon = myDelegate.getIcon(file);
return icon == null ? super.getIcon(file) : icon;
}
};
descriptor.setHideIgnored(false);
descriptor.setTitle(WIZARD_TITLE);
descriptor.setDescription(WIZARD_DESCRIPTION);
return descriptor;
}
示例5: setupSourceLocationControls
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
private void setupSourceLocationControls(@Nullable VirtualFile importSource) {
if (importSource == null) {
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor();
descriptor.setTitle("Select Source Location");
descriptor.setDescription("Select existing ADT or Gradle project to import as a new subproject");
mySourceLocation.addBrowseFolderListener(new TextBrowseFolderListener(descriptor));
mySourceLocation.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
invalidate();
}
});
}
else {
mySourceLocation.setVisible(false);
myLocationLabel.setVisible(false);
mySourceLocation.setText(importSource.getPath());
}
applyBackgroundOperationResult(checkPath(mySourceLocation.getText()));
myErrorWarning.setIcon(null);
myErrorWarning.setText(null);
}
示例6: 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);
}
示例7: 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);
}
示例8: initFileChooserDescriptor
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
private void initFileChooserDescriptor(String title, String description, String filterExtension) {
fileChooserDescriptor = new FileChooserDescriptor(isFile, isFolder, isJar, isJarAsFile, isJarContent, isMultiple);
fileChooserDescriptor.setTitle(title);
fileChooserDescriptor.setDescription(description);
if (!TextUtils.isEmpty(filterExtension)) {
fileChooserDescriptor.withFileFilter(virtualFile -> Objects.equals(virtualFile.getExtension(), "apk"));
}
}
示例9: setupRootAndAnnotateExternally
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
private void setupRootAndAnnotateExternally(@NotNull final OrderEntry entry,
@NotNull final Project project,
@NotNull final PsiModifierListOwner listOwner,
@NotNull final String annotationFQName,
@NotNull final PsiFile fromFile,
@NotNull final String packageName,
@Nullable final PsiNameValuePair[] value) {
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
descriptor.setTitle(ProjectBundle.message("external.annotations.root.chooser.title", entry.getPresentableName()));
descriptor.setDescription(ProjectBundle.message("external.annotations.root.chooser.description"));
final VirtualFile newRoot = FileChooser.chooseFile(descriptor, project, null);
if (newRoot == null) {
notifyAfterAnnotationChanging(listOwner, annotationFQName, false);
return;
}
new WriteCommandAction(project) {
@Override
protected void run(@NotNull final Result result) throws Throwable {
appendChosenAnnotationsRoot(entry, newRoot);
XmlFile xmlFileInRoot = findXmlFileInRoot(findExternalAnnotationsXmlFiles(listOwner), newRoot);
if (xmlFileInRoot != null) { //file already exists under appeared content root
if (!FileModificationService.getInstance().preparePsiElementForWrite(xmlFileInRoot)) {
notifyAfterAnnotationChanging(listOwner, annotationFQName, false);
return;
}
annotateExternally(listOwner, annotationFQName, xmlFileInRoot, fromFile, value);
}
else {
final XmlFile annotationsXml = createAnnotationsXml(newRoot, packageName);
if (annotationsXml != null) {
List<PsiFile> createdFiles = new SmartList<PsiFile>(annotationsXml);
cacheExternalAnnotations(packageName, fromFile, createdFiles);
}
annotateExternally(listOwner, annotationFQName, annotationsXml, fromFile, value);
}
}
}.execute();
}
示例10: createAttachFilesChooserDescriptor
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
@NotNull
@Override
public FileChooserDescriptor createAttachFilesChooserDescriptor(@Nullable String libraryName) {
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, true, false, true, true).withFileFilter(LIBRARY_ROOT_CONDITION);
descriptor.setTitle(StringUtil.isEmpty(libraryName) ? ProjectBundle.message("library.attach.files.action")
: ProjectBundle.message("library.attach.files.to.library.action", libraryName));
descriptor.setDescription(ProjectBundle.message("library.java.attach.files.description"));
return descriptor;
}
示例11: actionPerformed
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createMultipleJavaPathDescriptor();
descriptor.setTitle("Exclude from Library");
descriptor.setDescription("Select directories which should be excluded from the library content. Content of excluded directories won't be processed by IDE.");
Set<VirtualFile> roots = getNotExcludedRoots();
descriptor.setRoots(roots.toArray(new VirtualFile[roots.size()]));
if (roots.size() < 2) {
descriptor.withTreeRootVisible(true);
}
VirtualFile toSelect = null;
for (Object o : getSelectedElements()) {
Object itemElement = o instanceof ExcludedRootElement ? ((ExcludedRootElement)o).getParentDescriptor() : o;
if (itemElement instanceof ItemElement) {
toSelect = VirtualFileManager.getInstance().findFileByUrl(((ItemElement)itemElement).getUrl());
break;
}
}
final VirtualFile[] files = FileChooser.chooseFiles(descriptor, myPanel, myProject, toSelect);
if (files.length > 0) {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
for (VirtualFile file : files) {
getLibraryEditor().addExcludedRoot(file.getUrl());
}
}
});
myLastChosen = files[0];
libraryChanged(true);
}
}
示例12: selectFileAndCreateWizard
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
@Nullable
public static AddModuleWizard selectFileAndCreateWizard(@Nullable Project project, @Nullable Component dialogParent) {
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
descriptor.setHideIgnored(false);
descriptor.setTitle("Select File or Directory to Import");
List<ProjectImportProvider> providers = getProviders(project);
String description = getFileChooserDescription(providers);
descriptor.setDescription(description);
return selectFileAndCreateWizard(project, dialogParent, descriptor, toObjectArray(providers, ProjectImportProvider.class));
}
示例13: 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));
}
示例14: getDirectory
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
private static boolean getDirectory(@NotNull Context context) {
if (context.directory != null) return true;
FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false);
descriptor.setTitle("Select Destination Folder");
descriptor.setDescription("");
VirtualFile[] files = FileChooser.chooseFiles(descriptor, null, null);
context.directory = files.length == 0 ? null : files[0];
return context.directory != null;
}
示例15: createAttachFilesChooserDescriptor
import com.intellij.openapi.fileChooser.FileChooserDescriptor; //導入方法依賴的package包/類
/**
* @return descriptor for the file chooser which will be shown when 'Attach Files' button is pressed
* @param libraryName
*/
@NotNull
public FileChooserDescriptor createAttachFilesChooserDescriptor(@Nullable String libraryName) {
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createMultipleJavaPathDescriptor();
descriptor.setTitle(StringUtil.isEmpty(libraryName) ? ProjectBundle.message("library.attach.files.action")
: ProjectBundle.message("library.attach.files.to.library.action", libraryName));
descriptor.setDescription(ProjectBundle.message("library.attach.files.description"));
return descriptor;
}