Source Code Cross Referenced for BlockedTaskFinder.java in  » IDE-Eclipse » ui » org » eclipse » ui » internal » cheatsheets » composite » model » 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 » IDE Eclipse » ui » org.eclipse.ui.internal.cheatsheets.composite.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /*******************************************************************************
02:         * Copyright (c) 2006 IBM Corporation and others.
03:         * All rights reserved. This program and the accompanying materials
04:         * are made available under the terms of the Eclipse Public License v1.0
05:         * which accompanies this distribution, and is available at
06:         * http://www.eclipse.org/legal/epl-v10.html
07:         *
08:         * Contributors:
09:         *     IBM Corporation - initial API and implementation
10:         *******************************************************************************/package org.eclipse.ui.internal.cheatsheets.composite.model;
11:
12:        import java.util.HashSet;
13:        import java.util.Iterator;
14:        import java.util.Set;
15:
16:        import org.eclipse.ui.internal.provisional.cheatsheets.ICompositeCheatSheetTask;
17:
18:        public class BlockedTaskFinder {
19:
20:            private Set stateChangedTasks;
21:            private Set impactedTasks;
22:
23:            /**
24:             * Find which tasks have either become blocked or unblocked so that they
25:             * can be added to the list of change events.
26:             * @param stateChangedTasks The set of tasks which has changed
27:             * @return The set of tasks which have become blocked or unblocked by the
28:             * change of state and were not in the original set. The algorithm will sometimes add tasks to 
29:             * the result set which were not actually impacted but this is not a major problem 
30:             * since it only means that extra events get sent to the explorer. For updates other
31:             * than resets the number of extra events is very low.
32:             * 
33:             * This takes several steps.
34:             * <li> If a  group is completed, skipped or reset add any non-started children. 
35:             * <li> Determine all successors of tasks whose state has changed that are not in the change set
36:             * <li> Add the successor and its children to the list if not started
37:             */
38:
39:            public Set findBlockedTaskChanges(Set stateChangedTasks) {
40:                this .stateChangedTasks = stateChangedTasks;
41:                impactedTasks = new HashSet();
42:                visitChangedTasks();
43:                findSuccesors();
44:                return impactedTasks;
45:            }
46:
47:            private void visitChangedTasks() {
48:                for (Iterator iter = stateChangedTasks.iterator(); iter
49:                        .hasNext();) {
50:                    final ICompositeCheatSheetTask nextTask = (ICompositeCheatSheetTask) iter
51:                            .next();
52:                    if (nextTask.getState() != ICompositeCheatSheetTask.IN_PROGRESS) {
53:                        findUnstartedChildren(nextTask);
54:                    }
55:                }
56:            }
57:
58:            /*
59:             * Look for children which we have not seen elsewhere and if they are not started
60:             * add them to the list of impacted tasks.
61:             */
62:            private void findUnstartedChildren(ICompositeCheatSheetTask task) {
63:                ICompositeCheatSheetTask[] children = task.getSubtasks();
64:                for (int i = 0; i < children.length; i++) {
65:                    ICompositeCheatSheetTask nextChild = children[i];
66:                    // Ignore if this task has been seen before
67:                    if ((!stateChangedTasks.contains(nextChild))
68:                            && !impactedTasks.contains(nextChild)) {
69:                        if (nextChild.getState() == ICompositeCheatSheetTask.NOT_STARTED) {
70:                            impactedTasks.add(nextChild);
71:                        }
72:                        findUnstartedChildren(nextChild);
73:                    }
74:                }
75:            }
76:
77:            private void findSuccesors() {
78:                for (Iterator iter = stateChangedTasks.iterator(); iter
79:                        .hasNext();) {
80:                    final AbstractTask nextTask = (AbstractTask) iter.next();
81:                    ICompositeCheatSheetTask[] successors = nextTask
82:                            .getSuccessorTasks();
83:                    for (int i = 0; i < successors.length; i++) {
84:                        ICompositeCheatSheetTask nextSuccessor = successors[i];
85:                        if (nextSuccessor.getState() == ICompositeCheatSheetTask.NOT_STARTED) {
86:                            impactedTasks.add(nextSuccessor);
87:                        }
88:                        findUnstartedChildren(nextSuccessor);
89:                    }
90:                }
91:            }
92:
93:        }
w___ww___._j___a_va___2_s__._co_m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.