Java 类com.intellij.openapi.components.ServiceManager 实例源码

项目:intellij-spring-assistant    文件:MavenProcessorTask.java   
@Override
public void perform(Project project, MavenEmbeddersManager mavenEmbeddersManager,
    MavenConsole mavenConsole, MavenProgressIndicator mavenProgressIndicator) {
  debug(() -> log.debug(
      "Project imported successfully, will trigger indexing via dumbservice for project "
          + project.getName()));
  DumbService.getInstance(project).smartInvokeLater(() -> {
    log.debug("Will attempt to trigger indexing for project " + project.getName());

    try {
      SuggestionIndexService service =
          ServiceManager.getService(project, SuggestionIndexService.class);

      if (!service.canProvideSuggestions(project, module)) {
        service.reindex(project, module);
      } else {
        debug(() -> log.debug(
            "Index is already built, no point in rebuilding index for project " + project
                .getName()));
      }
    } catch (Throwable e) {
      log.error("Error occurred while indexing project " + project.getName(), e);
    }
  });
}
项目:AppleScript-IDEA    文件:AppleScriptDictionaryResolveProcessor.java   
@NotNull
public List<DictionaryComponent> getFilteredResult() {
  List<DictionaryComponent> result = new ArrayList<>();
  boolean filterStdCocoaTerminologyFlag = false; //if there was at least one dictionary from a real app imported
  AppleScriptProjectDictionaryService dictionaryRegistry = ServiceManager.getService(myProject, AppleScriptProjectDictionaryService.class);
  for (ApplicationDictionary collectedDictionary : collectedDictionaries) {
    collectAllComponentsFromDictionary(collectedDictionary, result, filterStdCocoaTerminologyFlag);//was false??
    filterStdCocoaTerminologyFlag = filterStdCocoaTerminologyFlag 
        || !collectedDictionary.getName().equals(ApplicationDictionary.SCRIPTING_ADDITIONS_LIBRARY);
  }
  if (dictionaryRegistry != null) {
    appendResultsIfNeeded(result, myProject, mySortedUseStatements.size() > 0,
        collectedDictionaries.contains(dictionaryRegistry.getScriptingAdditionsTerminology()), filterStdCocoaTerminologyFlag);
  }
  return result;
}
项目:AppleScript-IDEA    文件:AppleScriptLineMarkerProvider.java   
@Override
protected void collectNavigationMarkers(@NotNull PsiElement element,
                                        @NotNull Collection<? super RelatedItemLineMarkerInfo> result) {
  if (element instanceof AppleScriptApplicationReference) {
    PsiElement leafNode = PsiTreeUtil.firstChild(element);
    if (leafNode == null) return;
    AppleScriptProjectDictionaryService dictionaryService = ServiceManager.getService(element.getProject(),
        AppleScriptProjectDictionaryService.class);
    AppleScriptApplicationReference appRef = (AppleScriptApplicationReference) element;
    String appName = appRef.getApplicationName();
    if (dictionaryService == null || StringUtil.isEmpty(appName)) return;
    ApplicationDictionary dictionary = dictionaryService.getDictionary(appName);
    if (dictionary == null /*|| dictionary.getApplicationBundle() == null*/) return;

    NavigationGutterIconBuilder<PsiElement> builder =
        NavigationGutterIconBuilder.create(dictionary.getIcon(0)).
            setTargets(dictionary).setTooltipText("Navigate to application dictionary file");
    result.add(builder.createLineMarkerInfo(leafNode));

  }
}
项目:AppleScript-IDEA    文件:AppleScriptSystemDictionaryRegistryService.java   
@NotNull
@Override
public List<AppleScriptCommand> findApplicationCommands(@NotNull Project project, @NotNull String applicationName,
                                                        @NotNull String commandName) {
  AppleScriptProjectDictionaryService projectDictionaryRegistry =
      ServiceManager.getService(project, AppleScriptProjectDictionaryService.class);
  ApplicationDictionary dictionary = projectDictionaryRegistry.getDictionary(applicationName);
  //among dictionaries there should always be Standard Additions dictionaries checked BUT
  //if there was no command in that dictionaries found, we should initialize new dictionary here for the project
  //and do it only once!
  if (dictionary == null) {
    dictionary = projectDictionaryRegistry.createDictionary(applicationName);
  }
  if (dictionary != null) {
    return dictionary.findAllCommandsWithName(commandName);
  }
  return new ArrayList<>(0);// TODO: 29/11/15 use predefined empty list here
}
项目:jfrog-idea-plugin    文件:GradleScanManager.java   
@Override
protected void refreshDependencies(ExternalProjectRefreshCallback cbk, @Nullable Collection<DataNode<LibraryDependencyData>> libraryDependencies) {
    if (libraryDependencies != null) {
        // Change the dependencies only if there are new dependencies
        this.libraryDependencies = libraryDependencies;
        cbk.onSuccess(null);
        return;
    }
    if (this.libraryDependencies != null) {
        cbk.onSuccess(null);
        return;
    }
    ExternalSystemProcessingManager processingManager = ServiceManager.getService(ExternalSystemProcessingManager.class);
    if (processingManager != null && processingManager.findTask(ExternalSystemTaskType.RESOLVE_PROJECT, GradleConstants.SYSTEM_ID, getProjectBasePath(project)) != null) {
        // Another scan in progress
        return;
    }
    ExternalSystemUtil.refreshProject(project, GradleConstants.SYSTEM_ID, getProjectBasePath(project), cbk, false, ProgressExecutionMode.IN_BACKGROUND_ASYNC);
}
项目:jfrog-idea-plugin    文件:RefreshAction.java   
@Override
public void actionPerformed(AnActionEvent e) {
    if (e.getProject() != null) {
        ScanManager scanManager = ScanManagerFactory.getScanManager(e.getProject());
        if (scanManager == null) {
            // Check if the project is supported now
            ScanManagerFactory scanManagerFactory = ServiceManager.getService(e.getProject(), ScanManagerFactory.class);
            scanManagerFactory.initScanManager(e.getProject());
            scanManager = ScanManagerFactory.getScanManager(e.getProject());
            if (scanManager == null) {
                return;
            }
            MessageBus messageBus = ApplicationManager.getApplication().getMessageBus();
            messageBus.syncPublisher(Events.ON_IDEA_FRAMEWORK_CHANGE).update();
        }
        scanManager.asyncScanAndUpdateResults(false);
    }
}
项目:jfrog-idea-plugin    文件:XrayDependencyDataService.java   
/**
 * This function is called after change in the build.gradle file or refresh gradle dependencies call.
 * @param toImport the project dependencies
 * @param projectData the project data
 * @param project the current project
 * @param modelsProvider contains the project modules
 */
