use of org.eclipse.wst.server.core.internal.RuntimeTypeWithServerProxy in project webtools.servertools by eclipse.
the class NewRuntimeWizardFragment method createChildFragments.
protected void createChildFragments(List<WizardFragment> list) {
if (getTaskModel() == null)
return;
Object runtime = getTaskModel().getObject(TaskModel.TASK_RUNTIME);
if (runtime == null)
return;
WizardFragment sub = null;
if (runtime instanceof IRuntimeWorkingCopy)
sub = getWizardFragment(((RuntimeWorkingCopy) runtime).getRuntimeType().getId());
else if (runtime instanceof RuntimeTypeWithServerProxy)
sub = getWizardFragment(((RuntimeTypeWithServerProxy) runtime).getId());
if (sub != null)
list.add(sub);
Object serverObj = getTaskModel().getObject(TaskModel.TASK_SERVER);
if (serverObj != null && serverObj instanceof IServerWorkingCopy) {
IServerWorkingCopy server = (IServerWorkingCopy) serverObj;
if (server.getServerType().hasServerConfiguration() && server instanceof ServerWorkingCopy) {
ServerWorkingCopy swc = (ServerWorkingCopy) server;
try {
if (runtime instanceof IRuntimeWorkingCopy) {
RuntimeWorkingCopy runtimeWorkingCopy = (RuntimeWorkingCopy) runtime;
if (runtimeWorkingCopy.getLocation() != null && !runtimeWorkingCopy.getLocation().isEmpty())
swc.importRuntimeConfiguration(runtimeWorkingCopy, null);
}
} catch (CoreException ce) {
// ignore
}
}
list.add(new WizardFragment() {
public void enter() {
IRuntimeWorkingCopy runtime2 = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
IServerWorkingCopy server2 = (IServerWorkingCopy) getTaskModel().getObject(TaskModel.TASK_SERVER);
server2.setRuntime(runtime2);
}
});
sub = getWizardFragment(server.getServerType().getId());
if (sub != null)
list.add(sub);
list.add(WizardTaskUtil.SaveServerFragment);
}
}
use of org.eclipse.wst.server.core.internal.RuntimeTypeWithServerProxy in project webtools.servertools by eclipse.
the class RuntimeTypeTreeContentProvider method deferredAdapterInitialize.
protected void deferredAdapterInitialize(final TreeViewer treeViewer, IProgressMonitor monitor) {
List<TreeElement> list = new ArrayList<TreeElement>();
IRuntimeType[] runtimeTypes = ServerCore.getDownloadableRuntimeTypes(monitor);
if (runtimeTypes != null) {
int size = runtimeTypes.length;
for (int i = 0; i < size; i++) {
IRuntimeType runtimeType = runtimeTypes[i];
try {
if (!((RuntimeType) runtimeType).supportsManualCreation()) {
// Hide this runtime type from the list.
continue;
}
} catch (Exception e) {
// Do nothing since all IRuntimeType should be instance of RuntimeType.
}
TreeElement ele = getOrCreate(list, runtimeType.getVendor());
if (compareRuntimes(ele.contents, (RuntimeTypeWithServerProxy) runtimeType))
continue;
if (!compareRuntimes(runtimeInstalledList, (RuntimeTypeWithServerProxy) runtimeType)) {
// Sometime vendor name is different so need to search the entire list
ele.contents.add(runtimeType);
elementToParentMap.put(runtimeType, ele);
} else {
// Remove the empty node
if (ele.contents.isEmpty()) {
list.remove(ele);
elementToParentMap.remove(ele);
}
}
}
}
if (list.size() > 0) {
List<Object> newList = new ArrayList<Object>();
newList.addAll(Arrays.asList(elements));
newList.addAll(list);
elements = newList.toArray();
Display.getDefault().asyncExec(new Runnable() {
public void run() {
if (!treeViewer.getTree().isDisposed())
treeViewer.refresh("root");
}
});
}
}
use of org.eclipse.wst.server.core.internal.RuntimeTypeWithServerProxy in project webtools.servertools by eclipse.
the class RuntimeTypeTreeLabelProvider method getImageImpl.
/**
*/
protected Image getImageImpl(Object element) {
IRuntimeType runtimeType = (IRuntimeType) element;
Image image = ImageResource.getImage(runtimeType.getId());
DefaultServerImageDescriptor dsid = null;
if (element instanceof RuntimeTypeWithServerProxy) {
Image image1 = ImageResource.getImage(ImageResource.IMG_DOWN_ARROW);
dsid = new DefaultServerImageDescriptor(image, image1);
dsid.setFlags(DefaultServerImageDescriptor.BOTTOM_RIGHT);
image = dsid.createImage();
}
return image;
}
Aggregations