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


Java TemplateDataLanguageMappings类代码示例

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


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

示例1: SoyLayeredHighlighter

import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings; //导入依赖的package包/类
public SoyLayeredHighlighter(
    @Nullable Project project,
    @Nullable VirtualFile virtualFile,
    @NotNull EditorColorsScheme colors) {
  // Creating main highlighter.
  super(new SoySyntaxHighlighter(), colors);

  // Highlighter for the outer language.
  FileType type = null;
  if (project == null || virtualFile == null) {
    type = StdFileTypes.PLAIN_TEXT;
  } else {
    Language language = TemplateDataLanguageMappings.getInstance(project).getMapping(virtualFile);
    if (language != null) type = language.getAssociatedFileType();
    if (type == null) type = SoyLanguage.getDefaultTemplateLang();
  }

  SyntaxHighlighter outerHighlighter =
      SyntaxHighlighterFactory.getSyntaxHighlighter(type, project, virtualFile);

  registerLayer(OTHER, new LayerDescriptor(outerHighlighter, ""));
}
 
开发者ID:google,项目名称:bamboo-soy,代码行数:23,代码来源:SoyLayeredHighlighter.java

示例2: getAssociatedFileType

import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings; //导入依赖的package包/类
private static LanguageFileType getAssociatedFileType(VirtualFile file, Project project) {
    if (project == null) {
        return null;
    }
    Language language = TemplateDataLanguageMappings.getInstance(project).getMapping(file);

    LanguageFileType associatedFileType = null;
    if (language != null) {
        associatedFileType = language.getAssociatedFileType();
    }

    if (language == null || associatedFileType == null) {
        associatedFileType = RythmLanguage.getDefaultTemplateLang();
    }
    return associatedFileType;
}
 
开发者ID:scireum-incubator,项目名称:rythm_plugin,代码行数:17,代码来源:RythmFileType.java

示例3: getAssociatedFileType

import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings; //导入依赖的package包/类
private static LanguageFileType getAssociatedFileType(VirtualFile file, Project project) {
    if (project == null) {
        return null;
    }
    Language language = TemplateDataLanguageMappings.getInstance(project).getMapping(file);

    LanguageFileType associatedFileType = null;
    if (language != null) {
        associatedFileType = language.getAssociatedFileType();
    }

    if (language == null || associatedFileType == null) {
        associatedFileType = JetLanguage.getDefaultTemplateLang();
    }
    return associatedFileType;
}
 
开发者ID:jhsx,项目名称:GoJetPlugin,代码行数:17,代码来源:JetFileType.java

示例4: JetLayeredSyntaxHighlighter

import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings; //导入依赖的package包/类
public JetLayeredSyntaxHighlighter(Project project, EditorColorsScheme scheme, FileType ptype, VirtualFile virtualFile) {
    super(new JetSyntaxHighlighter(), scheme);

    // highlighter for outer ide
    FileType type = null;
    if (project == null || virtualFile == null) {
        type = StdFileTypes.PLAIN_TEXT;
    } else {
        Language language = TemplateDataLanguageMappings.getInstance(project).getMapping(virtualFile);
        if (language != null) type = language.getAssociatedFileType();
        if (type == null) type = JetLanguage.getDefaultTemplateLang();
    }

    SyntaxHighlighter outerHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(type, project, virtualFile);
    registerLayer(TEXT, new LayerDescriptor(outerHighlighter, ""));
}
 
开发者ID:jhsx,项目名称:GoJetPlugin,代码行数:17,代码来源:JetLayeredSyntaxHighlighter.java

示例5: DotTemplateHighlighter

import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings; //导入依赖的package包/类
public DotTemplateHighlighter(@Nullable Project project, @Nullable VirtualFile virtualFile, @NotNull EditorColorsScheme colors) {
    // create main highlighter
    super(new DotHighlighter(), colors);

    // highlighter for outer lang
    FileType type = null;
    if(project == null || virtualFile == null) {
        type = StdFileTypes.PLAIN_TEXT;
    } else {
        Language language = TemplateDataLanguageMappings.getInstance(project).getMapping(virtualFile);
        if(language != null) type = language.getAssociatedFileType();
        if(type == null) type = DotLanguage.getDefaultTemplateLang();
    }
    @SuppressWarnings ("deprecation") // deprecated in IDEA 12, still needed in IDEA 11 TODO remove when IDEA 11 support is dropped
            SyntaxHighlighter outerHighlighter = SyntaxHighlighter.PROVIDER.create(type, project, virtualFile);

    registerLayer(DotTokenTypes.CONTENT, new LayerDescriptor(outerHighlighter, ""));
}
 
开发者ID:webschik,项目名称:idea-doT,代码行数:19,代码来源:DotTemplateHighlighter.java

示例6: getAssociatedFileType

import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings; //导入依赖的package包/类
private LanguageFileType getAssociatedFileType(VirtualFile file, Project project) {
    if (project == null) {
        return null;
    }
    Language language = TemplateDataLanguageMappings.getInstance(project).getMapping(file);

    LanguageFileType associatedFileType = null;
    if (language != null) {
        associatedFileType = language.getAssociatedFileType();
    }

    if (language == null || associatedFileType == null) {
        associatedFileType = DotLanguage.getDefaultTemplateLang();
    }
    return associatedFileType;
}
 
