Search in sources :

Example 46 with PluginId

use of com.intellij.openapi.extensions.PluginId in project intellij-community by JetBrains.

the class ExtensionsRootType method getPluginResourcesRootName.

@Nullable
private String getPluginResourcesRootName(VirtualFile resourcesDir) throws IOException {
    PluginId ownerPluginId = getOwner(resourcesDir);
    if (ownerPluginId == null)
        return null;
    if (PluginManagerCore.CORE_PLUGIN_ID.equals(ownerPluginId.getIdString())) {
        return PlatformUtils.getPlatformPrefix();
    }
    IdeaPluginDescriptor plugin = PluginManager.getPlugin(ownerPluginId);
    if (plugin != null) {
        return plugin.getName();
    }
    return null;
}
Also used : IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor) PluginId(com.intellij.openapi.extensions.PluginId) Nullable(org.jetbrains.annotations.Nullable)

Example 47 with PluginId

use of com.intellij.openapi.extensions.PluginId in project intellij-community by JetBrains.

the class ExtensionsRootType method getPath.

@Nullable
String getPath(@Nullable VirtualFile resource) {
    VirtualFile pluginResourcesDir = getPluginResourcesDirectoryFor(resource);
    PluginId pluginId = getOwner(pluginResourcesDir);
    return pluginResourcesDir != null && pluginId != null ? VfsUtilCore.getRelativePath(resource, pluginResourcesDir) : null;
}
Also used : PluginId(com.intellij.openapi.extensions.PluginId) Nullable(org.jetbrains.annotations.Nullable)

Example 48 with PluginId

use of com.intellij.openapi.extensions.PluginId in project intellij-community by JetBrains.

the class RestoreBundledExtensionsAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    ExtensionsRootType extensionsRootType = ExtensionsRootType.getInstance();
    VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
    PluginId pluginId = extensionsRootType.getOwner(file);
    String path = extensionsRootType.getPath(file);
    assert file != null && pluginId != null && path != null;
    try {
        extensionsRootType.extractBundledResources(pluginId, path);
    } catch (IOException ex) {
        ExtensionsRootType.LOG.warn("Failed to extract bundled extensions for " + file.getPath(), ex);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) IOException(java.io.IOException) PluginId(com.intellij.openapi.extensions.PluginId)

Example 49 with PluginId

use of com.intellij.openapi.extensions.PluginId in project intellij-community by JetBrains.

the class ExtensionComponentAdapter method getComponentInstance.

@Override
public Object getComponentInstance(final PicoContainer container) throws PicoException, ProcessCanceledException {
    if (myComponentInstance == null) {
        try {
            if (Element.class.equals(getComponentImplementation())) {
                myComponentInstance = myExtensionElement;
            } else {
                Object componentInstance = getDelegate().getComponentInstance(container);
                if (myDeserializeInstance) {
                    try {
                        XmlSerializer.deserializeInto(componentInstance, myExtensionElement);
                    } catch (Exception e) {
                        throw new PicoInitializationException(e);
                    }
                }
                myComponentInstance = componentInstance;
            }
        } catch (ProcessCanceledException e) {
            throw e;
        } catch (Throwable t) {
            PluginId pluginId = myPluginDescriptor != null ? myPluginDescriptor.getPluginId() : null;
            throw new PicoPluginExtensionInitializationException(t.getMessage(), t, pluginId);
        }
        if (myComponentInstance instanceof PluginAware) {
            PluginAware pluginAware = (PluginAware) myComponentInstance;
            pluginAware.setPluginDescriptor(myPluginDescriptor);
        }
    }
    return myComponentInstance;
}
Also used : PluginAware(com.intellij.openapi.extensions.PluginAware) PluginId(com.intellij.openapi.extensions.PluginId) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException)

Example 50 with PluginId

use of com.intellij.openapi.extensions.PluginId in project intellij-elixir by KronicDeth.

the class Submitter method errorBean.

@NotNull
private static ErrorBean errorBean(@NotNull IdeaLoggingEvent[] events, String additionalInfo) {
    IdeaLoggingEvent event = events[0];
    ErrorBean bean = new ErrorBean(event.getThrowable(), IdeaLogger.ourLastActionId);
    bean.setDescription(additionalInfo);
    bean.setMessage(event.getMessage());
    Throwable throwable = event.getThrowable();
    if (throwable != null) {
        final PluginId pluginId = IdeErrorsDialog.findPluginId(throwable);
        if (pluginId != null) {
            final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId);
            if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) {
                bean.setPluginName(ideaPluginDescriptor.getName());
                bean.setPluginVersion(ideaPluginDescriptor.getVersion());
            }
        }
    }
    Object data = event.getData();
    if (data instanceof LogMessageEx) {
        bean.setAttachments(includedAttachments((LogMessageEx) data));
    }
    return bean;
}
Also used : ErrorBean(com.intellij.errorreport.bean.ErrorBean) LogMessageEx(com.intellij.diagnostic.LogMessageEx) IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor) PluginId(com.intellij.openapi.extensions.PluginId) IdeaLoggingEvent(com.intellij.openapi.diagnostic.IdeaLoggingEvent) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

PluginId (com.intellij.openapi.extensions.PluginId)54 IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)25 NotNull (org.jetbrains.annotations.NotNull)10 IOException (java.io.IOException)8 IdeaLoggingEvent (com.intellij.openapi.diagnostic.IdeaLoggingEvent)6 Project (com.intellij.openapi.project.Project)6 Nullable (org.jetbrains.annotations.Nullable)6 SubmittedReportInfo (com.intellij.openapi.diagnostic.SubmittedReportInfo)5 PluginException (com.intellij.diagnostic.PluginException)4 DataContext (com.intellij.openapi.actionSystem.DataContext)4 NonNls (org.jetbrains.annotations.NonNls)4 ErrorBean (com.intellij.errorreport.bean.ErrorBean)3 EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)3 PluginDownloader (com.intellij.openapi.updateSettings.impl.PluginDownloader)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 File (java.io.File)3 AbstractMessage (com.intellij.diagnostic.AbstractMessage)2 LogMessageEx (com.intellij.diagnostic.LogMessageEx)2 CantRunException (com.intellij.execution.CantRunException)2 DataManager (com.intellij.ide.DataManager)2