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


Java Language.findLanguageByID方法代碼示例

本文整理匯總了Java中com.intellij.lang.Language.findLanguageByID方法的典型用法代碼示例。如果您正苦於以下問題:Java Language.findLanguageByID方法的具體用法?Java Language.findLanguageByID怎麽用?Java Language.findLanguageByID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.lang.Language的用法示例。


在下文中一共展示了Language.findLanguageByID方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: commitModule

import com.intellij.lang.Language; //導入方法依賴的package包/類
@Nullable
@Override
public Module commitModule(@NotNull Project project, @Nullable ModifiableModuleModel model) {
  Module module = super.commitModule(project, model);
  if (module == null) {
    return null;
  }
  String languageName = myCourse.getLanguageID();
  Language language = Language.findLanguageByID(languageName);
  if (language == null) {
    return module;
  }
  EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language);
  if (configurator == null) {
    return module;
  }
  configurator.configureModule(module);
  return module;
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:20,代碼來源:EduRemoteCourseModuleBuilder.java

示例2: createModule

import com.intellij.lang.Language; //導入方法依賴的package包/類
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel)
  throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
  Module baseModule = super.createModule(moduleModel);
  String languageName = myCourse.getLanguageID();
  Language language = Language.findLanguageByID(languageName);
  if (language != null) {
    EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language);
    if (configurator != null) {
      Project project = baseModule.getProject();
      myGenerator.setSelectedCourse(myCourse);
      myGenerator.generateProject(project, project.getBaseDir());
      Course course = StudyTaskManager.getInstance(project).getCourse();
      if (course == null) {
        LOG.info("failed to generate course");
        return baseModule;
      }
      configurator.createCourseModuleContent(moduleModel, project, course, getModuleFileDirectory());
    }
  }
  return baseModule;
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:24,代碼來源:EduRemoteCourseModuleBuilder.java

示例3: commitModule

import com.intellij.lang.Language; //導入方法依賴的package包/類
@Nullable
@Override
public Module commitModule(@NotNull Project project, @Nullable ModifiableModuleModel model) {
  Module module = super.commitModule(project, model);
  if (module == null) {
    return null;
  }
  String languageName = mySelectedCourse.getLanguageID();
  Language language = Language.findLanguageByID(languageName);
  if (language == null) {
    return module;
  }
  EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language);
  if (configurator == null) {
    return module;
  }
  configurator.configureModule(module);
  return module;
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:20,代碼來源:EduCustomCourseModuleBuilder.java

示例4: createModule

import com.intellij.lang.Language; //導入方法依賴的package包/類
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel)
  throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
  Module baseModule = super.createModule(moduleModel);
  if (mySelectedCourse != null) {
    String languageName = mySelectedCourse.getLanguageID();
    Language language = Language.findLanguageByID(languageName);
    if (language != null) {
      EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language);
      if (configurator != null) {
        myGenerator.setSelectedCourse(mySelectedCourse);
        Project project = baseModule.getProject();
        myGenerator.generateProject(project, project.getBaseDir());
        Course course = StudyTaskManager.getInstance(project).getCourse();
        if (course == null) {
          LOG.info("failed to generate course");
          return baseModule;
        }
        configurator.createCourseModuleContent(moduleModel, project, course, getModuleFileDirectory());
      }
    }
  }
  return baseModule;
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:26,代碼來源:EduCustomCourseModuleBuilder.java

示例5: injectAll

