getAdapter change
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerRuntimeWizardFragment.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerRuntimeWizardFragment.java
index 2b2c407..ea63ac1 100644
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerRuntimeWizardFragment.java
+++ b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerRuntimeWizardFragment.java
@@ -52,7 +52,6 @@
public class GenericServerRuntimeWizardFragment extends ServerDefinitionTypeAwareWizardFragment {
private GenericServerRuntime fRuntimeDelegate;
-
private GenericServerCompositeDecorator[] fDecorators;
/**
@@ -75,15 +74,15 @@
public void createContent(Composite parent, IWizardHandle handle) {
Map properties= null;
ServerRuntime definition=null;
- if(getRuntimeDelegate()!=null)
- {
- properties = getRuntimeDelegate().getServerInstanceProperties();
+ if(getRuntimeDelegate()!=null){
+ properties = getRuntimeDelegate().getServerInstanceProperties();
definition = getServerTypeDefinition(getServerDefinitionId(),properties);
}
- fDecorators =new GenericServerCompositeDecorator[2];
+ fDecorators= new GenericServerCompositeDecorator[2];
fDecorators[0]= new JRESelectDecorator(getRuntimeDelegate());
fDecorators[1]= new ServerTypeDefinitionRuntimeDecorator(definition,properties,getWizard(),getRuntimeDelegate());
GenericServerComposite composite = new GenericServerComposite(parent,fDecorators);
+
}
@@ -104,7 +103,8 @@
* @see org.eclipse.wst.server.ui.wizard.IWizardFragment#enter()
*/
public void enter() {
- getRuntimeDelegate().getRuntimeWorkingCopy().setName(createName());
+ if(getRuntimeDelegate()!=null)
+ getRuntimeDelegate().getRuntimeWorkingCopy().setName(createName());
for (int i = 0; i < fDecorators.length; i++) {
if(fDecorators[i].validate())
return;
@@ -150,7 +150,9 @@
IRuntimeWorkingCopy wc = (IRuntimeWorkingCopy)getTaskModel().getObject(TaskModel.TASK_RUNTIME);
if(wc==null)
return null;
- fRuntimeDelegate = (GenericServerRuntime)wc.getAdapter(RuntimeDelegate.class);
+ fRuntimeDelegate = (GenericServerRuntime)wc.getAdapter(GenericServerRuntime.class);
+ if(fRuntimeDelegate==null)
+ fRuntimeDelegate= (GenericServerRuntime)wc.loadAdapter(GenericServerRuntime.class,new NullProgressMonitor());
}
return fRuntimeDelegate;
}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerWizardFragment.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerWizardFragment.java
index 1dd060d..c5a8bd5 100644
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerWizardFragment.java
+++ b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerWizardFragment.java
@@ -32,11 +32,12 @@
import java.util.Map;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jst.server.generic.core.internal.GenericServer;
import org.eclipse.jst.server.generic.core.internal.GenericServerRuntime;
import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.TaskModel;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
@@ -79,8 +80,10 @@
private ServerRuntime getServerTypeDefinitionFor(IServerWorkingCopy server) {
GenericServerRuntime runtime = (GenericServerRuntime)server.getRuntime().getAdapter(GenericServerRuntime.class);
if(runtime==null){
- IRuntimeWorkingCopy wc = (IRuntimeWorkingCopy)getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+ IRuntime wc = (IRuntime)getTaskModel().getObject(TaskModel.TASK_RUNTIME);
runtime= (GenericServerRuntime)wc.getAdapter(GenericServerRuntime.class);
+ if(runtime==null)
+ runtime= (GenericServerRuntime)wc.loadAdapter(GenericServerRuntime.class,new NullProgressMonitor());
}
String id = runtime.getRuntime().getRuntimeType().getId();
if(id==null){