@Override
public void importData(@NotNull Collection<DataNode<LibraryDependencyData>> toImport,
                       @Nullable ProjectData projectData,
                       @NotNull Project project,
                       @NotNull IdeModifiableModelsProvider modelsProvider) {
    if (projectData == null || !projectData.getOwner().equals(GradleConstants.SYSTEM_ID)) {
        return;
    }

    ScanManager scanManager = ScanManagerFactory.getScanManager(project);
    if (scanManager == null) {
        ScanManagerFactory scanManagerFactory = ServiceManager.getService(project, ScanManagerFactory.class);
        scanManagerFactory.initScanManager(project);
        scanManager = ScanManagerFactory.getScanManager(project);
        if (scanManager == null) {
            return;
        }
        MessageBus messageBus = ApplicationManager.getApplication().getMessageBus();
        messageBus.syncPublisher(Events.ON_IDEA_FRAMEWORK_CHANGE).update();
    }
    if (GlobalSettings.getInstance().isCredentialsSet()) {
        scanManager.asyncScanAndUpdateResults(true, toImport);
    }
}
项目:hybris-integration-intellij-idea-plugin    文件:DefaultHybrisProjectDescriptor.java   
@NotNull
protected Set<HybrisModuleDescriptor> getAlreadyOpenedModules(@NotNull final Project project) {
    Validate.notNull(project);

    final HybrisModuleDescriptorFactory hybrisModuleDescriptorFactory = ServiceManager.getService(
        HybrisModuleDescriptorFactory.class
    );

    final Set<HybrisModuleDescriptor> existingModules = new THashSet<HybrisModuleDescriptor>();

    for (Module module : ModuleManager.getInstance(project).getModules()) {
        try {
            final VirtualFile[] contentRoots = ModuleRootManager.getInstance(module).getContentRoots();

            if (!ArrayUtils.isEmpty(contentRoots)) {
                existingModules.add(hybrisModuleDescriptorFactory.createDescriptor(
                    VfsUtil.virtualToIoFile(contentRoots[0]), this
                ));
            }
        } catch (HybrisConfigurationException e) {
            LOG.error(e);
        }
    }

    return existingModules;
}
项目:hybris-integration-intellij-idea-plugin    文件:AbstractHybrisModuleDescriptor.java   
@NotNull
@Override
public String getRelativePath() {
    final VirtualFileSystemService virtualFileSystemService = ServiceManager.getService(
        VirtualFileSystemService.class
    );

    final File projectRootDir = this.getRootProjectDescriptor().getRootDirectory();
    final File moduleRootDir = this.getRootDirectory();

    if (null != projectRootDir && virtualFileSystemService.fileContainsAnother(projectRootDir, moduleRootDir)) {
        return virtualFileSystemService.getRelativePath(projectRootDir, moduleRootDir);
    }

    return moduleRootDir.getPath();
}
项目:hybris-integration-intellij-idea-plugin    文件:DefaultHybrisProjectService.java   
@Override
public boolean isOutOfTheBoxModule(@NotNull final File file, final HybrisProjectDescriptor rootProjectDescriptor) {
    Validate.notNull(file);
    final File extDir = rootProjectDescriptor.getExternalExtensionsDirectory();
    if (extDir != null) {
        final VirtualFileSystemService virtualFSService = ServiceManager.getService(
            VirtualFileSystemService.class
        );
        if (virtualFSService.fileContainsAnother(extDir, file)) {
            // this will override bin/ext-* naming convention.
            return false;
        }
        ;
    }
    return file.getAbsolutePath().contains(HybrisConstants.PLATFORM_OOTB_MODULE_PREFIX)
           && new File(file, HybrisConstants.EXTENSION_INFO_XML).isFile();
}
项目:hybris-integration-intellij-idea-plugin    文件:HybrisProjectManagerListener.java   
@Override
public void projectOpened(final Project project) {
    StartupManager.getInstance(project).registerPostStartupActivity((DumbAwareRunnable) () -> {
        if (project.isDisposed()) {
            return;
        }
        if (isOldHybrisProject(project)) {
            showNotification(project);
        }
        if (isDiscountTargetGroup()) {
            showDiscountOffer(project);
        }
        final CommonIdeaService commonIdeaService = ServiceManager.getService(CommonIdeaService.class);
        if (!commonIdeaService.isHybrisProject(project)) {
            return;
        }
        if (popupPermissionToSendStatistics(project)) {
            continueOpening(project);
        }
    });
}
项目:hybris-integration-intellij-idea-plugin    文件:XmlRuleInspection.java   
protected void validateOneRule(
    @NotNull final XmlRule rule,
    @NotNull final ValidateContext context,
    @NotNull final Collection<? super ProblemDescriptor> output
) throws XPathExpressionException {
    final XPathService xPathService = ServiceManager.getService(XPathService.class);

    final NodeList selection = xPathService.computeNodeSet(rule.getSelectionXPath(), context.getDocument());
    for (int i = 0; i < selection.getLength(); i++) {
        final Node nextSelected = selection.item(i);
        boolean passed = xPathService.computeBoolean(rule.getTestXPath(), nextSelected);
        if (rule.isFailOnTestQuery()) {
            passed = !passed;
        }
        if (!passed) {
            output.add(this.createProblem(context, nextSelected, rule));
        }
    }
}
项目:CodeGenerate    文件:GridMain.java   
/**
 * 获取选中的模板列表
 * @return 选中的模板列表
 */