import com.intellij.lang.Language; //導入方法依賴的package包/類
public void injectAll(Disposable parent) {
  injectVariousStuffEverywhere(parent, myPsiManager);

  Project project = myPsiManager.getProject();
  Language ql = Language.findLanguageByID("JPAQL");
  Language js = Language.findLanguageByID("JavaScript");
  registerForStringVarInitializer(parent, project, ql, "ql", null, null);
  registerForStringVarInitializer(parent, project, ql, "qlPrefixed", "xxx", null);
  registerForStringVarInitializer(parent, project, js, "js", null, null);
  registerForStringVarInitializer(parent, project, js, "jsSeparated", " + ", " + 'separator'");
  registerForStringVarInitializer(parent, project, js, "jsBrokenPrefix", "xx ", "");

  registerForStringVarInitializer(parent, project, Language.findLanguageByID("Oracle"), "oracle", null, null);

  registerForParameterValue(parent, project, Language.findLanguageByID("Groovy"), "groovy");
  registerForStringVarInitializer(parent, project, JavaLanguage.INSTANCE, "java", "", "");
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:MyTestInjector.java

示例6: getDialectIdsSpecifiedForTool

import com.intellij.lang.Language; //導入方法依賴的package包/類
@Nullable("null means not specified")
private static Set<String> getDialectIdsSpecifiedForTool(@NotNull LocalInspectionToolWrapper wrapper) {
  String langId = wrapper.getLanguage();
  if (langId == null) {
    return null;
  }
  Language language = Language.findLanguageByID(langId);
  Set<String> result;
  if (language != null) {
    List<Language> dialects = language.getDialects();
    boolean applyToDialects = wrapper.applyToDialects();
    result = applyToDialects && !dialects.isEmpty() ? new THashSet<String>(1 + dialects.size()) : new SmartHashSet<String>();
    result.add(langId);
    if (applyToDialects) {
      for (Language dialect : dialects) {
        result.add(dialect.getID());
      }
    }
  }
  else {
    // unknown language in plugin.xml, ignore
    result = Collections.singleton(langId);
  }
  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:InspectionEngine.java

示例7: getSuppressActions

import com.intellij.lang.Language; //導入方法依賴的package包/類
@Nullable
public static SuppressIntentionAction[] getSuppressActions(@NotNull InspectionToolWrapper toolWrapper) {
  final InspectionProfileEntry tool = toolWrapper.getTool();
  if (tool instanceof CustomSuppressableInspectionTool) {
    return ((CustomSuppressableInspectionTool)tool).getSuppressActions(null);
  }
  final List<LocalQuickFix> actions = new ArrayList<LocalQuickFix>(Arrays.asList(tool.getBatchSuppressActions(null)));
  if (actions.isEmpty()) {
    final Language language = Language.findLanguageByID(toolWrapper.getLanguage());
    if (language != null) {
      final List<InspectionSuppressor> suppressors = LanguageInspectionSuppressors.INSTANCE.allForLanguage(language);
      for (InspectionSuppressor suppressor : suppressors) {
        final SuppressQuickFix[] suppressActions = suppressor.getSuppressActions(null, toolWrapper.getID());
        Collections.addAll(actions, suppressActions);
      }
    }
  }
  return ContainerUtil.map2Array(actions, SuppressIntentionAction.class, new Function<LocalQuickFix, SuppressIntentionAction>() {
    @Override
    public SuppressIntentionAction fun(final LocalQuickFix fix) {
      return SuppressIntentionActionFromFix.convertBatchToSuppressIntentionAction((SuppressQuickFix)fix);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:InspectionManagerEx.java

示例8: TemplateLanguageErrorFilter

import com.intellij.lang.Language; //導入方法依賴的package包/類
protected TemplateLanguageErrorFilter(
  @NotNull final TokenSet templateExpressionStartTokens,
  @NotNull final Class templateFileViewProviderClass,
  @NotNull final String... knownSubLanguageNames)
{
  myTemplateExpressionStartTokens = TokenSet.create(templateExpressionStartTokens.getTypes());
  myTemplateFileViewProviderClass = templateFileViewProviderClass;

  List<String> knownSubLanguageList = new ArrayList<String>(Arrays.asList(knownSubLanguageNames));
  knownSubLanguageList.add("JavaScript");
  knownSubLanguageList.add("CSS");
  knownLanguageSet = new HashSet<Language>();
  for (String name : knownSubLanguageList) {
    final Language language = Language.findLanguageByID(name);
    if (language != null) {
      knownLanguageSet.add(language);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:TemplateLanguageErrorFilter.java

示例9: initTree

import com.intellij.lang.Language; //導入方法依賴的package包/類
public void initTree(@NotNull MultiMap<String, PostfixTemplate> langToTemplates) {
  myRoot.removeAllChildren();
  for (Map.Entry<String, Collection<PostfixTemplate>> entry : langToTemplates.entrySet()) {
    String id = entry.getKey();
    Language language = Language.findLanguageByID(id);
    String langName = language != null ? language.getDisplayName() : id;  
    CheckedTreeNode langNode = new CheckedTreeNode(langName);
    myRoot.add(langNode);
    for (PostfixTemplate template : entry.getValue()) {
      CheckedTreeNode templateNode = new PostfixTemplateCheckedTreeNode(template, langName);
      langNode.add(templateNode);
    }
  }

  myModel.nodeStructureChanged(myRoot);
  TreeUtil.expandAll(this);
  setSelectionRow(0);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:PostfixTemplatesCheckboxTree.java

示例10: updateFileTypeForEditorComponent

import com.intellij.lang.Language; //導入方法依賴的package包/類
private void updateFileTypeForEditorComponent(@NotNull ComboBox inputComboBox) {
  final Component editorComponent = inputComboBox.getEditor().getEditorComponent();

  if (editorComponent instanceof EditorTextField) {
    boolean isRegexp = myCbRegularExpressions.isSelectedWhenSelectable();
    FileType fileType = PlainTextFileType.INSTANCE;
    if (isRegexp) {
      Language regexpLanguage = Language.findLanguageByID("RegExp");
      if (regexpLanguage != null) {
        LanguageFileType regexpFileType = regexpLanguage.getAssociatedFileType();
        if (regexpFileType != null) {
          fileType = regexpFileType;
        }
      }
    }
    String fileName = isRegexp ? "a.regexp" : "a.txt";
    final PsiFile file = PsiFileFactory.getInstance(myProject).createFileFromText(fileName, fileType, ((EditorTextField)editorComponent).getText(), -1, true);

    ((EditorTextField)editorComponent).setNewDocumentAndFileType(fileType, PsiDocumentManager.getInstance(myProject).getDocument(file));
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:FindDialog.java

示例11: modifySettingsStep

import com.intellij.lang.Language; //導入方法依賴的package包/類
@Nullable
@Override
public ModuleWizardStep modifySettingsStep(@NotNull SettingsStep settingsStep) {
  ModuleWizardStep javaSettingsStep =
    ProjectWizardStepFactory.getInstance().createJavaSettingsStep(settingsStep, this, Conditions.alwaysTrue());
  Function<JTextField, String> getValue = JTextComponent::getText;
  getWizardInputField("ccname", "", "Name:", myPanel.getNameField(), getValue).addToSettings(settingsStep);
  getWizardInputField("ccauthor", "", "Author:", myPanel.getAuthorField(), getValue).addToSettings(settingsStep);

  myLanguageComboBox.removeAllItems();
  for (LanguageExtensionPoint extension : Extensions.<LanguageExtensionPoint>getExtensions(EduPluginConfigurator.EP_NAME, null)) {
    String languageId = extension.getKey();
    Language language = Language.findLanguageByID(languageId);
    if (language == null) {
      LOG.info("Language with id " + languageId + " not found");
      continue;
    }
    myLanguageComboBox.addItem(new LanguageWrapper(language));
  }
  getWizardInputField("cclang", "", "Language:", myLanguageComboBox, comboBox -> (String) comboBox.getSelectedItem())
    .addToSettings(settingsStep);
  JTextArea descriptionField = myPanel.getDescriptionField();
  descriptionField.setRows(4);
  descriptionField.setBorder(null);
  descriptionField.invalidate();
  JBScrollPane scrollPane = new JBScrollPane(descriptionField);
  scrollPane.setMinimumSize(scrollPane.getUI().getPreferredSize(descriptionField));
  getWizardInputField("ccdescr", "", "Description:", scrollPane, pane -> descriptionField.getText()).addToSettings(settingsStep);
  return javaSettingsStep;
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:31,代碼來源:EduCCModuleBuilder.java

示例12: injectLanguage

import com.intellij.lang.Language; //導入方法依賴的package包/類
private void injectLanguage(@NotNull PsiLanguageInjectionHost host, @NotNull InjectedLanguagePlaces injectedLanguagePlaces, String scriptingName) {
    final Language requiredLanguage = Language.findLanguageByID(scriptingName);
    if (requiredLanguage != null) {
        final TextRange range = TextRange.from(0, host.getTextRange().getLength());
        injectedLanguagePlaces.addPlace(requiredLanguage, range, null, null);
    }
}
 
開發者ID:machaval,項目名稱:mule-intellij-plugins,代碼行數:8,代碼來源:MuleLanguageInjector.java

示例13: readExternal

import com.intellij.lang.Language; //導入方法依賴的package包/類
@Override
public void readExternal(@NotNull Element element) throws InvalidDataException {
  synchronized (this) {
    initCommonSettingsMap();
    final List list = element.getChildren(COMMON_SETTINGS_TAG);
    for (Object o : list) {
      final Element commonSettingsElement = (Element)o;
      final String languageId = commonSettingsElement.getAttributeValue(LANGUAGE_ATTR);
      if (languageId != null && !languageId.isEmpty()) {
        Language target = Language.findLanguageByID(languageId);
        boolean isKnownLanguage = target != null;
        if (isKnownLanguage) {
          final LanguageCodeStyleSettingsProvider provider = LanguageCodeStyleSettingsProvider.forLanguage(target);
          if (provider != null) {
            CommonCodeStyleSettings settings = provider.getDefaultCommonSettings();
            if (settings != null) {
              settings.readExternal(commonSettingsElement);
              init(settings, target);
            }
          }
          else {
            isKnownLanguage = false;
          }
        }
        if (!isKnownLanguage) {
          myUnknownSettingsMap.put(languageId, (Content)commonSettingsElement.clone());
        }
      }
    }
    initNonReadSettings();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:33,代碼來源:CommonCodeStyleSettingsManager.java

示例14: toXExpression

import com.intellij.lang.Language; //導入方法依賴的package包/類
@Nullable
public XExpression toXExpression() {
  checkConverted();
  // old versions may have empty expressions serialized
  if (StringUtil.isEmptyOrSpaces(myExpression)) {
    return null;
  }
  return new XExpressionImpl(myExpression, Language.findLanguageByID(myLanguage), myCustomInfo);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:XExpressionState.java

示例15: getInspectionTools

import com.intellij.lang.Language; //導入方法依賴的package包/類
@NotNull
List<LocalInspectionToolWrapper> getInspectionTools(@NotNull InspectionProfileWrapper profile) {
  List<LocalInspectionToolWrapper> enabled = new ArrayList<LocalInspectionToolWrapper>();
  final InspectionToolWrapper[] toolWrappers = profile.getInspectionTools(getFile());
  InspectionProfileWrapper.checkInspectionsDuplicates(toolWrappers);
  for (InspectionToolWrapper toolWrapper : toolWrappers) {
    ProgressManager.checkCanceled();
    if (!profile.isToolEnabled(HighlightDisplayKey.find(toolWrapper.getShortName()), getFile())) continue;
    LocalInspectionToolWrapper wrapper = null;
    if (toolWrapper instanceof LocalInspectionToolWrapper) {
      wrapper = (LocalInspectionToolWrapper)toolWrapper;
    }
    else if (toolWrapper instanceof GlobalInspectionToolWrapper) {
      final GlobalInspectionToolWrapper globalInspectionToolWrapper = (GlobalInspectionToolWrapper)toolWrapper;
      wrapper = globalInspectionToolWrapper.getSharedLocalInspectionToolWrapper();
    }
    if (wrapper == null) continue;
    String language = wrapper.getLanguage();
    if (language != null && Language.findLanguageByID(language) == null) {
      continue; // filter out at least unknown languages
    }
    if (myIgnoreSuppressed && SuppressionUtil.inspectionResultSuppressed(getFile(), wrapper.getTool())) {
      continue;
    }
    enabled.add(wrapper);
  }
  return enabled;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:29,代碼來源:LocalInspectionsPass.java


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