Source Code Cross Referenced for RuleHelperActionDelegate.java in  » Rule-Engine » drolls-Rule-Engine » org » drools » eclipse » menu » 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 » Rule Engine » drolls Rule Engine » org.drools.eclipse.menu 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.drools.eclipse.menu;
002:
003:        import java.util.ArrayList;
004:        import java.util.Iterator;
005:        import java.util.List;
006:
007:        import org.drools.eclipse.rulebuilder.wizards.NewBrlFileWizard;
008:        import org.drools.eclipse.wizard.decisiontable.NewDTFileWizard;
009:        import org.drools.eclipse.wizard.dsl.NewDSLFileWizard;
010:        import org.drools.eclipse.wizard.project.NewDroolsProjectWizard;
011:        import org.drools.eclipse.wizard.rule.NewRulePackageWizard;
012:        import org.eclipse.jface.action.IAction;
013:        import org.eclipse.jface.viewers.ISelection;
014:        import org.eclipse.jface.viewers.IStructuredSelection;
015:        import org.eclipse.jface.wizard.WizardDialog;
016:        import org.eclipse.swt.SWT;
017:        import org.eclipse.swt.events.SelectionEvent;
018:        import org.eclipse.swt.events.SelectionListener;
019:        import org.eclipse.swt.widgets.Control;
020:        import org.eclipse.swt.widgets.Menu;
021:        import org.eclipse.swt.widgets.MenuItem;
022:        import org.eclipse.swt.widgets.Shell;
023:        import org.eclipse.ui.INewWizard;
024:        import org.eclipse.ui.IWorkbench;
025:        import org.eclipse.ui.IWorkbenchWindow;
026:        import org.eclipse.ui.IWorkbenchWindowPulldownDelegate;
027:
028:        /**
029:         * Menu driver for launching wizards etc from the top level toolbar.
030:         * 
031:         * More can be added to this as needed.
032:         * 
033:         * @author Michael Neale
034:         */
035:        public class RuleHelperActionDelegate implements 
036:                IWorkbenchWindowPulldownDelegate {
037:
038:            private IWorkbench workbench;
039:            private Menu menu;
040:
041:            /** Return a menu which launches the various wizards */
042:            public Menu getMenu(Control parent) {
043:
044:                setMenu(new Menu(parent));
045:
046:                final Shell shell = parent.getShell();
047:                addProjectWizard(menu, shell);
048:
049:                addRuleWizard(menu, shell);
050:
051:                addDSLWizard(menu, shell);
052:
053:                addDTWizard(menu, shell);
054:
055:                addGuidedEditorWizard(menu, shell);
056:
057:                return menu;
058:            }
059:
060:            private void setMenu(Menu menu) {
061:                if (this .menu != null) {
062:                    this .menu.dispose();
063:                }
064:                this .menu = menu;
065:            }
066:
067:            private void addDTWizard(Menu menu, final Shell shell) {
068:                MenuItem dsl = new MenuItem(menu, SWT.NONE);
069:                dsl.setText("New Decision Table");
070:                dsl.addSelectionListener(new SelectionListener() {
071:
072:                    public void widgetSelected(SelectionEvent e) {
073:                        NewDTFileWizard wizard = new NewDTFileWizard();
074:                        launchWizard(shell, wizard);
075:                    }
076:
077:                    public void widgetDefaultSelected(SelectionEvent e) {
078:                    }
079:                });
080:
081:            }
082:
083:            private void addProjectWizard(Menu menu, final Shell shell) {
084:                MenuItem rule = new MenuItem(menu, SWT.NONE);
085:                rule.setText("New Rule Project");
086:
087:                rule.addSelectionListener(new SelectionListener() {
088:                    public void widgetSelected(SelectionEvent e) {
089:                        NewDroolsProjectWizard wizard = new NewDroolsProjectWizard();
090:                        launchWizard(shell, wizard);
091:                    }
092:
093:                    public void widgetDefaultSelected(SelectionEvent e) {
094:                    }
095:                });
096:            }
097:
098:            private void addRuleWizard(Menu menu, final Shell shell) {
099:                MenuItem rule = new MenuItem(menu, SWT.NONE);
100:                rule.setText("New Rule resource");
101:
102:                rule.addSelectionListener(new SelectionListener() {
103:                    public void widgetSelected(SelectionEvent e) {
104:                        NewRulePackageWizard wizard = new NewRulePackageWizard();
105:                        launchWizard(shell, wizard);
106:                    }
107:
108:                    public void widgetDefaultSelected(SelectionEvent e) {
109:                    }
110:                });
111:            }
112:
113:            private void addDSLWizard(Menu menu, final Shell shell) {
114:                MenuItem dsl = new MenuItem(menu, SWT.NONE);
115:                dsl.setText("New Domain Specific Language");
116:                dsl.addSelectionListener(new SelectionListener() {
117:
118:                    public void widgetSelected(SelectionEvent e) {
119:                        NewDSLFileWizard wizard = new NewDSLFileWizard();
120:                        launchWizard(shell, wizard);
121:                    }
122:
123:                    public void widgetDefaultSelected(SelectionEvent e) {
124:                    }
125:                });
126:            }
127:
128:            private void addGuidedEditorWizard(Menu menu, final Shell shell) {
129:                MenuItem dsl = new MenuItem(menu, SWT.NONE);
130:                dsl.setText("New Business rule (guided editor)");
131:                dsl.addSelectionListener(new SelectionListener() {
132:
133:                    public void widgetSelected(SelectionEvent e) {
134:                        NewBrlFileWizard wizard = new NewBrlFileWizard();
135:                        launchWizard(shell, wizard);
136:                    }
137:
138:                    public void widgetDefaultSelected(SelectionEvent e) {
139:                    }
140:                });
141:            }
142:
143:            private void launchWizard(Shell shell, INewWizard wizard) {
144:                wizard.init(workbench, new DummySelection());
145:                WizardDialog dialog = new WizardDialog(shell, wizard);
146:                dialog.open();
147:            }
148:
149:            public void dispose() {
150:            }
151:
152:            public void init(IWorkbenchWindow window) {
153:                workbench = window.getWorkbench();
154:            }
155:
156:            public void run(IAction action) {
157:            }
158:
159:            public void selectionChanged(IAction action, ISelection selection) {
160:            }
161:
162:            /** Stub structured selection listener, as is required to launch the wizard */
163:            static class DummySelection implements  IStructuredSelection {
164:                public Object getFirstElement() {
165:                    return null;
166:                }
167:
168:                public Iterator iterator() {
169:                    return (new ArrayList()).iterator();
170:                }
171:
172:                public int size() {
173:                    return 0;
174:                }
175:
176:                public Object[] toArray() {
177:                    return null;
178:                }
179:
180:                public List toList() {
181:                    return null;
182:                }
183:
184:                public boolean isEmpty() {
185:                    return true;
186:                }
187:            }
188:
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.