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;
}
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;
}
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);
}
}
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;
}
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;
}
Aggregations