本文整理汇总了Java中com.intellij.diagnostic.PluginException类的典型用法代码示例。如果您正苦于以下问题:Java PluginException类的具体用法?Java PluginException怎么用?Java PluginException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PluginException类属于com.intellij.diagnostic包,在下文中一共展示了PluginException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: compute
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
@NotNull
protected Class compute() {
if (key == null) {
String error = "No key specified for mixin with implementation class " + implementationClass;
if (myPluginDescriptor != null) {
throw new PluginException(error, myPluginDescriptor.getPluginId());
}
throw new IllegalArgumentException(error);
}
try {
return findClass(key);
}
catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MixinEP.java
示例2: loadClassInsideSelf
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
@Nullable
private synchronized Class loadClassInsideSelf(@Nonnull String name) {
Class c = findLoadedClass(name);
if (c != null) {
return c;
}
try {
c = _findClass(name);
}
catch (IncompatibleClassChangeError | UnsupportedClassVersionError e) {
throw new PluginException("While loading class " + name + ": " + e.getMessage(), e, myPluginId);
}
if (c != null) {
PluginManagerCore.addPluginClass(myPluginId);
}
return c;
}
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:PluginClassLoader.java
示例3: wrapException
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
private static Exception wrapException(InvalidMirrorException e, VirtualFile file) {
ClassFileDecompilers.Decompiler decompiler = ClassFileDecompilers.find(file);
if (decompiler instanceof ClassFileDecompilers.Light) {
PluginId pluginId = PluginManagerCore.getPluginByClassName(decompiler.getClass().getName());
if (pluginId != null) {
return new PluginException(e, pluginId);
}
}
return e;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ClsFileImpl.java
示例4: reportActionError
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
private static void reportActionError(final PluginId pluginId, @NonNls @NotNull String message) {
if (pluginId == null) {
LOG.error(message);
}
else {
LOG.error(new PluginException(message, null, pluginId));
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ActionManagerImpl.java
示例5: reportActionWarning
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
private static void reportActionWarning(final PluginId pluginId, @NonNls @NotNull String message) {
if (pluginId == null) {
LOG.warn(message);
}
else {
LOG.warn(new PluginException(message, null, pluginId).getMessage());
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ActionManagerImpl.java
示例6: getStateSpecOrError
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
@NotNull
public static State getStateSpecOrError(@NotNull Class<? extends PersistentStateComponent> componentClass) {
State spec = getStateSpec(componentClass);
if (spec != null) {
return spec;
}
PluginId pluginId = PluginManagerCore.getPluginByClassName(componentClass.getName());
if (pluginId == null) {
throw new RuntimeException("No @State annotation found in " + componentClass);
}
else {
throw new PluginException("No @State annotation found in " + componentClass, pluginId);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:StoreUtil.java
示例7: processException
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
public static void processException(Throwable t) {
if (!IdeaApplication.isLoaded()) {
@SuppressWarnings("ThrowableResultOfMethodCallIgnored") StartupAbortedException se = findCause(t, StartupAbortedException.class);
if (se == null) se = new StartupAbortedException(t);
@SuppressWarnings("ThrowableResultOfMethodCallIgnored") PluginException pe = findCause(t, PluginException.class);
PluginId pluginId = pe != null ? pe.getPluginId() : null;
if (Logger.isInitialized() && !(t instanceof ProcessCanceledException)) {
try {
getLogger().error(t);
}
catch (Throwable ignore) { }
}
if (pluginId != null && !CORE_PLUGIN_ID.equals(pluginId.getIdString())) {
disablePlugin(pluginId.getIdString());
StringWriter message = new StringWriter();
message.append("Plugin '").append(pluginId.getIdString()).append("' failed to initialize and will be disabled. ");
message.append(" Please restart ").append(ApplicationNamesInfo.getInstance().getFullProductName()).append('.');
message.append("\n\n");
pe.getCause().printStackTrace(new PrintWriter(message));
Main.showMessage("Plugin Error", message.toString(), false);
System.exit(Main.PLUGIN_ERROR);
}
else {
Main.showMessage("Start Failed", t);
System.exit(se.exitCode());
}
}
else if (!(t instanceof ProcessCanceledException)) {
getLogger().error(t);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:PluginManager.java
示例8: handleComponentError
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
public static void handleComponentError(Throwable t, @Nullable String componentClassName, @Nullable PluginId pluginId) {
Application app = ApplicationManager.getApplication();
if (app != null && app.isUnitTestMode()) {
if (t instanceof Error) throw (Error)t;
if (t instanceof RuntimeException) throw (RuntimeException)t;
throw new RuntimeException(t);
}
if (t instanceof StartupAbortedException) {
throw (StartupAbortedException)t;
}
if (pluginId == null || CORE_PLUGIN_ID.equals(pluginId.getIdString())) {
if (componentClassName != null) {
pluginId = getPluginByClassName(componentClassName);
}
}
if (pluginId == null || CORE_PLUGIN_ID.equals(pluginId.getIdString())) {
if (t instanceof PicoPluginExtensionInitializationException) {
pluginId = ((PicoPluginExtensionInitializationException)t).getPluginId();
}
}
if (pluginId != null && !CORE_PLUGIN_ID.equals(pluginId.getIdString())) {
throw new StartupAbortedException(new PluginException(t, pluginId));
}
else {
throw new StartupAbortedException("Fatal error initializing '" + componentClassName + "'", t);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:PluginManager.java
示例9: testPresentation
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
public void testPresentation() {
ActionManager manager = ActionManager.getInstance();
List<String> failures = new SmartList<String>();
for (String id : manager.getActionIds("")) {
if (!ACTION_WITHOUT_TEXT_AND_DESCRIPTION.equals(id)) {
try {
AnAction stub = manager.getActionOrStub(id);
AnAction action = manager.getAction(id);
String message = id + " (" + action.getClass().getName() + ")";
if (stub != action) {
Presentation before = stub.getTemplatePresentation();
Presentation after = action.getTemplatePresentation();
checkPresentationProperty("icon", message, before.getIcon(), after.getIcon());
checkPresentationProperty("text", message, before.getText(), after.getText());
checkPresentationProperty("description", message, before.getDescription(), after.getDescription());
}
if (action instanceof ActionGroup) {
System.out.println("ignored action group: " + message);
}
else if (StringUtil.isEmpty(action.getTemplatePresentation().getText())) {
failures.add("no text: " + message);
}
}
catch (PluginException exception) {
System.out.println(id + " ignored because " + exception.getMessage());
}
}
}
assertEmpty(failures);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ActionsTreeTest.java
示例10: _saveSettings
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
public void _saveSettings() { // public for testing purposes
if (mySaveSettingsIsInProgress.compareAndSet(false, true)) {
try {
StoreUtil.doSave(getStateStore());
}
catch (final Throwable ex) {
if (isUnitTestMode()) {
System.out.println("Saving application settings failed");
ex.printStackTrace();
}
else {
LOG.info("Saving application settings failed", ex);
invokeLater(new Runnable() {
@Override
public void run() {
if (ex instanceof PluginException) {
final PluginException pluginException = (PluginException)ex;
PluginManagerCore.disablePlugin(pluginException.getPluginId().getIdString());
Messages.showMessageDialog("The plugin " +
pluginException.getPluginId() +
" failed to save settings and has been disabled. Please restart " +
ApplicationNamesInfo.getInstance().getFullProductName(), CommonBundle.getErrorTitle(),
Messages.getErrorIcon());
}
else {
Messages.showMessageDialog(ApplicationBundle.message("application.save.settings.error", ex.getLocalizedMessage()),
CommonBundle.getErrorTitle(), Messages.getErrorIcon());
}
}
});
}
}
finally {
mySaveSettingsIsInProgress.set(false);
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:39,代码来源:ApplicationImpl.java
示例11: getStateSpec
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
private static <T> State getStateSpec(@NotNull final PersistentStateComponent<T> persistentStateComponent) {
final Class<? extends PersistentStateComponent> aClass = persistentStateComponent.getClass();
final State stateSpec = aClass.getAnnotation(State.class);
if (stateSpec == null) {
final PluginId pluginId = PluginManager.getPluginByClassName(aClass.getName());
if (pluginId != null) {
throw new PluginException("No @State annotation found in " + aClass, pluginId);
}
throw new RuntimeException("No @State annotation found in " + aClass);
}
return stateSpec;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:ComponentStoreImpl.java
示例12: reportActionError
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
private static void reportActionError(final PluginId pluginId, @NonNls final String message) {
if (pluginId == null) {
LOG.error(message);
}
else {
LOG.error(new PluginException(message, null, pluginId));
}
}
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:ActionManagerImpl.java
示例13: wrapException
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
private static Exception wrapException(InvalidMirrorException e, VirtualFile file)
{
ClassFileDecompilers.Decompiler decompiler = ClassFileDecompilers.find(file);
if(decompiler instanceof ClassFileDecompilers.Light)
{
PluginId pluginId = PluginManagerCore.getPluginByClassName(decompiler.getClass().getName());
if(pluginId != null)
{
return new PluginException(e, pluginId);
}
}
return e;
}
开发者ID:consulo,项目名称:consulo-java,代码行数:15,代码来源:ClsFileImpl.java
示例14: getPoint
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
@Nullable
private ExtensionPoint<KeyedLazyInstance<T>> getPoint() {
ExtensionPoint<KeyedLazyInstance<T>> point = myPoint;
if (point == null && Extensions.getRootArea().hasExtensionPoint(myEpName)) {
ExtensionPointName<KeyedLazyInstance<T>> typesafe = ExtensionPointName.create(myEpName);
myPoint = point = Extensions.getRootArea().getExtensionPoint(typesafe);
myListener = new ExtensionPointAndAreaListener<KeyedLazyInstance<T>>() {
@Override
public void extensionAdded(@NotNull final KeyedLazyInstance<T> bean, @Nullable final PluginDescriptor pluginDescriptor) {
synchronized (lock) {
if (bean.getKey() == null) {
if (pluginDescriptor != null) {
throw new PluginException("No key specified for extension of class " + bean.getInstance().getClass(),
pluginDescriptor.getPluginId());
}
LOG.error("No key specified for extension of class " + bean.getInstance().getClass());
return;
}
myCache.remove(bean.getKey());
for (ExtensionPointListener<T> listener : myListeners) {
listener.extensionAdded(bean.getInstance(), null);
}
}
}
@Override
public void extensionRemoved(@NotNull final KeyedLazyInstance<T> bean, @Nullable final PluginDescriptor pluginDescriptor) {
synchronized (lock) {
myCache.remove(bean.getKey());
for (ExtensionPointListener<T> listener : myListeners) {
listener.extensionRemoved(bean.getInstance(), null);
}
}
}
@Override
public void areaReplaced(final ExtensionsArea area) {
resetAreaListener();
}
};
point.addExtensionPointListener(myListener);
}
return point;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:46,代码来源:KeyedExtensionCollector.java
示例15: getComponentInstance
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
@Override
public Object getComponentInstance(PicoContainer picoContainer) throws PicoInitializationException, PicoIntrospectionException, ProcessCanceledException {
Object instance = myInitializedComponentInstance;
if (instance != null) {
return instance;
}
try {
//noinspection SynchronizeOnThis
synchronized (this) {
instance = myInitializedComponentInstance;
if (instance != null) {
return instance;
}
long startTime = System.nanoTime();
instance = super.getComponentInstance(picoContainer);
if (myInitializing) {
String errorMessage = "Cyclic component initialization: " + getComponentKey();
if (myPluginId != null) {
LOG.error(new PluginException(errorMessage, myPluginId));
}
else {
LOG.error(new Throwable(errorMessage));
}
}
try {
myInitializing = true;
registerComponentInstance(instance);
ProgressIndicator indicator = getProgressIndicator();
if (indicator != null) {
indicator.checkCanceled();
setProgressDuringInit(indicator);
}
initializeComponent(instance, false);
if (instance instanceof BaseComponent) {
((BaseComponent)instance).initComponent();
}
long ms = (System.nanoTime() - startTime) / 1000000;
if (ms > 10 && logSlowComponents()) {
LOG.info(instance.getClass().getName() + " initialized in " + ms + " ms");
}
}
finally {
myInitializing = false;
}
myInitializedComponentInstance = instance;
}
}
catch (ProcessCanceledException e) {
throw e;
}
catch (Throwable t) {
handleInitComponentError(t, ((Class)getComponentKey()).getName(), myPluginId);
}
return instance;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:64,代码来源:ComponentManagerImpl.java
示例16: doCompile
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
private void doCompile(final CompileContextImpl compileContext,
final boolean isRebuild,
final boolean forceCompile,
final CompileStatusNotification callback,
final boolean checkCachesVersion) {
ExitStatus status = ExitStatus.ERRORS;
boolean wereExceptions = false;
final long vfsTimestamp = (ManagingFS.getInstance()).getCreationTimestamp();
try {
if (checkCachesVersion) {
checkCachesVersion(compileContext, vfsTimestamp);
if (compileContext.isRebuildRequested()) {
return;
}
}
writeStatus(new CompileStatus(CompilerConfigurationImpl.DEPENDENCY_FORMAT_VERSION, true, vfsTimestamp), compileContext);
if (compileContext.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
return;
}
myAllOutputDirectories = getAllOutputDirectories(compileContext);
status = doCompile(compileContext, isRebuild, forceCompile, false);
}
catch (Throwable ex) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
throw new RuntimeException(ex);
}
wereExceptions = true;
final PluginId pluginId = IdeErrorsDialog.findPluginId(ex);
final StringBuilder message = new StringBuilder();
message.append("Internal error");
if (pluginId != null) {
message.append(" (Plugin: ").append(pluginId).append(")");
}
message.append(": ").append(ex.getMessage());
compileContext.addMessage(CompilerMessageCategory.ERROR, message.toString(), null, -1, -1);
if (pluginId != null) {
throw new PluginException(ex, pluginId);
}
throw new RuntimeException(ex);
}
finally {
dropDependencyCache(compileContext);
CompilerCacheManager.getInstance(myProject).flushCaches();
if (compileContext.isRebuildRequested()) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
final CompilerMessageImpl msg = new CompilerMessageImpl(myProject, CompilerMessageCategory.INFORMATION, compileContext.getRebuildReason());
doRebuild(callback, msg, false, compileContext.getCompileScope());
}
}, ModalityState.NON_MODAL);
}
else {
if (!myProject.isDisposed()) {
writeStatus(new CompileStatus(CompilerConfigurationImpl.DEPENDENCY_FORMAT_VERSION, wereExceptions, vfsTimestamp), compileContext);
}
final long duration = notifyCompilationCompleted(compileContext, callback, status, false);
CompilerUtil.logDuration(
"\tCOMPILATION FINISHED; Errors: " +
compileContext.getMessageCount(CompilerMessageCategory.ERROR) +
"; warnings: " +
compileContext.getMessageCount(CompilerMessageCategory.WARNING),
duration
);
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:70,代码来源:CompileDriver.java
示例17: getPoint
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
@Nullable
private ExtensionPoint<KeyedLazyInstance<T>> getPoint() {
if (myPoint == null) {
if (Extensions.getRootArea().hasExtensionPoint(myEpName)) {
ExtensionPointName<KeyedLazyInstance<T>> typesafe = ExtensionPointName.create(myEpName);
myPoint = Extensions.getRootArea().getExtensionPoint(typesafe);
myListener = new ExtensionPointAndAreaListener<KeyedLazyInstance<T>>() {
@Override
public void extensionAdded(@NotNull final KeyedLazyInstance<T> bean, @Nullable final PluginDescriptor pluginDescriptor) {
synchronized (lock) {
if (bean.getKey() == null) {
if (pluginDescriptor != null) {
throw new PluginException("No key specified for extension of class " + bean.getInstance().getClass(),
pluginDescriptor.getPluginId());
}
LOG.error("No key specified for extension of class " + bean.getInstance().getClass());
return;
}
myCache.remove(bean.getKey());
for (ExtensionPointListener<T> listener : myListeners) {
listener.extensionAdded(bean.getInstance(), null);
}
}
}
@Override
public void extensionRemoved(@NotNull final KeyedLazyInstance<T> bean, @Nullable final PluginDescriptor pluginDescriptor) {
synchronized (lock) {
myCache.remove(bean.getKey());
for (ExtensionPointListener<T> listener : myListeners) {
listener.extensionRemoved(bean.getInstance(), null);
}
}
}
@Override
public void areaReplaced(final ExtensionsArea area) {
resetAreaListener();
}
};
myPoint.addExtensionPointListener(myListener);
}
}
return myPoint;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:47,代码来源:KeyedExtensionCollector.java
示例18: ComponentConfigComponentAdapter
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
public ComponentConfigComponentAdapter(final ComponentConfig config, Class<?> implementationClass) {
myConfig = config;
final String componentKey = config.getInterfaceClass();
myDelegate = new CachingComponentAdapter(new ConstructorInjectionComponentAdapter(componentKey, implementationClass, null, true)) {
@Override
public Object getComponentInstance(PicoContainer picoContainer) throws PicoInitializationException, PicoIntrospectionException {
ProgressIndicator indicator = getProgressIndicator();
if (indicator != null) {
indicator.checkCanceled();
}
Object componentInstance = null;
try {
long startTime = myInitialized ? 0 : System.nanoTime();
componentInstance = super.getComponentInstance(picoContainer);
if (!myInitialized) {
if (myInitializing) {
if (myConfig.pluginDescriptor != null) {
LOG.error(new PluginException("Cyclic component initialization: " + componentKey, myConfig.pluginDescriptor.getPluginId()));
}
else {
LOG.error(new Throwable("Cyclic component initialization: " + componentKey));
}
}
try {
myInitializing = true;
myComponentsRegistry.registerComponentInstance(componentInstance);
initializeComponent(componentInstance, false);
if (componentInstance instanceof BaseComponent) {
((BaseComponent)componentInstance).initComponent();
}
long ms = (System.nanoTime() - startTime) / 1000000;
if (ms > 10 && logSlowComponents()) {
LOG.info(componentInstance.getClass().getName() + " initialized in " + ms + " ms");
}
}
finally {
myInitializing = false;
}
myInitialized = true;
}
}
catch (ProcessCanceledException e) {
throw e;
}
catch (StateStorageException e) {
throw e;
}
catch (Throwable t) {
handleInitComponentError(t, componentKey, config);
}
return componentInstance;
}
};
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:64,代码来源:ComponentManagerImpl.java
示例19: doCompile
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
private void doCompile(final CompileContextImpl compileContext,
final boolean isRebuild,
final boolean forceCompile,
final CompileStatusNotification callback,
final boolean checkCachesVersion) {
ExitStatus status = ExitStatus.ERRORS;
boolean wereExceptions = false;
final long vfsTimestamp = (ManagingFS.getInstance()).getCreationTimestamp();
try {
if (checkCachesVersion) {
checkCachesVersion(compileContext, vfsTimestamp);
if (compileContext.isRebuildRequested()) {
return;
}
}
writeStatus(new CompileStatus(DEPENDENCY_FORMAT_VERSION, true, vfsTimestamp), compileContext);
if (compileContext.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
return;
}
myAllOutputDirectories = getAllOutputDirectories(compileContext);
status = doCompile(compileContext, isRebuild, forceCompile, false);
}
catch (Throwable ex) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
throw new RuntimeException(ex);
}
wereExceptions = true;
final PluginId pluginId = IdeErrorsDialog.findPluginId(ex);
final StringBuilder message = new StringBuilder();
message.append("Internal error");
if (pluginId != null) {
message.append(" (Plugin: ").append(pluginId).append(")");
}
message.append(": ").append(ex.getMessage());
compileContext.addMessage(CompilerMessageCategory.ERROR, message.toString(), null, -1, -1);
if (pluginId != null) {
throw new PluginException(ex, pluginId);
}
throw new RuntimeException(ex);
}
finally {
dropDependencyCache(compileContext);
CompilerCacheManager.getInstance(myProject).flushCaches();
if (compileContext.isRebuildRequested()) {
ApplicationManager.getApplication().invokeLater(() -> {
final CompilerMessageImpl msg =
new CompilerMessageImpl(myProject, CompilerMessageCategory.INFORMATION, compileContext.getRebuildReason());
doRebuild(callback, msg, false, compileContext.getCompileScope());
}, ModalityState.NON_MODAL);
}
else {
if (!myProject.isDisposed()) {
writeStatus(new CompileStatus(DEPENDENCY_FORMAT_VERSION, wereExceptions, vfsTimestamp), compileContext);
}
final long duration = notifyCompilationCompleted(compileContext, callback, status, false);
CompilerUtil.logDuration("\tCOMPILATION FINISHED; Errors: " +
compileContext.getMessageCount(CompilerMessageCategory.ERROR) +
"; warnings: " +
compileContext.getMessageCount(CompilerMessageCategory.WARNING), duration);
}
}
}
开发者ID:consulo,项目名称:consulo,代码行数:67,代码来源:CompileDriver.java
示例20: getPoint
import com.intellij.diagnostic.PluginException; //导入依赖的package包/类
@Nullable
private ExtensionPoint<KeyedLazyInstance<T>> getPoint() {
ExtensionPoint<KeyedLazyInstance<T>> point = myPoint;
if (point == null && Extensions.getRootArea().hasExtensionPoint(myEpName)) {
ExtensionPointName<KeyedLazyInstance<T>> typesafe = ExtensionPointName.create(myEpName);
myPoint = point = Extensions.getRootArea().getExtensionPoint(typesafe);
myListener = new ExtensionPointAndAreaListener<KeyedLazyInstance<T>>() {
@Override
public void extensionAdded(@Nonnull final KeyedLazyInstance<T> bean, @Nullable final PluginDescriptor pluginDescriptor) {
synchronized (lock) {
if (bean.getKey() == null) {
if (pluginDescriptor != null) {
throw new PluginException("No key specified for extension of class " + bean.getInstance().getClass(),
pluginDescriptor.getPluginId());
}
LOG.error("No key specified for extension of class " + bean.getInstance().getClass());
return;
}
myCache.remove(bean.getKey());
for (ExtensionPointListener<T> listener : myListeners) {
listener.extensionAdded(bean.getInstance(), null);
}
}
}
@Override
public void extensionRemoved(@Nonnull final KeyedLazyInstance<T> bean, @Nullable final PluginDescriptor pluginDescriptor) {
synchronized (lock) {
myCache.remove(bean.getKey());
for (ExtensionPointListener<T> listener : myListeners) {
listener.extensionRemoved(bean.getInstance(), null);
}
}
}
@Override
public void areaReplaced(final ExtensionsArea area) {
resetAreaListener();
}
};
point.addExtensionPointListener(myListener);
}
return point;
}
开发者ID:consulo,项目名称:consulo,代码行数:46,代码来源:KeyedExtensionCollector.java
注:本文中的com.intellij.diagnostic.PluginException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论