View Javadoc

1   /*
2    WSMO Studio - a Semantic Web Service Editor
3    Copyright (c) 2004-2006, OntoText Lab. / SIRMA Group
4    
5    This library is free software; you can redistribute it and/or modify it under
6    the terms of the GNU Lesser General Public License as published by the Free
7    Software Foundation; either version 2.1 of the License, or (at your option)
8    any later version.
9    This library is distributed in the hope that it will be useful, but WITHOUT
10   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   details.
13   You should have received a copy of the GNU Lesser General Public License along
14   with this library; if not, write to the Free Software Foundation, Inc.,
15   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16   */
17  
18  /***
19   * <p>Title: WSMO Studio</p>
20   * <p>Description: Semantic Web Service Editor</p>
21   * <p>Copyright:  Copyright (c) 2004-2006</p>
22   * <p>Company: OntoText Lab. / SIRMA </p>
23   */
24  
25  package org.wsmostudio.choreography.navigator.actions;
26  
27  import org.eclipse.swt.widgets.TreeItem;
28  import org.wsmo.service.Interface;
29  import org.wsmo.service.choreography.Choreography;
30  import org.wsmostudio.ui.editors.model.ObservableModel;
31  import org.wsmostudio.ui.views.navigator.actions.AbstractAction;
32  
33  public class RemoveChoreography extends AbstractAction {
34  
35      public void run() {
36          
37          TreeItem[] selection = navigator.getTree().getTree().getSelection();
38          Choreography chorToRemove = (Choreography)selection[0].getData();
39          Interface iface = (Interface)selection[0].getParentItem().getData();
40          
41          ObservableModel uiModel = 
42              (ObservableModel)navigator.getWsmoInput().getAdapter(ObservableModel.class);
43          
44          if (false == navigator.ensureEditorForEntityIsClosed(chorToRemove)) {
45              return;
46          }
47          iface.setChoreography(null);
48          uiModel.setChanged();
49          navigator.fireEntityChanged(iface);
50      }
51  }
52  
53  /*
54   * $Log$
55   * Revision 1.2  2006/01/09 12:51:11  alex_simov
56   * Copyright message in header updated
57   *
58   * Revision 1.1  2005/11/17 16:09:58  alex_simov
59   * new navigator actions
60   *
61   */