本文整理匯總了Java中com.intellij.lang.Language.getDisplayName方法的典型用法代碼示例。如果您正苦於以下問題:Java Language.getDisplayName方法的具體用法?Java Language.getDisplayName怎麽用?Java Language.getDisplayName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.lang.Language
的用法示例。
在下文中一共展示了Language.getDisplayName方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: getRangePair
import com.intellij.lang.Language; //導入方法依賴的package包/類
@Nullable
protected Pair<PsiElement, TextRange> getRangePair(final PsiFile file, final Editor editor) {
final int offset = editor.getCaretModel().getOffset();
final PsiLanguageInjectionHost host =
PsiTreeUtil.getParentOfType(file.findElementAt(offset), PsiLanguageInjectionHost.class, false);
if (host == null || ElementManipulators.getManipulator(host) == null) return null;
final List<Pair<PsiElement, TextRange>> injections = InjectedLanguageManager.getInstance(host.getProject()).getInjectedPsiFiles(host);
if (injections == null || injections.isEmpty()) return null;
final int offsetInElement = offset - host.getTextRange().getStartOffset();
final Pair<PsiElement, TextRange> rangePair = ContainerUtil.find(injections, new Condition<Pair<PsiElement, TextRange>>() {
@Override
public boolean value(final Pair<PsiElement, TextRange> pair) {
return pair.second.containsRange(offsetInElement, offsetInElement);
}
});
if (rangePair != null) {
final Language language = rangePair.first.getContainingFile().getLanguage();
final Object action = language.getUserData(EDIT_ACTION_AVAILABLE);
if (action != null && action.equals(false)) return null;
myLastLanguageName = language.getDisplayName();
}
return rangePair;
}
示例3: createModule
import com.intellij.lang.Language; //導入方法依賴的package包/類
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel)
throws InvalidDataException, IOException, ModuleWithNameAlreadyExists,
JDOMException, ConfigurationException {
Module module = super.createModule(moduleModel);
Project project = module.getProject();
final Course course = new Course();
course.setName(myPanel.getName());
course.setAuthorsAsString(myPanel.getAuthors());
course.setDescription(myPanel.getDescription());
LanguageWrapper wrapper = (LanguageWrapper)myLanguageComboBox.getSelectedItem();
Language language = wrapper.getLanguage();
course.setLanguage(language.getID());
course.setCourseMode(CCUtils.COURSE_MODE);
StudyTaskManager.getInstance(project).setCourse(course);
EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language);
String languageName = language.getDisplayName();
if (configurator == null) {
LOG.error("EduPluginConfigurator for language " + languageName + " not found");
return module;
}
configurator.createCourseModuleContent(moduleModel, project, course, getModuleFileDirectory());
StartupManager.getInstance(project).runWhenProjectIsInitialized(() -> new WriteCommandAction.Simple(project) {
@Override
protected void run() throws Throwable {
PsiDirectory baseDir = PsiManager.getInstance(project).findDirectory(project.getBaseDir());
if (baseDir == null) {
return;
}
PsiDirectory lessonDir = new CCCreateLesson().createItem(null, project, baseDir, course);
if (lessonDir == null) {
LOG.error("Failed to create lesson");
return;
}
new CCCreateTask().createItem(null, project, lessonDir, course);
}
}.execute());
return module;
}
示例4: getRearrangeCodeKeyFor
import com.intellij.lang.Language; //導入方法依賴的package包/類
private static String getRearrangeCodeKeyFor(@NotNull Language language) {
return REARRANGE_ENTRIES_KEY + language.getDisplayName();
}
示例5: LanguageFilterAction
import com.intellij.lang.Language; //導入方法依賴的package包/類
public LanguageFilterAction(final @Nullable Language language) {
super(language == null ? "Language is not specified" : language.getDisplayName());
myLanguageId = language == null ? null : language.getID();
}
示例6: visualize
import com.intellij.lang.Language; //導入方法依賴的package包/類
@Override
protected String visualize(@NotNull final Language language) {
return language.getDisplayName();
}
示例7: textForFilterValue
import com.intellij.lang.Language; //導入方法依賴的package包/類
@Override
protected String textForFilterValue(@NotNull Language value) {
return value.getDisplayName();
}
示例8: getLanguageName
import com.intellij.lang.Language; //導入方法依賴的package包/類
/**
* Returns a language name to be shown in UI. Used to overwrite language's display name by another name to
* be shown in UI.
*
* @param lang The language whose display name must be return.
* @return Alternative UI name defined by provider.getLanguageName() method or (if the method returns null)
* language's own display name.
*/
@Nullable
public static String getLanguageName(Language lang) {
final LanguageCodeStyleSettingsProvider provider = forLanguage(lang);
String providerLangName = provider != null ? provider.getLanguageName() : null;
return providerLangName != null ? providerLangName : lang.getDisplayName();
}
示例9: getConfigurableDisplayName
import com.intellij.lang.Language; //導入方法依賴的package包/類
/**
* Returns the name of the configurable page without creating a Configurable instance.
*
* @return the display name of the configurable page.
* @since 9.0
*/
@Nullable
public String getConfigurableDisplayName() {
Language lang = getLanguage();
return lang == null ? null : lang.getDisplayName();
}