Author: rob.stryker(a)jboss.com
Date: 2008-10-14 12:53:33 -0400 (Tue, 14 Oct 2008)
New Revision: 10834
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ServerViewProvider.java
Log:
JBIDE-2893 NPE for fileset view provider
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ServerViewProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ServerViewProvider.java 2008-10-14
16:22:39 UTC (rev 10833)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ServerViewProvider.java 2008-10-14
16:53:33 UTC (rev 10834)
@@ -33,6 +33,7 @@
private boolean enabled;
private int weight;
+ private boolean loadFailed = false;
public ServerViewProvider(IConfigurationElement element) {
this.element = element;
@@ -84,11 +85,12 @@
public JBossServerViewExtension getDelegate() {
try {
- if( extension == null ) {
+ if( extension == null && !loadFailed) {
extension =
(JBossServerViewExtension)element.createExecutableExtension(PROVIDER_LABEL);
extension.setViewProvider(this);
}
} catch( CoreException ce ) {
+ loadFailed = true;
ce.printStackTrace();
}
return extension;
@@ -105,15 +107,15 @@
public void setEnabled(boolean enable) {
if( enable && !enabled ) {
enabled = true;
- getDelegate().enable();
+ if(getDelegate() != null ) getDelegate().enable();
} else if( !enable && enabled ) {
enabled = false;
- getDelegate().disable();
+ if(getDelegate() != null ) getDelegate().disable();
}
}
public boolean supports(IServer server) {
- return getDelegate().supports(server);
+ return getDelegate() == null ? false : getDelegate().supports(server);
}
public int getWeight() {
@@ -125,7 +127,8 @@
}
public void dispose() {
- getDelegate().dispose();
+ if( getDelegate() != null )
+ getDelegate().dispose();
if( icon != null && iconDescriptor != null )
icon.dispose();
Show replies by date