blob: f179bbccb120bdc936c3f015972346e9406982e6 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2010 Eteration A.S. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* - This code is based on WTP SDK frameworks and Tomcat Server Adapters
* org.eclipse.jst.server.core
* org.eclipse.jst.server.ui
*
* Naci Dai and Murat Yener, Eteration A.S.
*******************************************************************************/
package org.eclipse.libra.framework.ui;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.libra.framework.core.FrameworkCorePlugin;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
import org.eclipse.wst.server.core.TaskModel;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
/**
*
*/
public class OSGIFrameworkWizardFragment extends WizardFragment {
protected OSGIFrameworkComposite comp;
public OSGIFrameworkWizardFragment() {
// do nothing
}
public boolean hasComposite() {
return true;
}
public boolean isComplete() {
IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
if (runtime == null)
return false;
IStatus status = runtime.validate(null);
return (status == null || status.getSeverity() != IStatus.ERROR);
}
/* (non-Javadoc)
* @see org.eclipse.wst.server.ui.task.WizardFragment#createComposite()
*/
public Composite createComposite(Composite parent, IWizardHandle wizard) {
comp = new OSGIFrameworkComposite(parent, wizard);
return comp;
}
public void enter() {
if (comp != null) {
IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
comp.setRuntime(runtime);
}
}
public void exit() {
IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
IPath path = runtime.getLocation();
if (runtime.validate(null).getSeverity() != IStatus.ERROR)
FrameworkCorePlugin.setPreference("location" + runtime.getRuntimeType().getId(), path.toString());
}
}