private List<CodeTemplate> getCodeTemplateList (){
    List<CodeTemplate> tmpCodeTemplateList = new ArrayList<CodeTemplate>();
    List<String>  tmpSelectedList =  listClassType.getSelectedValuesList();
    CodeMakerSettings settings = ServiceManager.getService(CodeMakerSettings.class);
    for(String tmp : tmpSelectedList){
        tmpCodeTemplateList.add(settings.getCodeTemplate(tmp));
    }
    return tmpCodeTemplateList;
}
项目:intellij-plugin    文件:SeedStackNavigator.java   
private void initToolWindow() {
    initTree();
    JPanel panel = new SeedStackNavigatorPanel(myProject, tree);

    final ToolWindowManagerEx manager = ToolWindowManagerEx.getInstanceEx(myProject);
    toolWindow = (ToolWindowEx) manager.registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.LEFT, myProject, true);
    toolWindow.setIcon(SeedStackIcons.LOGO);
    final ContentFactory contentFactory = ServiceManager.getService(ContentFactory.class);
    final Content content = contentFactory.createContent(panel, "", false);
    ContentManager contentManager = toolWindow.getContentManager();
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, false);

    final ToolWindowManagerAdapter listener = new ToolWindowManagerAdapter() {
        boolean wasVisible = false;

        @Override
        public void stateChanged() {
            if (toolWindow.isDisposed()) return;
            boolean visible = toolWindow.isVisible();
            if (!visible) {
                return;
            }
            scheduleStructureUpdate(null);
        }
    };
    manager.addToolWindowManagerListener(listener, myProject);

    ActionManager actionManager = ActionManager.getInstance();
    DefaultActionGroup group = new DefaultActionGroup();
    toolWindow.setAdditionalGearActions(group);
}
项目:intellij-spring-assistant    文件:GradleReindexingProjectDataService.java   
@Override
public void onSuccessImport(@NotNull Collection<DataNode<ModuleData>> imported,
    @Nullable ProjectData projectData, @NotNull Project project,
    @NotNull IdeModelsProvider modelsProvider) {
  if (projectData != null) {
    debug(() -> log.debug(
        "Gradle dependencies are updated for project, will trigger indexing via dumbservice for project "
            + project.getName()));
    DumbService.getInstance(project).smartInvokeLater(() -> {
      log.debug("Will attempt to trigger indexing for project " + project.getName());
      SuggestionIndexService service =
          ServiceManager.getService(project, SuggestionIndexService.class);

      try {
        Module[] validModules = stream(modelsProvider.getModules()).filter(module -> {
          String externalRootProjectPath = getExternalRootProjectPath(module);
          return externalRootProjectPath != null && externalRootProjectPath
              .equals(projectData.getLinkedExternalProjectPath());
        }).toArray(Module[]::new);

        if (validModules.length > 0) {
          service.reindex(project, validModules);
        } else {
          debug(() -> log.debug(
              "None of the modules " + moduleNamesAsStrCommaDelimited(modelsProvider.getModules(),
                  true) + " are relevant for indexing, skipping for project " + project
                  .getName()));
        }
      } catch (Throwable e) {
        log.error("Error occurred while indexing project " + project.getName() + " & modules "
            + moduleNamesAsStrCommaDelimited(modelsProvider.getModules(), false), e);
      }
    });
  }
}
项目:AppleScript-IDEA    文件:AppleScriptDictionaryResolveProcessor.java   
private boolean setResultFromCocoaStandardLibrary(@NotNull DictionaryCompositeElement element) {
  AppleScriptProjectDictionaryService dictionaryRegistry = ServiceManager
      .getService(element.getProject(), AppleScriptProjectDictionaryService.class);
  if (dictionaryRegistry == null) return false;
  ApplicationDictionary cocoaStandard = dictionaryRegistry.getCocoaStandardTerminology();
  return cocoaStandard != null && setResult(cocoaStandard, element);
}
项目:AppleScript-IDEA    文件:AppleScriptDictionaryResolveProcessor.java   
private boolean setResultFromStandardAdditionsLibrary(@NotNull DictionaryCompositeElement element) {
  AppleScriptProjectDictionaryService dictionaryRegistry = ServiceManager
      .getService(element.getProject(), AppleScriptProjectDictionaryService.class);
  if (dictionaryRegistry == null) return false;
  ApplicationDictionary scriptingAdditions = dictionaryRegistry.getScriptingAdditionsTerminology();
  return scriptingAdditions != null && setResult(scriptingAdditions, element);
}
项目:AppleScript-IDEA    文件:AppleScriptDictionaryResolveProcessor.java   
private static void appendResultsIfNeeded(@NotNull Collection<DictionaryComponent> result,
                                          @NotNull Project project,
                                          boolean areThereUseStatements,
                                          boolean filterStandardAdditions, boolean filterCocoaStandard) {
  AppleScriptProjectDictionaryService dictionaryRegistry = ServiceManager.getService(project, AppleScriptProjectDictionaryService.class);
  if (dictionaryRegistry == null) return;
  if (!filterStandardAdditions && !areThereUseStatements) {
    ApplicationDictionary scriptAdditions = dictionaryRegistry.getScriptingAdditionsTerminology();
    collectAllComponentsFromDictionary(scriptAdditions, result, false);
  }
  if (!filterCocoaStandard) {
    ApplicationDictionary cocoaStandardTerminology = dictionaryRegistry.getCocoaStandardTerminology();
    collectAllComponentsFromDictionary(cocoaStandardTerminology, result, false);
  }
}
项目:AppleScript-IDEA    文件:AppleScriptDictionaryResolveProcessor.java   
/**
 * Gathers all term declaratiopns from the dictionary
 *
 * @param importedDict             dictionary to collect declarations from
 * @param dictionaryComponents     resulted list
 * @param withCocoaStdLibFiltering if true - do not add the terms which are present in Standard Terminology dictionary
 */
