~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/DeleteElementAction.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.gef.EditPart;
7
 
import org.eclipse.gef.Request;
8
 
import org.eclipse.gef.commands.Command;
9
 
import org.eclipse.gef.commands.UnexecutableCommand;
10
 
import org.eclipse.gmf.runtime.diagram.ui.actions.AbstractDeleteFromAction;
11
 
import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
12
 
import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
13
 
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
14
 
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
15
 
import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
16
 
import org.eclipse.ui.ISharedImages;
17
 
import org.eclipse.ui.IWorkbenchPage;
18
 
import org.eclipse.ui.IWorkbenchPart;
19
 
import org.eclipse.ui.PlatformUI;
20
 
 
21
 
/**
22
 
 * @generated
23
 
 */
24
 
public class DeleteElementAction extends AbstractDeleteFromAction {
25
 
 
26
 
        /**
27
 
         * @generated
28
 
         */
29
 
        public DeleteElementAction(IWorkbenchPart part) {
30
 
                super(part);
31
 
        }
32
 
 
33
 
        /**
34
 
         * @generated
35
 
         */
36
 
        public DeleteElementAction(IWorkbenchPage workbenchPage) {
37
 
                super(workbenchPage);
38
 
        }
39
 
 
40
 
        /**
41
 
         * @generated
42
 
         */
43
 
        public void init() {
44
 
                super.init();
45
 
                setId(ActionIds.ACTION_DELETE_FROM_MODEL);
46
 
                setText(DiagramUIMessages.DiagramEditor_Delete_from_Model);
47
 
                setToolTipText(DiagramUIMessages.DiagramEditor_Delete_from_ModelToolTip);
48
 
                ISharedImages workbenchImages = PlatformUI.getWorkbench()
49
 
                                .getSharedImages();
50
 
                setHoverImageDescriptor(workbenchImages
51
 
                                .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
52
 
                setImageDescriptor(workbenchImages
53
 
                                .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
54
 
                setDisabledImageDescriptor(workbenchImages
55
 
                                .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
56
 
        }
57
 
 
58
 
        /**
59
 
         * @generated
60
 
         */
61
 
        protected String getCommandLabel() {
62
 
                return DiagramUIMessages.DiagramEditor_Delete_from_Model;
63
 
        }
64
 
 
65
 
        /**
66
 
         * @generated
67
 
         */
68
 
        protected Command getCommand(Request request) {
69
 
                List operationSet = getOperationSet();
70
 
                if (operationSet.isEmpty()) {
71
 
                        return UnexecutableCommand.INSTANCE;
72
 
                }
73
 
                Iterator editParts = operationSet.iterator();
74
 
                CompositeTransactionalCommand command = new CompositeTransactionalCommand(
75
 
                                getEditingDomain(), getCommandLabel());
76
 
                while (editParts.hasNext()) {
77
 
                        EditPart editPart = (EditPart) editParts.next();
78
 
                        Command curCommand = editPart.getCommand(request);
79
 
                        if (curCommand != null) {
80
 
                                command.compose(new CommandProxy(curCommand));
81
 
                        }
82
 
                }
83
 
                if (command.isEmpty() || command.size() != operationSet.size()) {
84
 
                        return UnexecutableCommand.INSTANCE;
85
 
                }
86
 
                return new ICommandProxy(command);
87
 
        }
88
 
}