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.eclipse.ui.*;
29  import org.wsmo.service.choreography.Choreography;
30  import org.wsmostudio.choreography.editors.ChoreographyEditor;
31  import org.wsmostudio.runtime.LogManager;
32  import org.wsmostudio.ui.GUIHelper;
33  import org.wsmostudio.ui.editors.WSMOEditorInput;
34  import org.wsmostudio.ui.editors.model.ObservableModel;
35  import org.wsmostudio.ui.views.navigator.WSMONavigator;
36  import org.wsmostudio.ui.views.navigator.actions.AbstractAction;
37  
38  public class EditSignatureAction extends AbstractAction {
39  
40      public EditSignatureAction() {
41          super();
42      }
43      
44      public EditSignatureAction(WSMONavigator navi) {
45          super();
46          navigator = navi;
47      }
48      
49      public void run() {
50          
51          TreeItem[] selected = navigator.getTree().getTree().getSelection();
52          
53          Choreography choreography = (Choreography)selected[0].getParentItem().getData();
54          
55          try {
56              ObservableModel model = GUIHelper.createEditorModel(choreography, 
57                      (ObservableModel)navigator.getWsmoInput().getAdapter(ObservableModel.class),
58                      ChoreographyEditor.id);
59              IEditorInput input = new WSMOEditorInput(choreography, model);
60              PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
61                      .openEditor(input, ChoreographyEditor.id);
62          }
63          catch(PartInitException pie) {
64              LogManager.logError("Error opening editor \n"+pie.getMessage(), pie);
65          }
66      }
67  }
68  
69  /*
70   * $Log$
71   * Revision 1.4  2007/07/19 12:52:44  alex_simov
72   * refactoring in WSMO UI plug-in
73   *
74   * Revision 1.3  2006/04/18 07:30:16  alex_simov
75   * obsolete (WSMO proxy) checks removed
76   *
77   * Revision 1.2  2006/01/09 12:51:11  alex_simov
78   * Copyright message in header updated
79   *
80   * Revision 1.1  2005/11/16 16:23:31  alex_simov
81   * new WSMO navigator actions for StateSignature objects
82   *
83   *
84   */