use of com.intellij.openapi.extensions.ExtensionsArea in project intellij-community by JetBrains.
the class PathMacroManagerTest method setupApplication.
@Before
public final void setupApplication() throws Exception {
context = new JUnit4Mockery();
context.setImposteriser(ClassImposteriser.INSTANCE);
myApplication = context.mock(ApplicationEx.class, "application");
context.checking(new Expectations() {
{
allowing(myApplication).isUnitTestMode();
will(returnValue(false));
allowing(myApplication).getName();
will(returnValue("IDEA"));
// some tests leave invokeLater()'s after them
allowing(myApplication).invokeLater(with(any(Runnable.class)), with(any(ModalityState.class)));
allowing(myApplication).runReadAction(with(any(Runnable.class)));
will(new Action() {
@Override
public void describeTo(final Description description) {
description.appendText("runs runnable");
}
@Override
@Nullable
public Object invoke(final Invocation invocation) throws Throwable {
((Runnable) invocation.getParameter(0)).run();
return null;
}
});
}
});
final ExtensionsArea area = Extensions.getRootArea();
final String epName = PathMacrosCollector.MACRO_FILTER_EXTENSION_POINT_NAME.getName();
if (!area.hasExtensionPoint(epName)) {
area.registerExtensionPoint(epName, "com.intellij.openapi.application.PathMacroFilter");
Disposer.register(myRootDisposable, new Disposable() {
@Override
public void dispose() {
area.unregisterExtensionPoint(epName);
}
});
}
}
use of com.intellij.openapi.extensions.ExtensionsArea in project intellij-community by JetBrains.
the class PyCharmEduInitialConfigurator method patchProjectAreaExtensions.
private static void patchProjectAreaExtensions(@NotNull final Project project) {
Executor debugExecutor = DefaultDebugExecutor.getDebugExecutorInstance();
unregisterAction(debugExecutor.getId(), ExecutorRegistryImpl.RUNNERS_GROUP);
unregisterAction(debugExecutor.getContextActionId(), ExecutorRegistryImpl.RUN_CONTEXT_GROUP);
ExtensionsArea projectArea = Extensions.getArea(project);
for (SelectInTarget target : Extensions.getExtensions(SelectInTarget.EP_NAME, project)) {
if (ToolWindowId.FAVORITES_VIEW.equals(target.getToolWindowId()) || ToolWindowId.STRUCTURE_VIEW.equals(target.getToolWindowId())) {
projectArea.getExtensionPoint(SelectInTarget.EP_NAME).unregisterExtension(target);
}
}
for (AbstractProjectViewPane pane : Extensions.getExtensions(AbstractProjectViewPane.EP_NAME, project)) {
if (pane.getId().equals(ScopeViewPane.ID)) {
Disposer.dispose(pane);
projectArea.getExtensionPoint(AbstractProjectViewPane.EP_NAME).unregisterExtension(pane);
}
}
}
use of com.intellij.openapi.extensions.ExtensionsArea in project intellij-community by JetBrains.
the class PyCharmEduInitialConfigurator method patchRootAreaExtensions.
private static void patchRootAreaExtensions() {
ExtensionsArea rootArea = Extensions.getArea(null);
rootArea.unregisterExtensionPoint("com.intellij.runLineMarkerContributor");
for (ToolWindowEP ep : Extensions.getExtensions(ToolWindowEP.EP_NAME)) {
if (ToolWindowId.FAVORITES_VIEW.equals(ep.id) || ToolWindowId.TODO_VIEW.equals(ep.id) || EventLog.LOG_TOOL_WINDOW_ID.equals(ep.id) || ToolWindowId.STRUCTURE_VIEW.equals(ep.id)) {
rootArea.getExtensionPoint(ToolWindowEP.EP_NAME).unregisterExtension(ep);
}
}
for (DirectoryProjectConfigurator ep : Extensions.getExtensions(DirectoryProjectConfigurator.EP_NAME)) {
if (ep instanceof PlatformProjectViewOpener) {
rootArea.getExtensionPoint(DirectoryProjectConfigurator.EP_NAME).unregisterExtension(ep);
}
}
// unregister unrelated tips
for (TipAndTrickBean tip : Extensions.getExtensions(TipAndTrickBean.EP_NAME)) {
if (UNRELATED_TIPS.contains(tip.fileName)) {
rootArea.getExtensionPoint(TipAndTrickBean.EP_NAME).unregisterExtension(tip);
}
}
for (IntentionActionBean ep : Extensions.getExtensions(IntentionManager.EP_INTENTION_ACTIONS)) {
if ("org.intellij.lang.regexp.intention.CheckRegExpIntentionAction".equals(ep.className)) {
rootArea.getExtensionPoint(IntentionManager.EP_INTENTION_ACTIONS).unregisterExtension(ep);
}
}
final ExtensionPoint<ProjectAttachProcessor> point = Extensions.getRootArea().getExtensionPoint(ProjectAttachProcessor.EP_NAME);
for (ProjectAttachProcessor attachProcessor : Extensions.getExtensions(ProjectAttachProcessor.EP_NAME)) {
point.unregisterExtension(attachProcessor);
}
}
use of com.intellij.openapi.extensions.ExtensionsArea in project android by JetBrains.
the class CaptureServiceTest method testUpdate.
public void testUpdate() throws Exception {
CaptureService service = CaptureService.getInstance(myProject);
assertNull(service.getCapturesDirectory());
VirtualFile projectDir = LocalFileSystem.getInstance().findFileByPath(myProject.getBasePath());
assertNotNull(projectDir);
VirtualFile captures = createChildDirectory(projectDir, "captures");
assertTrue(service.getCaptures().isEmpty());
createChildData(captures, "data.capture");
service.update();
assertTrue(service.getCaptures().isEmpty());
ExtensionsArea area = Extensions.getRootArea();
Element element = readElement(" <extensions defaultExtensionNs=\"com.android\">\n" + " <captureType implementation=\"" + MyCaptureType.class.getName() + "\"/>\n </extensions>");
area.registerExtension(new DefaultPluginDescriptor(PluginId.getId("com.android")), element.getChild("captureType"));
MyCaptureType type = CaptureTypeService.getInstance().getType(MyCaptureType.class);
service.update();
assertEquals(1, service.getCaptures().size());
assertEquals(type, service.getCaptures().iterator().next().getType());
}
Aggregations