Source Code Cross Referenced for PropertyPage.java in  » Net » Terracotta » org » terracotta » dso » properties » 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 » Net » Terracotta » org.terracotta.dso.properties 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003:         * notice. All rights reserved.
004:         */
005:        package org.terracotta.dso.properties;
006:
007:        import org.eclipse.core.resources.IProject;
008:        import org.eclipse.jdt.core.IJavaProject;
009:        import org.eclipse.swt.SWT;
010:        import org.eclipse.swt.events.SelectionAdapter;
011:        import org.eclipse.swt.events.SelectionEvent;
012:        import org.eclipse.swt.layout.GridData;
013:        import org.eclipse.swt.layout.GridLayout;
014:        import org.eclipse.swt.widgets.Button;
015:        import org.eclipse.swt.widgets.Composite;
016:        import org.eclipse.swt.widgets.Control;
017:        import org.eclipse.swt.widgets.Group;
018:        import org.eclipse.swt.widgets.Text;
019:        import org.terracotta.dso.TcPlugin;
020:        import org.terracotta.dso.editors.chooser.ConfigFileBehavior;
021:        import org.terracotta.dso.editors.chooser.NavigatorBehavior;
022:        import org.terracotta.dso.editors.chooser.PackageNavigator;
023:        import org.terracotta.ui.util.SWTUtil;
024:
025:        import com.tc.util.event.UpdateEvent;
026:        import com.tc.util.event.UpdateEventListener;
027:
028:        public final class PropertyPage extends
029:                org.eclipse.ui.dialogs.PropertyPage {
030:            private static final String TERRACOTTA_CONFIG = "Terracotta Configuration";
031:            private static final String BROWSE = "Browse...";
032:            private static final String RESET = "Reset";
033:            private static final String SERVER_OPTIONS = "Server Options";
034:
035:            private Text m_configPathField;
036:            private Button m_configFileButton;
037:            private Text m_serverOptionsField;
038:            private Button m_autoStartServerButton;
039:            private Button m_warnConfigProblemsButton;
040:            private Button m_queryRestartButton;
041:            private Button m_resetOptionsButton;
042:
043:            private static final String DEFAULT_CONFIG_FILENAME = TcPlugin.DEFAULT_CONFIG_FILENAME;
044:            private static final String DEFAULT_SERVER_OPTIONS = TcPlugin.DEFAULT_SERVER_OPTIONS;
045:            private static final boolean DEFAULT_AUTO_START_SERVER_OPTION = TcPlugin.DEFAULT_AUTO_START_SERVER_OPTION;
046:            private static final boolean DEFAULT_WARN_CONFIG_PROBLEMS_OPTION = TcPlugin.DEFAULT_WARN_CONFIG_PROBLEMS_OPTION;
047:            private static final boolean DEFAULT_QUERY_RESTART_OPTION = TcPlugin.DEFAULT_QUERY_RESTART_OPTION;
048:
049:            private static final String AUTO_RESTART_SERVER_MSG = "Automatically start the Terracotta Server when necessary";
050:            private static final String WARN_CONFIG_PROBLEMS_MSG = "Warn about config problems before launching a Terracotta process";
051:            private static final String QUERY_RESTART_MSG = "When the config changes, offer to restart running Terracotta processes";
052:
053:            private void fillControls() {
054:                TcPlugin plugin = TcPlugin.getDefault();
055:                IProject project = getProject();
056:                m_configPathField.setText(plugin
057:                        .getConfigurationFilePath(project));
058:                m_serverOptionsField.setText(plugin.getServerOptions(project));
059:                m_autoStartServerButton.setSelection(plugin
060:                        .getAutoStartServerOption(project));
061:                m_warnConfigProblemsButton.setSelection(plugin
062:                        .getWarnConfigProblemsOption(project));
063:                m_queryRestartButton.setSelection(plugin
064:                        .getQueryRestartOption(project));
065:            }
066:
067:            protected Control createContents(Composite parent) {
068:                final Composite topComp = new Composite(parent, SWT.NONE);
069:                GridLayout gridLayout = new GridLayout();
070:                gridLayout.numColumns = 1;
071:                gridLayout.makeColumnsEqualWidth = false;
072:                topComp.setLayout(gridLayout);
073:                topComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
074:
075:                Group domainConfig = new Group(topComp, SWT.NONE);
076:                domainConfig.setText(TERRACOTTA_CONFIG);
077:                gridLayout = new GridLayout();
078:                gridLayout.numColumns = 2;
079:                domainConfig.setLayout(gridLayout);
080:                domainConfig.setLayoutData(new GridData(
081:                        GridData.FILL_HORIZONTAL));
082:
083:                m_configPathField = new Text(domainConfig, SWT.SINGLE
084:                        | SWT.BORDER);
085:                m_configPathField.setLayoutData(new GridData(
086:                        GridData.FILL_HORIZONTAL));
087:
088:                m_configFileButton = new Button(domainConfig, SWT.PUSH);
089:                m_configFileButton.setText(BROWSE);
090:                m_configFileButton.setLayoutData(new GridData(
091:                        GridData.HORIZONTAL_ALIGN_END));
092:                SWTUtil.applyDefaultButtonSize(m_configFileButton);
093:                m_configFileButton.addSelectionListener(new SelectionAdapter() {
094:                    public void widgetSelected(SelectionEvent e) {
095:                        NavigatorBehavior behavior = new ConfigFileBehavior();
096:                        PackageNavigator dialog = new PackageNavigator(
097:                                getShell(), behavior.getTitle(), getProject(),
098:                                behavior);
099:                        dialog.addValueListener(new UpdateEventListener() {
100:                            public void handleUpdate(UpdateEvent event) {
101:                                m_configPathField.setText((String) event.data);
102:                            }
103:                        });
104:                        dialog.open();
105:                    }
106:                });
107:                Group serverOptions = new Group(topComp, SWT.NONE);
108:                serverOptions.setText(SERVER_OPTIONS);
109:                serverOptions.setLayout(new GridLayout(2, false));
110:                GridData gridData = new GridData();
111:                gridData.horizontalAlignment = GridData.FILL;
112:                gridData.heightHint = 60;
113:                serverOptions.setLayoutData(gridData);
114:
115:                m_serverOptionsField = new Text(serverOptions, SWT.MULTI
116:                        | SWT.BORDER | SWT.V_SCROLL);
117:                GridData gd = new GridData(GridData.FILL_BOTH);
118:                m_serverOptionsField.setLayoutData(gd);
119:
120:                m_resetOptionsButton = new Button(serverOptions, SWT.PUSH);
121:                m_resetOptionsButton.setText(RESET);
122:                SWTUtil.applyDefaultButtonSize(m_resetOptionsButton);
123:                gd = (GridData) m_resetOptionsButton.getLayoutData();
124:                gd.verticalAlignment = SWT.BEGINNING;
125:                m_resetOptionsButton
126:                        .addSelectionListener(new SelectionAdapter() {
127:                            public void widgetSelected(SelectionEvent e) {
128:                                m_serverOptionsField
129:                                        .setText(DEFAULT_SERVER_OPTIONS);
130:                            }
131:                        });
132:
133:                m_autoStartServerButton = new Button(topComp, SWT.CHECK);
134:                m_autoStartServerButton.setText(AUTO_RESTART_SERVER_MSG);
135:                m_autoStartServerButton.setLayoutData(new GridData());
136:
137:                m_warnConfigProblemsButton = new Button(topComp, SWT.CHECK);
138:                m_warnConfigProblemsButton.setText(WARN_CONFIG_PROBLEMS_MSG);
139:                m_warnConfigProblemsButton.setLayoutData(new GridData());
140:
141:                m_queryRestartButton = new Button(topComp, SWT.CHECK);
142:                m_queryRestartButton.setText(QUERY_RESTART_MSG);
143:                m_queryRestartButton.setLayoutData(new GridData());
144:
145:                Composite composite = new Composite(topComp, SWT.EMBEDDED);
146:                composite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
147:                fillControls();
148:                return topComp;
149:            }
150:
151:            protected void performDefaults() {
152:                m_configPathField.setText(DEFAULT_CONFIG_FILENAME);
153:                m_serverOptionsField.setText(DEFAULT_SERVER_OPTIONS);
154:                m_autoStartServerButton
155:                        .setSelection(DEFAULT_AUTO_START_SERVER_OPTION);
156:                m_warnConfigProblemsButton
157:                        .setSelection(DEFAULT_WARN_CONFIG_PROBLEMS_OPTION);
158:                m_queryRestartButton.setSelection(DEFAULT_QUERY_RESTART_OPTION);
159:            }
160:
161:            private IProject getProject() {
162:                return ((IJavaProject) getElement()).getProject();
163:            }
164:
165:            private void updateProject() {
166:                TcPlugin plugin = TcPlugin.getDefault();
167:                IProject project = getProject();
168:                plugin.setup(project, m_configPathField.getText(),
169:                        m_serverOptionsField.getText());
170:                plugin.setAutoStartServerOption(project,
171:                        m_autoStartServerButton.getSelection());
172:                plugin.setWarnConfigProblemsOption(project,
173:                        m_warnConfigProblemsButton.getSelection());
174:                plugin.setQueryRestartOption(project, m_queryRestartButton
175:                        .getSelection());
176:            }
177:
178:            public boolean performOk() {
179:                updateProject();
180:                return true;
181:            }
182:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.