private static void collectAllComponentsFromDictionary(@Nullable ApplicationDictionary importedDict,
                                                       @NotNull Collection<DictionaryComponent> dictionaryComponents,
                                                       boolean withCocoaStdLibFiltering) {
  if (importedDict == null) return;
  if (withCocoaStdLibFiltering) {
    AppleScriptProjectDictionaryService dictionaryRegistry = ServiceManager.getService(importedDict.getProject(), AppleScriptProjectDictionaryService.class);
    ApplicationDictionary cocoaStandard = null;
    if (dictionaryRegistry != null) {
      cocoaStandard = dictionaryRegistry.getCocoaStandardTerminology();
    }
    if (cocoaStandard != null) {
      for (DictionaryEnumerator dicConst : importedDict.getDictionaryEnumeratorMap().values()) {
        if (cocoaStandard.findEnumerator(dicConst.getName()) == null) {
          dictionaryComponents.add(dicConst);
        }
      }
      for (AppleScriptClass clz : importedDict.getDictionaryClassMap().values()) {
        if (cocoaStandard.findClass(clz.getName()) == null) {
          dictionaryComponents.add(clz);
        }
      }
      for (AppleScriptCommand cmd : importedDict.getAllCommands()) {
        if (cocoaStandard.findCommand(cmd.getName()) == null) {
          dictionaryComponents.add(cmd);
        }
      }
      for (AppleScriptPropertyDefinition prop : importedDict.getDictionaryPropertyMap().values()) {
        if (cocoaStandard.findCommand(prop.getName()) == null) {
          dictionaryComponents.add(prop);
        }
      }
    }
  } else {
    dictionaryComponents.addAll(importedDict.getDictionaryEnumeratorMap().values());
    dictionaryComponents.addAll(importedDict.getDictionaryPropertyMap().values());
    dictionaryComponents.addAll(importedDict.getDictionaryClassMap().values());
    dictionaryComponents.addAll(importedDict.getAllCommands());
  }
}
项目:AppleScript-IDEA    文件:LoadDictionaryAction.java   
public static void openLoadDirectoryDialog(@NotNull final Project project, @Nullable VirtualFile directoryFile, @Nullable final String appName) {
  final boolean chooseMultiple = StringUtil.isEmpty(appName);
  FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, false, false, false, chooseMultiple);
  FileChooser.chooseFiles(descriptor, project, directoryFile, files -> {
    AppleScriptProjectDictionaryService projectDictionaryRegistry = ServiceManager.getService(project, AppleScriptProjectDictionaryService
        .class);
    if (projectDictionaryRegistry == null) return;

    for (VirtualFile file : files) {
      if (!ApplicationDictionaryImpl.extensionSupported(file.getExtension())) continue;

      if (chooseMultiple) {
        String applicationName;
        if (ApplicationDictionary.SUPPORTED_APPLICATION_EXTENSIONS.contains(file.getExtension())) {
          applicationName = file.getNameWithoutExtension();
        } else {
          applicationName = Messages.showInputDialog(project, "Please specify application name for dictionary "
              + file.getName(), "Enter Application Name", null, file.getNameWithoutExtension(), null);
        }
        if (StringUtil.isEmpty(applicationName)) continue;
        projectDictionaryRegistry.createDictionaryFromFile(applicationName, file);
      } else {
        projectDictionaryRegistry.createDictionaryFromFile(appName, file);
        return;
      }
    }
  });
}
项目:intellij-mattermost-plugin    文件:SettingsForm.java   
@Override
public boolean isModified() {
    SettingsBean bean = ServiceManager.getService(SettingsBean.class);
    boolean mod = !this.username.getText().equals(bean.getUsername());
    mod |= !new String(this.password.getPassword()).equals(bean.getPassword());
    mod |= !this.url.getText().equals(stripScheme(bean.getUrl()));
    mod |= !((this.scheme.getSelectedItem() == null) || (bean.getUrl() == null)
            || bean.getUrl().startsWith(this.scheme.getSelectedItem() + "://"));
    return mod;
}
项目:jfrog-idea-plugin    文件:XrayToolWindowFactory.java   
@Override
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {
    ScanManager scanManager = ScanManagerFactory.getScanManager(project);
    boolean isSupported = scanManager != null;
    DumbService.getInstance(project).runWhenSmart(() -> ServiceManager.getService(project, XrayToolWindow.class).initToolWindow(toolWindow, isSupported));
    if (isSupported && GlobalSettings.getInstance().isCredentialsSet()) {
        scanManager.asyncScanAndUpdateResults(true);
    }
}
项目:IntelliJ-Key-Promoter-X    文件:SuppressedList.java   
private void unsuppressItem() {
    final StatisticsItem selectedValue = getSelectedValue();
    if (selectedValue != null) {
        final KeyPromoterStatistics service = ServiceManager.getService(KeyPromoterStatistics.class);
        service.unsuppressItem(selectedValue);
    }
}
项目:hybris-integration-intellij-idea-plugin    文件:SearchHybrisDistributionDirectoryTaskModalWindow.java   
@Override
public void run(@NotNull final ProgressIndicator indicator) {
    Validate.notNull(indicator);

    final VirtualFileSystemService virtualFileSystemService = ServiceManager.getService(VirtualFileSystemService.class);

    final File hybrisServerShellScriptFile;
    try {
        hybrisServerShellScriptFile = virtualFileSystemService.findFileByNameInDirectory(
            rootProjectDirectory,
            HybrisConstants.HYBRIS_SERVER_SHELL_SCRIPT_NAME,
            new DirectoriesScannerProgressIndicatorUpdaterProcessor(indicator)
        );
    } catch (InterruptedException e) {
        LOG.warn(e);
        return;
    }

    if (null != hybrisServerShellScriptFile
        && null != hybrisServerShellScriptFile.getParentFile()
        && null != hybrisServerShellScriptFile.getParentFile().getParentFile()) {

        this.resultProcessor.process(
            hybrisServerShellScriptFile.getParentFile().getParentFile().getParentFile().getAbsolutePath()
        );
    }
}
项目:hybris-integration-intellij-idea-plugin    文件:DefaultConfiguratorFactory.java   
@NotNull
@Override
public SpringConfigurator getSpringConfigurator() {
    final SpringConfigurator springConfigurator = ServiceManager.getService(
        DefaultSpringConfigurator.class
    );

    return (null == springConfigurator) ? new DummySpringConfigurator() : springConfigurator;
}
项目:hybris-integration-intellij-idea-plugin    文件:DefaultVersionControlSystemConfigurator.java   
@Override
public void configure(@NotNull Project project) {
    final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
    final Collection<VcsRoot> detectedRoots = ServiceManager.getService(project, VcsRootDetector.class).detect();
    final ArrayList<VcsDirectoryMapping> directoryMappings = detectedRoots
        .stream()
        .map(root -> new VcsDirectoryMapping(root.getPath().getPath(), root.getVcs().getName()))
        .collect(Collectors.toCollection(ArrayList::new));
    vcsManager.setDirectoryMappings(directoryMappings);
}
项目:hybris-integration-intellij-idea-plugin    文件:DefaultHybrisProjectImportBuilder.java   
public ConfiguratorFactory getConfiguratorFactory() {
    if (!Extensions.getRootArea().hasExtensionPoint(HybrisConstants.CONFIGURATOR_FACTORY_ID)) {
        return ServiceManager.getService(DefaultConfiguratorFactory.class);
    }

    final ExtensionPoint ep = Extensions.getRootArea().getExtensionPoint(HybrisConstants.CONFIGURATOR_FACTORY_ID);
    final ConfiguratorFactory ultimateConfiguratorFactory = (ConfiguratorFactory) ep.getExtension();

    if (ultimateConfiguratorFactory != null) {
        return ultimateConfiguratorFactory;
    }

    return ServiceManager.getService(DefaultConfiguratorFactory.class);
}
项目:hybris-integration-intellij-idea-plugin    文件:HybrisProjectManagerListener.java   
private boolean popupPermissionToSendStatistics(final Project project) {
    final CommonIdeaService commonIdeaService = ServiceManager.getService(CommonIdeaService.class);
    if (commonIdeaService.shouldShowPermissionToSendStatisticsDialog()) {
        EventQueue.invokeLater(() -> {
            if (new PermissionToSendStatisticsDialog(project).showAndGet()) {
               continueOpening(project);
            }
        });
        return false;
    }
    return true;
}
项目:hybris-integration-intellij-idea-plugin    文件:HybrisProjectManagerListener.java   
private void resetSpringGeneralSettings(final Project project) {
    final CommonIdeaService commonIdeaService = ServiceManager.getService(CommonIdeaService.class);
    if (commonIdeaService.isHybrisProject(project)) {
        if (isPluginActive(SPRING_PLUGIN_ID)) {
            SpringGeneralSettings springGeneralSettings = SpringGeneralSettings.getInstance(project);
            springGeneralSettings.setShowMultipleContextsPanel(false);
            springGeneralSettings.setShowProfilesPanel(false);
        }
    }
}
项目:hybris-integration-intellij-idea-plugin    文件:HybrisProjectManagerListener.java   
private void registerAntListener(final Project project) {
    final CommonIdeaService commonIdeaService = ServiceManager.getService(CommonIdeaService.class);
    if (commonIdeaService.isHybrisProject(project)) {
        if (isPluginActive(ANT_SUPPORT_PLUGIN_ID)) {
            HybrisAntBuildListener.registerAntListener(project);
        }
    }
}
项目:hybris-integration-intellij-idea-plugin    文件:HybrisProjectManagerListener.java   
private boolean isOldHybrisProject(final Project project) {
    final CommonIdeaService commonIdeaService = ServiceManager.getService(CommonIdeaService.class);
    final StatsCollector statsCollector = StatsCollector.getInstance();
    if (commonIdeaService.isHybrisProject(project)) {
        statsCollector.collectStat(StatsCollector.ACTIONS.OPEN_PROJECT);
        return commonIdeaService.isOutDatedHybrisProject(project);
    } else {
        final boolean potential = commonIdeaService.isPotentiallyHybrisProject(project);
        if (potential) {
            statsCollector.collectStat(StatsCollector.ACTIONS.OPEN_POTENTIAL_PROJECT);
        }
        return potential;
    }
}
项目:hybris-integration-intellij-idea-plugin    文件:BpDiagramElementManagerIml.java   
@Nullable
@Override
public BpGraphNode findInDataContext(final DataContext dataContext) {
    final Project project = CommonDataKeys.PROJECT.getData(dataContext);
    final CommonIdeaService commonIdeaService = ServiceManager.getService(CommonIdeaService.class);
    if (!commonIdeaService.isHybrisProject(project)) {
        return null;
    }

    final VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);

    if (null == virtualFile) {
        return null;
    }

    if (!virtualFile.getName().endsWith("process.xml")) {
        return null;
    }

    final PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext);

    if (!(psiFile instanceof XmlFile) ||
        psiFile instanceof HtmlFileImpl) { // but psiFile must not be html.
        return null;
    }

    final BpGraphService bpGraphService = ServiceManager.getService(BpGraphService.class);

    try {
        return bpGraphService.buildGraphFromXmlFile(virtualFile);
    } catch (UnmarshalException e) {
        return null;
    }
}
项目:intellij-mattermost-plugin    文件:SettingsForm.java   
@Nullable
@Override
public JComponent createComponent() {
    SettingsBean bean = ServiceManager.getService(SettingsBean.class);
    username.setText(bean.getUsername());
    password.setText(bean.getPassword());
    url.setText(stripScheme(bean.getUrl()).toLowerCase());
    scheme.setSelectedIndex(isHttpsScheme(bean.getUrl()) ? 1 : 0);
    return panel;
}
项目:IdeaCurrency    文件:IdeaCurrencyConfig.java   
public static IdeaCurrencyConfig getInstance() {
    return ServiceManager.getService(IdeaCurrencyConfig.class);
}
项目:CodeGenerate    文件:GridMain.java   
public GridMain(PsiClass cls, PsiFile file, Project project) {
    this.cls = cls;
    this.file = file;
    this.project = project;
    isConnect = false;
    setContentPane(mainPanel);
    //this.father = father;
    this.project = project;
    settings = ServiceManager.getService(CodeMakerSettings.class);
    setTitle("Code Generate                      By Zeng");
    getRootPane().setDefaultButton(okButton);
    this.setAlwaysOnTop(true);
    JComboBox comboBox = new JComboBox(ComboBoxTableModel.getValidStates());
    comboBox.setEditable(true);
    tableModel = new ComboBoxTableModel();
    listDBTable = new JList();
    listDBTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listClassType = new JList(settings.getCodeTemplateNamesArray());
    listClassType.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    //listClassType.setModel();
    //listDBTable.setModel(new DefaultComboBoxModel(new String[]{"so_student_info","test"}));
    mainTable = new JTable(tableModel);
    MouseInputListener mouseInputListener = getMouseInputListener(mainTable);//
    mainTable.addMouseListener(mouseInputListener);
    DefaultCellEditor editor = new DefaultCellEditor(comboBox);
    JCheckBox checkBox = new JCheckBox();
    checkBox.setHorizontalAlignment(JLabel.CENTER);
    checkBox.setEnabled(true);
    DefaultCellEditor editorCheck = new DefaultCellEditor(checkBox);

    TableColumnModel tcm = mainTable.getColumnModel();
    tcm.getColumn(6).setCellEditor(editor);
    tcm.getColumn(8).setCellEditor(editorCheck);
    tcm.getColumn(9).setCellEditor(editorCheck);
    tcm.getColumn(10).setCellEditor(editorCheck);
    tcm.getColumn(11).setCellEditor(editorCheck);
    tcm.getColumn(12).setCellEditor(editorCheck);
    tcm.getColumn(13).setCellEditor(editorCheck);
    tcm.getColumn(14).setCellEditor(editorCheck);
    // Set column widths
    tcm.getColumn(0).setPreferredWidth(100);
    tcm.getColumn(8).setPreferredWidth(50);
    tcm.getColumn(9).setPreferredWidth(50);
    tcm.getColumn(10).setPreferredWidth(50);
    tcm.getColumn(11).setPreferredWidth(50);
    tcm.getColumn(12).setPreferredWidth(50);
    tcm.getColumn(13).setPreferredWidth(50);
    tcm.getColumn(14).setPreferredWidth(50);
    //tcm.getColumn(1).setPreferredWidth(100);
    mainTable.setRowHeight(30);
    mainTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    mainTable.setPreferredScrollableViewportSize(mainTable.getPreferredSize());
    gridPane.setViewportView(mainTable);
    listPane.setViewportView(listDBTable);
    listClassPane.setViewportView(listClassType);
    //getContentPane().add(new JScrollPane(mainTable), "Center");
    getDbConfig();
    initActionListener();
    //father.setVisible(false);
    setSize(1366, 768);
    setLocationRelativeTo(null);
    setVisible(true);
}
项目:CodeGenerate    文件:CodeMakerGroup.java   
public CodeMakerGroup() {
    settings = ServiceManager.getService(CodeMakerSettings.class);
}
项目:CodeGenerate    文件:CodeMakerAction.java   
public CodeMakerAction(String templateKey) {
    this.settings = ServiceManager.getService(CodeMakerSettings.class);
    this.templateKey = templateKey;
    getTemplatePresentation().setDescription("description");
    getTemplatePresentation().setText(templateKey, false);
}
项目:intellij-spring-assistant    文件:YamlCompletionProvider.java   
@Override
protected void addCompletions(@NotNull final CompletionParameters completionParameters,
    final ProcessingContext processingContext, @NotNull final CompletionResultSet resultSet) {

  PsiElement element = completionParameters.getPosition();
  if (element instanceof PsiComment) {
    return;
  }

  Project project = element.getProject();
  Module module = ModuleUtil.findModuleForPsiElement(element);

  SuggestionIndexService service =
      ServiceManager.getService(project, SuggestionIndexService.class);

  if ((module == null || !service.canProvideSuggestions(project, module)) && !service
      .canProvideSuggestions(project)) {
    return;
  }

  YAMLKeyValue keyValue = getParentOfType(element, YAMLKeyValue.class);

  List<LookupElementBuilder> suggestions;
  // For top level element, since there is no parent keyValue would be null
  String queryString = truncateIdeaDummyIdentifier(element);

  if (keyValue == null) {
    if (module == null) {
      suggestions = service
          .computeSuggestions(project, element.getClass().getClassLoader(), null, queryString);
    } else {
      suggestions = service
          .computeSuggestions(project, module, element.getClass().getClassLoader(), null,
              queryString);
    }
  } else {
    List<String> containerElements = new ArrayList<>();
    do {
      containerElements.add(0, truncateIdeaDummyIdentifier(keyValue.getKeyText()));
      keyValue = getParentOfType(keyValue, YAMLKeyValue.class);
    } while (keyValue != null);

    if (module == null) {
      suggestions = service
          .computeSuggestions(project, element.getClass().getClassLoader(), containerElements,
              queryString);
    } else {
      suggestions = service
          .computeSuggestions(project, module, element.getClass().getClassLoader(),
              containerElements, queryString);
    }
  }

  if (suggestions != null) {
    suggestions.forEach(resultSet::addElement);
  }
}
项目:intellij-spring-assistant    文件:SuggestionIndexService.java   
static SuggestionIndexService getInstance(@NotNull Project project) {
  return ServiceManager.getService(project, SuggestionIndexService.class);
}
项目:intellij-spring-assistant    文件:MavenReIndexingDependencyChangeSubscriber.java   
static MavenReIndexingDependencyChangeSubscriber getInstance(Project project) {
  return ServiceManager.getService(project, MavenReIndexingDependencyChangeSubscriber.class);
}