本文整理汇总了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());
}
示例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");
}
示例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);
}
示例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);
}
});
}
示例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;
}
示例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;
}
示例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);
}
});
}
示例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);
}
});
}
示例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());
}
});
}
示例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);
}
}
示例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);
}
});
}
示例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);
}
示例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);
}
}
});
}
示例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);
}
});
}