當前位置: 首頁>>代碼示例>>Java>>正文


Java FileChooserDescriptor.setDescription方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:hykes,項目名稱:CodeGen,代碼行數:23,代碼來源:PsiUtil.java

示例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());
}
 
開發者ID:machaval,項目名稱:mule-intellij-plugins,代碼行數:22,代碼來源:MuleUIUtils.java

示例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();
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:StartBrowserPanel.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:AndroidImportProjectAction.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:ImportSourceLocationStep.java

示例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);
}
 
開發者ID:hykes,項目名稱:CodeGen,代碼行數:9,代碼來源:PsiUtil.java

示例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);
}
 
開發者ID:hykes,項目名稱:CodeGen,代碼行數:9,代碼來源:PsiUtil.java

示例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"));
    }
}
 
開發者ID:kaygisiz,項目名稱:Dependency-Injection-Graph,代碼行數:9,代碼來源:FileChooserDialogManager.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:39,代碼來源:ExternalAnnotationsManagerImpl.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:DefaultLibraryRootsComponentDescriptor.java

示例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);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:33,代碼來源:LibraryRootsComponent.java

示例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));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:ImportModuleAction.java

示例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));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:ExportOptionsDialog.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:VcsProjectSetProcessor.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:LibraryRootsComponentDescriptor.java


注:本文中的com.intellij.openapi.fileChooser.FileChooserDescriptor.setDescription方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。