~peta-power-group/+junk/vIDE-trunk

« back to all changes in this revision

Viewing changes to net.launchpad.vide.diagram/src/net/launchpad/vide/flowchart/diagram/part/FlowchartDiagramUpdateCommand.java

  • Committer: Dražen Lučanin
  • Date: 2010-12-16 01:15:35 UTC
  • Revision ID: kermit666@gmail.com-20101216011535-5uk4xtiwbu9ia3hl
Added the algorithm domain model & deleted the old generated projects

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package net.launchpad.vide.flowchart.diagram.part;
2
 
 
3
 
import java.util.Iterator;
4
 
import java.util.List;
5
 
 
6
 
import org.eclipse.core.commands.ExecutionEvent;
7
 
import org.eclipse.core.commands.ExecutionException;
8
 
import org.eclipse.core.commands.IHandler;
9
 
import org.eclipse.core.commands.IHandlerListener;
10
 
import org.eclipse.emf.ecore.EObject;
11
 
import org.eclipse.gef.EditPart;
12
 
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
13
 
import org.eclipse.gmf.runtime.notation.View;
14
 
import org.eclipse.jface.viewers.ISelection;
15
 
import org.eclipse.jface.viewers.IStructuredSelection;
16
 
import org.eclipse.ui.PlatformUI;
17
 
 
18
 
/**
19
 
 * @generated
20
 
 */
21
 
public class FlowchartDiagramUpdateCommand implements IHandler {
22
 
 
23
 
        /**
24
 
         * @generated
25
 
         */
26
 
        public void addHandlerListener(IHandlerListener handlerListener) {
27
 
        }
28
 
 
29
 
        /**
30
 
         * @generated
31
 
         */
32
 
        public void dispose() {
33
 
        }
34
 
 
35
 
        /**
36
 
         * @generated
37
 
         */
38
 
        public Object execute(ExecutionEvent event) throws ExecutionException {
39
 
                ISelection selection = PlatformUI.getWorkbench()
40
 
                                .getActiveWorkbenchWindow().getSelectionService()
41
 
                                .getSelection();
42
 
                if (selection instanceof IStructuredSelection) {
43
 
                        IStructuredSelection structuredSelection = (IStructuredSelection) selection;
44
 
                        if (structuredSelection.size() != 1) {
45
 
                                return null;
46
 
                        }
47
 
                        if (structuredSelection.getFirstElement() instanceof EditPart
48
 
                                        && ((EditPart) structuredSelection.getFirstElement())
49
 
                                                        .getModel() instanceof View) {
50
 
                                EObject modelElement = ((View) ((EditPart) structuredSelection
51
 
                                                .getFirstElement()).getModel()).getElement();
52
 
                                List editPolicies = CanonicalEditPolicy
53
 
                                                .getRegisteredEditPolicies(modelElement);
54
 
                                for (Iterator it = editPolicies.iterator(); it.hasNext();) {
55
 
                                        CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy) it
56
 
                                                        .next();
57
 
                                        nextEditPolicy.refresh();
58
 
                                }
59
 
 
60
 
                        }
61
 
                }
62
 
                return null;
63
 
        }
64
 
 
65
 
        /**
66
 
         * @generated
67
 
         */
68
 
        public boolean isEnabled() {
69
 
                return true;
70
 
        }
71
 
 
72
 
        /**
73
 
         * @generated
74
 
         */
75
 
        public boolean isHandled() {
76
 
                return true;
77
 
        }
78
 
 
79
 
        /**
80
 
         * @generated
81
 
         */
82
 
        public void removeHandlerListener(IHandlerListener handlerListener) {
83
 
        }
84
 
 
85
 
}