Source Code Cross Referenced for New_processMarkerNavigationProvider.java in  » Workflow-Engines » osbl-1_0 » newprocess » diagram » providers » 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 » newprocess.diagram.providers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package newprocess.diagram.providers;
002:
003:        import java.util.ArrayList;
004:        import java.util.Arrays;
005:        import java.util.HashSet;
006:        import java.util.Iterator;
007:        import java.util.List;
008:        import java.util.Map;
009:        import java.util.Set;
010:
011:        import newprocess.diagram.part.New_processDiagramEditorPlugin;
012:        import newprocess.diagram.part.New_processDiagramEditorUtil;
013:
014:        import org.eclipse.core.resources.IFile;
015:        import org.eclipse.core.resources.IMarker;
016:        import org.eclipse.core.resources.IResource;
017:
018:        import org.eclipse.core.runtime.CoreException;
019:        import org.eclipse.core.runtime.IStatus;
020:
021:        import org.eclipse.emf.common.util.Diagnostic;
022:
023:        import org.eclipse.emf.ecore.EObject;
024:
025:        import org.eclipse.emf.validation.model.IConstraintStatus;
026:
027:        import org.eclipse.gef.EditPart;
028:
029:        import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
030:
031:        import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
032:
033:        import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
034:
035:        import org.eclipse.gmf.runtime.emf.ui.providers.marker.AbstractModelMarkerNavigationProvider;
036:
037:        import org.eclipse.gmf.runtime.notation.View;
038:
039:        /**
040:         * @generated
041:         */
042:        public class New_processMarkerNavigationProvider extends
043:                AbstractModelMarkerNavigationProvider {
044:            /**
045:             * @generated
046:             */
047:            public static final String MARKER_TYPE = New_processDiagramEditorPlugin.ID
048:                    + ".diagnostic"; //$NON-NLS-1$
049:
050:            /**
051:             * @generated
052:             */
053:            protected void doGotoMarker(IMarker marker) {
054:                String elementId = marker
055:                        .getAttribute(
056:                                org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID,
057:                                null);
058:                if (elementId == null
059:                        || !(getEditor() instanceof  DiagramEditor)) {
060:                    return;
061:                }
062:
063:                DiagramEditor editor = (DiagramEditor) getEditor();
064:                Map editPartRegistry = editor.getDiagramGraphicalViewer()
065:                        .getEditPartRegistry();
066:                EObject targetView = editor.getDiagram().eResource()
067:                        .getEObject(elementId);
068:                if (targetView == null) {
069:                    return;
070:                }
071:                EditPart targetEditPart = (EditPart) editPartRegistry
072:                        .get(targetView);
073:                if (targetEditPart != null) {
074:                    New_processDiagramEditorUtil.selectElementsInDiagram(
075:                            editor, Arrays
076:                                    .asList(new EditPart[] { targetEditPart }));
077:                }
078:            }
079:
080:            /**
081:             * @generated
082:             */
083:            public static void createMarkers(IFile diagramFile,
084:                    IStatus validationStatus, DiagramEditPart diagramEditPart) {
085:                if (validationStatus.isOK())
086:                    return;
087:
088:                final IStatus rootStatus = validationStatus;
089:                List allStatuses = new ArrayList();
090:                New_processDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new New_processDiagramEditorUtil.LazyElement2ViewMap(
091:                        diagramEditPart.getDiagramView(),
092:                        collectTargetElements(rootStatus, new HashSet(),
093:                                allStatuses));
094:
095:                for (Iterator it = allStatuses.iterator(); it.hasNext();) {
096:                    IConstraintStatus nextStatus = (IConstraintStatus) it
097:                            .next();
098:                    View view = New_processDiagramEditorUtil.findView(
099:                            diagramEditPart, nextStatus.getTarget(),
100:                            element2ViewMap);
101:                    IMarker newMarker = addMarker(diagramFile, view.eResource()
102:                            .getURIFragment(view), EMFCoreUtil
103:                            .getQualifiedName(nextStatus.getTarget(), true),
104:                            nextStatus.getMessage(), nextStatus.getSeverity());
105:                    if (newMarker != null) {
106:                        adjustMarker(newMarker, nextStatus);
107:                    }
108:                }
109:            }
110:
111:            /**
112:             * @generated
113:             */
114:            public static void createMarkers(IFile diagramFile,
115:                    Diagnostic emfValidationStatus,
116:                    DiagramEditPart diagramEditPart) {
117:                if (emfValidationStatus.getSeverity() == Diagnostic.OK)
118:                    return;
119:
120:                final Diagnostic rootStatus = emfValidationStatus;
121:                List allDiagnostics = new ArrayList();
122:                New_processDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new New_processDiagramEditorUtil.LazyElement2ViewMap(
123:                        diagramEditPart.getDiagramView(),
124:                        collectTargetElements(rootStatus, new HashSet(),
125:                                allDiagnostics));
126:
127:                for (Iterator it = emfValidationStatus.getChildren().iterator(); it
128:                        .hasNext();) {
129:                    Diagnostic nextDiagnostic = (Diagnostic) it.next();
130:                    List data = nextDiagnostic.getData();
131:                    if (data != null && !data.isEmpty()
132:                            && data.get(0) instanceof  EObject) {
133:                        EObject element = (EObject) data.get(0);
134:                        View view = New_processDiagramEditorUtil.findView(
135:                                diagramEditPart, element, element2ViewMap);
136:                        IMarker newMarker = addMarker(diagramFile, view
137:                                .eResource().getURIFragment(view), EMFCoreUtil
138:                                .getQualifiedName(element, true),
139:                                nextDiagnostic.getMessage(),
140:                                diagnosticToStatusSeverity(nextDiagnostic
141:                                        .getSeverity()));
142:                        if (newMarker != null) {
143:                            adjustMarker(newMarker, emfValidationStatus);
144:                        }
145:                    }
146:                }
147:            }
148:
149:            /**
150:             * @generated
151:             */
152:            public static void deleteMarkers(IResource resource) {
153:                try {
154:                    resource.deleteMarkers(MARKER_TYPE, true,
155:                            IResource.DEPTH_ZERO);
156:                } catch (CoreException e) {
157:                    New_processDiagramEditorPlugin.getInstance().logError(
158:                            "Failed to delete validation markers", e); //$NON-NLS-1$
159:                }
160:            }
161:
162:            /**
163:             * @generated
164:             */
165:            public static void adjustMarker(IMarker marker,
166:                    Diagnostic sourceDiagnostic) {
167:                assert marker != null && sourceDiagnostic != null;
168:            }
169:
170:            /**
171:             * @generated
172:             */
173:            public static void adjustMarker(IMarker marker,
174:                    IConstraintStatus sourceStatus) {
175:                assert marker != null && sourceStatus != null;
176:            }
177:
178:            /**
179:             * @generated
180:             */
181:            private static IMarker addMarker(IFile file, String elementId,
182:                    String location, String message, int statusSeverity) {
183:                IMarker marker = null;
184:                try {
185:                    marker = file.createMarker(MARKER_TYPE);
186:                    marker.setAttribute(IMarker.MESSAGE, message);
187:                    marker.setAttribute(IMarker.LOCATION, location);
188:                    marker
189:                            .setAttribute(
190:                                    org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID,
191:                                    elementId);
192:                    int markerSeverity = IMarker.SEVERITY_INFO;
193:                    if (statusSeverity == IStatus.WARNING) {
194:                        markerSeverity = IMarker.SEVERITY_WARNING;
195:                    } else if (statusSeverity == IStatus.ERROR
196:                            || statusSeverity == IStatus.CANCEL) {
197:                        markerSeverity = IMarker.SEVERITY_ERROR;
198:                    }
199:                    marker.setAttribute(IMarker.SEVERITY, markerSeverity);
200:                } catch (CoreException e) {
201:                    New_processDiagramEditorPlugin.getInstance().logError(
202:                            "Failed to create validation marker", e); //$NON-NLS-1$
203:                }
204:                return marker;
205:            }
206:
207:            /**
208:             * @generated
209:             */
210:            private static int diagnosticToStatusSeverity(int diagnosticSeverity) {
211:                if (diagnosticSeverity == Diagnostic.OK) {
212:                    return IStatus.OK;
213:                } else if (diagnosticSeverity == Diagnostic.INFO) {
214:                    return IStatus.INFO;
215:                } else if (diagnosticSeverity == Diagnostic.WARNING) {
216:                    return IStatus.WARNING;
217:                } else if (diagnosticSeverity == Diagnostic.ERROR
218:                        || diagnosticSeverity == Diagnostic.CANCEL) {
219:                    return IStatus.ERROR;
220:                }
221:                return IStatus.INFO;
222:            }
223:
224:            /**
225:             * @generated
226:             */
227:            private static Set collectTargetElements(IStatus status,
228:                    Set targetElementCollector, List allConstraintStatuses) {
229:                if (status instanceof  IConstraintStatus) {
230:                    targetElementCollector.add(((IConstraintStatus) status)
231:                            .getTarget());
232:                    allConstraintStatuses.add(status);
233:                }
234:                if (status.isMultiStatus()) {
235:                    IStatus[] children = status.getChildren();
236:                    for (int i = 0; i < children.length; i++) {
237:                        collectTargetElements(children[i],
238:                                targetElementCollector, allConstraintStatuses);
239:                    }
240:                }
241:                return targetElementCollector;
242:            }
243:
244:            /**
245:             * @generated
246:             */
247:            private static Set collectTargetElements(Diagnostic diagnostic,
248:                    Set targetElementCollector, List allDiagnostics) {
249:                List data = diagnostic.getData();
250:                EObject target = null;
251:                if (data != null && !data.isEmpty()
252:                        && data.get(0) instanceof  EObject) {
253:                    target = (EObject) data.get(0);
254:                    targetElementCollector.add(target);
255:                    allDiagnostics.add(diagnostic);
256:                }
257:                if (diagnostic.getChildren() != null
258:                        && !diagnostic.getChildren().isEmpty()) {
259:                    for (Iterator it = diagnostic.getChildren().iterator(); it
260:                            .hasNext();) {
261:                        collectTargetElements((Diagnostic) it.next(),
262:                                targetElementCollector, allDiagnostics);
263:                    }
264:                }
265:                return targetElementCollector;
266:            }
267:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.