当前位置: 首页>>代码示例>>Java>>正文


Java FileChooserDescriptor.setTitle方法代码示例

本文整理汇总了Java中com.intellij.openapi.fileChooser.FileChooserDescriptor.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java FileChooserDescriptor.setTitle方法的具体用法?Java FileChooserDescriptor.setTitle怎么用?Java FileChooserDescriptor.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.fileChooser.FileChooserDescriptor的用法示例。


在下文中一共展示了FileChooserDescriptor.setTitle方法的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: addSourcePath

import com.intellij.openapi.fileChooser.FileChooserDescriptor; //导入方法依赖的package包/类
private void addSourcePath(SettingsStep settingsStep) {
  Project project = settingsStep.getContext().getProject();
  FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  descriptor.setTitle(IdeBundle.message("prompt.select.source.directory"));
  mySourcePath.addBrowseFolderListener(new TextBrowseFolderListener(descriptor, project) {
    @NotNull
    @Override
    protected String chosenFileToResultingText(@NotNull VirtualFile chosenFile) {
      String contentEntryPath = myModuleBuilder.getContentEntryPath();
      String path = chosenFile.getPath();
      return contentEntryPath == null ? path : path.substring(StringUtil.commonPrefixLength(contentEntryPath, path));
    }
  });
  myCreateSourceRoot.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      mySourcePath.setEnabled(myCreateSourceRoot.isSelected());
    }
  });
  settingsStep.addExpertPanel(myPanel);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:JavaSettingsStep.java

示例4: 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

示例5: createLibraryFromFiles

import com.intellij.openapi.fileChooser.FileChooserDescriptor; //导入方法依赖的package包/类
@Override
public NewLibraryConfiguration createLibraryFromFiles(@NotNull LibraryRootsComponentDescriptor descriptor,
                                                      @NotNull JComponent parentComponent,
                                                      @Nullable VirtualFile contextDirectory,
                                                      LibraryType<?> type,
                                                      final Project project) {
  final FileChooserDescriptor chooserDescriptor = descriptor.createAttachFilesChooserDescriptor(null);
  chooserDescriptor.setTitle("Select Library Files");
  final VirtualFile[] rootCandidates = FileChooser.chooseFiles(chooserDescriptor, parentComponent, project, contextDirectory);
  if (rootCandidates.length == 0) {
    return null;
  }

  final List<OrderRoot> roots = RootDetectionUtil.detectRoots(Arrays.asList(rootCandidates), parentComponent, project, descriptor);
  if (roots.isEmpty()) return null;
  String name = suggestLibraryName(roots);
  return doCreate(type, name, roots);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:LibraryTypeServiceImpl.java

示例6: 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

示例7: createSingleFolderDescriptor

import com.intellij.openapi.fileChooser.FileChooserDescriptor; //导入方法依赖的package包/类
@NotNull
private static FileChooserDescriptor createSingleFolderDescriptor(@NotNull String title, @NotNull final Function<File, Void> validation) {
  final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false) {
    @Override
    public void validateSelectedFiles(VirtualFile[] files) throws Exception {
      for (VirtualFile virtualFile : files) {
        File file = virtualToIoFile(virtualFile);
        validation.fun(file);
      }
    }
  };
  if (SystemInfo.isMac) {
    descriptor.withShowHiddenFiles(true);
  }
  descriptor.setTitle(title);
  return descriptor;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DefaultSdksConfigurable.java

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: configureNdkTextField

import com.intellij.openapi.fileChooser.FileChooserDescriptor; //导入方法依赖的package包/类
private void configureNdkTextField() {
  myNdkTextFieldWithButton.setTextFieldPreferredWidth(50);

  FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false) {
    @Override
    public void validateSelectedFiles(VirtualFile[] files) throws Exception {
      for (VirtualFile virtualFile : files) {
        File file = virtualToIoFile(virtualFile);
        ValidationResult validationResult = validateAndroidNdk(file, false);
        if (!validationResult.success) {
          String msg = validationResult.message;
          if (isEmpty(msg)) {
            msg = "Please choose a valid Android NDK directory.";
          }
          throw new IllegalArgumentException(msg);
        }
      }
    }
  };

  if (SystemInfo.isMac) {
    descriptor.withShowHiddenFiles(true);
  }
  descriptor.setTitle("Choose Android NDK Location");

  myNdkTextFieldWithButton.addBrowseFolderListener(null, new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
    "Select Android NDK Home", null, myNdkTextFieldWithButton, null, descriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:SelectNdkDialog.java


注:本文中的com.intellij.openapi.fileChooser.FileChooserDescriptor.setTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。