/*******************************************************************************
* Copyright (c) 2009, 2010 Innovation Gate GmbH.
* 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:
* Innovation Gate GmbH - initial API and implementation
******************************************************************************/
package de.innovationgate.eclipse.wgadesigner.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import de.innovationgate.eclipse.wgadesigner.WGADesignerPlugin;
import de.innovationgate.eclipse.wgadesigner.natures.WGARuntime;
import de.innovationgate.eclipse.wgadesigner.team.WGARemoteServerSynchronizationWizard;
public class SynchronizeWithRemoteServer implements IObjectActionDelegate {
private WGARuntime _wgaRuntime;
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
}
public void run(IAction action) {
if (_wgaRuntime != null) {
WGARemoteServerSynchronizationWizard wizard = new WGARemoteServerSynchronizationWizard(_wgaRuntime);
WizardDialog dialog = new WizardDialog(WGADesignerPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
dialog.open();
}
}
public void selectionChanged(IAction action, ISelection selection) {
_wgaRuntime = WGARuntime.fromSelection(selection);
if (_wgaRuntime != null) {
action.setEnabled(true);
} else {
action.setEnabled(false);
}
}
}