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


Java ExtensionPointName類代碼示例

本文整理匯總了Java中com.intellij.openapi.extensions.ExtensionPointName的典型用法代碼示例。如果您正苦於以下問題:Java ExtensionPointName類的具體用法?Java ExtensionPointName怎麽用?Java ExtensionPointName使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: testInfoTestAttributes

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
public void testInfoTestAttributes() throws Exception {
  LanguageExtensionPoint<Annotator> extension = new LanguageExtensionPoint<Annotator>();
  extension.language="TEXT";
  extension.implementationClass = TestAnnotator.class.getName();
  PlatformTestUtil.registerExtension(ExtensionPointName.create(LanguageAnnotators.EP_NAME), extension, getTestRootDisposable());
  myFixture.configureByText(PlainTextFileType.INSTANCE, "foo");
  EditorColorsScheme scheme = new EditorColorsSchemeImpl(new DefaultColorsScheme()){{initFonts();}};
  scheme.setAttributes(HighlighterColors.TEXT, new TextAttributes(Color.black, Color.white, null, null, Font.PLAIN));
  ((EditorEx)myFixture.getEditor()).setColorsScheme(scheme);
  myFixture.doHighlighting();
  MarkupModel model = DocumentMarkupModel.forDocument(myFixture.getEditor().getDocument(), getProject(), false);
  RangeHighlighter[] highlighters = model.getAllHighlighters();
  assertEquals(1, highlighters.length);
  TextAttributes attributes = highlighters[0].getTextAttributes();
  assertNotNull(attributes);
  assertNull(attributes.getBackgroundColor());
  assertNull(attributes.getForegroundColor());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:DocumentMarkupModelTest.java

示例2: testCustomMimeType

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
public void testCustomMimeType() throws Exception {
  final Language language = new MyLanguage();
  addExplicitExtension(LanguageHtmlScriptContentProvider.INSTANCE, language, new HtmlScriptContentProvider() {
    @Override
    public IElementType getScriptElementType() {
      return new IElementType("MyElementType", language);
    }

    @Nullable
    @Override
    public Lexer getHighlightingLexer() {
      return null;
    }
  });
  addExplicitExtension(LanguageParserDefinitions.INSTANCE, HTMLLanguage.INSTANCE, new HTMLParserDefinition());
  addExplicitExtension(LanguageASTFactory.INSTANCE, HTMLLanguage.INSTANCE, new XmlASTFactory());
  registerExtensionPoint(new ExtensionPointName<HtmlEmbeddedTokenTypesProvider>("com.intellij.html.embeddedTokenTypesProvider"),
                         HtmlEmbeddedTokenTypesProvider.class);
  myLanguage = HTMLLanguage.INSTANCE;
  doTest("<script type=\"application/custom\">Custom Script</script>", "test.html");
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:XmlParsingTest.java

示例3: isExtensionPointNameDeclarationField

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
private static boolean isExtensionPointNameDeclarationField(PsiField psiField) {
  // *do* allow non-public
  if (!psiField.hasModifierProperty(PsiModifier.FINAL) ||
      !psiField.hasModifierProperty(PsiModifier.STATIC) ||
      psiField.hasModifierProperty(PsiModifier.ABSTRACT)) {
    return false;
  }

  if (!psiField.hasInitializer()) {
    return false;
  }

  final PsiExpression initializer = psiField.getInitializer();
  if (!(initializer instanceof PsiMethodCallExpression) &&
      !(initializer instanceof PsiNewExpression)) {
    return false;
  }

  final PsiClass fieldClass = PsiTypesUtil.getPsiClass(psiField.getType());
  if (fieldClass == null) {
    return false;
  }

  return ExtensionPointName.class.getName().equals(fieldClass.getQualifiedName());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:ExtensionPointDeclarationRelatedItemLineMarkerProvider.java

示例4: initTest

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
@Override
protected void initTest(Container applicationServices, Container projectServices) {
  module = new MockModule(project, () -> {});

  mockBlazeImportSettings(projectServices); // For Blaze.isBlazeProject.
  createMocksForBuildProject(applicationServices);
  createMocksForSyncProject(projectServices);
  createMocksForAddDependency(applicationServices, projectServices);

  ExtensionPoint<BuildSystemService> extensionPoint =
      registerExtensionPoint(
          ExtensionPointName.create("com.android.project.buildSystemService"),
          BuildSystemService.class);
  extensionPoint.registerExtension(new BlazeBuildSystemService());

  service = BuildSystemService.getInstance(project);
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:18,代碼來源:BlazeBuildSystemServiceTest.java

示例5: addModuleExtension

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
protected <T> void addModuleExtension(final ExtensionPointName<T> name, final T extension) {
  final ExtensionPoint<T> extensionPoint = Extensions.getArea(this).getExtensionPoint(name);
  extensionPoint.registerExtension(extension);
  Disposer.register(myLifetime, new Disposable() {
    @Override
    public void dispose() {
      extensionPoint.unregisterExtension(extension);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:CoreModule.java

示例6: getInstance

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
@Nullable
public static <T> T getInstance(ExtensionPointName<MixinEP<T>> name, Object key) {
  final MixinEP<T>[] eps = Extensions.getExtensions(name);
  for(MixinEP<T> ep: eps) {
    if (ep.getKey().isInstance(key)) {
      return ep.getInstance();
    }
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:MixinExtension.java

示例7: loadServicesFromBeans

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
public static <T> List<T> loadServicesFromBeans(final ExtensionPointName<ServiceBean> epName, Class<T> componentClass) {
  final List<T> components = new ArrayList<T>();
  for (ServiceBean exportableBean : Extensions.getExtensions(epName)) {
    final String serviceClass = exportableBean.serviceInterface;
    if (serviceClass == null) {
      LOG.error("Service interface not specified in " + epName);
      continue;
    }
    try {
      final Class<?> aClass = Class.forName(serviceClass, true, exportableBean.getPluginDescriptor().getPluginClassLoader());
      final Object service = ServiceManager.getService(aClass);
      if (service == null) {
        LOG.error("Can't find service: " + serviceClass);
        continue;
      }
      if (!componentClass.isInstance(service)) {
        LOG.error("Service " + serviceClass + " is registered in " + epName.getName() + " EP, but doesn't implement " + componentClass.getName());
        continue;
      }

      components.add((T)service);
    }
    catch (ClassNotFoundException e) {
      LOG.error(e);
    }
  }
  return components;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:29,代碼來源:ServiceBean.java

示例8: registerExtension

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
public static <T> void registerExtension(@NotNull ExtensionsArea area, @NotNull ExtensionPointName<T> name, @NotNull final T t, @NotNull Disposable parentDisposable) {
  final ExtensionPoint<T> extensionPoint = area.getExtensionPoint(name.getName());
  extensionPoint.registerExtension(t);
  Disposer.register(parentDisposable, new Disposable() {
    @Override
    public void dispose() {
      extensionPoint.unregisterExtension(t);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:PlatformTestUtil.java

示例9: registerExtension

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
public <T> void registerExtension(final ExtensionsArea area, final ExtensionPointName<T> epName, final T extension) {
  assertInitialized();
  final ExtensionPoint<T> extensionPoint = area.getExtensionPoint(epName);
  extensionPoint.registerExtension(extension);
  Disposer.register(getTestRootDisposable(), new Disposable() {
    @Override
    public void dispose() {
      extensionPoint.unregisterExtension(extension);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:CodeInsightTestFixtureImpl.java

示例10: registerExtensionPoint

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
@Override
protected <T> void registerExtensionPoint(final ExtensionPointName<T> extensionPointName, Class<T> aClass) {
  super.registerExtensionPoint(extensionPointName, aClass);
  Disposer.register(myProject, new Disposable() {
    @Override
    public void dispose() {
      Extensions.getRootArea().unregisterExtensionPoint(extensionPointName.getName());
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:ParsingTestCase.java

示例11: registerExtensionPoint

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
protected <T> void registerExtensionPoint(final ExtensionsArea area, final ExtensionPointName<T> extensionPointName,
                                          final Class<? extends T> aClass) {
  final String name = extensionPointName.getName();
  if (!area.hasExtensionPoint(name)) {
    ExtensionPoint.Kind kind = aClass.isInterface() || (aClass.getModifiers() & Modifier.ABSTRACT) != 0 ? ExtensionPoint.Kind.INTERFACE : ExtensionPoint.Kind.BEAN_CLASS;
    area.registerExtensionPoint(name, aClass.getName(), kind);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:PlatformLiteFixture.java

示例12: createConfigurables

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
public static <T extends UnnamedConfigurable> List<T> createConfigurables(ExtensionPointName<? extends ConfigurableEP<T>> name) {
  return ContainerUtil.mapNotNull(name.getExtensions(), new NullableFunction<ConfigurableEP<T>, T>() {
    @Override
    public T fun(ConfigurableEP<T> ep) {
      return wrapConfigurable(ep);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:ConfigurableWrapper.java

示例13: testManipulatorRegistered

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
public void testManipulatorRegistered() {
  LanguageExtensionPoint[] extensions =
    Extensions.getExtensions(new ExtensionPointName<LanguageExtensionPoint>("com.intellij.lang.parserDefinition"));
  Set<String> classes = new HashSet<String>();
  List<String> failures = new ArrayList<String>();
  int total = 0;
  for (LanguageExtensionPoint e : extensions) {
    ParserDefinition definition = (ParserDefinition)e.getInstance();

    for (IElementType type : IElementType.enumerate(IElementType.TRUE)) {
      if (type instanceof ILeafElementType) continue;
      try {
        CompositeElement treeElement = ASTFactory.composite(type);
        total++;
        PsiElement element = treeElement instanceof PsiElement? (PsiElement)treeElement : definition.createElement(treeElement);
        if (element instanceof PsiLanguageInjectionHost && classes.add(element.getClass().getName())) {
          boolean ok = ElementManipulators.getManipulator(element) != null;
          System.out.println((ok ? "OK  " : "FAIL") + " " + element.getClass().getSimpleName() + " [" + definition.getClass().getSimpleName() + "]");
          if (!ok) failures.add(element.getClass().getName());
        }
      }
      catch (Throwable ignored) {
      }
    }
  }
  System.out.println("count: " + classes.size() + ", total: " + total);
  assertEmpty("PsiLanguageInjectionHost requires " + ElementManipulators.EP_NAME, failures);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:29,代碼來源:IElementTypeTest.java

示例14: addExtension

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
public <T> void addExtension(@NotNull ExtensionPointName<T> name, @NotNull final T extension) {
  final ExtensionPoint<T> extensionPoint = Extensions.getRootArea().getExtensionPoint(name);
  extensionPoint.registerExtension(extension);
  Disposer.register(myParentDisposable, new Disposable() {
    @Override
    public void dispose() {
      // There is a possible case that particular extension was replaced in particular environment, e.g. Upsource
      // replaces some IntelliJ extensions.
      if (extensionPoint.hasExtension(extension)) {
        extensionPoint.unregisterExtension(extension);
      }
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:CoreApplicationEnvironment.java

示例15: addProjectExtension

import com.intellij.openapi.extensions.ExtensionPointName; //導入依賴的package包/類
public <T> void addProjectExtension(@NotNull ExtensionPointName<T> name, @NotNull final T extension) {
  final ExtensionPoint<T> extensionPoint = Extensions.getArea(myProject).getExtensionPoint(name);
  extensionPoint.registerExtension(extension);
  Disposer.register(myParentDisposable, new Disposable() {
    @Override
    public void dispose() {
      extensionPoint.unregisterExtension(extension);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:CoreProjectEnvironment.java


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