blob: afcf36f325f5b50a638fde86ead7e5c362b0b6f3 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2003, 2005 IBM Corporation 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
*******************************************************************************/
package org.eclipse.wst.server.ui.internal.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
/**
* Action to create a new server element through a wizard.
*/
public abstract class NewWizardAction implements IWorkbenchWindowActionDelegate {
protected IWorkbench workbench;
protected IStructuredSelection selection;
/**
* NewWizardAction constructor comment.
*/
public NewWizardAction() {
super();
}
/**
* Disposes this action delegate. The implementor should unhook any references
* to itself so that garbage collection can occur.
*/
public void dispose() {
// do nothing
}
/**
* Initializes this action delegate with the workbench window it will work in.
*
* @param window the window that provides the context for this delegate
*/
public void init(IWorkbenchWindow window) {
workbench = window.getWorkbench();
}
/**
* Notifies this action delegate that the selection in the workbench has changed.
* <p>
* Implementers can use this opportunity to change the availability of the
* action or to modify other presentation properties.
* </p>
*
* @param action the action proxy that handles presentation portion of the action
* @param sel the current selection in the workbench
*/
public void selectionChanged(IAction action, ISelection sel) {
if (sel instanceof IStructuredSelection)
selection = (IStructuredSelection) sel;
else
selection = null;
}
}