Package es.upm.dit.gsi.eclipse.jadex.adfmanager.actions

Source Code of es.upm.dit.gsi.eclipse.jadex.adfmanager.actions.NewConfigurationAction

/*******************************************************************************
* Copyright (c) 2011 Grupo de Sistemas Inteligentes (GSI) - DIT UPM
*
* 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
*******************************************************************************/
package es.upm.dit.gsi.eclipse.jadex.adfmanager.actions;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;

import es.upm.dit.gsi.eclipse.jadex.adfmanager.wizards.AddConfigurationWizard;

/**
*
* This action is placed in the ADF files context menu. It's able to start the new
* configuration wizard in order to add a new configuration to the selected agent.
*
* @author Mario Moreno
*
*/

public class NewConfigurationAction implements IActionDelegate {
  private ISelection _selection;
  private Shell shell;
  WizardDialog dialog;
  AddConfigurationWizard wizard;

  /**
   * Constructor for NewBeliefAction
   */
  public NewConfigurationAction() {
    super();
  }

  /**
   * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
   */
  public void setActivePart(IAction action, IWorkbenchPart targetPart) {
    shell = targetPart.getSite().getShell();
  }

  /**
   * @see IActionDelegate#run(IAction)
   */
  public void run(IAction action) {
    if (_selection != null ) {
      wizard = new AddConfigurationWizard(_selection);
      shell = new Shell();
      dialog = new WizardDialog( shell, wizard );
      dialog.open();
        }

  }

  /**
   * @see IActionDelegate#selectionChanged(IAction, ISelection)
   */
  public void selectionChanged(IAction action, ISelection selection) {
    _selection = selection;
  }
}
TOP

Related Classes of es.upm.dit.gsi.eclipse.jadex.adfmanager.actions.NewConfigurationAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.