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


Java ProjectBundle类代码示例

本文整理汇总了Java中com.intellij.openapi.project.ProjectBundle的典型用法代码示例。如果您正苦于以下问题:Java ProjectBundle类的具体用法?Java ProjectBundle怎么用?Java ProjectBundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProjectBundle类属于com.intellij.openapi.project包,在下文中一共展示了ProjectBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkSourceRootsConfigured

import com.intellij.openapi.project.ProjectBundle; //导入依赖的package包/类
public static boolean checkSourceRootsConfigured(final Module module, final boolean askUserToSetupSourceRoots) {
  List<VirtualFile> sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots(JavaModuleSourceRootTypes.SOURCES);
  if (sourceRoots.isEmpty()) {
    if (!askUserToSetupSourceRoots) {
      return false;
    }

    Project project = module.getProject();
    Messages.showErrorDialog(project,
                             ProjectBundle.message("module.source.roots.not.configured.error", module.getName()),
                             ProjectBundle.message("module.source.roots.not.configured.title"));

    ProjectSettingsService.getInstance(project).showModuleConfigurationDialog(module.getName(), CommonContentEntriesEditor.NAME);

    sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots(JavaModuleSourceRootTypes.SOURCES);
    if (sourceRoots.isEmpty()) {
      return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:PackageUtil.java

示例2: checkModulesNames

import com.intellij.openapi.project.ProjectBundle; //导入依赖的package包/类
public void checkModulesNames(ProjectStructureProblemsHolder problemsHolder) {
  final ModifiableModuleModel moduleModel = myContext.getModulesConfigurator().getModuleModel();
  final Module[] all = moduleModel.getModules();
  if (!ArrayUtil.contains(myModule, all)) {
    return;//module has been deleted
  }

  for (Module each : all) {
    if (each != myModule && myContext.getRealName(each).equals(myContext.getRealName(myModule))) {
      problemsHolder.registerProblem(ProjectBundle.message("project.roots.module.duplicate.name.message"), null,
                                     ProjectStructureProblemType.error("duplicate-module-name"), createPlace(),
                                     null);
      break;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ModuleProjectStructureElement.java

示例3: showDialogAndAddLibraryToDependencies

import com.intellij.openapi.project.ProjectBundle; //导入依赖的package包/类
public static void showDialogAndAddLibraryToDependencies(final Library library, final Project project, boolean allowEmptySelection) {
  for (ProjectStructureValidator validator : EP_NAME.getExtensions()) {
    if (validator.addLibraryToDependencies(library, project, allowEmptySelection)) {
      return;
    }
  }

  final ModuleStructureConfigurable moduleStructureConfigurable = ModuleStructureConfigurable.getInstance(project);
  final List<Module> modules =
    LibraryEditingUtil.getSuitableModules(moduleStructureConfigurable, ((LibraryEx)library).getKind(), library);
  if (modules.isEmpty()) return;
  final ChooseModulesDialog
    dlg = new ChooseModulesDialog(moduleStructureConfigurable.getProject(), modules, ProjectBundle.message("choose.modules.dialog.title"),
                                  ProjectBundle
                                    .message("choose.modules.dialog.description", library.getName()));
  if (dlg.showAndGet()) {
    final List<Module> chosenModules = dlg.getChosenElements();
    for (Module module : chosenModules) {
      moduleStructureConfigurable.addLibraryOrderEntry(module, library);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ProjectStructureValidator.java

示例4: getHomeChooserDescriptor

import com.intellij.openapi.project.ProjectBundle; //导入依赖的package包/类
public FileChooserDescriptor getHomeChooserDescriptor() {
  final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false) {
    @Override
    public void validateSelectedFiles(VirtualFile[] files) throws Exception {
      if (files.length != 0){
        final String selectedPath = files[0].getPath();
        boolean valid = isValidSdkHome(selectedPath);
        if (!valid){
          valid = isValidSdkHome(adjustSelectedSdkHome(selectedPath));
          if (!valid) {
            String message = files[0].isDirectory()
                             ? ProjectBundle.message("sdk.configure.home.invalid.error", getPresentableName())
                             : ProjectBundle.message("sdk.configure.home.file.invalid.error", getPresentableName());
            throw new Exception(message);
          }
        }
      }
    }
  };
  descriptor.setTitle(ProjectBundle.message("sdk.configure.home.title", getPresentableName()));
  return descriptor;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SdkType.java

示例5: createCompositeDescriptor

import com.intellij.openapi.project.ProjectBundle; //导入依赖的package包/类
private static FileChooserDescriptor createCompositeDescriptor(final SdkType... sdkTypes) {
  return new FileChooserDescriptor(sdkTypes[0].getHomeChooserDescriptor()) {
    @Override
    public void validateSelectedFiles(final VirtualFile[] files) throws Exception {
      if (files.length > 0) {
        for (SdkType type : sdkTypes) {
          if (type.isValidSdkHome(files[0].getPath())) {
            return;
          }
        }
      }
      String key = files.length > 0 && files[0].isDirectory() ? "sdk.configure.home.invalid.error" : "sdk.configure.home.file.invalid.error";
      throw new Exception(ProjectBundle.message(key, sdkTypes[0].getPresentableName()));
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:SdkConfigurationUtil.java

示例6: createAddAction

import com.intellij.openapi.project.ProjectBundle; //导入依赖的package包/类
@Override
public AbstractAddGroup createAddAction() {
  return new AbstractAddGroup(ProjectBundle.message("add.new.jdk.text")) {
    @NotNull
    @Override
    public AnAction[] getChildren(@Nullable final AnActionEvent e) {
      DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.new.jdk.text"), true);
      myJdksTreeModel.createAddActions(group, myTree, new Consumer<Sdk>() {
        @Override
        public void consume(final Sdk projectJdk) {
          addJdkNode(projectJdk, true);
        }
      });
      return group.getChildren(null);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JdkListConfigurable.java

示例7: validateAndApply

import com.intellij.openapi.project.ProjectBundle; //导入依赖的package包/类
protected boolean validateAndApply() {
  String newName = myNameField.getText().trim();
  if (newName.length() == 0) {
    newName = null;
  }
  if (shouldCheckName(newName)) {
    final LibraryTable.ModifiableModel tableModifiableModel = getTableModifiableModel();
    if (tableModifiableModel != null && !(tableModifiableModel instanceof ModuleLibraryTable)) {
      if (newName == null) {
        Messages.showErrorDialog(ProjectBundle.message("library.name.not.specified.error", newName), ProjectBundle.message("library.name.not.specified.title"));
        return false;
      }
      if (LibraryEditingUtil.libraryAlreadyExists(tableModifiableModel, newName)) {
        Messages.showErrorDialog(ProjectBundle.message("library.name.already.exists.error", newName), ProjectBundle.message("library.name.already.exists.title"));
        return false;
      }
    }
    myLibraryRootsComponent.renameLibrary(newName);
  }
  myLibraryRootsComponent.applyProperties();
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:LibraryEditorDialogBase.java

示例8: createHeader

import com.intellij.openapi.project.ProjectBundle; //导入依赖的package包/类
private JComponent createHeader() {
  final JPanel panel = new JPanel(new GridBagLayout());
  final JLabel headerLabel = new JLabel(toDisplayPath(getContentEntry().getUrl()));
  headerLabel.setFont(headerLabel.getFont().deriveFont(Font.BOLD));
  headerLabel.setOpaque(false);
  if (getContentEntry().getFile() == null) {
    headerLabel.setForeground(JBColor.RED);
  }
  final IconActionComponent deleteIconComponent = new IconActionComponent(AllIcons.Modules.DeleteContentRoot,
                                                                          AllIcons.Modules.DeleteContentRootRollover,
                                                                          ProjectBundle.message("module.paths.remove.content.tooltip"), new Runnable() {
    @Override
    public void run() {
      myCallback.deleteContentEntry();
    }
  });
  final ResizingWrapper wrapper = new ResizingWrapper(headerLabel);
  panel.add(wrapper, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 0, 0), 0, 0));
  panel.add(deleteIconComponent, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 2), 0, 0));
  FilePathClipper.install(headerLabel, wrapper);
  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ContentRootPanel.java

示例9: ExtractArtifactDialog

import com.intellij.openapi.project.ProjectBundle; //导入依赖的package包/类
public ExtractArtifactDialog(ArtifactEditorContext context, LayoutTreeComponent treeComponent, String initialName) {
  super(treeComponent.getLayoutTree(), true);
  myContext = context;
  setTitle(ProjectBundle.message("dialog.title.extract.artifact"));
  for (ArtifactType type : ArtifactType.getAllTypes()) {
    myTypeBox.addItem(type);
  }
  myTypeBox.setSelectedItem(PlainArtifactType.getInstance());
  myTypeBox.setRenderer(new ArtifactTypeCellRenderer(myTypeBox.getRenderer()));
  myNameField.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      setOKActionEnabled(!StringUtil.isEmptyOrSpaces(getArtifactName()));
    }
  });
  myNameField.setText(initialName);
  init();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ExtractArtifactDialog.java

示例10: loadModuleInternal

import com.intellij.openapi.project.ProjectBundle; //导入依赖的package包/类
@NotNull
private Module loadModuleInternal(@NotNull String filePath) throws ModuleWithNameAlreadyExists, IOException {
  filePath = resolveShortWindowsName(filePath);
  final VirtualFile moduleFile = StandardFileSystems.local().findFileByPath(filePath);
  if (moduleFile == null || !moduleFile.exists()) {
    throw new FileNotFoundException(ProjectBundle.message("module.file.does.not.exist.error", filePath));
  }

  String path = moduleFile.getPath();
  ModuleEx module = getModuleByFilePath(path);
  if (module == null) {
    ApplicationManager.getApplication().invokeAndWait(new Runnable() {
      @Override
      public void run() {
        moduleFile.refresh(false, false);
      }
    }, ModalityState.any());
    module = createAndLoadModule(path);
    initModule(module, path, null);
  }
  return module;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ModuleManagerImpl.java

示例11: ClasspathFormatPanel

import com.intellij.openapi.project.ProjectBundle; //导入依赖的package包/类
private ClasspathFormatPanel(@NotNull ClasspathStorageProvider[] providers) {
  super(new GridBagLayout());

  add(new JLabel(ProjectBundle.message("project.roots.classpath.format.label")),
      new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 6, 6, 0), 0, 0));

  formatIdToDescription.put(ClassPathStorageUtil.DEFAULT_STORAGE, ProjectBundle.message("project.roots.classpath.format.default.descr"));
  for (ClasspathStorageProvider provider : providers) {
    formatIdToDescription.put(provider.getID(), provider.getDescription());
  }

  comboBoxClasspathFormat = new ComboBox(formatIdToDescription.values().toArray());
  updateClasspathFormat();
  add(comboBoxClasspathFormat,
      new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 0), 0, 0));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ClasspathEditor.java

示例12: createUIComponents

import com.intellij.openapi.project.ProjectBundle; //导入依赖的package包/类
private void createUIComponents() {
  myLanguageLevelCombo = new LanguageLevelCombo(JavaCoreBundle.message("default.language.level.description")) {
    @Override
    protected LanguageLevel getDefaultLevel() {
      Sdk sdk = myProjectJdkConfigurable.getSelectedProjectJdk();
      if (sdk == null) return null;
      JavaSdkVersion version = JavaSdk.getInstance().getVersion(sdk);
      return version == null ? null : version.getMaxLanguageLevel();
    }
  };
  final JTextField textField = new JTextField();
  final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
  outputPathsChooserDescriptor.setHideIgnored(false);
  BrowseFilesListener listener = new BrowseFilesListener(textField, "", ProjectBundle.message("project.compiler.output"), outputPathsChooserDescriptor);
  myProjectCompilerOutput = new FieldPanel(textField, null, null, listener, EmptyRunnable.getInstance());
  FileChooserFactory.getInstance().installFileCompletion(myProjectCompilerOutput.getTextField(), outputPathsChooserDescriptor, true, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ProjectConfigurable.java

示例13: getTooltipText

import com.intellij.openapi.project.ProjectBundle; //导入依赖的package包/类
@Override
public String getTooltipText() {
  if (myEntry == null) return null;

  final Library library = myEntry.getLibrary();
  if (library == null) return null;

  final String name = library.getName();
  if (name != null) {
    final List<String> invalidUrls = ((LibraryEx)library).getInvalidRootUrls(OrderRootType.CLASSES);
    if (!invalidUrls.isEmpty()) {
      return ProjectBundle.message("project.roots.tooltip.library.has.broken.paths", name, invalidUrls.size());
    }
  }

  final List<String> descriptions = LibraryPresentationManager.getInstance().getDescriptions(library, myContext);
  if (descriptions.isEmpty()) return null;

  return XmlStringUtil.wrapInHtml(StringUtil.join(descriptions, "<br>"));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LibraryItem.java

示例14: doOKAction

import com.intellij.openapi.project.ProjectBundle; //导入依赖的package包/类
protected void doOKAction() {
  if (myAddSupportPanel.hasSelectedFrameworks()) {
    if (!myAddSupportPanel.downloadLibraries()) {
      int answer = Messages.showYesNoDialog(myAddSupportPanel.getMainPanel(),
                                            ProjectBundle.message("warning.message.some.required.libraries.wasn.t.downloaded"),
                                            CommonBundle.getWarningTitle(), Messages.getWarningIcon());
      if (answer != Messages.YES) {
        return;
      }
    }

    DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
      @Override
      public void run() {
        new WriteAction() {
          protected void run(@NotNull final Result result) {
            ModifiableRootModel model = ModuleRootManager.getInstance(myModule).getModifiableModel();
            myAddSupportPanel.addSupport(myModule, model);
            model.commit();
          }
        }.execute();
      }
    });
  }
  super.doOKAction();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AddFrameworkSupportDialog.java

示例15: setupRootAndAnnotateExternally

import com.intellij.openapi.project.ProjectBundle; //导入依赖的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


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