开发者ID:webschik,项目名称:idea-doT,代码行数:17,代码来源:DotFileType.java

示例7: DustLayeredSyntaxHighlighter

import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings; //导入依赖的package包/类
public DustLayeredSyntaxHighlighter(@Nullable Project project, @Nullable VirtualFile virtualFile, @NotNull EditorColorsScheme colors) {
  // create main highlighter
  super(new DustSyntaxHighlighter(), colors);

  // highlighter for outer lang
  FileType type = null;
  if(project == null || virtualFile == null) {
    type = StdFileTypes.PLAIN_TEXT;
  } else {
    Language language = TemplateDataLanguageMappings.getInstance(project).getMapping(virtualFile);
    if(language != null) type = language.getAssociatedFileType();
    if(type == null) type = StdFileTypes.HTML;
  }
  SyntaxHighlighter outerHighlighter = SyntaxHighlighter.PROVIDER.create(type, project, virtualFile);

  registerLayer(DustTypes.HTML, new LayerDescriptor(outerHighlighter, ""));
}
 
开发者ID:yifanz,项目名称:Intellij-Dust,代码行数:18,代码来源:DustLayeredSyntaxHighlighter.java

示例8: RythmLayeredSyntaxHighlighter

import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings; //导入依赖的package包/类
public RythmLayeredSyntaxHighlighter(Project project, EditorColorsScheme scheme, FileType ptype, VirtualFile virtualFile) {
    super(new RythmSyntaxHighlighter(), scheme);

    FileType type = null;

    //Test for Java implementation
    FileType type1 = null;

    if (project == null || virtualFile == null) {
        type = StdFileTypes.PLAIN_TEXT;
    } else {
        Language language = TemplateDataLanguageMappings.getInstance(project).getMapping(virtualFile);
        if (language != null) type = language.getAssociatedFileType();
        if (type == null) {
            type = RythmLanguage.getDefaultTemplateLang();

            //Test for Java implementation
            //type1 = RythmLanguage.getLanguage();
        }

    }

    SyntaxHighlighter outerHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(type, project, virtualFile);
    registerLayer(TEXT, new LayerDescriptor(outerHighlighter, ""));


    //Test for Java implementation
   /* SyntaxHighlighter middleHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(type1, project, virtualFile);
    registerLayer(TEXT, new LayerDescriptor(middleHighlighter, ""));
   */

}
 
开发者ID:scireum-incubator,项目名称:rythm_plugin,代码行数:33,代码来源:RythmLayeredSyntaxHighlighter.java

示例9: JetFileViewProvider

import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings; //导入依赖的package包/类
public JetFileViewProvider(PsiManager manager, VirtualFile file, boolean physical) {
    super(manager, file, physical);

    Language dataLang = TemplateDataLanguageMappings.getInstance(manager.getProject()).getMapping(file);
    if (dataLang == null) dataLang = StdFileTypes.HTML.getLanguage();

    if (dataLang instanceof TemplateLanguage) {
        myTemplateDataLanguage = PlainTextLanguage.INSTANCE;
    } else {
        myTemplateDataLanguage = LanguageSubstitutors.INSTANCE.substituteLanguage(dataLang, file, manager.getProject());
    }
}
 
开发者ID:jhsx,项目名称:GoJetPlugin,代码行数:13,代码来源:JetFileViewProvider.java

示例10: FileTypePatternDialog

