Source Code Cross Referenced for WriteCommand.java in  » Workflow-Engines » osbl-1_0 » diagram » commands » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » osbl 1_0 » diagram.commands 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * 
003:         */package diagram.commands;
004:
005:        import newprocess.diagram.edit.parts.ActorEditPart;
006:        import newprocess.diagram.edit.parts.AsyncActivity2EditPart;
007:        import newprocess.diagram.edit.parts.AsyncActivityEditPart;
008:        import newprocess.diagram.edit.parts.ConditionEditPart;
009:        import newprocess.diagram.edit.parts.EventEditPart;
010:        import newprocess.diagram.edit.parts.ListenerEditPart;
011:        import newprocess.diagram.edit.parts.LoaderEditPart;
012:        import newprocess.diagram.edit.parts.ProcessEditPart;
013:        import newprocess.diagram.edit.parts.SyncActivityEditPart;
014:        import newprocess.diagram.providers.New_processElementTypes;
015:
016:        import org.eclipse.core.commands.ExecutionException;
017:        import org.eclipse.core.runtime.IAdaptable;
018:        import org.eclipse.core.runtime.IProgressMonitor;
019:        import org.eclipse.emf.ecore.EObject;
020:        import org.eclipse.emf.transaction.TransactionalEditingDomain;
021:        import org.eclipse.gef.EditPart;
022:        import org.eclipse.gmf.runtime.common.core.command.CommandResult;
023:        import org.eclipse.gmf.runtime.common.core.command.ICommand;
024:        import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
025:        import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
026:        import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
027:        import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramEditDomain;
028:        import org.eclipse.gmf.runtime.emf.type.core.IElementType;
029:        import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
030:        import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
031:        import org.eclipse.gmf.runtime.notation.Diagram;
032:        import org.eclipse.gmf.runtime.notation.Node;
033:
034:        import diagram.section.EnvEntry;
035:
036:        /**
037:         * Sets the attributes "name", "type" and "value" 
038:         * of an EMF EnvEntry model Object
039:         * 
040:         * @author sh
041:         */
042:        public class WriteCommand {
043:
044:            /**
045:             * This command sets the attributes "name", "type" and "value" ob an given
046:             * EMF EnvEntry model Object and values.
047:             * 
048:             * @param editPart the EditPart which owns the EnvEntry
049:             * @param elementToEdit the EMF EnvEntry model Object
050:             * @param envEntryValues the values to be set
051:             */
052:            public void executeWriteCommand(EditPart editPart,
053:                    newprocess.EnvEntry elementToEdit, EnvEntry envEntryValues) {
054:                TransactionalEditingDomain writeEditingDomain = null;
055:                EObject elementToConfigure = null;
056:                IDiagramEditDomain diagramEditDomain = null;
057:                IElementType typeToConfigure = null;
058:
059:                if (editPart instanceof  DiagramEditPart) {
060:                    writeEditingDomain = ((DiagramEditPart) editPart)
061:                            .getEditingDomain();
062:                    elementToConfigure = ((Diagram) editPart.getModel())
063:                            .getElement();
064:                    diagramEditDomain = ((DiagramEditPart) editPart)
065:                            .getDiagramEditDomain();
066:                }
067:                if (editPart instanceof  ShapeNodeEditPart) {
068:                    writeEditingDomain = ((ShapeNodeEditPart) editPart)
069:                            .getEditingDomain();
070:                    elementToConfigure = ((Node) editPart.getModel())
071:                            .getElement();
072:                    diagramEditDomain = ((ShapeNodeEditPart) editPart)
073:                            .getDiagramEditDomain();
074:                }
075:
076:                typeToConfigure = getType(editPart);
077:
078:                ConfigureRequest req = new ConfigureRequest(writeEditingDomain,
079:                        elementToConfigure, typeToConfigure);
080:                ICommand configureCommand = getConfigureCommand(req,
081:                        elementToEdit, envEntryValues);
082:                ICommandProxy proxy = new ICommandProxy(configureCommand);
083:                diagramEditDomain.getDiagramCommandStack().execute(proxy);
084:            }
085:
086:            /**
087:             * This method returns a ConfigureElementCommand which sets the attributes by the 
088:             * doExecuteWithResult method.
089:             * 
090:             * @param req the specified ConfigureRequest
091:             * @param modelEntry the EMF EnvEntry model object where changes take place
092:             * @param envEntryValues the values do be set
093:             * @return a new ConfigureElementCommand
094:             */
095:            protected ICommand getConfigureCommand(final ConfigureRequest req,
096:                    final newprocess.EnvEntry modelEntry,
097:                    final EnvEntry envEntryValues) {
098:
099:                return new ConfigureElementCommand(req) {
100:                    protected CommandResult doExecuteWithResult(
101:                            IProgressMonitor monitor, IAdaptable info)
102:                            throws ExecutionException {
103:                        EObject element = req.getElementToConfigure();
104:
105:                        // setting the attributes
106:                        modelEntry.setName(envEntryValues.getName());
107:                        modelEntry.setType(envEntryValues.getType());
108:                        modelEntry.setValue(envEntryValues.getValue());
109:
110:                        return CommandResult.newOKCommandResult(element);
111:                    }
112:                };
113:            }
114:
115:            /**
116:             * a helper method to load meta information of the selected EditPart.
117:             * 
118:             * @param ep the EditPart of the metat data
119:             * @return the IElementType of the selected EditPart
120:             */
121:            private IElementType getType(EditPart ep) {
122:                if (ep instanceof  ActorEditPart)
123:                    return New_processElementTypes.Actor_2007;
124:                else if (ep instanceof  ProcessEditPart)
125:                    return New_processElementTypes.Process_1000;
126:                else if (ep instanceof  LoaderEditPart)
127:                    return New_processElementTypes.Loader_3013;
128:                else if (ep instanceof  ConditionEditPart)
129:                    return New_processElementTypes.Condition_3014;
130:                else if (ep instanceof  AsyncActivityEditPart
131:                        || ep instanceof  AsyncActivity2EditPart)
132:                    return New_processElementTypes.AsyncActivity_2003;
133:                else if (ep instanceof  SyncActivityEditPart)
134:                    return New_processElementTypes.SyncActivity_2001;
135:                else if (ep instanceof  EventEditPart)
136:                    return New_processElementTypes.Event_2005;
137:                else if (ep instanceof  ListenerEditPart)
138:                    return New_processElementTypes.Listener_2002;
139:                else
140:                    return null;
141:            }
142:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.