Source Code Cross Referenced for LogicWizardPage1.java in  » IDE-Eclipse » ui-examples » org » eclipse » ui » examples » views » properties » tabbed » logic » 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 examples » org.eclipse.ui.examples.views.properties.tabbed.logic 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2006 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         * 
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.ui.examples.views.properties.tabbed.logic;
011:
012:        import java.io.ByteArrayInputStream;
013:        import java.io.ByteArrayOutputStream;
014:        import java.io.InputStream;
015:        import java.io.ObjectOutputStream;
016:
017:        import org.eclipse.swt.SWT;
018:        import org.eclipse.swt.events.SelectionEvent;
019:        import org.eclipse.swt.events.SelectionListener;
020:        import org.eclipse.swt.layout.GridData;
021:        import org.eclipse.swt.layout.GridLayout;
022:        import org.eclipse.swt.widgets.Button;
023:        import org.eclipse.swt.widgets.Composite;
024:        import org.eclipse.swt.widgets.Group;
025:        import org.eclipse.swt.widgets.Label;
026:
027:        import org.eclipse.core.resources.IFile;
028:        import org.eclipse.jface.resource.ImageDescriptor;
029:        import org.eclipse.jface.viewers.IStructuredSelection;
030:        import org.eclipse.ui.IWorkbench;
031:        import org.eclipse.ui.IWorkbenchPage;
032:        import org.eclipse.ui.IWorkbenchWindow;
033:        import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
034:        import org.eclipse.ui.ide.IDE;
035:
036:        import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
037:        import org.eclipse.gef.examples.logicdesigner.model.LogicDiagramFactory;
038:
039:        public class LogicWizardPage1 extends WizardNewFileCreationPage
040:                implements  SelectionListener {
041:
042:            private IWorkbench workbench;
043:
044:            private static int exampleCount = 1;
045:
046:            private Button model1 = null;
047:
048:            private Button model2 = null;
049:
050:            private int modelSelected = 1;
051:
052:            public LogicWizardPage1(IWorkbench aWorkbench,
053:                    IStructuredSelection selection) {
054:                super ("sampleLogicPage1", selection); //$NON-NLS-1$
055:                this .setTitle("Tabbed Properties View Logic Example");//$NON-NLS-1$
056:                this 
057:                        .setDescription("Create a new Tabbed Properties View Logic Example file");//$NON-NLS-1$
058:                this .setImageDescriptor(ImageDescriptor.createFromFile(
059:                        getClass(), "icons/logicbanner.gif")); //$NON-NLS-1$
060:                this .workbench = aWorkbench;
061:            }
062:
063:            public void createControl(Composite parent) {
064:                super .createControl(parent);
065:                this 
066:                        .setFileName("emptyModel" + exampleCount + ".tabbedpropertieslogic"); //$NON-NLS-2$//$NON-NLS-1$
067:
068:                Composite composite = (Composite) getControl();
069:
070:                // sample section generation group
071:                Group group = new Group(composite, SWT.NONE);
072:                group.setLayout(new GridLayout());
073:                group.setText("Logic Model Samples"); //$NON-NLS-1$
074:                group.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
075:                        | GridData.HORIZONTAL_ALIGN_FILL));
076:
077:                // sample section generation checkboxes
078:                model1 = new Button(group, SWT.RADIO);
079:                model1.setText("E&mpty Model");//$NON-NLS-1$
080:                model1.addSelectionListener(this );
081:                model1.setSelection(true);
082:
083:                model2 = new Button(group, SWT.RADIO);
084:                model2.setText("F&our-bit Adder Model");//$NON-NLS-1$
085:                model2.addSelectionListener(this );
086:
087:                new Label(composite, SWT.NONE);
088:
089:                setPageComplete(validatePage());
090:            }
091:
092:            protected InputStream getInitialContents() {
093:                LogicDiagram ld = new LogicDiagram();
094:                if (modelSelected == 2)
095:                    ld = (LogicDiagram) LogicDiagramFactory.createLargeModel();
096:                ByteArrayInputStream bais = null;
097:                try {
098:                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
099:                    ObjectOutputStream oos = new ObjectOutputStream(baos);
100:                    oos.writeObject(ld);
101:                    oos.flush();
102:                    oos.close();
103:                    baos.close();
104:                    bais = new ByteArrayInputStream(baos.toByteArray());
105:                    bais.close();
106:                } catch (Exception e) {
107:                    e.printStackTrace();
108:                }
109:                return bais;
110:            }
111:
112:            public boolean finish() {
113:                IFile newFile = createNewFile();
114:                if (newFile == null)
115:                    return false; // ie.- creation was unsuccessful
116:
117:                // Since the file resource was created fine, open it for editing
118:                // iff requested by the user
119:                try {
120:                    IWorkbenchWindow dwindow = workbench
121:                            .getActiveWorkbenchWindow();
122:                    IWorkbenchPage page = dwindow.getActivePage();
123:                    if (page != null)
124:                        IDE.openEditor(page, newFile, true);
125:                } catch (org.eclipse.ui.PartInitException e) {
126:                    e.printStackTrace();
127:                    return false;
128:                }
129:                exampleCount++;
130:                return true;
131:            }
132:
133:            /**
134:             * @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent)
135:             */
136:            public void widgetSelected(SelectionEvent e) {
137:                if (e.getSource() == model1) {
138:                    modelSelected = 1;
139:                    setFileName("emptyModel" + exampleCount + ".tabbedpropertieslogic"); //$NON-NLS-2$//$NON-NLS-1$
140:                } else {
141:                    modelSelected = 2;
142:                    setFileName("fourBitAdder" + exampleCount + ".tabbedpropertieslogic"); //$NON-NLS-2$//$NON-NLS-1$
143:                }
144:            }
145:
146:            /**
147:             * Empty method
148:             */
149:            public void widgetDefaultSelected(SelectionEvent e) {
150:                //
151:            }
152:
153:        }
w___ww.__ja_v___a_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.