import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings; //导入依赖的package包/类
public FileTypePatternDialog(@Nullable String initialPatterns, FileType fileType, Language templateDataLanguage) {
  myPatternField.setText(initialPatterns);

  if (fileType instanceof TemplateLanguageFileType) {
    final DefaultComboBoxModel model = (DefaultComboBoxModel) myLanguageCombo.getModel();
    model.addElement(null);
    final List<Language> languages = TemplateDataLanguageMappings.getTemplateableLanguages();
    Collections.sort(languages, new Comparator<Language>() {
      @Override
      public int compare(final Language o1, final Language o2) {
        return o1.getID().compareTo(o2.getID());
      }
    });
    for (Language language : languages) {
      model.addElement(language);
    }
    myLanguageCombo.setRenderer(new ListCellRendererWrapper() {
      @Override
      public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
        setText(value == null ? "" : ((Language) value).getDisplayName());
        if (value != null) {
          final FileType type = ((Language)value).getAssociatedFileType();
          if (type != null) {
            setIcon(type.getIcon());
          }
        }
      }
    });
    myLanguageCombo.setSelectedItem(templateDataLanguage);
  } else {
    myLanguageCombo.setVisible(false);
    myTemplateDataLanguageButton.setVisible(false);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:FileTypePatternDialog.java

示例11: getTemplateDataLanguage

import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings; //导入依赖的package包/类
private Language getTemplateDataLanguage(PsiManager manager, VirtualFile file) {
    Language dataLang = TemplateDataLanguageMappings.getInstance(manager.getProject()).getMapping(file);
    if(dataLang == null) {
        dataLang = DotLanguage.getDefaultTemplateLang().getLanguage();
    }

    Language substituteLang = LanguageSubstitutors.INSTANCE.substituteLanguage(dataLang, file, manager.getProject());

    // only use a substituted language if it's templateable
    if (TemplateDataLanguageMappings.getTemplateableLanguages().contains(substituteLang)) {
        dataLang = substituteLang;
    }

    return dataLang;
}
 
开发者ID:webschik,项目名称:idea-doT,代码行数:16,代码来源:DotFileViewProvider.java

示例12: doTearDown

import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings; //导入依赖的package包/类
public static void doTearDown(@Nonnull final Project project, ApplicationStarter application, boolean checkForEditors) throws Exception {
  CodeStyleSettingsManager.getInstance(project).dropTemporarySettings();
  checkAllTimersAreDisposed();
  UsefulTestCase.doPostponedFormatting(project);

  LookupManager lookupManager = LookupManager.getInstance(project);
  if (lookupManager != null) {
    lookupManager.hideActiveLookup();
  }
  ((StartupManagerImpl)StartupManager.getInstance(project)).prepareForNextTest();
  InspectionProfileManager.getInstance().deleteProfile(PROFILE);
  assertNotNull("Application components damaged", ProjectManager.getInstance());

  new WriteCommandAction.Simple(project) {
    @Override
    @RequiredWriteAction
    protected void run() throws Throwable {
      if (ourSourceRoot != null) {
        try {
          final VirtualFile[] children = ourSourceRoot.getChildren();
          for (VirtualFile child : children) {
            child.delete(this);
          }
        }
        catch (IOException e) {
          //noinspection CallToPrintStackTrace
          e.printStackTrace();
        }
      }
      EncodingManager encodingManager = EncodingManager.getInstance();
      if (encodingManager instanceof EncodingManagerImpl) ((EncodingManagerImpl)encodingManager).clearDocumentQueue();

      FileDocumentManager manager = FileDocumentManager.getInstance();

      ApplicationManager.getApplication().runWriteAction(EmptyRunnable.getInstance()); // Flush postponed formatting if any.
      manager.saveAllDocuments();
      if (manager instanceof FileDocumentManagerImpl) {
        ((FileDocumentManagerImpl)manager).dropAllUnsavedDocuments();
      }
    }
  }.execute().throwException();

  assertFalse(PsiManager.getInstance(project).isDisposed());
  if (!ourAssertionsInTestDetected) {
    if (IdeaLogger.ourErrorsOccurred != null) {
      throw IdeaLogger.ourErrorsOccurred;
    }
  }
  PsiDocumentManagerImpl documentManager = clearUncommittedDocuments(project);
  ((HintManagerImpl)HintManager.getInstance()).cleanup();

  UIUtil.invokeAndWaitIfNeeded(new Runnable() {
    @Override
    public void run() {
      ((UndoManagerImpl)UndoManager.getGlobalInstance()).dropHistoryInTests();
      ((UndoManagerImpl)UndoManager.getInstance(project)).dropHistoryInTests();

      UIUtil.dispatchAllInvocationEvents();
    }
  });

  TemplateDataLanguageMappings.getInstance(project).cleanupForNextTest();

  ProjectManagerEx.getInstanceEx().closeTestProject(project);
  //application.setDataProvider(null);
  ourTestCase = null;
  ((PsiManagerImpl)PsiManager.getInstance(project)).cleanupForNextTest();

  CompletionProgressIndicator.cleanupForNextTest();

  if (checkForEditors) {
    checkEditorsReleased();
  }
  if (isLight(project)) {
    // mark temporarily as disposed so that rogue component trying to access it will fail
    ((ProjectImpl)project).setTemporarilyDisposed(true);
    documentManager.clearUncommittedDocuments();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:80,代码来源:LightPlatformTestCase.java

示例13: getTemplateDataLanguage

import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings; //导入依赖的package包/类
@NotNull
static Language getTemplateDataLanguage(@NotNull VirtualFile virtualFile, @NotNull Project project) {
    final Language language = TemplateDataLanguageMappings.getInstance(project).getMapping(virtualFile);
    return language == null ? getTemplateDataLanguageByExtention(virtualFile) : language;
}
 
开发者ID:consulo,项目名称:consulo-apache-velocity,代码行数:6,代码来源:VtlFileViewProvider.java

示例14: mapTemplateDataLanguageFor

import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings; //导入依赖的package包/类
static void mapTemplateDataLanguageFor(PsiFile file, Language dataLanguage) {
    TemplateDataLanguageMappings mappings = TemplateDataLanguageMappings.getInstance(file.getProject());
    mappings.setMapping(file.getViewProvider().getVirtualFile(), dataLanguage);
    Assert.assertSame(dataLanguage, mappings.getMapping(file.getViewProvider().getVirtualFile()));
}
 
开发者ID:consulo,项目名称:consulo-apache-velocity,代码行数:6,代码来源:Util.java


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