Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 203158 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/datatools/enablement/hsqldb/catalog/HSQLDBPipelineTreeContentProvider.java (-114 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Sybase, Inc.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Brian Fitzpatrick - initial API and implementation
10
 ******************************************************************************/
11
package org.eclipse.datatools.enablement.hsqldb.catalog;
12
13
import java.util.ArrayList;
14
import java.util.Arrays;
15
import java.util.Iterator;
16
import java.util.Set;
17
18
import org.eclipse.datatools.connectivity.sqm.core.internal.ui.explorer.providers.content.virtual.StoredProcedureNode;
19
import org.eclipse.datatools.connectivity.sqm.server.internal.ui.explorer.providers.content.impl.ServerExplorerContentProviderNav;
20
import org.eclipse.ui.IMemento;
21
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
22
import org.eclipse.ui.navigator.IPipelinedTreeContentProvider;
23
import org.eclipse.ui.navigator.PipelinedShapeModification;
24
import org.eclipse.ui.navigator.PipelinedViewerUpdate;
25
26
/**
27
 * @author brianf
28
 *
29
 */
30
public class HSQLDBPipelineTreeContentProvider extends ServerExplorerContentProviderNav implements IPipelinedTreeContentProvider {
31
32
	/**
33
	 * 
34
	 */
35
	public HSQLDBPipelineTreeContentProvider() {
36
		super();
37
	}
38
39
	/* (non-Javadoc)
40
	 * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#getPipelinedChildren(java.lang.Object, java.util.Set)
41
	 */
42
	public void getPipelinedChildren(Object aParent, Set theCurrentChildren) {
43
		Object[] children = getChildren(aParent);
44
		ArrayList kids = new ArrayList(Arrays.asList(children));
45
		theCurrentChildren.clear();
46
		for (Iterator iter = kids.iterator(); iter.hasNext();) {
47
			if (iter.next() instanceof StoredProcedureNode)
48
				iter.remove();
49
		}
50
		theCurrentChildren.addAll(kids);
51
	}
52
53
	/* (non-Javadoc)
54
	 * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#getPipelinedElements(java.lang.Object, java.util.Set)
55
	 */
56
	public void getPipelinedElements(Object anInput, Set theCurrentElements) {
57
		Object[] children = getElements(anInput);
58
59
		theCurrentElements.addAll(Arrays.asList(children));
60
	}
61
62
	/* (non-Javadoc)
63
	 * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#getPipelinedParent(java.lang.Object, java.lang.Object)
64
	 */
65
	public Object getPipelinedParent(Object anObject, Object aSuggestedParent) {
66
		return getParent(anObject);
67
	}
68
69
	/* (non-Javadoc)
70
	 * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#interceptAdd(org.eclipse.ui.navigator.PipelinedShapeModification)
71
	 */
72
	public PipelinedShapeModification interceptAdd(
73
			PipelinedShapeModification anAddModification) {
74
		return anAddModification;
75
	}
76
77
	/* (non-Javadoc)
78
	 * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#interceptRefresh(org.eclipse.ui.navigator.PipelinedViewerUpdate)
79
	 */
80
	public boolean interceptRefresh(
81
			PipelinedViewerUpdate aRefreshSynchronization) {
82
		return true;
83
	}
84
85
	/* (non-Javadoc)
86
	 * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#interceptRemove(org.eclipse.ui.navigator.PipelinedShapeModification)
87
	 */
88
	public PipelinedShapeModification interceptRemove(
89
			PipelinedShapeModification aRemoveModification) {
90
		return aRemoveModification;
91
	}
92
93
	/* (non-Javadoc)
94
	 * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#interceptUpdate(org.eclipse.ui.navigator.PipelinedViewerUpdate)
95
	 */
96
	public boolean interceptUpdate(PipelinedViewerUpdate anUpdateSynchronization) {
97
		return true;
98
	}
99
	/* (non-Javadoc)
100
	 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
101
	 */
102
	public void dispose() {
103
		super.dispose();
104
	}
105
106
	public void init(ICommonContentExtensionSite aConfig) {
107
	}
108
109
	public void restoreState(IMemento aMemento) {
110
	}
111
112
	public void saveState(IMemento aMemento) {
113
	}
114
}
(-)build.properties (-2 / +1 lines)
Lines 5-12 Link Here
5
               about.html,\
5
               about.html,\
6
               META-INF/,\
6
               META-INF/,\
7
               .,\
7
               .,\
8
               icons/,\
8
               icons/
9
               runtime/
10
jars.compile.order = .
9
jars.compile.order = .
11
output.. = bin/
10
output.. = bin/
12
source.. = src/
11
source.. = src/
(-)plugin.xml (-61 lines)
Lines 2-18 Link Here
2
<?eclipse version="3.2"?>
2
<?eclipse version="3.2"?>
3
<plugin>
3
<plugin>
4
   <extension
4
   <extension
5
         point="org.eclipse.datatools.connectivity.sqm.core.databaseDefinition">
6
      <definition
7
            description="%product.display.description"
8
            file="runtime/vendors/HSQLDB_1.8/HSQLDB_1.8.xmi"
9
            product="HSQLDB"
10
            productDisplayString="%product.display.string"
11
            version="1.8"
12
            versionDisplayString="%product.display.version.string"/>
13
   </extension>
14
15
   <extension
16
         point="org.eclipse.datatools.connectivity.driverExtension">
5
         point="org.eclipse.datatools.connectivity.driverExtension">
17
      <category
6
      <category
18
            description="%driver.category.description"
7
            description="%driver.category.description"
Lines 92-122 Link Here
92
            id="org.eclipse.datatools.enablement.hsqldb.connectionProfile"
81
            id="org.eclipse.datatools.enablement.hsqldb.connectionProfile"
93
            name="%connection.profile"
82
            name="%connection.profile"
94
            pingFactory="org.eclipse.datatools.enablement.hsqldb.connection.HSQLDBJDBCConnectionFactory"/>
83
            pingFactory="org.eclipse.datatools.enablement.hsqldb.connection.HSQLDBJDBCConnectionFactory"/>
95
      <newWizard
96
            class="org.eclipse.datatools.enablement.hsqldb.ui.wizard.NewHSQLDBConnectionProfileWizard"
97
            icon="icons/new_db_element.gif"
98
            id="org.eclipse.datatools.enablement.hsqldb.connectionProfile.NewConnectionProfileWizard"
99
            name="%connection.profile.newwizard"
100
            description = "%connection.profile.newwizard.description"
101
            profile="org.eclipse.datatools.enablement.hsqldb.connectionProfile"/>
102
   </extension>
84
   </extension>
103
85
104
   <extension
105
         point="org.eclipse.ui.propertyPages">
106
      <page
107
            class="org.eclipse.datatools.enablement.hsqldb.ui.properties.HSQLDBPropertyPage"
108
            id="org.eclipse.datatools.enablement.hsqldb.connectionProfile.profileProperties"
109
            name="%profile.page.name">
110
         <filter
111
               name="org.eclipse.datatools.profile.property.id"
112
               value="org.eclipse.datatools.enablement.hsqldb.connectionProfile"/>
113
         <enabledWhen>
114
            <instanceof
115
                  value="org.eclipse.datatools.connectivity.IConnectionProfile">
116
            </instanceof>
117
         </enabledWhen>
118
      </page>
119
   </extension>
120
<!--
86
<!--
121
   <extension
87
   <extension
122
         point="org.eclipse.datatools.connectivity.sqm.core.catalog">
88
         point="org.eclipse.datatools.connectivity.sqm.core.catalog">
Lines 126-157 Link Here
126
            product="HSQLDB"
92
            product="HSQLDB"
127
            version="1.8"/>
93
            version="1.8"/>
128
   </extension>
94
   </extension>
129
130
   <extension
131
         point="org.eclipse.ui.navigator.viewer">
132
      <viewerContentBinding viewerId="org.eclipse.datatools.connectivity.DataSourceExplorerNavigator">
133
         <includes>
134
            <contentExtension pattern="org.eclipse.datatools.enablement.hsqldb.navigatorContent"/>
135
         </includes>
136
      </viewerContentBinding>
137
   </extension>
138
139
   <extension
140
         point="org.eclipse.ui.navigator.navigatorContent">
141
      <navigatorContent
142
            activeByDefault="true"
143
            contentProvider="org.eclipse.datatools.enablement.hsqldb.catalog.HSQLDBPipelineTreeContentProvider"
144
            id="org.eclipse.datatools.enablement.hsqldb.navigatorContent"
145
            labelProvider="org.eclipse.datatools.connectivity.sqm.server.internal.ui.explorer.providers.SQLModelLabelProviderExtension"
146
            name="%navigator.content.name"
147
            priority="highest">
148
         <override
149
               policy="InvokeAlwaysRegardlessOfSuppressedExt"
150
               suppressedExtensionId="org.eclipse.datatools.connectivity.db.sqlModelContent"/>
151
         <triggerPoints>
152
            <instanceof value="org.eclipse.datatools.enablement.hsqldb.catalog.HSQLDBCatalogSchema"/>
153
         </triggerPoints>
154
      </navigatorContent>
155
   </extension>
156
-->
95
-->
157
</plugin>
96
</plugin>
(-)plugin.properties (-22 / +2 lines)
Lines 1-28 Link Here
1
DRIVER_CLASS_PROPERTY_NAME=Driver Class
2
VENDOR_PROPERTY_NAME=Vendor
3
VERSION_PROPERTY_NAME=Version
4
DATABASE_NAME_PROPERTY_NAME=Database Name
5
CONNECTION_URL_PROPERTY_NAME=Connection URL
6
USER_ID_PROPERTY_NAME=User ID
7
PASSWORD_PROPERTY_NAME=Password
8
9
Bundle-Vendor = Eclipse.org
1
Bundle-Vendor = Eclipse.org
10
Bundle-Name = Eclipse Data Tools Platform HSQLDB Enablement Plug-in
2
Bundle-Name = Eclipse Data Tools Platform HSQLDB Enablement Plug-in
11
profile.page.name = HSQLDB Profile Properties
12
navigator.content.name = HSQLDB Profile Content Extension
13
14
product.display.string = HSQLDB
15
product.display.version.string = 1.8
16
product.display.description = HSQLDB Connection Profile
17
3
18
driver.category.name = HSQLDB
4
navigator.content.name = HSQLDB Profile Content Extension
19
driver.category.description = HSQLDB JDBC Drivers
20
driver.version.category.name = 1.8
21
driver.version.category.description = HSQLDB JDBC Drivers for Version 1.8
22
driver.name = HSQLDB JDBC Driver
23
driver.description = JDBC driver for HSQLDB
24
5
25
connection.factory = HSQLDB Connection Factory
6
connection.factory = HSQLDB Connection Factory
26
connection.profile = HSQLDB Connection Profile
7
connection.profile = HSQLDB Connection Profile
27
connection.profile.newwizard = HSQLDB
8
28
connection.profile.newwizard.description = Create an HSQLDB connection profile.
(-)src/org/eclipse/datatools/enablement/hsqldb/ui/properties/HSQLDBPropertyPage.java (-479 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Sybase, Inc.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Brian Fitzpatrick - initial API and implementation
10
 ******************************************************************************/
11
package org.eclipse.datatools.enablement.hsqldb.ui.properties;
12
13
import java.io.File;
14
import java.util.Properties;
15
import java.util.StringTokenizer;
16
17
import javax.swing.event.ChangeEvent;
18
import javax.swing.event.ChangeListener;
19
20
import org.eclipse.core.runtime.Path;
21
import org.eclipse.datatools.connectivity.ConnectionProfileConstants;
22
import org.eclipse.datatools.connectivity.IConnectionProfile;
23
import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants;
24
import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants;
25
import org.eclipse.datatools.connectivity.drivers.DriverInstance;
26
import org.eclipse.datatools.connectivity.internal.ui.DelimitedStringList;
27
import org.eclipse.datatools.connectivity.internal.ui.DriverListCombo;
28
import org.eclipse.datatools.connectivity.ui.wizards.ProfileDetailsPropertyPage;
29
import org.eclipse.datatools.enablement.hsqldb.ui.IHSQLDBConnectionProfileConstants;
30
import org.eclipse.datatools.enablement.hsqldb.ui.Messages;
31
import org.eclipse.jface.preference.PreferencePage;
32
import org.eclipse.swt.SWT;
33
import org.eclipse.swt.events.ModifyEvent;
34
import org.eclipse.swt.events.ModifyListener;
35
import org.eclipse.swt.events.SelectionEvent;
36
import org.eclipse.swt.events.SelectionListener;
37
import org.eclipse.swt.layout.GridData;
38
import org.eclipse.swt.layout.GridLayout;
39
import org.eclipse.swt.widgets.Button;
40
import org.eclipse.swt.widgets.Composite;
41
import org.eclipse.swt.widgets.Control;
42
import org.eclipse.swt.widgets.DirectoryDialog;
43
import org.eclipse.swt.widgets.Label;
44
import org.eclipse.swt.widgets.Text;
45
46
/**
47
 * Property page for HSQLDB profiles
48
 *
49
 */
50
public class HSQLDBPropertyPage extends ProfileDetailsPropertyPage {
51
52
	private static final String EMPTY_STRING = new String();
53
54
	// UI components
55
	private Text mDatabaseNameText;
56
	private Text mDBUIDText;
57
	private Text mDBPWDText;
58
	private Text mURLText;
59
	private Button mSaveDBPWDCheckbox;
60
	private Text mDBFilePathText;
61
	private Button mBrowseFilePathButton;
62
	final DriverListCombo combo = new DriverListCombo();
63
	private DelimitedStringList mDBConnProps;
64
65
	// other components
66
	private DriverInstance mDriverInstance;
67
	private String mDriverCategory;
68
69
	/**
70
	 * Constructor
71
	 */
72
	public HSQLDBPropertyPage() {
73
		super();
74
		noDefaultAndApplyButton();
75
		setDriverCategory(IHSQLDBConnectionProfileConstants.HSQLDB_CATEGORY_ID);
76
	}
77
78
	/**
79
	 * @see PreferencePage#createContents(Composite)
80
	 */
81
	protected void createCustomContents(Composite parent) {
82
		Composite content = new Composite(parent, SWT.NULL);
83
		GridLayout layout = new GridLayout(2, false);
84
		content.setLayout(layout);
85
86
		this.combo.setLabelText(Messages.getString(
87
				"HSQLDBProfileDetailsWizardPage.driverCombo.label")); //$NON-NLS-1$
88
		this.combo.setCategory(getDriverCategory());
89
		this.combo.setNullDriverIsValid(false);
90
		this.combo.createContents(content);
91
92
		this.mDatabaseNameText = (Text) createLabelTextPair(
93
				content,
94
				Messages.getString(
95
						"HSQLDBProfileDetailsWizardPage.databaseName.label"), //$NON-NLS-1$
96
				this.mURLText, SWT.BORDER, GridData.FILL_HORIZONTAL);		
97
98
		Label label = new Label(content, SWT.NULL);
99
		label.setLayoutData(new GridData());
100
		label.setText(Messages.getString("HSQLDBProfileDetailsWizardPage.0")); //$NON-NLS-1$
101
102
		Composite textAndBrowseComposite = new Composite(content, SWT.NULL);
103
		GridLayout subCompositeLayout = new GridLayout(2, false);
104
		subCompositeLayout.marginLeft = -5;
105
		subCompositeLayout.marginRight = -5;
106
		subCompositeLayout.marginTop = -5;
107
		subCompositeLayout.marginBottom = -5;
108
		textAndBrowseComposite.setLayout(subCompositeLayout);
109
		textAndBrowseComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
110
		this.mDBFilePathText = new Text(textAndBrowseComposite, SWT.BORDER);
111
		this.mDBFilePathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
112
		this.mBrowseFilePathButton = new Button(textAndBrowseComposite, SWT.PUSH);
113
		this.mBrowseFilePathButton.setText(Messages.getString("HSQLDBProfileDetailsWizardPage.1")); //$NON-NLS-1$
114
		this.mBrowseFilePathButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
115
116
		this.mURLText = (Text) createLabelTextPair(content, Messages.getString(
117
						"HSQLDBProfileDetailsWizardPage.url.label"), //$NON-NLS-1$
118
				this.mURLText, SWT.BORDER, GridData.FILL_HORIZONTAL);
119
		this.mDBUIDText = (Text) createLabelTextPair(content, Messages.getString(
120
						"HSQLDBProfileDetailsWizardPage.userName.label"), //$NON-NLS-1$ 
121
				this.mDBUIDText, SWT.BORDER, GridData.FILL_HORIZONTAL);
122
123
		this.mDBPWDText = (Text) createLabelTextPair(content, Messages.getString(
124
						"HSQLDBProfileDetailsWizardPage.password.label"), //$NON-NLS-1$, 
125
				this.mDBPWDText, SWT.BORDER | SWT.PASSWORD, GridData.FILL_HORIZONTAL);
126
127
		this.mSaveDBPWDCheckbox = new Button(content, SWT.CHECK);
128
		this.mSaveDBPWDCheckbox.setText(Messages
129
				.getString(
130
						"HSQLDBProfileDetailsWizardPage.persistpassword.label")); //$NON-NLS-1$
131
		this.mSaveDBPWDCheckbox.setLayoutData(new GridData(GridData.BEGINNING,
132
				GridData.CENTER, true, false, 2, 1));
133
134
		Composite spacer = new Composite(content, SWT.NULL);
135
		GridData gdata = new GridData(GridData.FILL_HORIZONTAL);
136
		gdata.horizontalSpan = 2;
137
		gdata.heightHint = 20;
138
		spacer.setLayoutData(gdata);
139
140
		label = new Label(content, SWT.NULL);
141
		gdata = new GridData(GridData.FILL_HORIZONTAL);
142
		gdata.horizontalSpan = 2;
143
		label.setLayoutData(gdata);
144
		label.setText(Messages.getString(
145
				"HSQLDBProfileDetailsWizardPage.optionalProps.label")); //$NON-NLS-1$
146
147
		this.mDBConnProps = new DelimitedStringList(content, SWT.NONE);
148
		gdata = new GridData(GridData.FILL_HORIZONTAL);
149
		gdata.horizontalSpan = 2;
150
		this.mDBConnProps.setLayoutData(gdata);
151
152
		this.mDBConnProps.addChangeListener(new ChangeListener() {
153
154
			public void stateChanged(ChangeEvent arg0) {
155
				setErrorMessage(null);
156
				if (HSQLDBPropertyPage.this.mDBConnProps.getWarning() != null) {
157
					setErrorMessage(HSQLDBPropertyPage.this.mDBConnProps
158
							.getWarning());
159
				}
160
			}
161
162
		});
163
164
		this.combo.addChangeListener(new ChangeListener() {
165
166
			public void stateChanged(ChangeEvent arg0) {
167
				HSQLDBPropertyPage.this.mDriverInstance = HSQLDBPropertyPage.this.combo
168
						.getSelectedDriverInstance();
169
				setErrorMessage(null);
170
				if (HSQLDBPropertyPage.this.combo.getErrorMessage() != null) {
171
					setErrorMessage(HSQLDBPropertyPage.this.combo
172
							.getErrorMessage());
173
				}
174
				else
175
					HSQLDBPropertyPage.this.mURLText
176
							.setText(getDriverURL());
177
				String username = HSQLDBPropertyPage.this
178
						.getPropertyFromDriverInstance(IDBDriverDefinitionConstants.USERNAME_PROP_ID);
179
				if (username == null || username.trim().length() == 0)
180
					username = new String();
181
				String oldUsername = HSQLDBPropertyPage.this.mDBUIDText
182
						.getText();
183
				if (oldUsername == null || oldUsername.trim().length() == 0)
184
					oldUsername = new String();
185
				if (oldUsername.length() == 0)
186
					HSQLDBPropertyPage.this.mDBUIDText
187
							.setText(username);
188
189
				String password = HSQLDBPropertyPage.this
190
						.getPropertyFromDriverInstance(IDBDriverDefinitionConstants.PASSWORD_PROP_ID);
191
				if (password == null || password.trim().length() == 0)
192
					password = new String();
193
				String oldPassword = HSQLDBPropertyPage.this.mDBPWDText
194
						.getText();
195
				if (oldPassword == null || oldPassword.trim().length() == 0)
196
					oldPassword = new String();
197
				if (oldPassword.length() == 0)
198
					HSQLDBPropertyPage.this.mDBPWDText
199
							.setText(password);
200
			}
201
202
		});
203
204
		initControls();
205
206
		this.mDBFilePathText.addModifyListener(new ModifyListener() {
207
			public void modifyText(ModifyEvent e) {
208
				HSQLDBPropertyPage.this.updateURLFromProps();
209
			}
210
		});
211
		
212
		this.mBrowseFilePathButton.addSelectionListener( new SelectionListener() {
213
214
			public void widgetDefaultSelected(SelectionEvent e) {
215
				HSQLDBPropertyPage.this.browseForDBFolder();
216
			}
217
218
			public void widgetSelected(SelectionEvent e) {
219
				HSQLDBPropertyPage.this.browseForDBFolder();
220
			}
221
		});
222
223
		// return content;
224
	}
225
226
	/*
227
	 * (non-Javadoc)
228
	 * 
229
	 * @see org.eclipse.jface.preference.IPreferencePage#performOk()
230
	 */
231
	protected Properties collectProperties() {
232
		Properties props = new Properties();
233
234
		String driverID = EMPTY_STRING;
235
236
		if (this.combo.getSelectedDriverInstance() != null) {
237
			DriverInstance instance = this.combo.getSelectedDriverInstance();
238
			driverID = instance.getId();
239
		}
240
241
		props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID,
242
				driverID);
243
		props.setProperty(
244
				IDBConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID,
245
				this.mDBConnProps.getSelection());	
246
		props.setProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, getPropertyFromDriverInstance(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID));		
247
		props.setProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, getPropertyFromDriverInstance(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID));		
248
		props.setProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, getPropertyFromDriverInstance(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID));	
249
		props.setProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID, this.mDatabaseNameText
250
				.getText());
251
		props.setProperty(IDBDriverDefinitionConstants.PASSWORD_PROP_ID, this.mDBPWDText
252
				.getText());
253
		props.setProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID, this.mDBUIDText
254
				.getText());
255
		props.setProperty(IDBDriverDefinitionConstants.URL_PROP_ID,
256
				this.mURLText.getText());
257
		props.setProperty(
258
				IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID, String
259
						.valueOf(this.mSaveDBPWDCheckbox.getSelection()));
260
261
		return props;
262
	}
263
264
	/**
265
	 * 
266
	 */
267
	private void initControls() {
268
		IConnectionProfile profile = getConnectionProfile();
269
		String driverID = profile.getBaseProperties().getProperty(
270
				ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID);
271
		if (driverID != null) {
272
			this.combo.setSelectionToID(driverID);
273
		}
274
275
		String connectionProps = profile.getBaseProperties().getProperty(
276
				IDBConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID);
277
		if (connectionProps != null) {
278
			this.mDBConnProps.setSelection(connectionProps);
279
		}
280
281
		String databaseName = profile.getBaseProperties().getProperty(
282
				IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID);
283
		if (databaseName != null) {
284
			this.mDatabaseNameText.setText(databaseName);
285
		}
286
		
287
		String databasePwd = profile.getBaseProperties().getProperty(
288
				IDBDriverDefinitionConstants.PASSWORD_PROP_ID);
289
		if (databasePwd != null) {
290
			this.mDBPWDText.setText(databasePwd);
291
		}
292
293
		String databaseUid = profile.getBaseProperties().getProperty(
294
				IDBDriverDefinitionConstants.USERNAME_PROP_ID);
295
		if (databaseUid != null) {
296
			this.mDBUIDText.setText(databaseUid);
297
		}
298
299
		String urlText = profile.getBaseProperties().getProperty(
300
				IDBDriverDefinitionConstants.URL_PROP_ID);
301
		if (urlText != null) {
302
			this.mURLText.setText(urlText);
303
			this.mURLText.setEnabled(false);
304
		}
305
306
		this.mSaveDBPWDCheckbox.setSelection(Boolean.valueOf(
307
				profile.getBaseProperties().getProperty(
308
						IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID,
309
						Boolean.FALSE.toString())).booleanValue());
310
311
		this.updatePropsFromURL();
312
313
		setErrorMessage(null);
314
		if (this.combo.getErrorMessage() != null) {
315
			setErrorMessage(this.combo.getErrorMessage());
316
		}
317
	}
318
	
319
	/**
320
	 * Browse for a DB folder
321
	 */
322
	private void browseForDBFolder() {
323
		DirectoryDialog dialog = new DirectoryDialog(getShell());
324
		dialog.setText(Messages
325
				.getString("HSQLDBProfileDetailsWizardPage.FileDialog.title.filebrowse")); //$NON-NLS-1$
326
		dialog.setMessage(Messages
327
				.getString("HSQLDBProfileDetailsWizardPage.FileDialog.msg.filebrowse")); //$NON-NLS-1$
328
329
		String dirName = mDBFilePathText.getText();
330
331
		File path = new File(dirName);
332
		if (path.exists()) {
333
			dialog.setFilterPath(new Path(dirName).toOSString());
334
		}
335
336
		String selectedDirectory = dialog.open();
337
		if (selectedDirectory != null) {
338
			this.mDBFilePathText.setText(selectedDirectory);
339
		}
340
	}
341
342
	/**
343
	 * Based on the URL, update the UI components accordingly
344
	 */
345
	private void updatePropsFromURL() {
346
		if (this.mDBFilePathText != null && this.mURLText != null) {
347
			String url = this.mURLText.getText();
348
			String[] chunks = parseString(url, ";"); //$NON-NLS-1$
349
			if (chunks.length > 0) {
350
				String[] chunks2 = parseString(chunks[0], ":"); //$NON-NLS-1$
351
				if (chunks2.length > 2) {
352
					String filepath = chunks2[2];
353
					if (chunks2.length > 3) {
354
						filepath = filepath + ":" + chunks2[3]; //$NON-NLS-1$
355
					}
356
					this.mDBFilePathText.setText(filepath);
357
				}
358
			}
359
		}
360
	}
361
	
362
	/**
363
	 * Based on the state of the UI components, reset the URL
364
	 */
365
	private void updateURLFromProps() {
366
		if (this.mDBFilePathText != null && this.mURLText != null) {
367
			String url = this.mURLText.getText();
368
			String filePath = this.mDBFilePathText.getText();
369
			//jdbc:derby:C:\DerbyDatabases\MyDB;create=true
370
			String[] chunks = parseString(url, ";"); //$NON-NLS-1$
371
			if (chunks.length > 0) {
372
				String[] chunks2 = parseString(chunks[0], ":"); //$NON-NLS-1$
373
				if (chunks2.length > 2) {
374
					url = chunks2[0] + ":" + chunks2[1] + ":" + filePath; //$NON-NLS-1$ //$NON-NLS-2$
375
					this.mURLText.setText(url);
376
				}
377
			}
378
		}
379
	}
380
381
	/**
382
	 * Parse a string into an array based on a token
383
	 * @param str_list
384
	 * @param token
385
	 * @return
386
	 */
387
	private  String[] parseString(String str_list, String token) {
388
		StringTokenizer tk = new StringTokenizer(str_list, token);
389
		String[] pieces = new String[tk.countTokens()];
390
		int index = 0;
391
		while (tk.hasMoreTokens())
392
			pieces[index++] = tk.nextToken();
393
		return pieces;
394
	}
395
396
	/**
397
	 * @param propertyID
398
	 * @return
399
	 */
400
	private String getPropertyFromDriverInstance(String propertyID) {
401
		String returnStr = new String();
402
		if (this.mDriverInstance != null
403
				&& this.mDriverInstance.getProperty(propertyID) != null) {
404
			returnStr = this.mDriverInstance.getProperty(propertyID);
405
		}
406
		return returnStr;
407
	}
408
409
	/**
410
	 * @param parent
411
	 * @param labelText
412
	 * @param ctl
413
	 * @param style
414
	 * @param gData
415
	 * @return
416
	 */
417
	private Control createLabelTextPair(Composite parent, String labelText,
418
			Control ctl, int style, int gData) {
419
		Label label = new Label(parent, SWT.NULL);
420
		label.setLayoutData(new GridData());
421
		label.setText(labelText);
422
423
		ctl = new Text(parent, style);
424
		ctl.setLayoutData(new GridData(gData));
425
426
		return ctl;
427
	}
428
429
	/**
430
	 * @return
431
	 */
432
	public String getDriverURL() {
433
		return this.mDriverInstance
434
				.getProperty(IDBDriverDefinitionConstants.URL_PROP_ID);
435
	}
436
437
	/*
438
	 * (non-Javadoc)
439
	 * 
440
	 * @see org.eclipse.jface.preference.IPreferencePage#isValid()
441
	 */
442
	public boolean isValid() {
443
		if (getErrorMessage() != null) {
444
			return false;
445
		}
446
		return super.isValid();
447
	}
448
449
	/*
450
	 * (non-Javadoc)
451
	 * 
452
	 * @see org.eclipse.jface.dialogs.DialogPage#setErrorMessage(java.lang.String)
453
	 */
454
	public void setErrorMessage(String newMessage) {
455
		super.setErrorMessage(newMessage);
456
		isValid();
457
	}
458
459
	/**
460
	 * @return
461
	 */
462
	public String getDriverCategory() {
463
		return mDriverCategory;
464
	}
465
466
	
467
	/**
468
	 * Sets the driver category that should be used for displaying available
469
	 * driver defnitions.
470
	 * 
471
	 * @param driverCategory
472
	 */
473
	public void setDriverCategory(String driverCategory) {
474
		mDriverCategory = driverCategory;
475
		if (combo != null) {
476
			combo.setCategory(mDriverCategory);
477
		}
478
	}
479
}
(-)src/org/eclipse/datatools/enablement/hsqldb/ui/wizard/HSQLDBProfileDetailsWizardPage.java (-576 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Sybase, Inc.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Brian Fitzpatrick - initial API and implementation
10
 ******************************************************************************/
11
package org.eclipse.datatools.enablement.hsqldb.ui.wizard;
12
13
import java.io.File;
14
import java.util.ArrayList;
15
import java.util.List;
16
import java.util.StringTokenizer;
17
18
import javax.swing.event.ChangeEvent;
19
import javax.swing.event.ChangeListener;
20
21
import org.eclipse.core.runtime.Path;
22
import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants;
23
import org.eclipse.datatools.connectivity.drivers.DriverInstance;
24
import org.eclipse.datatools.connectivity.internal.ui.DelimitedStringList;
25
import org.eclipse.datatools.connectivity.internal.ui.DriverListCombo;
26
import org.eclipse.datatools.connectivity.ui.wizards.ConnectionProfileDetailsPage;
27
import org.eclipse.datatools.enablement.hsqldb.ui.IHSQLDBConnectionProfileConstants;
28
import org.eclipse.datatools.enablement.hsqldb.ui.Messages;
29
import org.eclipse.swt.SWT;
30
import org.eclipse.swt.events.ModifyEvent;
31
import org.eclipse.swt.events.ModifyListener;
32
import org.eclipse.swt.events.SelectionEvent;
33
import org.eclipse.swt.events.SelectionListener;
34
import org.eclipse.swt.layout.GridData;
35
import org.eclipse.swt.layout.GridLayout;
36
import org.eclipse.swt.widgets.Button;
37
import org.eclipse.swt.widgets.Composite;
38
import org.eclipse.swt.widgets.Control;
39
import org.eclipse.swt.widgets.DirectoryDialog;
40
import org.eclipse.swt.widgets.Label;
41
import org.eclipse.swt.widgets.Text;
42
43
/**
44
 * This class gathers the properties for the HSQLDB connection profile.
45
 * 
46
 * @author brianf
47
 */
48
public class HSQLDBProfileDetailsWizardPage extends ConnectionProfileDetailsPage {
49
50
	// ui pieces
51
	private Text mDatabaseNameText;
52
53
	private Text mURLText;
54
55
	private Text mDBUIDText;
56
57
	private Text mDBPWDText;
58
59
	private Button mSaveDBPWDCheckbox;
60
61
	private DelimitedStringList mDBConnProps;
62
63
	final DriverListCombo combo = new DriverListCombo();
64
65
	private Text mDBFilePathText;
66
67
	private Button mBrowseFilePathButton;
68
69
	// stashed driver instance
70
	private DriverInstance mDriverInstance;
71
	
72
	private String mDriverCategory;
73
74
	/**
75
	 * Constructor
76
	 * 
77
	 * @param pageName
78
	 */
79
	public HSQLDBProfileDetailsWizardPage(String pageName) {
80
		super(pageName);
81
		setTitle(Messages.getString(
82
				"HSQLDBProfileDetailsWizardPage.title")); //$NON-NLS-1$
83
		setDescription(Messages.getString(
84
				"HSQLDBProfileDetailsWizardPage.msg")); //$NON-NLS-1$
85
		setDriverCategory(IHSQLDBConnectionProfileConstants.HSQLDB_CATEGORY_ID);
86
	}
87
88
	/*
89
	 * (non-Javadoc)
90
	 * 
91
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
92
	 */
93
	public void createCustomControl(Composite parent) {
94
		Composite content = new Composite(parent, SWT.NULL);
95
		GridLayout layout = new GridLayout(2, false);
96
		content.setLayout(layout);
97
98
		// set up the drivers combo
99
		this.combo.setLabelText(Messages.getString(
100
				"HSQLDBProfileDetailsWizardPage.driverCombo.label")); //$NON-NLS-1$
101
		this.combo.setCategory(getDriverCategory());
102
		this.combo.setNullDriverIsValid(false);
103
		this.combo.createContents(content);
104
		if (this.combo.getErrorMessage() != null) {
105
			setErrorMessage(this.combo.getErrorMessage());
106
		}
107
108
		// set up the fields
109
		this.mDatabaseNameText = (Text) createLabelTextPair(
110
				content,
111
				Messages.getString(
112
						"HSQLDBProfileDetailsWizardPage.databaseName.label"), //$NON-NLS-1$
113
				this.mURLText, SWT.BORDER, GridData.FILL_HORIZONTAL);
114
115
		Label label = new Label(content, SWT.NULL);
116
		label.setLayoutData(new GridData());
117
		label.setText(Messages.getString("HSQLDBProfileDetailsWizardPage.0")); //$NON-NLS-1$
118
119
		Composite textAndBrowseComposite = new Composite(content, SWT.NULL);
120
		GridLayout subCompositeLayout = new GridLayout(2, false);
121
		subCompositeLayout.marginLeft = -5;
122
		subCompositeLayout.marginRight = -5;
123
		subCompositeLayout.marginTop = -5;
124
		subCompositeLayout.marginBottom = -5;
125
		textAndBrowseComposite.setLayout(subCompositeLayout);
126
		textAndBrowseComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
127
		this.mDBFilePathText = new Text(textAndBrowseComposite, SWT.BORDER);
128
		this.mDBFilePathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
129
		this.mBrowseFilePathButton = new Button(textAndBrowseComposite, SWT.PUSH);
130
		this.mBrowseFilePathButton.setText(Messages.getString("HSQLDBProfileDetailsWizardPage.1")); //$NON-NLS-1$
131
		this.mBrowseFilePathButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
132
133
		this.mDBUIDText = (Text) createLabelTextPair(content, Messages.getString(
134
						"HSQLDBProfileDetailsWizardPage.userName.label"), //$NON-NLS-1$
135
				this.mDBUIDText, SWT.BORDER, GridData.FILL_HORIZONTAL);
136
137
		this.mDBPWDText = (Text) createLabelTextPair(content, Messages.getString(
138
						"HSQLDBProfileDetailsWizardPage.password.label"), //$NON-NLS-1$
139
				this.mDBPWDText, SWT.BORDER | SWT.PASSWORD, GridData.FILL_HORIZONTAL);
140
141
		this.mURLText = (Text) createLabelTextPair(content, Messages.getString(
142
			"HSQLDBProfileDetailsWizardPage.url.label"), //$NON-NLS-1$
143
			this.mURLText, SWT.BORDER, GridData.FILL_HORIZONTAL);
144
145
		this.mSaveDBPWDCheckbox = new Button(content, SWT.CHECK);
146
		this.mSaveDBPWDCheckbox.setText(Messages.getString(
147
						"HSQLDBProfileDetailsWizardPage.persistpassword.label")); //$NON-NLS-1$
148
		this.mSaveDBPWDCheckbox.setLayoutData(new GridData(GridData.BEGINNING,
149
				GridData.CENTER, true, false, 2, 1));
150
151
		// spacer
152
		Composite spacer = new Composite(content, SWT.NULL);
153
		GridData gdata = new GridData(GridData.FILL_HORIZONTAL);
154
		gdata.horizontalSpan = 2;
155
		gdata.heightHint = 20;
156
		spacer.setLayoutData(gdata);
157
158
		// followed by the optional properties
159
		label = new Label(content, SWT.NULL);
160
		gdata = new GridData(GridData.FILL_HORIZONTAL);
161
		gdata.horizontalSpan = 2;
162
		label.setLayoutData(gdata);
163
		label.setText(Messages.getString(
164
				"HSQLDBProfileDetailsWizardPage.optionalProps.label")); //$NON-NLS-1$
165
166
		this.mDBConnProps = new DelimitedStringList(content, SWT.NONE);
167
		gdata = new GridData(GridData.FILL_HORIZONTAL);
168
		gdata.horizontalSpan = 2;
169
		this.mDBConnProps.setLayoutData(gdata);
170
171
//		// now set up the initial instance
172
//		if (this.mDriverInstance == null)
173
//			this.mDriverInstance = this.combo.getSelectedDriverInstance();
174
175
		this.mDBConnProps.addChangeListener(new ChangeListener() {
176
177
			public void stateChanged(ChangeEvent arg0) {
178
				setErrorMessage(null);
179
				if (HSQLDBProfileDetailsWizardPage.this.mDBConnProps.getWarning() != null) {
180
					setErrorMessage(HSQLDBProfileDetailsWizardPage.this.mDBConnProps
181
							.getWarning());
182
				}
183
			}
184
185
		});
186
187
		// add a change listener to the combo box so
188
		// we know when a new driver has been selected
189
		this.combo.addChangeListener(new ChangeListener() {
190
191
			public void stateChanged(ChangeEvent arg0) {
192
				HSQLDBProfileDetailsWizardPage.this.mDriverInstance = HSQLDBProfileDetailsWizardPage.this.combo
193
						.getSelectedDriverInstance();
194
				setErrorMessage(null);
195
				if (HSQLDBProfileDetailsWizardPage.this.combo.getErrorMessage() != null) {
196
					setErrorMessage(HSQLDBProfileDetailsWizardPage.this.combo
197
							.getErrorMessage());
198
				}
199
				HSQLDBProfileDetailsWizardPage.this.mDatabaseNameText
200
						.setText(getDriverDatabaseName());
201
202
				HSQLDBProfileDetailsWizardPage.this.mURLText
203
						.setText(getDriverURL());
204
				HSQLDBProfileDetailsWizardPage.this.updatePropsFromURL();
205
206
				String username = HSQLDBProfileDetailsWizardPage.this
207
						.getPropertyFromDriverInstance(IDBDriverDefinitionConstants.USERNAME_PROP_ID);
208
				if (username == null || username.trim().length() == 0)
209
					username = new String();
210
				HSQLDBProfileDetailsWizardPage.this.mDBUIDText.setText(username);
211
212
				String password = HSQLDBProfileDetailsWizardPage.this
213
						.getPropertyFromDriverInstance(IDBDriverDefinitionConstants.PASSWORD_PROP_ID);
214
				if (password == null || password.trim().length() == 0)
215
					password = new String();
216
				HSQLDBProfileDetailsWizardPage.this.mDBPWDText.setText(password);
217
218
				setPageComplete(isValid());
219
			}
220
221
		});
222
		
223
		this.mDBFilePathText.addModifyListener(new ModifyListener() {
224
			public void modifyText(ModifyEvent e) {
225
				HSQLDBProfileDetailsWizardPage.this.updateURLFromProps();
226
			}
227
		});
228
		this.mBrowseFilePathButton.addSelectionListener( new SelectionListener() {
229
230
			public void widgetDefaultSelected(SelectionEvent e) {
231
				HSQLDBProfileDetailsWizardPage.this.browseForDBFolder();
232
			}
233
234
			public void widgetSelected(SelectionEvent e) {
235
				HSQLDBProfileDetailsWizardPage.this.browseForDBFolder();
236
			}
237
		});
238
239
		this.combo.selectFirstItem();
240
		// now set up the initial instance
241
		if (this.mDriverInstance == null)
242
			this.mDriverInstance = this.combo.getSelectedDriverInstance();
243
		if (this.mDriverInstance != null) {
244
			this.mURLText.setText(getDriverURL());
245
		}
246
		this.mURLText.setEnabled(false);
247
248
	}
249
	
250
	/**
251
	 * Browse for the database folder
252
	 */
253
	private void browseForDBFolder() {
254
		DirectoryDialog dialog = new DirectoryDialog(getShell());
255
		dialog.setText(Messages
256
				.getString("HSQLDBProfileDetailsWizardPage.FileDialog.title.filebrowse")); //$NON-NLS-1$
257
		dialog.setMessage(Messages
258
				.getString("HSQLDBProfileDetailsWizardPage.FileDialog.msg.filebrowse")); //$NON-NLS-1$
259
260
		String dirName = mDBFilePathText.getText();
261
262
		File path = new File(dirName);
263
		if (path.exists()) {
264
			dialog.setFilterPath(new Path(dirName).toOSString());
265
		}
266
267
		String selectedDirectory = dialog.open();
268
		if (selectedDirectory != null) {
269
			this.mDBFilePathText.setText(selectedDirectory);
270
		}
271
	}
272
273
	/**
274
	 * Update the UI components from the URL
275
	 */
276
	private void updatePropsFromURL() {
277
		if (this.mDBFilePathText != null && this.mURLText != null) {
278
			String url = this.mURLText.getText();
279
			String[] chunks = parseString(url, ";"); //$NON-NLS-1$
280
			if (chunks.length > 0) {
281
				String[] chunks2 = parseString(chunks[0], ":"); //$NON-NLS-1$
282
				if (chunks2.length > 2) {
283
					String filepath = chunks2[2];
284
					if (chunks2.length > 3) {
285
						filepath = filepath + ":" + chunks2[3]; //$NON-NLS-1$
286
					}
287
					this.mDBFilePathText.setText(filepath);
288
				}
289
			}
290
		}
291
	}
292
	
293
	/**
294
	 * Update the URL from the UI components
295
	 */
296
	private void updateURLFromProps() {
297
		if (this.mDBFilePathText != null && this.mURLText != null) {
298
			String url = this.mURLText.getText();
299
			String filePath = this.mDBFilePathText.getText();
300
			//jdbc:derby:C:\DerbyDatabases\MyDB;create=true
301
			String[] chunks = parseString(url, ";"); //$NON-NLS-1$
302
			if (chunks.length > 0) {
303
				String[] chunks2 = parseString(chunks[0], ":"); //$NON-NLS-1$
304
				if (chunks2.length > 2) {
305
					url = chunks2[0] + ":" + chunks2[1] + ":" + filePath; //$NON-NLS-1$ //$NON-NLS-2$
306
					this.mURLText.setText(url);
307
				}
308
			}
309
		}
310
	}
311
312
	/**
313
	 * Parse a string into a string array based on a token
314
	 * @param str_list
315
	 * @param token
316
	 * @return
317
	 */
318
	private  String[] parseString(String str_list, String token) {
319
		StringTokenizer tk = new StringTokenizer(str_list, token);
320
		String[] pieces = new String[tk.countTokens()];
321
		int index = 0;
322
		while (tk.hasMoreTokens())
323
			pieces[index++] = tk.nextToken();
324
		return pieces;
325
	}
326
327
	/**
328
	 * @param propertyID
329
	 * @return
330
	 */
331
	private String getPropertyFromDriverInstance(String propertyID) {
332
		String returnStr = new String();
333
		if (this.mDriverInstance != null
334
				&& this.mDriverInstance.getProperty(propertyID) != null) {
335
			returnStr = this.mDriverInstance.getProperty(propertyID);
336
		}
337
		return returnStr;
338
	}
339
340
	/**
341
	 * Get the sample URL from the driver instance.
342
	 * 
343
	 * @return
344
	 */
345
	public String getDriverURL() {
346
		if (this.mDriverInstance != null
347
				&& this.mDriverInstance
348
						.getProperty(IDBDriverDefinitionConstants.URL_PROP_ID) != null)
349
			return this.mDriverInstance
350
					.getProperty(IDBDriverDefinitionConstants.URL_PROP_ID);
351
		return new String();
352
	}
353
354
	/**
355
	 * Get the sample database name from the driver instance.
356
	 * 
357
	 * @return
358
	 */
359
	public String getDriverDatabaseName() {
360
		if (this.mDriverInstance != null
361
				&& this.mDriverInstance
362
						.getProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID) != null)
363
			return this.mDriverInstance
364
					.getProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID);
365
		return new String();
366
	}
367
368
	/**
369
	 * Get the vendor
370
	 * 
371
	 * @return
372
	 */
373
	public String getVendor() {
374
		String vendor = ""; //$NON-NLS-1$
375
		if (this.mDriverInstance != null) {
376
			vendor = this.mDriverInstance
377
					.getProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID);
378
		}
379
		return vendor;
380
	}
381
382
	/**
383
	 * Get the version
384
	 * 
385
	 * @return
386
	 */
387
	public String getVersion() {
388
		String version = ""; //$NON-NLS-1$
389
		if (this.mDriverInstance != null) {
390
			version = this.mDriverInstance
391
					.getProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID);
392
		}
393
		return version;
394
	}
395
396
	/**
397
	 * Get the driver class
398
	 * 
399
	 * @return
400
	 */
401
	public String getDriverClass() {
402
		String driverClass = ""; //$NON-NLS-1$
403
		if (this.mDriverInstance != null) {
404
			driverClass = this.mDriverInstance
405
					.getProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID);
406
		}
407
		return driverClass;
408
	}
409
	
410
	/**
411
	 * Get the user name
412
	 * 
413
	 * @return
414
	 */
415
	public String getDBUID() {
416
		return this.mDBUIDText.getText();
417
	}
418
419
	/**
420
	 * Get the password
421
	 * 
422
	 * @return
423
	 */
424
	public String getDBPWD() {
425
		return this.mDBPWDText.getText();
426
	}
427
428
	/**
429
	 * Get the password
430
	 * 
431
	 * @return
432
	 */
433
	public boolean getSaveDBPWD() {
434
		return this.mSaveDBPWDCheckbox.getSelection();
435
	}
436
437
	/**
438
	 * Get the optional connection properties
439
	 * 
440
	 * @return
441
	 */
442
	public String getDBConnProps() {
443
		return this.mDBConnProps.getSelection();
444
	}
445
446
	/**
447
	 * Get the database name
448
	 * 
449
	 * @return
450
	 */
451
	public String getDatabaseName() {
452
		return this.mDatabaseNameText.getText();
453
	}
454
455
	/**
456
	 * Get the URL for the CP
457
	 * 
458
	 * @return
459
	 */
460
	public String getURL() {
461
		return this.mURLText.getText();
462
	}
463
464
	/**
465
	 * Get the driver ID
466
	 * 
467
	 * @return
468
	 */
469
	public String getDriverID() {
470
		return this.mDriverInstance.getId();
471
	}
472
473
	/*
474
	 * Create a label and a text box side by side.
475
	 */
476
	private Control createLabelTextPair(Composite parent, String labelText,
477
			Control ctl, int style, int gData) {
478
		Label label = new Label(parent, SWT.NULL);
479
		label.setLayoutData(new GridData());
480
		label.setText(labelText);
481
482
		ctl = new Text(parent, style);
483
		ctl.setLayoutData(new GridData(gData));
484
485
		return ctl;
486
	}
487
488
	/*
489
	 * (non-Javadoc)
490
	 * 
491
	 * @see com.sybase.suade.common.ui.wizards.ISummaryDataSource#getSummaryData()
492
	 */
493
	public List getSummaryData() {
494
		List data = new ArrayList();
495
496
		data
497
				.add(new String[] {
498
						Messages.getString(
499
										"HSQLDBProfileDetailsWizardPage.summary.driverName.label"), //$NON-NLS-1$
500
						mDriverInstance.getName() });
501
502
		data
503
				.add(new String[] {
504
						Messages.getString(
505
										"HSQLDBProfileDetailsWizardPage.summary.connProps.label"), //$NON-NLS-1$
506
						getDBConnProps() });
507
508
		data
509
				.add(new String[] {
510
						Messages.getString(
511
										"HSQLDBProfileDetailsWizardPage.summary.userName.label"), //$NON-NLS-1$
512
						getDBUID() });
513
514
		StringBuffer pwdMask = new StringBuffer();
515
		if (getDBPWD() != null && getDBPWD().length() > 0) {
516
			for (int i = 0, count = getDBPWD().length(); i < count; ++i) {
517
				pwdMask = pwdMask.append('*');
518
			}
519
		}
520
521
		data
522
				.add(new String[] {
523
						Messages.getString(
524
										"HSQLDBProfileDetailsWizardPage.summary.password.label"), //$NON-NLS-1$
525
						pwdMask.toString() });
526
527
		data.add(new String[] {
528
				Messages.getString(
529
						"HSQLDBProfileDetailsWizardPage.summary.url.label"), //$NON-NLS-1$
530
				getURL() });
531
532
		return data;
533
	}
534
535
	private boolean isValid() {
536
		if (getErrorMessage() != null) {
537
			setPageComplete(false);
538
			return false;
539
		}
540
541
		return true;
542
	}
543
544
	/*
545
	 * (non-Javadoc)
546
	 * 
547
	 * @see org.eclipse.jface.dialogs.DialogPage#setErrorMessage(java.lang.String)
548
	 */
549
	public void setErrorMessage(String newMessage) {
550
		super.setErrorMessage(newMessage);
551
		isValid();
552
	}
553
554
	
555
	/**
556
	 * @return
557
	 */
558
	public String getDriverCategory() {
559
		return mDriverCategory;
560
	}
561
562
	
563
	/**
564
	 * Sets the driver category that should be used for displaying available
565
	 * driver defnitions.
566
	 * 
567
	 * @param driverCategory
568
	 */
569
	public void setDriverCategory(String driverCategory) {
570
		mDriverCategory = driverCategory;
571
		if (combo != null) {
572
			combo.setCategory(mDriverCategory);
573
		}
574
	}
575
576
}
(-)src/org/eclipse/datatools/enablement/hsqldb/ui/wizard/NewHSQLDBConnectionProfileWizard.java (-77 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Sybase, Inc.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Brian Fitzpatrick - initial API and implementation
10
 ******************************************************************************/
11
package org.eclipse.datatools.enablement.hsqldb.ui.wizard;
12
13
import java.util.Properties;
14
15
import org.eclipse.datatools.connectivity.ConnectionProfileConstants;
16
import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants;
17
import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants;
18
import org.eclipse.datatools.connectivity.db.generic.ui.NewConnectionProfileWizard;
19
import org.eclipse.datatools.enablement.hsqldb.ui.Messages;
20
import org.eclipse.jface.wizard.Wizard;
21
22
/**
23
 * @author brianf
24
 * @see Wizard
25
 *
26
 */
27
public class NewHSQLDBConnectionProfileWizard extends
28
		NewConnectionProfileWizard {
29
30
	protected HSQLDBProfileDetailsWizardPage mPropPage;
31
32
	/**
33
	 * 
34
	 */
35
	public NewHSQLDBConnectionProfileWizard() {
36
		setWindowTitle(Messages.getString("NewHSQLDBConnectionProfileWizard.HSQLDBWizardTitle")); //$NON-NLS-1$
37
	}
38
39
	/**
40
	 * @see org.eclipse.datatools.connectivity.ui.wizards.NewHSQLDBConnectionProfileWizard#addCustomPages()
41
	 */
42
	public void addCustomPages() {
43
		mPropPage = new HSQLDBProfileDetailsWizardPage("detailsPage"); //$NON-NLS-1$
44
		addPage(mPropPage);
45
	}
46
47
	/* (non-Javadoc)
48
	 * @see org.eclipse.datatools.connectivity.db.generic.ui.NewConnectionProfileWizard#getProfileProperties()
49
	 */
50
	public Properties getProfileProperties() {
51
		Properties props = new Properties();
52
		props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID,
53
				this.mPropPage.getDriverID());
54
		props.setProperty(
55
				IDBConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID,
56
				this.mPropPage.getDBConnProps());
57
		props.setProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, this.mPropPage
58
				.getDriverClass());
59
		props.setProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, this.mPropPage
60
				.getVendor());		
61
		props.setProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, this.mPropPage
62
				.getVersion());			
63
		props.setProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID, this.mPropPage
64
				.getDatabaseName());
65
		props.setProperty(IDBDriverDefinitionConstants.PASSWORD_PROP_ID, this.mPropPage
66
				.getDBPWD());
67
		props.setProperty(
68
				IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID, String
69
						.valueOf(this.mPropPage.getSaveDBPWD()));
70
		props.setProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID, this.mPropPage
71
				.getDBUID());
72
		props.setProperty(IDBDriverDefinitionConstants.URL_PROP_ID,
73
				this.mPropPage.getURL());
74
		return props;
75
	}
76
77
}
(-)META-INF/MANIFEST.MF (-15 / +5 lines)
Lines 3-29 Link Here
3
Bundle-Name: %Bundle-Name
3
Bundle-Name: %Bundle-Name
4
Bundle-SymbolicName: org.eclipse.datatools.enablement.hsqldb;singleton:=true
4
Bundle-SymbolicName: org.eclipse.datatools.enablement.hsqldb;singleton:=true
5
Bundle-Version: 1.0.0.200710293
5
Bundle-Version: 1.0.0.200710293
6
Bundle-Activator: org.eclipse.datatools.enablement.hsqldb.HSQLDBActivator
7
Bundle-Vendor: %Bundle-Vendor
6
Bundle-Vendor: %Bundle-Vendor
8
Bundle-Localization: plugin
7
Bundle-Localization: plugin
9
Require-Bundle: org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
8
Require-Bundle: org.eclipse.datatools.connectivity;bundle-version="[1.0.0,1.5.0)",
10
 org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
11
 org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)",
12
 org.eclipse.datatools.connectivity;bundle-version="[1.0.0,1.5.0)",
13
 org.eclipse.datatools.connectivity.sqm.core;bundle-version="[1.0.0,1.5.0)",
9
 org.eclipse.datatools.connectivity.sqm.core;bundle-version="[1.0.0,1.5.0)",
14
 org.eclipse.datatools.modelbase.sql;bundle-version="[1.0.0,1.5.0)",
10
 org.eclipse.datatools.modelbase.sql;bundle-version="[1.0.0,1.5.0)",
15
 org.eclipse.datatools.modelbase.dbdefinition;bundle-version="[1.0.0,1.5.0)",
11
 org.eclipse.datatools.modelbase.dbdefinition;bundle-version="[1.0.0,1.5.0)",
16
 org.eclipse.datatools.connectivity.ui;bundle-version="[1.0.0,1.5.0)",
12
 org.eclipse.datatools.connectivity.db.generic;bundle-version="[1.0.0,1.5.0)"
17
 org.eclipse.datatools.connectivity.db.generic;bundle-version="[1.0.0,1.5.0)",
18
 org.eclipse.datatools.connectivity.db.generic.ui;bundle-version="[1.0.0,1.5.0)",
19
 org.eclipse.datatools.connectivity.sqm.server.ui;bundle-version="[1.0.0,1.5.0)",
20
 org.eclipse.datatools.connectivity.sqm.core.ui;bundle-version="[1.0.0,1.5.0)"
21
Eclipse-LazyStart: true
13
Eclipse-LazyStart: true
22
Export-Package: org.eclipse.datatools.enablement.hsqldb,
14
Export-Package: org.eclipse.datatools.enablement.hsqldb.catalog,
23
 org.eclipse.datatools.enablement.hsqldb.catalog,
24
 org.eclipse.datatools.enablement.hsqldb.connection,
15
 org.eclipse.datatools.enablement.hsqldb.connection,
25
 org.eclipse.datatools.enablement.hsqldb.internal,
16
 org.eclipse.datatools.enablement.hsqldb.internal,
26
 org.eclipse.datatools.enablement.hsqldb.ui,
17
 org.eclipse.datatools.enablement.hsqldb.ui
27
 org.eclipse.datatools.enablement.hsqldb.ui.properties,
28
 org.eclipse.datatools.enablement.hsqldb.ui.wizard
29
Bundle-RequiredExecutionEnvironment: J2SE-1.4
18
Bundle-RequiredExecutionEnvironment: J2SE-1.4
19
(-)src/org/eclipse/datatools/enablement/hsqldb/ui/messages.properties (-23 lines)
Removed Link Here
1
NewHSQLDBConnectionProfileWizard.HSQLDBWizardTitle=HSQLDB Database
2
3
HSQLDBProfileDetailsWizardPage.title = Specify a Driver and Connection Details
4
HSQLDBProfileDetailsWizardPage.msg = Select a driver from the drop-down and provide login details for the connection.
5
HSQLDBProfileDetailsWizardPage.0=Database location:
6
HSQLDBProfileDetailsWizardPage.1=Browse...
7
HSQLDBProfileDetailsWizardPage.2=Create database (if required)
8
HSQLDBProfileDetailsWizardPage.3=Upgrade database to current version
9
HSQLDBProfileDetailsWizardPage.driverCombo.label = Select a driver from the drop-down:
10
HSQLDBProfileDetailsWizardPage.databaseName.label = Database:
11
HSQLDBProfileDetailsWizardPage.url.label = URL:
12
HSQLDBProfileDetailsWizardPage.PingButton=Test connection
13
HSQLDBProfileDetailsWizardPage.userName.label = User name:
14
HSQLDBProfileDetailsWizardPage.password.label = Password:
15
HSQLDBProfileDetailsWizardPage.persistpassword.label = Save Password
16
HSQLDBProfileDetailsWizardPage.optionalProps.label = Optional properties:
17
HSQLDBProfileDetailsWizardPage.summary.driverName.label = Driver name
18
HSQLDBProfileDetailsWizardPage.summary.connProps.label = Connection properties
19
HSQLDBProfileDetailsWizardPage.summary.userName.label = User name
20
HSQLDBProfileDetailsWizardPage.summary.password.label = Password
21
HSQLDBProfileDetailsWizardPage.summary.url.label = URL
22
HSQLDBProfileDetailsWizardPage.FileDialog.title.filebrowse = Browse for Database Folder
23
HSQLDBProfileDetailsWizardPage.FileDialog.msg.filebrowse = Select the folder that corresponds to your HSQLDB database.
(-)src/org/eclipse/datatools/enablement/hsqldb/ui/Messages.java (-44 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Sybase, Inc.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Brian Fitzpatrick - initial API and implementation
10
 ******************************************************************************/
11
package org.eclipse.datatools.enablement.hsqldb.ui;
12
13
import java.util.MissingResourceException;
14
import java.util.ResourceBundle;
15
16
/**
17
 * @author brianf
18
 *
19
 */
20
public class Messages {
21
	
22
	private static final String BUNDLE_NAME = "org.eclipse.datatools.enablement.hsqldb.ui.messages"; //$NON-NLS-1$
23
24
	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
25
			.getBundle(BUNDLE_NAME);
26
27
	/**
28
	 * 
29
	 */
30
	private Messages() {
31
	}
32
33
	/**
34
	 * @param key
35
	 * @return
36
	 */
37
	public static String getString(String key) {
38
		try {
39
			return RESOURCE_BUNDLE.getString(key);
40
		} catch (MissingResourceException e) {
41
			return '!' + key + '!';
42
		}
43
	}
44
}
(-)runtime/vendors/HSQLDB_1.8/HSQLDB_1.8.xmi (-102 lines)
Removed Link Here
1
<?xml version="1.0" encoding="ASCII"?>
2
<DBDefinition:DatabaseVendorDefinition xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:DBDefinition="http:///org/eclipse/datatools/modelbase/dbdefinition/dbdefinition.ecore" vendor="HSQLDB" version="1.8" maximumIdentifierLength="64" maximumCommentLength="64" sequenceSupported="true" aliasSupported="true" storedProcedureSupported="false">
3
  <predefinedDataTypeDefinitions xmi:id="INTEGER_1" keyConstraintSupported="true" identitySupported="true" primitiveType="INTEGER" jdbcEnumType="4" javaClassName="int">
4
    <defaultValueTypes>NULL</defaultValueTypes>
5
    <name>INTEGER</name>
6
    <name>INT</name>
7
  </predefinedDataTypeDefinitions>
8
  <predefinedDataTypeDefinitions xmi:id="DOUBLE_PRECISION_1" keyConstraintSupported="true" primitiveType="DOUBLE_PRECISION" jdbcEnumType="8" javaClassName="double">
9
    <defaultValueTypes>NULL</defaultValueTypes>
10
    <name>DOUBLE</name>
11
    <name>DOUBLE PRECISION</name>
12
    <name>FLOAT</name>
13
  </predefinedDataTypeDefinitions>
14
  <predefinedDataTypeDefinitions xmi:id="CHARACTER_2" lengthSupported="true" keyConstraintSupported="true" maximumLength="2147483647" jdbcEnumType="12" javaClassName="java.lang.String">
15
    <defaultValueTypes>NULL</defaultValueTypes>
16
    <name>VARCHAR</name>
17
  </predefinedDataTypeDefinitions>
18
  <predefinedDataTypeDefinitions xmi:id="CHARACTER_3" lengthSupported="true" keyConstraintSupported="true" maximumLength="2147483647" jdbcEnumType="12" javaClassName="java.lang.String">
19
    <defaultValueTypes>NULL</defaultValueTypes>
20
    <name>VARCHAR_IGNORECASE</name>
21
  </predefinedDataTypeDefinitions>
22
  <predefinedDataTypeDefinitions xmi:id="CHARACTER_1" lengthSupported="true" keyConstraintSupported="true" maximumLength="2147483647" jdbcEnumType="1" javaClassName="java.lang.String">
23
    <defaultValueTypes>NULL</defaultValueTypes>
24
    <name>CHAR</name>
25
    <name>CHARACTER</name>
26
  </predefinedDataTypeDefinitions>
27
  <predefinedDataTypeDefinitions xmi:id="CHARACTER_4" lengthSupported="true" keyConstraintSupported="true" maximumLength="2147483647" jdbcEnumType="-1" javaClassName="java.lang.String">
28
    <defaultValueTypes>NULL</defaultValueTypes>
29
    <name>LONGVARCHAR</name>
30
  </predefinedDataTypeDefinitions>
31
  <predefinedDataTypeDefinitions xmi:id="DATE_1" keyConstraintSupported="true" identitySupported="true" primitiveType="DATE" jdbcEnumType="91" javaClassName="java.sql.Date">
32
    <defaultValueTypes>NULL</defaultValueTypes>
33
    <name>DATE</name>
34
  </predefinedDataTypeDefinitions>
35
  <predefinedDataTypeDefinitions xmi:id="TIME_1" keyConstraintSupported="true" identitySupported="true" primitiveType="TIME" jdbcEnumType="92" javaClassName="java.sql.Time">
36
    <defaultValueTypes>NULL</defaultValueTypes>
37
    <name>TIME</name>
38
  </predefinedDataTypeDefinitions>
39
  <predefinedDataTypeDefinitions xmi:id="TIMESTAMP_1" keyConstraintSupported="true" identitySupported="true" primitiveType="TIMESTAMP" jdbcEnumType="93" javaClassName="java.sql.Timestamp">
40
    <defaultValueTypes>NULL</defaultValueTypes>
41
    <name>TIMESTAMP</name>
42
    <name>DATETIME</name>
43
  </predefinedDataTypeDefinitions>
44
  <predefinedDataTypeDefinitions xmi:id="DECIMAL_1" scaleSupported="true" precisionSupported="true" keyConstraintSupported="true" identitySupported="true" primitiveType="DECIMAL" jdbcEnumType="3" javaClassName="java.math.BigDecimal">
45
    <defaultValueTypes>NULL</defaultValueTypes>
46
    <name>DECIMAL</name>
47
  </predefinedDataTypeDefinitions>
48
  <predefinedDataTypeDefinitions xmi:id="NUMERIC_1" scaleSupported="true" precisionSupported="true" keyConstraintSupported="true" primitiveType="NUMERIC" jdbcEnumType="2" javaClassName="java.math.BigDecimal">
49
    <defaultValueTypes>NULL</defaultValueTypes>
50
    <name>NUMERIC</name>
51
  </predefinedDataTypeDefinitions>
52
  <predefinedDataTypeDefinitions xmi:id="BOOLEAN_1" keyConstraintSupported="true" identitySupported="true" primitiveType="BOOLEAN" jdbcEnumType="16" javaClassName="boolean">
53
    <defaultValueTypes>NULL</defaultValueTypes>
54
    <name>BOOLEAN</name>
55
    <name>BIT</name>
56
  </predefinedDataTypeDefinitions>
57
  <predefinedDataTypeDefinitions xmi:id="SMALLINT_2" keyConstraintSupported="true" identitySupported="true" primitiveType="SMALLINT" jdbcEnumType="-6" javaClassName="byte">
58
    <defaultValueTypes>NULL</defaultValueTypes>
59
    <name>TINYINT</name>
60
  </predefinedDataTypeDefinitions>
61
  <predefinedDataTypeDefinitions xmi:id="SMALLINT_1" keyConstraintSupported="true" identitySupported="true" primitiveType="SMALLINT" jdbcEnumType="5" javaClassName="short">
62
    <defaultValueTypes>NULL</defaultValueTypes>
63
    <name>SMALLINT</name>
64
  </predefinedDataTypeDefinitions>
65
  <predefinedDataTypeDefinitions xmi:id="BIGINT_1" keyConstraintSupported="true" identitySupported="true" primitiveType="BIGINT" jdbcEnumType="-5" javaClassName="long">
66
    <defaultValueTypes>NULL</defaultValueTypes>
67
    <name>BIGINT</name>
68
  </predefinedDataTypeDefinitions>
69
  <predefinedDataTypeDefinitions xmi:id="REAL_1" keyConstraintSupported="true" primitiveType="REAL" jdbcEnumType="7" javaClassName="double">
70
    <defaultValueTypes>NULL</defaultValueTypes>
71
    <name>REAL</name>
72
  </predefinedDataTypeDefinitions>
73
  <predefinedDataTypeDefinitions xmi:id="BINARY_1" keyConstraintSupported="true" maximumValue="2147483647" primitiveType="BINARY" jdbcEnumType="-2" javaClassName="byte[]">
74
    <defaultValueTypes>NULL</defaultValueTypes>
75
    <name>BINARY</name>
76
  </predefinedDataTypeDefinitions>
77
  <predefinedDataTypeDefinitions xmi:id="BINARY_VARYING_1" keyConstraintSupported="true" maximumValue="2147483647" primitiveType="BINARY_VARYING" jdbcEnumType="-3" javaClassName="byte[]">
78
    <defaultValueTypes>NULL</defaultValueTypes>
79
    <name>VARBINARY</name>
80
  </predefinedDataTypeDefinitions>
81
  <predefinedDataTypeDefinitions xmi:id="BINARY_VARYING_2" keyConstraintSupported="true" maximumValue="2147483647" primitiveType="BINARY_VARYING" jdbcEnumType="-4" javaClassName="byte[]">
82
    <defaultValueTypes>NULL</defaultValueTypes>
83
    <name>LONGVARBINARY</name>
84
  </predefinedDataTypeDefinitions>
85
  <predefinedDataTypeDefinitions xmi:id="BINARY_LARGE_OBJECT_1" keyConstraintSupported="true" maximumValue="2147483647" primitiveType="BINARY_LARGE_OBJECT" jdbcEnumType="1111" javaClassName="java.lang.Object">
86
    <defaultValueTypes>NULL</defaultValueTypes>
87
    <name>OTHER</name>
88
    <name>OBJECT</name>
89
  </predefinedDataTypeDefinitions>
90
  <columnDefinition identitySupported="true" computedSupported="false" identityStartValueSupported="true" identityIncrementSupported="true" identityMinimumSupported="true" identityMaximumSupported="true" identityCycleSupported="true"/>
91
  <constraintDefinition clusteredPrimaryKeySupported="true" clusteredUniqueConstraintSupported="true">
92
    <parentUpdateDRIRuleType>RESTRICT</parentUpdateDRIRuleType>
93
    <parentUpdateDRIRuleType>NO_ACTION</parentUpdateDRIRuleType>
94
    <parentDeleteDRIRuleType>RESTRICT</parentDeleteDRIRuleType>
95
    <parentDeleteDRIRuleType>CASCADE</parentDeleteDRIRuleType>
96
    <parentDeleteDRIRuleType>SET_NULL</parentDeleteDRIRuleType>
97
    <parentDeleteDRIRuleType>NO_ACTION</parentDeleteDRIRuleType>
98
    <checkOption>NONE</checkOption>
99
    <checkOption>LOCAL</checkOption>
100
    <checkOption>CASCADE</checkOption>
101
  </constraintDefinition>
102
</DBDefinition:DatabaseVendorDefinition>
(-)src/org/eclipse/datatools/enablement/hsqldb/HSQLDBActivator.java (-60 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 Sybase, Inc.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Brian Fitzpatrick - initial API and implementation
10
 ******************************************************************************/
11
package org.eclipse.datatools.enablement.hsqldb;
12
13
import org.eclipse.ui.plugin.AbstractUIPlugin;
14
import org.osgi.framework.BundleContext;
15
16
/**
17
 * The activator class controls the plug-in life cycle
18
 */
19
public class HSQLDBActivator extends AbstractUIPlugin {
20
21
	// The plug-in ID
22
	public static final String PLUGIN_ID = "org.eclipse.datatools.enablement.hsqldb"; //$NON-NLS-1$
23
24
	// The shared instance
25
	private static HSQLDBActivator plugin;
26
	
27
	/**
28
	 * The constructor
29
	 */
30
	public HSQLDBActivator() {
31
		plugin = this;
32
	}
33
34
	/*
35
	 * (non-Javadoc)
36
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
37
	 */
38
	public void start(BundleContext context) throws Exception {
39
		super.start(context);
40
	}
41
42
	/*
43
	 * (non-Javadoc)
44
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
45
	 */
46
	public void stop(BundleContext context) throws Exception {
47
		plugin = null;
48
		super.stop(context);
49
	}
50
51
	/**
52
	 * Returns the shared instance
53
	 *
54
	 * @return the shared instance
55
	 */
56
	public static HSQLDBActivator getDefault() {
57
		return plugin;
58
	}
59
60
}
(-)build.properties (-2 / +5 lines)
Lines 1-7 Link Here
1
bin.includes = META-INF/
1
bin.includes = META-INF/,\
2
               runtime/,\
3
               plugin.properties,\
4
               plugin.xml
2
src.dir	= src/
5
src.dir	= src/
3
plugin.version =	1.0.0.200801041
6
plugin.version =	1.0.0.200801041
4
javadoc.dir =		doc/api/
7
javadoc.dir =		doc/api/
5
download.dir =		./download/
8
download.dir =		./download/
6
javac.source =		1.4
9
javac.source =		1.4
7
javac.target =		1.4
10
javac.target =		1.4
(-).cvsignore (-1 lines)
Lines 1-2 Link Here
1
bin
1
bin
2
build.xml
(-)META-INF/MANIFEST.MF (-2 / +2 lines)
Lines 1-9 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: HSQLDB Dbdefinition Plug-in
3
Bundle-Name: %Bundle-Name
4
Bundle-SymbolicName: org.eclipse.datatools.enablement.hsqldb.dbdefinition; singleton:=true
4
Bundle-SymbolicName: org.eclipse.datatools.enablement.hsqldb.dbdefinition; singleton:=true
5
Bundle-Version: 1.0.0.200801041
5
Bundle-Version: 1.0.0.200801041
6
Bundle-Vendor: Eclipse.org
6
Bundle-Vendor: %Bundle-Vendor
7
Bundle-Localization: plugin
7
Bundle-Localization: plugin
8
Eclipse-AutoStart: true
8
Eclipse-AutoStart: true
9
Bundle-RequiredExecutionEnvironment: J2SE-1.4
9
Bundle-RequiredExecutionEnvironment: J2SE-1.4
(-)runtime/vendors/HSQLDB_1.8/HSQLDB_1.8.xmi (+102 lines)
Added Link Here
1
<?xml version="1.0" encoding="ASCII"?>
2
<DBDefinition:DatabaseVendorDefinition xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:DBDefinition="http:///org/eclipse/datatools/modelbase/dbdefinition/dbdefinition.ecore" vendor="HSQLDB" version="1.8" maximumIdentifierLength="64" maximumCommentLength="64" sequenceSupported="true" aliasSupported="true" storedProcedureSupported="false">
3
  <predefinedDataTypeDefinitions xmi:id="INTEGER_1" keyConstraintSupported="true" identitySupported="true" primitiveType="INTEGER" jdbcEnumType="4" javaClassName="int">
4
    <defaultValueTypes>NULL</defaultValueTypes>
5
    <name>INTEGER</name>
6
    <name>INT</name>
7
  </predefinedDataTypeDefinitions>
8
  <predefinedDataTypeDefinitions xmi:id="DOUBLE_PRECISION_1" keyConstraintSupported="true" primitiveType="DOUBLE_PRECISION" jdbcEnumType="8" javaClassName="double">
9
    <defaultValueTypes>NULL</defaultValueTypes>
10
    <name>DOUBLE</name>
11
    <name>DOUBLE PRECISION</name>
12
    <name>FLOAT</name>
13
  </predefinedDataTypeDefinitions>
14
  <predefinedDataTypeDefinitions xmi:id="CHARACTER_2" lengthSupported="true" keyConstraintSupported="true" maximumLength="2147483647" jdbcEnumType="12" javaClassName="java.lang.String">
15
    <defaultValueTypes>NULL</defaultValueTypes>
16
    <name>VARCHAR</name>
17
  </predefinedDataTypeDefinitions>
18
  <predefinedDataTypeDefinitions xmi:id="CHARACTER_3" lengthSupported="true" keyConstraintSupported="true" maximumLength="2147483647" jdbcEnumType="12" javaClassName="java.lang.String">
19
    <defaultValueTypes>NULL</defaultValueTypes>
20
    <name>VARCHAR_IGNORECASE</name>
21
  </predefinedDataTypeDefinitions>
22
  <predefinedDataTypeDefinitions xmi:id="CHARACTER_1" lengthSupported="true" keyConstraintSupported="true" maximumLength="2147483647" jdbcEnumType="1" javaClassName="java.lang.String">
23
    <defaultValueTypes>NULL</defaultValueTypes>
24
    <name>CHAR</name>
25
    <name>CHARACTER</name>
26
  </predefinedDataTypeDefinitions>
27
  <predefinedDataTypeDefinitions xmi:id="CHARACTER_4" lengthSupported="true" keyConstraintSupported="true" maximumLength="2147483647" jdbcEnumType="-1" javaClassName="java.lang.String">
28
    <defaultValueTypes>NULL</defaultValueTypes>
29
    <name>LONGVARCHAR</name>
30
  </predefinedDataTypeDefinitions>
31
  <predefinedDataTypeDefinitions xmi:id="DATE_1" keyConstraintSupported="true" identitySupported="true" primitiveType="DATE" jdbcEnumType="91" javaClassName="java.sql.Date">
32
    <defaultValueTypes>NULL</defaultValueTypes>
33
    <name>DATE</name>
34
  </predefinedDataTypeDefinitions>
35
  <predefinedDataTypeDefinitions xmi:id="TIME_1" keyConstraintSupported="true" identitySupported="true" primitiveType="TIME" jdbcEnumType="92" javaClassName="java.sql.Time">
36
    <defaultValueTypes>NULL</defaultValueTypes>
37
    <name>TIME</name>
38
  </predefinedDataTypeDefinitions>
39
  <predefinedDataTypeDefinitions xmi:id="TIMESTAMP_1" keyConstraintSupported="true" identitySupported="true" primitiveType="TIMESTAMP" jdbcEnumType="93" javaClassName="java.sql.Timestamp">
40
    <defaultValueTypes>NULL</defaultValueTypes>
41
    <name>TIMESTAMP</name>
42
    <name>DATETIME</name>
43
  </predefinedDataTypeDefinitions>
44
  <predefinedDataTypeDefinitions xmi:id="DECIMAL_1" scaleSupported="true" precisionSupported="true" keyConstraintSupported="true" identitySupported="true" primitiveType="DECIMAL" jdbcEnumType="3" javaClassName="java.math.BigDecimal">
45
    <defaultValueTypes>NULL</defaultValueTypes>
46
    <name>DECIMAL</name>
47
  </predefinedDataTypeDefinitions>
48
  <predefinedDataTypeDefinitions xmi:id="NUMERIC_1" scaleSupported="true" precisionSupported="true" keyConstraintSupported="true" primitiveType="NUMERIC" jdbcEnumType="2" javaClassName="java.math.BigDecimal">
49
    <defaultValueTypes>NULL</defaultValueTypes>
50
    <name>NUMERIC</name>
51
  </predefinedDataTypeDefinitions>
52
  <predefinedDataTypeDefinitions xmi:id="BOOLEAN_1" keyConstraintSupported="true" identitySupported="true" primitiveType="BOOLEAN" jdbcEnumType="16" javaClassName="boolean">
53
    <defaultValueTypes>NULL</defaultValueTypes>
54
    <name>BOOLEAN</name>
55
    <name>BIT</name>
56
  </predefinedDataTypeDefinitions>
57
  <predefinedDataTypeDefinitions xmi:id="SMALLINT_2" keyConstraintSupported="true" identitySupported="true" primitiveType="SMALLINT" jdbcEnumType="-6" javaClassName="byte">
58
    <defaultValueTypes>NULL</defaultValueTypes>
59
    <name>TINYINT</name>
60
  </predefinedDataTypeDefinitions>
61
  <predefinedDataTypeDefinitions xmi:id="SMALLINT_1" keyConstraintSupported="true" identitySupported="true" primitiveType="SMALLINT" jdbcEnumType="5" javaClassName="short">
62
    <defaultValueTypes>NULL</defaultValueTypes>
63
    <name>SMALLINT</name>
64
  </predefinedDataTypeDefinitions>
65
  <predefinedDataTypeDefinitions xmi:id="BIGINT_1" keyConstraintSupported="true" identitySupported="true" primitiveType="BIGINT" jdbcEnumType="-5" javaClassName="long">
66
    <defaultValueTypes>NULL</defaultValueTypes>
67
    <name>BIGINT</name>
68
  </predefinedDataTypeDefinitions>
69
  <predefinedDataTypeDefinitions xmi:id="REAL_1" keyConstraintSupported="true" primitiveType="REAL" jdbcEnumType="7" javaClassName="double">
70
    <defaultValueTypes>NULL</defaultValueTypes>
71
    <name>REAL</name>
72
  </predefinedDataTypeDefinitions>
73
  <predefinedDataTypeDefinitions xmi:id="BINARY_1" keyConstraintSupported="true" maximumValue="2147483647" primitiveType="BINARY" jdbcEnumType="-2" javaClassName="byte[]">
74
    <defaultValueTypes>NULL</defaultValueTypes>
75
    <name>BINARY</name>
76
  </predefinedDataTypeDefinitions>
77
  <predefinedDataTypeDefinitions xmi:id="BINARY_VARYING_1" keyConstraintSupported="true" maximumValue="2147483647" primitiveType="BINARY_VARYING" jdbcEnumType="-3" javaClassName="byte[]">
78
    <defaultValueTypes>NULL</defaultValueTypes>
79
    <name>VARBINARY</name>
80
  </predefinedDataTypeDefinitions>
81
  <predefinedDataTypeDefinitions xmi:id="BINARY_VARYING_2" keyConstraintSupported="true" maximumValue="2147483647" primitiveType="BINARY_VARYING" jdbcEnumType="-4" javaClassName="byte[]">
82
    <defaultValueTypes>NULL</defaultValueTypes>
83
    <name>LONGVARBINARY</name>
84
  </predefinedDataTypeDefinitions>
85
  <predefinedDataTypeDefinitions xmi:id="BINARY_LARGE_OBJECT_1" keyConstraintSupported="true" maximumValue="2147483647" primitiveType="BINARY_LARGE_OBJECT" jdbcEnumType="1111" javaClassName="java.lang.Object">
86
    <defaultValueTypes>NULL</defaultValueTypes>
87
    <name>OTHER</name>
88
    <name>OBJECT</name>
89
  </predefinedDataTypeDefinitions>
90
  <columnDefinition identitySupported="true" computedSupported="false" identityStartValueSupported="true" identityIncrementSupported="true" identityMinimumSupported="true" identityMaximumSupported="true" identityCycleSupported="true"/>
91
  <constraintDefinition clusteredPrimaryKeySupported="true" clusteredUniqueConstraintSupported="true">
92
    <parentUpdateDRIRuleType>RESTRICT</parentUpdateDRIRuleType>
93
    <parentUpdateDRIRuleType>NO_ACTION</parentUpdateDRIRuleType>
94
    <parentDeleteDRIRuleType>RESTRICT</parentDeleteDRIRuleType>
95
    <parentDeleteDRIRuleType>CASCADE</parentDeleteDRIRuleType>
96
    <parentDeleteDRIRuleType>SET_NULL</parentDeleteDRIRuleType>
97
    <parentDeleteDRIRuleType>NO_ACTION</parentDeleteDRIRuleType>
98
    <checkOption>NONE</checkOption>
99
    <checkOption>LOCAL</checkOption>
100
    <checkOption>CASCADE</checkOption>
101
  </constraintDefinition>
102
</DBDefinition:DatabaseVendorDefinition>
(-)plugin.xml (+14 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.2"?>
3
<plugin>
4
   <extension
5
         point="org.eclipse.datatools.connectivity.sqm.core.databaseDefinition">
6
      <definition
7
            description="%product.display.description"
8
            file="runtime/vendors/HSQLDB_1.8/HSQLDB_1.8.xmi"
9
            product="HSQLDB"
10
            productDisplayString="%product.display.string"
11
            version="1.8"
12
            versionDisplayString="%product.display.version.string"/>
13
   </extension>
14
</plugin>
(-)plugin.properties (+6 lines)
Added Link Here
1
Bundle-Vendor = Eclipse.org
2
Bundle-Name = Eclipse Data Tools Platform HSQLDB Database Definition Enablement Plug-in
3
4
product.display.string = HSQLDB
5
product.display.version.string = 1.8
6
product.display.description = HSQLDB Connection Profile
(-)build.properties (-2 / +4 lines)
Lines 1-7 Link Here
1
source.. = src/
1
source.. = src/
2
output.. = bin/
2
output.. = bin/
3
bin.includes = META-INF/,\
3
bin.includes = META-INF/,\
4
               .
4
               .,\
5
               plugin.xml,\
6
               plugin.properties
5
7
6
jars.compile.order = .
8
jars.compile.order = .
7
output.. = bin/
9
output.. = bin/
Lines 11-14 Link Here
11
javadoc.dir =		doc/api/
13
javadoc.dir =		doc/api/
12
download.dir =		./download/
14
download.dir =		./download/
13
javac.source =		1.4
15
javac.source =		1.4
14
javac.target =		1.4
16
javac.target =		1.4
(-)META-INF/MANIFEST.MF (-4 / +19 lines)
Lines 1-9 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: HSQLDB Ui Plug-in
3
Bundle-Name: %Bundle-Name
4
Bundle-SymbolicName: org.eclipse.datatools.enablement.hsqldb.ui
4
Bundle-SymbolicName: org.eclipse.datatools.enablement.hsqldb.ui;singleton:=true
5
Bundle-Version: 1.0.0.200801041
5
Bundle-Version: 1.0.0.200801041
6
Bundle-Vendor: Eclipse.org
6
Bundle-Vendor: %Bundle-Vendor
7
Bundle-Activator: org.eclipse.datatools.enablement.hsqldb.ui.HSQLDBActivator
7
Bundle-Localization: plugin
8
Bundle-Localization: plugin
8
Eclipse-AutoStart: true
9
Require-Bundle: org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
10
 org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
11
 org.eclipse.datatools.connectivity.sqm.core;bundle-version="[1.0.0,1.5.0)",
12
 org.eclipse.datatools.connectivity;bundle-version="[1.0.0,1.5.0)",
13
 org.eclipse.datatools.connectivity.ui;bundle-version="[1.0.0,1.5.0)",
14
 org.eclipse.datatools.connectivity.db.generic;bundle-version="[1.0.0,1.5.0)",
15
 org.eclipse.datatools.connectivity.db.generic.ui;bundle-version="[1.0.0,1.5.0)",
16
 org.eclipse.datatools.enablement.hsqldb;bundle-version="[1.0.0,2.0.0)",
17
 org.eclipse.datatools.connectivity.sqm.server.ui;bundle-version="[1.0.0,1.5.0)",
18
 org.eclipse.datatools.connectivity.sqm.core.ui;bundle-version="[1.0.0,1.5.0)",
19
 org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)"
20
Eclipse-LazyStart: true
21
Export-Package: org.eclipse.datatools.enablement.hsqldb.ui,
22
 org.eclipse.datatools.enablement.hsqldb.ui.properties,
23
 org.eclipse.datatools.enablement.hsqldb.ui.wizard
9
Bundle-RequiredExecutionEnvironment: J2SE-1.4
24
Bundle-RequiredExecutionEnvironment: J2SE-1.4
(-)src/org/eclipse/datatools/enablement/hsqldb/ui/HSQLDBActivator.java (+61 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 Sybase, Inc.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Brian Fitzpatrick - initial API and implementation
10
 * 			IBM Corporation - refactored plug-in
11
 ******************************************************************************/
12
package org.eclipse.datatools.enablement.hsqldb.ui;
13
14
import org.eclipse.ui.plugin.AbstractUIPlugin;
15
import org.osgi.framework.BundleContext;
16
17
/**
18
 * The activator class controls the plug-in life cycle
19
 */
20
public class HSQLDBActivator extends AbstractUIPlugin {
21
22
	// The plug-in ID
23
	public static final String PLUGIN_ID = "org.eclipse.datatools.enablement.hsqldb"; //$NON-NLS-1$
24
25
	// The shared instance
26
	private static HSQLDBActivator plugin;
27
	
28
	/**
29
	 * The constructor
30
	 */
31
	public HSQLDBActivator() {
32
		plugin = this;
33
	}
34
35
	/*
36
	 * (non-Javadoc)
37
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
38
	 */
39
	public void start(BundleContext context) throws Exception {
40
		super.start(context);
41
	}
42
43
	/*
44
	 * (non-Javadoc)
45
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
46
	 */
47
	public void stop(BundleContext context) throws Exception {
48
		plugin = null;
49
		super.stop(context);
50
	}
51
52
	/**
53
	 * Returns the shared instance
54
	 *
55
	 * @return the shared instance
56
	 */
57
	public static HSQLDBActivator getDefault() {
58
		return plugin;
59
	}
60
61
}
(-)about.html (+28 lines)
Added Link Here
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
6
<title>About</title>
7
</head>
8
<body lang="EN-US">
9
<h2>About This Content</h2>
10
 
11
<p>June 2, 2006</p>	
12
<h3>License</h3>
13
14
<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;).  Unless otherwise 
15
indicated below, the Content is provided to you under the terms and conditions of the
16
Eclipse Public License Version 1.0 (&quot;EPL&quot;).  A copy of the EPL is available 
17
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
18
For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
19
20
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is 
21
being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
22
apply to your use of any object code in the Content.  Check the Redistributor's license that was 
23
provided with the Content.  If no such license exists, contact the Redistributor.  Unless otherwise
24
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
25
and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
26
27
</body>
28
</html>
(-)src/org/eclipse/datatools/enablement/hsqldb/ui/wizard/NewHSQLDBConnectionProfileWizard.java (+78 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 Sybase, Inc.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Brian Fitzpatrick - initial API and implementation
10
 * 			IBM Corporation - refactored plug-in
11
 ******************************************************************************/
12
package org.eclipse.datatools.enablement.hsqldb.ui.wizard;
13
14
import java.util.Properties;
15
16
import org.eclipse.datatools.connectivity.ConnectionProfileConstants;
17
import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants;
18
import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants;
19
import org.eclipse.datatools.connectivity.db.generic.ui.NewConnectionProfileWizard;
20
import org.eclipse.datatools.enablement.hsqldb.ui.Messages;
21
import org.eclipse.jface.wizard.Wizard;
22
23
/**
24
 * @author brianf
25
 * @see Wizard
26
 *
27
 */
28
public class NewHSQLDBConnectionProfileWizard extends
29
		NewConnectionProfileWizard {
30
31
	protected HSQLDBProfileDetailsWizardPage mPropPage;
32
33
	/**
34
	 * 
35
	 */
36
	public NewHSQLDBConnectionProfileWizard() {
37
		setWindowTitle(Messages.getString("NewHSQLDBConnectionProfileWizard.HSQLDBWizardTitle")); //$NON-NLS-1$
38
	}
39
40
	/**
41
	 * @see org.eclipse.datatools.connectivity.ui.wizards.NewHSQLDBConnectionProfileWizard#addCustomPages()
42
	 */
43
	public void addCustomPages() {
44
		mPropPage = new HSQLDBProfileDetailsWizardPage("detailsPage"); //$NON-NLS-1$
45
		addPage(mPropPage);
46
	}
47
48
	/* (non-Javadoc)
49
	 * @see org.eclipse.datatools.connectivity.db.generic.ui.NewConnectionProfileWizard#getProfileProperties()
50
	 */
51
	public Properties getProfileProperties() {
52
		Properties props = new Properties();
53
		props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID,
54
				this.mPropPage.getDriverID());
55
		props.setProperty(
56
				IDBConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID,
57
				this.mPropPage.getDBConnProps());
58
		props.setProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, this.mPropPage
59
				.getDriverClass());
60
		props.setProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, this.mPropPage
61
				.getVendor());		
62
		props.setProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, this.mPropPage
63
				.getVersion());			
64
		props.setProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID, this.mPropPage
65
				.getDatabaseName());
66
		props.setProperty(IDBDriverDefinitionConstants.PASSWORD_PROP_ID, this.mPropPage
67
				.getDBPWD());
68
		props.setProperty(
69
				IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID, String
70
						.valueOf(this.mPropPage.getSaveDBPWD()));
71
		props.setProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID, this.mPropPage
72
				.getDBUID());
73
		props.setProperty(IDBDriverDefinitionConstants.URL_PROP_ID,
74
				this.mPropPage.getURL());
75
		return props;
76
	}
77
78
}
(-)src/org/eclipse/datatools/enablement/hsqldb/ui/wizard/HSQLDBProfileDetailsWizardPage.java (+577 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 Sybase, Inc.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Brian Fitzpatrick - initial API and implementation
10
 * 			IBM Corporation - refactored plug-in
11
 ******************************************************************************/
12
package org.eclipse.datatools.enablement.hsqldb.ui.wizard;
13
14
import java.io.File;
15
import java.util.ArrayList;
16
import java.util.List;
17
import java.util.StringTokenizer;
18
19
import javax.swing.event.ChangeEvent;
20
import javax.swing.event.ChangeListener;
21
22
import org.eclipse.core.runtime.Path;
23
import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants;
24
import org.eclipse.datatools.connectivity.drivers.DriverInstance;
25
import org.eclipse.datatools.connectivity.internal.ui.DelimitedStringList;
26
import org.eclipse.datatools.connectivity.internal.ui.DriverListCombo;
27
import org.eclipse.datatools.connectivity.ui.wizards.ConnectionProfileDetailsPage;
28
import org.eclipse.datatools.enablement.hsqldb.ui.IHSQLDBConnectionProfileConstants;
29
import org.eclipse.datatools.enablement.hsqldb.ui.Messages;
30
import org.eclipse.swt.SWT;
31
import org.eclipse.swt.events.ModifyEvent;
32
import org.eclipse.swt.events.ModifyListener;
33
import org.eclipse.swt.events.SelectionEvent;
34
import org.eclipse.swt.events.SelectionListener;
35
import org.eclipse.swt.layout.GridData;
36
import org.eclipse.swt.layout.GridLayout;
37
import org.eclipse.swt.widgets.Button;
38
import org.eclipse.swt.widgets.Composite;
39
import org.eclipse.swt.widgets.Control;
40
import org.eclipse.swt.widgets.DirectoryDialog;
41
import org.eclipse.swt.widgets.Label;
42
import org.eclipse.swt.widgets.Text;
43
44
/**
45
 * This class gathers the properties for the HSQLDB connection profile.
46
 * 
47
 * @author brianf
48
 */
49
public class HSQLDBProfileDetailsWizardPage extends ConnectionProfileDetailsPage {
50
51
	// ui pieces
52
	private Text mDatabaseNameText;
53
54
	private Text mURLText;
55
56
	private Text mDBUIDText;
57
58
	private Text mDBPWDText;
59
60
	private Button mSaveDBPWDCheckbox;
61
62
	private DelimitedStringList mDBConnProps;
63
64
	final DriverListCombo combo = new DriverListCombo();
65
66
	private Text mDBFilePathText;
67
68
	private Button mBrowseFilePathButton;
69
70
	// stashed driver instance
71
	private DriverInstance mDriverInstance;
72
	
73
	private String mDriverCategory;
74
75
	/**
76
	 * Constructor
77
	 * 
78
	 * @param pageName
79
	 */
80
	public HSQLDBProfileDetailsWizardPage(String pageName) {
81
		super(pageName);
82
		setTitle(Messages.getString(
83
				"HSQLDBProfileDetailsWizardPage.title")); //$NON-NLS-1$
84
		setDescription(Messages.getString(
85
				"HSQLDBProfileDetailsWizardPage.msg")); //$NON-NLS-1$
86
		setDriverCategory(IHSQLDBConnectionProfileConstants.HSQLDB_CATEGORY_ID);
87
	}
88
89
	/*
90
	 * (non-Javadoc)
91
	 * 
92
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
93
	 */
94
	public void createCustomControl(Composite parent) {
95
		Composite content = new Composite(parent, SWT.NULL);
96
		GridLayout layout = new GridLayout(2, false);
97
		content.setLayout(layout);
98
99
		// set up the drivers combo
100
		this.combo.setLabelText(Messages.getString(
101
				"HSQLDBProfileDetailsWizardPage.driverCombo.label")); //$NON-NLS-1$
102
		this.combo.setCategory(getDriverCategory());
103
		this.combo.setNullDriverIsValid(false);
104
		this.combo.createContents(content);
105
		if (this.combo.getErrorMessage() != null) {
106
			setErrorMessage(this.combo.getErrorMessage());
107
		}
108
109
		// set up the fields
110
		this.mDatabaseNameText = (Text) createLabelTextPair(
111
				content,
112
				Messages.getString(
113
						"HSQLDBProfileDetailsWizardPage.databaseName.label"), //$NON-NLS-1$
114
				this.mURLText, SWT.BORDER, GridData.FILL_HORIZONTAL);
115
116
		Label label = new Label(content, SWT.NULL);
117
		label.setLayoutData(new GridData());
118
		label.setText(Messages.getString("HSQLDBProfileDetailsWizardPage.0")); //$NON-NLS-1$
119
120
		Composite textAndBrowseComposite = new Composite(content, SWT.NULL);
121
		GridLayout subCompositeLayout = new GridLayout(2, false);
122
		subCompositeLayout.marginLeft = -5;
123
		subCompositeLayout.marginRight = -5;
124
		subCompositeLayout.marginTop = -5;
125
		subCompositeLayout.marginBottom = -5;
126
		textAndBrowseComposite.setLayout(subCompositeLayout);
127
		textAndBrowseComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
128
		this.mDBFilePathText = new Text(textAndBrowseComposite, SWT.BORDER);
129
		this.mDBFilePathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
130
		this.mBrowseFilePathButton = new Button(textAndBrowseComposite, SWT.PUSH);
131
		this.mBrowseFilePathButton.setText(Messages.getString("HSQLDBProfileDetailsWizardPage.1")); //$NON-NLS-1$
132
		this.mBrowseFilePathButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
133
134
		this.mDBUIDText = (Text) createLabelTextPair(content, Messages.getString(
135
						"HSQLDBProfileDetailsWizardPage.userName.label"), //$NON-NLS-1$
136
				this.mDBUIDText, SWT.BORDER, GridData.FILL_HORIZONTAL);
137
138
		this.mDBPWDText = (Text) createLabelTextPair(content, Messages.getString(
139
						"HSQLDBProfileDetailsWizardPage.password.label"), //$NON-NLS-1$
140
				this.mDBPWDText, SWT.BORDER | SWT.PASSWORD, GridData.FILL_HORIZONTAL);
141
142
		this.mURLText = (Text) createLabelTextPair(content, Messages.getString(
143
			"HSQLDBProfileDetailsWizardPage.url.label"), //$NON-NLS-1$
144
			this.mURLText, SWT.BORDER, GridData.FILL_HORIZONTAL);
145
146
		this.mSaveDBPWDCheckbox = new Button(content, SWT.CHECK);
147
		this.mSaveDBPWDCheckbox.setText(Messages.getString(
148
						"HSQLDBProfileDetailsWizardPage.persistpassword.label")); //$NON-NLS-1$
149
		this.mSaveDBPWDCheckbox.setLayoutData(new GridData(GridData.BEGINNING,
150
				GridData.CENTER, true, false, 2, 1));
151
152
		// spacer
153
		Composite spacer = new Composite(content, SWT.NULL);
154
		GridData gdata = new GridData(GridData.FILL_HORIZONTAL);
155
		gdata.horizontalSpan = 2;
156
		gdata.heightHint = 20;
157
		spacer.setLayoutData(gdata);
158
159
		// followed by the optional properties
160
		label = new Label(content, SWT.NULL);
161
		gdata = new GridData(GridData.FILL_HORIZONTAL);
162
		gdata.horizontalSpan = 2;
163
		label.setLayoutData(gdata);
164
		label.setText(Messages.getString(
165
				"HSQLDBProfileDetailsWizardPage.optionalProps.label")); //$NON-NLS-1$
166
167
		this.mDBConnProps = new DelimitedStringList(content, SWT.NONE);
168
		gdata = new GridData(GridData.FILL_HORIZONTAL);
169
		gdata.horizontalSpan = 2;
170
		this.mDBConnProps.setLayoutData(gdata);
171
172
//		// now set up the initial instance
173
//		if (this.mDriverInstance == null)
174
//			this.mDriverInstance = this.combo.getSelectedDriverInstance();
175
176
		this.mDBConnProps.addChangeListener(new ChangeListener() {
177
178
			public void stateChanged(ChangeEvent arg0) {
179
				setErrorMessage(null);
180
				if (HSQLDBProfileDetailsWizardPage.this.mDBConnProps.getWarning() != null) {
181
					setErrorMessage(HSQLDBProfileDetailsWizardPage.this.mDBConnProps
182
							.getWarning());
183
				}
184
			}
185
186
		});
187
188
		// add a change listener to the combo box so
189
		// we know when a new driver has been selected
190
		this.combo.addChangeListener(new ChangeListener() {
191
192
			public void stateChanged(ChangeEvent arg0) {
193
				HSQLDBProfileDetailsWizardPage.this.mDriverInstance = HSQLDBProfileDetailsWizardPage.this.combo
194
						.getSelectedDriverInstance();
195
				setErrorMessage(null);
196
				if (HSQLDBProfileDetailsWizardPage.this.combo.getErrorMessage() != null) {
197
					setErrorMessage(HSQLDBProfileDetailsWizardPage.this.combo
198
							.getErrorMessage());
199
				}
200
				HSQLDBProfileDetailsWizardPage.this.mDatabaseNameText
201
						.setText(getDriverDatabaseName());
202
203
				HSQLDBProfileDetailsWizardPage.this.mURLText
204
						.setText(getDriverURL());
205
				HSQLDBProfileDetailsWizardPage.this.updatePropsFromURL();
206
207
				String username = HSQLDBProfileDetailsWizardPage.this
208
						.getPropertyFromDriverInstance(IDBDriverDefinitionConstants.USERNAME_PROP_ID);
209
				if (username == null || username.trim().length() == 0)
210
					username = new String();
211
				HSQLDBProfileDetailsWizardPage.this.mDBUIDText.setText(username);
212
213
				String password = HSQLDBProfileDetailsWizardPage.this
214
						.getPropertyFromDriverInstance(IDBDriverDefinitionConstants.PASSWORD_PROP_ID);
215
				if (password == null || password.trim().length() == 0)
216
					password = new String();
217
				HSQLDBProfileDetailsWizardPage.this.mDBPWDText.setText(password);
218
219
				setPageComplete(isValid());
220
			}
221
222
		});
223
		
224
		this.mDBFilePathText.addModifyListener(new ModifyListener() {
225
			public void modifyText(ModifyEvent e) {
226
				HSQLDBProfileDetailsWizardPage.this.updateURLFromProps();
227
			}
228
		});
229
		this.mBrowseFilePathButton.addSelectionListener( new SelectionListener() {
230
231
			public void widgetDefaultSelected(SelectionEvent e) {
232
				HSQLDBProfileDetailsWizardPage.this.browseForDBFolder();
233
			}
234
235
			public void widgetSelected(SelectionEvent e) {
236
				HSQLDBProfileDetailsWizardPage.this.browseForDBFolder();
237
			}
238
		});
239
240
		this.combo.selectFirstItem();
241
		// now set up the initial instance
242
		if (this.mDriverInstance == null)
243
			this.mDriverInstance = this.combo.getSelectedDriverInstance();
244
		if (this.mDriverInstance != null) {
245
			this.mURLText.setText(getDriverURL());
246
		}
247
		this.mURLText.setEnabled(false);
248
249
	}
250
	
251
	/**
252
	 * Browse for the database folder
253
	 */
254
	private void browseForDBFolder() {
255
		DirectoryDialog dialog = new DirectoryDialog(getShell());
256
		dialog.setText(Messages
257
				.getString("HSQLDBProfileDetailsWizardPage.FileDialog.title.filebrowse")); //$NON-NLS-1$
258
		dialog.setMessage(Messages
259
				.getString("HSQLDBProfileDetailsWizardPage.FileDialog.msg.filebrowse")); //$NON-NLS-1$
260
261
		String dirName = mDBFilePathText.getText();
262
263
		File path = new File(dirName);
264
		if (path.exists()) {
265
			dialog.setFilterPath(new Path(dirName).toOSString());
266
		}
267
268
		String selectedDirectory = dialog.open();
269
		if (selectedDirectory != null) {
270
			this.mDBFilePathText.setText(selectedDirectory);
271
		}
272
	}
273
274
	/**
275
	 * Update the UI components from the URL
276
	 */
277
	private void updatePropsFromURL() {
278
		if (this.mDBFilePathText != null && this.mURLText != null) {
279
			String url = this.mURLText.getText();
280
			String[] chunks = parseString(url, ";"); //$NON-NLS-1$
281
			if (chunks.length > 0) {
282
				String[] chunks2 = parseString(chunks[0], ":"); //$NON-NLS-1$
283
				if (chunks2.length > 2) {
284
					String filepath = chunks2[2];
285
					if (chunks2.length > 3) {
286
						filepath = filepath + ":" + chunks2[3]; //$NON-NLS-1$
287
					}
288
					this.mDBFilePathText.setText(filepath);
289
				}
290
			}
291
		}
292
	}
293
	
294
	/**
295
	 * Update the URL from the UI components
296
	 */
297
	private void updateURLFromProps() {
298
		if (this.mDBFilePathText != null && this.mURLText != null) {
299
			String url = this.mURLText.getText();
300
			String filePath = this.mDBFilePathText.getText();
301
			//jdbc:derby:C:\DerbyDatabases\MyDB;create=true
302
			String[] chunks = parseString(url, ";"); //$NON-NLS-1$
303
			if (chunks.length > 0) {
304
				String[] chunks2 = parseString(chunks[0], ":"); //$NON-NLS-1$
305
				if (chunks2.length > 2) {
306
					url = chunks2[0] + ":" + chunks2[1] + ":" + filePath; //$NON-NLS-1$ //$NON-NLS-2$
307
					this.mURLText.setText(url);
308
				}
309
			}
310
		}
311
	}
312
313
	/**
314
	 * Parse a string into a string array based on a token
315
	 * @param str_list
316
	 * @param token
317
	 * @return
318
	 */
319
	private  String[] parseString(String str_list, String token) {
320
		StringTokenizer tk = new StringTokenizer(str_list, token);
321
		String[] pieces = new String[tk.countTokens()];
322
		int index = 0;
323
		while (tk.hasMoreTokens())
324
			pieces[index++] = tk.nextToken();
325
		return pieces;
326
	}
327
328
	/**
329
	 * @param propertyID
330
	 * @return
331
	 */
332
	private String getPropertyFromDriverInstance(String propertyID) {
333
		String returnStr = new String();
334
		if (this.mDriverInstance != null
335
				&& this.mDriverInstance.getProperty(propertyID) != null) {
336
			returnStr = this.mDriverInstance.getProperty(propertyID);
337
		}
338
		return returnStr;
339
	}
340
341
	/**
342
	 * Get the sample URL from the driver instance.
343
	 * 
344
	 * @return
345
	 */
346
	public String getDriverURL() {
347
		if (this.mDriverInstance != null
348
				&& this.mDriverInstance
349
						.getProperty(IDBDriverDefinitionConstants.URL_PROP_ID) != null)
350
			return this.mDriverInstance
351
					.getProperty(IDBDriverDefinitionConstants.URL_PROP_ID);
352
		return new String();
353
	}
354
355
	/**
356
	 * Get the sample database name from the driver instance.
357
	 * 
358
	 * @return
359
	 */
360
	public String getDriverDatabaseName() {
361
		if (this.mDriverInstance != null
362
				&& this.mDriverInstance
363
						.getProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID) != null)
364
			return this.mDriverInstance
365
					.getProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID);
366
		return new String();
367
	}
368
369
	/**
370
	 * Get the vendor
371
	 * 
372
	 * @return
373
	 */
374
	public String getVendor() {
375
		String vendor = ""; //$NON-NLS-1$
376
		if (this.mDriverInstance != null) {
377
			vendor = this.mDriverInstance
378
					.getProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID);
379
		}
380
		return vendor;
381
	}
382
383
	/**
384
	 * Get the version
385
	 * 
386
	 * @return
387
	 */
388
	public String getVersion() {
389
		String version = ""; //$NON-NLS-1$
390
		if (this.mDriverInstance != null) {
391
			version = this.mDriverInstance
392
					.getProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID);
393
		}
394
		return version;
395
	}
396
397
	/**
398
	 * Get the driver class
399
	 * 
400
	 * @return
401
	 */
402
	public String getDriverClass() {
403
		String driverClass = ""; //$NON-NLS-1$
404
		if (this.mDriverInstance != null) {
405
			driverClass = this.mDriverInstance
406
					.getProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID);
407
		}
408
		return driverClass;
409
	}
410
	
411
	/**
412
	 * Get the user name
413
	 * 
414
	 * @return
415
	 */
416
	public String getDBUID() {
417
		return this.mDBUIDText.getText();
418
	}
419
420
	/**
421
	 * Get the password
422
	 * 
423
	 * @return
424
	 */
425
	public String getDBPWD() {
426
		return this.mDBPWDText.getText();
427
	}
428
429
	/**
430
	 * Get the password
431
	 * 
432
	 * @return
433
	 */
434
	public boolean getSaveDBPWD() {
435
		return this.mSaveDBPWDCheckbox.getSelection();
436
	}
437
438
	/**
439
	 * Get the optional connection properties
440
	 * 
441
	 * @return
442
	 */
443
	public String getDBConnProps() {
444
		return this.mDBConnProps.getSelection();
445
	}
446
447
	/**
448
	 * Get the database name
449
	 * 
450
	 * @return
451
	 */
452
	public String getDatabaseName() {
453
		return this.mDatabaseNameText.getText();
454
	}
455
456
	/**
457
	 * Get the URL for the CP
458
	 * 
459
	 * @return
460
	 */
461
	public String getURL() {
462
		return this.mURLText.getText();
463
	}
464
465
	/**
466
	 * Get the driver ID
467
	 * 
468
	 * @return
469
	 */
470
	public String getDriverID() {
471
		return this.mDriverInstance.getId();
472
	}
473
474
	/*
475
	 * Create a label and a text box side by side.
476
	 */
477
	private Control createLabelTextPair(Composite parent, String labelText,
478
			Control ctl, int style, int gData) {
479
		Label label = new Label(parent, SWT.NULL);
480
		label.setLayoutData(new GridData());
481
		label.setText(labelText);
482
483
		ctl = new Text(parent, style);
484
		ctl.setLayoutData(new GridData(gData));
485
486
		return ctl;
487
	}
488
489
	/*
490
	 * (non-Javadoc)
491
	 * 
492
	 * @see com.sybase.suade.common.ui.wizards.ISummaryDataSource#getSummaryData()
493
	 */
494
	public List getSummaryData() {
495
		List data = new ArrayList();
496
497
		data
498
				.add(new String[] {
499
						Messages.getString(
500
										"HSQLDBProfileDetailsWizardPage.summary.driverName.label"), //$NON-NLS-1$
501
						mDriverInstance.getName() });
502
503
		data
504
				.add(new String[] {
505
						Messages.getString(
506
										"HSQLDBProfileDetailsWizardPage.summary.connProps.label"), //$NON-NLS-1$
507
						getDBConnProps() });
508
509
		data
510
				.add(new String[] {
511
						Messages.getString(
512
										"HSQLDBProfileDetailsWizardPage.summary.userName.label"), //$NON-NLS-1$
513
						getDBUID() });
514
515
		StringBuffer pwdMask = new StringBuffer();
516
		if (getDBPWD() != null && getDBPWD().length() > 0) {
517
			for (int i = 0, count = getDBPWD().length(); i < count; ++i) {
518
				pwdMask = pwdMask.append('*');
519
			}
520
		}
521
522
		data
523
				.add(new String[] {
524
						Messages.getString(
525
										"HSQLDBProfileDetailsWizardPage.summary.password.label"), //$NON-NLS-1$
526
						pwdMask.toString() });
527
528
		data.add(new String[] {
529
				Messages.getString(
530
						"HSQLDBProfileDetailsWizardPage.summary.url.label"), //$NON-NLS-1$
531
				getURL() });
532
533
		return data;
534
	}
535
536
	private boolean isValid() {
537
		if (getErrorMessage() != null) {
538
			setPageComplete(false);
539
			return false;
540
		}
541
542
		return true;
543
	}
544
545
	/*
546
	 * (non-Javadoc)
547
	 * 
548
	 * @see org.eclipse.jface.dialogs.DialogPage#setErrorMessage(java.lang.String)
549
	 */
550
	public void setErrorMessage(String newMessage) {
551
		super.setErrorMessage(newMessage);
552
		isValid();
553
	}
554
555
	
556
	/**
557
	 * @return
558
	 */
559
	public String getDriverCategory() {
560
		return mDriverCategory;
561
	}
562
563
	
564
	/**
565
	 * Sets the driver category that should be used for displaying available
566
	 * driver defnitions.
567
	 * 
568
	 * @param driverCategory
569
	 */
570
	public void setDriverCategory(String driverCategory) {
571
		mDriverCategory = driverCategory;
572
		if (combo != null) {
573
			combo.setCategory(mDriverCategory);
574
		}
575
	}
576
577
}
(-)src/org/eclipse/datatools/enablement/hsqldb/ui/messages.properties (+23 lines)
Added Link Here
1
NewHSQLDBConnectionProfileWizard.HSQLDBWizardTitle=HSQLDB Database
2
3
HSQLDBProfileDetailsWizardPage.title = Specify a Driver and Connection Details
4
HSQLDBProfileDetailsWizardPage.msg = Select a driver from the drop-down and provide login details for the connection.
5
HSQLDBProfileDetailsWizardPage.0=Database location:
6
HSQLDBProfileDetailsWizardPage.1=Browse...
7
HSQLDBProfileDetailsWizardPage.2=Create database (if required)
8
HSQLDBProfileDetailsWizardPage.3=Upgrade database to current version
9
HSQLDBProfileDetailsWizardPage.driverCombo.label = Select a driver from the drop-down:
10
HSQLDBProfileDetailsWizardPage.databaseName.label = Database:
11
HSQLDBProfileDetailsWizardPage.url.label = URL:
12
HSQLDBProfileDetailsWizardPage.PingButton=Test connection
13
HSQLDBProfileDetailsWizardPage.userName.label = User name:
14
HSQLDBProfileDetailsWizardPage.password.label = Password:
15
HSQLDBProfileDetailsWizardPage.persistpassword.label = Save Password
16
HSQLDBProfileDetailsWizardPage.optionalProps.label = Optional properties:
17
HSQLDBProfileDetailsWizardPage.summary.driverName.label = Driver name
18
HSQLDBProfileDetailsWizardPage.summary.connProps.label = Connection properties
19
HSQLDBProfileDetailsWizardPage.summary.userName.label = User name
20
HSQLDBProfileDetailsWizardPage.summary.password.label = Password
21
HSQLDBProfileDetailsWizardPage.summary.url.label = URL
22
HSQLDBProfileDetailsWizardPage.FileDialog.title.filebrowse = Browse for Database Folder
23
HSQLDBProfileDetailsWizardPage.FileDialog.msg.filebrowse = Select the folder that corresponds to your HSQLDB database.
(-)plugin.xml (+60 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.2"?>
3
<plugin>
4
   <extension
5
         point="org.eclipse.datatools.connectivity.connectionProfile">
6
      <newWizard
7
            class="org.eclipse.datatools.enablement.hsqldb.ui.wizard.NewHSQLDBConnectionProfileWizard"
8
            icon="icons/new_db_element.gif"
9
            id="org.eclipse.datatools.enablement.hsqldb.connectionProfile.NewConnectionProfileWizard"
10
            name="%connection.profile.newwizard"
11
            description = "%connection.profile.newwizard.description"
12
            profile="org.eclipse.datatools.enablement.hsqldb.connectionProfile"/>
13
   </extension>
14
   
15
      <extension
16
         point="org.eclipse.ui.propertyPages">
17
      <page
18
            class="org.eclipse.datatools.enablement.hsqldb.ui.properties.HSQLDBPropertyPage"
19
            id="org.eclipse.datatools.enablement.hsqldb.connectionProfile.profileProperties"
20
            name="%profile.page.name">
21
         <filter
22
               name="org.eclipse.datatools.profile.property.id"
23
               value="org.eclipse.datatools.enablement.hsqldb.connectionProfile"/>
24
         <enabledWhen>
25
            <instanceof
26
                  value="org.eclipse.datatools.connectivity.IConnectionProfile">
27
            </instanceof>
28
         </enabledWhen>
29
      </page>
30
   </extension>
31
   
32
<!--
33
   <extension
34
         point="org.eclipse.ui.navigator.viewer">
35
      <viewerContentBinding viewerId="org.eclipse.datatools.connectivity.DataSourceExplorerNavigator">
36
         <includes>
37
            <contentExtension pattern="org.eclipse.datatools.enablement.hsqldb.navigatorContent"/>
38
         </includes>
39
      </viewerContentBinding>
40
   </extension>
41
42
   <extension
43
         point="org.eclipse.ui.navigator.navigatorContent">
44
      <navigatorContent
45
            activeByDefault="true"
46
            contentProvider="org.eclipse.datatools.enablement.hsqldb.catalog.HSQLDBPipelineTreeContentProvider"
47
            id="org.eclipse.datatools.enablement.hsqldb.navigatorContent"
48
            labelProvider="org.eclipse.datatools.connectivity.sqm.server.internal.ui.explorer.providers.SQLModelLabelProviderExtension"
49
            name="%navigator.content.name"
50
            priority="highest">
51
         <override
52
               policy="InvokeAlwaysRegardlessOfSuppressedExt"
53
               suppressedExtensionId="org.eclipse.datatools.connectivity.db.sqlModelContent"/>
54
         <triggerPoints>
55
            <instanceof value="org.eclipse.datatools.enablement.hsqldb.catalog.HSQLDBCatalogSchema"/>
56
         </triggerPoints>
57
      </navigatorContent>
58
   </extension>
59
-->
60
</plugin>
(-)plugin.properties (+21 lines)
Added Link Here
1
DRIVER_CLASS_PROPERTY_NAME=Driver Class
2
VENDOR_PROPERTY_NAME=Vendor
3
VERSION_PROPERTY_NAME=Version
4
DATABASE_NAME_PROPERTY_NAME=Database Name
5
CONNECTION_URL_PROPERTY_NAME=Connection URL
6
USER_ID_PROPERTY_NAME=User ID
7
PASSWORD_PROPERTY_NAME=Password
8
9
Bundle-Vendor = Eclipse.org
10
Bundle-Name = Eclipse Data Tools Platform HSQLDB UI Enablement Plug-in
11
profile.page.name = HSQLDB Profile Properties
12
13
driver.category.name = HSQLDB
14
driver.category.description = HSQLDB JDBC Drivers
15
driver.version.category.name = 1.8
16
driver.version.category.description = HSQLDB JDBC Drivers for Version 1.8
17
driver.name = HSQLDB JDBC Driver
18
driver.description = JDBC driver for HSQLDB
19
20
connection.profile.newwizard = HSQLDB
21
connection.profile.newwizard.description = Create an HSQLDB connection profile.
(-)src/org/eclipse/datatools/enablement/hsqldb/ui/properties/HSQLDBPropertyPage.java (+480 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 Sybase, Inc.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Brian Fitzpatrick - initial API and implementation
10
 * 			IBM Corporation - refactored plug-in
11
 ******************************************************************************/
12
package org.eclipse.datatools.enablement.hsqldb.ui.properties;
13
14
import java.io.File;
15
import java.util.Properties;
16
import java.util.StringTokenizer;
17
18
import javax.swing.event.ChangeEvent;
19
import javax.swing.event.ChangeListener;
20
21
import org.eclipse.core.runtime.Path;
22
import org.eclipse.datatools.connectivity.ConnectionProfileConstants;
23
import org.eclipse.datatools.connectivity.IConnectionProfile;
24
import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants;
25
import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants;
26
import org.eclipse.datatools.connectivity.drivers.DriverInstance;
27
import org.eclipse.datatools.connectivity.internal.ui.DelimitedStringList;
28
import org.eclipse.datatools.connectivity.internal.ui.DriverListCombo;
29
import org.eclipse.datatools.connectivity.ui.wizards.ProfileDetailsPropertyPage;
30
import org.eclipse.datatools.enablement.hsqldb.ui.IHSQLDBConnectionProfileConstants;
31
import org.eclipse.datatools.enablement.hsqldb.ui.Messages;
32
import org.eclipse.jface.preference.PreferencePage;
33
import org.eclipse.swt.SWT;
34
import org.eclipse.swt.events.ModifyEvent;
35
import org.eclipse.swt.events.ModifyListener;
36
import org.eclipse.swt.events.SelectionEvent;
37
import org.eclipse.swt.events.SelectionListener;
38
import org.eclipse.swt.layout.GridData;
39
import org.eclipse.swt.layout.GridLayout;
40
import org.eclipse.swt.widgets.Button;
41
import org.eclipse.swt.widgets.Composite;
42
import org.eclipse.swt.widgets.Control;
43
import org.eclipse.swt.widgets.DirectoryDialog;
44
import org.eclipse.swt.widgets.Label;
45
import org.eclipse.swt.widgets.Text;
46
47
/**
48
 * Property page for HSQLDB profiles
49
 *
50
 */
51
public class HSQLDBPropertyPage extends ProfileDetailsPropertyPage {
52
53
	private static final String EMPTY_STRING = new String();
54
55
	// UI components
56
	private Text mDatabaseNameText;
57
	private Text mDBUIDText;
58
	private Text mDBPWDText;
59
	private Text mURLText;
60
	private Button mSaveDBPWDCheckbox;
61
	private Text mDBFilePathText;
62
	private Button mBrowseFilePathButton;
63
	final DriverListCombo combo = new DriverListCombo();
64
	private DelimitedStringList mDBConnProps;
65
66
	// other components
67
	private DriverInstance mDriverInstance;
68
	private String mDriverCategory;
69
70
	/**
71
	 * Constructor
72
	 */
73
	public HSQLDBPropertyPage() {
74
		super();
75
		noDefaultAndApplyButton();
76
		setDriverCategory(IHSQLDBConnectionProfileConstants.HSQLDB_CATEGORY_ID);
77
	}
78
79
	/**
80
	 * @see PreferencePage#createContents(Composite)
81
	 */
82
	protected void createCustomContents(Composite parent) {
83
		Composite content = new Composite(parent, SWT.NULL);
84
		GridLayout layout = new GridLayout(2, false);
85
		content.setLayout(layout);
86
87
		this.combo.setLabelText(Messages.getString(
88
				"HSQLDBProfileDetailsWizardPage.driverCombo.label")); //$NON-NLS-1$
89
		this.combo.setCategory(getDriverCategory());
90
		this.combo.setNullDriverIsValid(false);
91
		this.combo.createContents(content);
92
93
		this.mDatabaseNameText = (Text) createLabelTextPair(
94
				content,
95
				Messages.getString(
96
						"HSQLDBProfileDetailsWizardPage.databaseName.label"), //$NON-NLS-1$
97
				this.mURLText, SWT.BORDER, GridData.FILL_HORIZONTAL);		
98
99
		Label label = new Label(content, SWT.NULL);
100
		label.setLayoutData(new GridData());
101
		label.setText(Messages.getString("HSQLDBProfileDetailsWizardPage.0")); //$NON-NLS-1$
102
103
		Composite textAndBrowseComposite = new Composite(content, SWT.NULL);
104
		GridLayout subCompositeLayout = new GridLayout(2, false);
105
		subCompositeLayout.marginLeft = -5;
106
		subCompositeLayout.marginRight = -5;
107
		subCompositeLayout.marginTop = -5;
108
		subCompositeLayout.marginBottom = -5;
109
		textAndBrowseComposite.setLayout(subCompositeLayout);
110
		textAndBrowseComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
111
		this.mDBFilePathText = new Text(textAndBrowseComposite, SWT.BORDER);
112
		this.mDBFilePathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
113
		this.mBrowseFilePathButton = new Button(textAndBrowseComposite, SWT.PUSH);
114
		this.mBrowseFilePathButton.setText(Messages.getString("HSQLDBProfileDetailsWizardPage.1")); //$NON-NLS-1$
115
		this.mBrowseFilePathButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
116
117
		this.mURLText = (Text) createLabelTextPair(content, Messages.getString(
118
						"HSQLDBProfileDetailsWizardPage.url.label"), //$NON-NLS-1$
119
				this.mURLText, SWT.BORDER, GridData.FILL_HORIZONTAL);
120
		this.mDBUIDText = (Text) createLabelTextPair(content, Messages.getString(
121
						"HSQLDBProfileDetailsWizardPage.userName.label"), //$NON-NLS-1$ 
122
				this.mDBUIDText, SWT.BORDER, GridData.FILL_HORIZONTAL);
123
124
		this.mDBPWDText = (Text) createLabelTextPair(content, Messages.getString(
125
						"HSQLDBProfileDetailsWizardPage.password.label"), //$NON-NLS-1$, 
126
				this.mDBPWDText, SWT.BORDER | SWT.PASSWORD, GridData.FILL_HORIZONTAL);
127
128
		this.mSaveDBPWDCheckbox = new Button(content, SWT.CHECK);
129
		this.mSaveDBPWDCheckbox.setText(Messages
130
				.getString(
131
						"HSQLDBProfileDetailsWizardPage.persistpassword.label")); //$NON-NLS-1$
132
		this.mSaveDBPWDCheckbox.setLayoutData(new GridData(GridData.BEGINNING,
133
				GridData.CENTER, true, false, 2, 1));
134
135
		Composite spacer = new Composite(content, SWT.NULL);
136
		GridData gdata = new GridData(GridData.FILL_HORIZONTAL);
137
		gdata.horizontalSpan = 2;
138
		gdata.heightHint = 20;
139
		spacer.setLayoutData(gdata);
140
141
		label = new Label(content, SWT.NULL);
142
		gdata = new GridData(GridData.FILL_HORIZONTAL);
143
		gdata.horizontalSpan = 2;
144
		label.setLayoutData(gdata);
145
		label.setText(Messages.getString(
146
				"HSQLDBProfileDetailsWizardPage.optionalProps.label")); //$NON-NLS-1$
147
148
		this.mDBConnProps = new DelimitedStringList(content, SWT.NONE);
149
		gdata = new GridData(GridData.FILL_HORIZONTAL);
150
		gdata.horizontalSpan = 2;
151
		this.mDBConnProps.setLayoutData(gdata);
152
153
		this.mDBConnProps.addChangeListener(new ChangeListener() {
154
155
			public void stateChanged(ChangeEvent arg0) {
156
				setErrorMessage(null);
157
				if (HSQLDBPropertyPage.this.mDBConnProps.getWarning() != null) {
158
					setErrorMessage(HSQLDBPropertyPage.this.mDBConnProps
159
							.getWarning());
160
				}
161
			}
162
163
		});
164
165
		this.combo.addChangeListener(new ChangeListener() {
166
167
			public void stateChanged(ChangeEvent arg0) {
168
				HSQLDBPropertyPage.this.mDriverInstance = HSQLDBPropertyPage.this.combo
169
						.getSelectedDriverInstance();
170
				setErrorMessage(null);
171
				if (HSQLDBPropertyPage.this.combo.getErrorMessage() != null) {
172
					setErrorMessage(HSQLDBPropertyPage.this.combo
173
							.getErrorMessage());
174
				}
175
				else
176
					HSQLDBPropertyPage.this.mURLText
177
							.setText(getDriverURL());
178
				String username = HSQLDBPropertyPage.this
179
						.getPropertyFromDriverInstance(IDBDriverDefinitionConstants.USERNAME_PROP_ID);
180
				if (username == null || username.trim().length() == 0)
181
					username = new String();
182
				String oldUsername = HSQLDBPropertyPage.this.mDBUIDText
183
						.getText();
184
				if (oldUsername == null || oldUsername.trim().length() == 0)
185
					oldUsername = new String();
186
				if (oldUsername.length() == 0)
187
					HSQLDBPropertyPage.this.mDBUIDText
188
							.setText(username);
189
190
				String password = HSQLDBPropertyPage.this
191
						.getPropertyFromDriverInstance(IDBDriverDefinitionConstants.PASSWORD_PROP_ID);
192
				if (password == null || password.trim().length() == 0)
193
					password = new String();
194
				String oldPassword = HSQLDBPropertyPage.this.mDBPWDText
195
						.getText();
196
				if (oldPassword == null || oldPassword.trim().length() == 0)
197
					oldPassword = new String();
198
				if (oldPassword.length() == 0)
199
					HSQLDBPropertyPage.this.mDBPWDText
200
							.setText(password);
201
			}
202
203
		});
204
205
		initControls();
206
207
		this.mDBFilePathText.addModifyListener(new ModifyListener() {
208
			public void modifyText(ModifyEvent e) {
209
				HSQLDBPropertyPage.this.updateURLFromProps();
210
			}
211
		});
212
		
213
		this.mBrowseFilePathButton.addSelectionListener( new SelectionListener() {
214
215
			public void widgetDefaultSelected(SelectionEvent e) {
216
				HSQLDBPropertyPage.this.browseForDBFolder();
217
			}
218
219
			public void widgetSelected(SelectionEvent e) {
220
				HSQLDBPropertyPage.this.browseForDBFolder();
221
			}
222
		});
223
224
		// return content;
225
	}
226
227
	/*
228
	 * (non-Javadoc)
229
	 * 
230
	 * @see org.eclipse.jface.preference.IPreferencePage#performOk()
231
	 */
232
	protected Properties collectProperties() {
233
		Properties props = new Properties();
234
235
		String driverID = EMPTY_STRING;
236
237
		if (this.combo.getSelectedDriverInstance() != null) {
238
			DriverInstance instance = this.combo.getSelectedDriverInstance();
239
			driverID = instance.getId();
240
		}
241
242
		props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID,
243
				driverID);
244
		props.setProperty(
245
				IDBConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID,
246
				this.mDBConnProps.getSelection());	
247
		props.setProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, getPropertyFromDriverInstance(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID));		
248
		props.setProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, getPropertyFromDriverInstance(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID));		
249
		props.setProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, getPropertyFromDriverInstance(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID));	
250
		props.setProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID, this.mDatabaseNameText
251
				.getText());
252
		props.setProperty(IDBDriverDefinitionConstants.PASSWORD_PROP_ID, this.mDBPWDText
253
				.getText());
254
		props.setProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID, this.mDBUIDText
255
				.getText());
256
		props.setProperty(IDBDriverDefinitionConstants.URL_PROP_ID,
257
				this.mURLText.getText());
258
		props.setProperty(
259
				IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID, String
260
						.valueOf(this.mSaveDBPWDCheckbox.getSelection()));
261
262
		return props;
263
	}
264
265
	/**
266
	 * 
267
	 */
268
	private void initControls() {
269
		IConnectionProfile profile = getConnectionProfile();
270
		String driverID = profile.getBaseProperties().getProperty(
271
				ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID);
272
		if (driverID != null) {
273
			this.combo.setSelectionToID(driverID);
274
		}
275
276
		String connectionProps = profile.getBaseProperties().getProperty(
277
				IDBConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID);
278
		if (connectionProps != null) {
279
			this.mDBConnProps.setSelection(connectionProps);
280
		}
281
282
		String databaseName = profile.getBaseProperties().getProperty(
283
				IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID);
284
		if (databaseName != null) {
285
			this.mDatabaseNameText.setText(databaseName);
286
		}
287
		
288
		String databasePwd = profile.getBaseProperties().getProperty(
289
				IDBDriverDefinitionConstants.PASSWORD_PROP_ID);
290
		if (databasePwd != null) {
291
			this.mDBPWDText.setText(databasePwd);
292
		}
293
294
		String databaseUid = profile.getBaseProperties().getProperty(
295
				IDBDriverDefinitionConstants.USERNAME_PROP_ID);
296
		if (databaseUid != null) {
297
			this.mDBUIDText.setText(databaseUid);
298
		}
299
300
		String urlText = profile.getBaseProperties().getProperty(
301
				IDBDriverDefinitionConstants.URL_PROP_ID);
302
		if (urlText != null) {
303
			this.mURLText.setText(urlText);
304
			this.mURLText.setEnabled(false);
305
		}
306
307
		this.mSaveDBPWDCheckbox.setSelection(Boolean.valueOf(
308
				profile.getBaseProperties().getProperty(
309
						IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID,
310
						Boolean.FALSE.toString())).booleanValue());
311
312
		this.updatePropsFromURL();
313
314
		setErrorMessage(null);
315
		if (this.combo.getErrorMessage() != null) {
316
			setErrorMessage(this.combo.getErrorMessage());
317
		}
318
	}
319
	
320
	/**
321
	 * Browse for a DB folder
322
	 */
323
	private void browseForDBFolder() {
324
		DirectoryDialog dialog = new DirectoryDialog(getShell());
325
		dialog.setText(Messages
326
				.getString("HSQLDBProfileDetailsWizardPage.FileDialog.title.filebrowse")); //$NON-NLS-1$
327
		dialog.setMessage(Messages
328
				.getString("HSQLDBProfileDetailsWizardPage.FileDialog.msg.filebrowse")); //$NON-NLS-1$
329
330
		String dirName = mDBFilePathText.getText();
331
332
		File path = new File(dirName);
333
		if (path.exists()) {
334
			dialog.setFilterPath(new Path(dirName).toOSString());
335
		}
336
337
		String selectedDirectory = dialog.open();
338
		if (selectedDirectory != null) {
339
			this.mDBFilePathText.setText(selectedDirectory);
340
		}
341
	}
342
343
	/**
344
	 * Based on the URL, update the UI components accordingly
345
	 */
346
	private void updatePropsFromURL() {
347
		if (this.mDBFilePathText != null && this.mURLText != null) {
348
			String url = this.mURLText.getText();
349
			String[] chunks = parseString(url, ";"); //$NON-NLS-1$
350
			if (chunks.length > 0) {
351
				String[] chunks2 = parseString(chunks[0], ":"); //$NON-NLS-1$
352
				if (chunks2.length > 2) {
353
					String filepath = chunks2[2];
354
					if (chunks2.length > 3) {
355
						filepath = filepath + ":" + chunks2[3]; //$NON-NLS-1$
356
					}
357
					this.mDBFilePathText.setText(filepath);
358
				}
359
			}
360
		}
361
	}
362
	
363
	/**
364
	 * Based on the state of the UI components, reset the URL
365
	 */
366
	private void updateURLFromProps() {
367
		if (this.mDBFilePathText != null && this.mURLText != null) {
368
			String url = this.mURLText.getText();
369
			String filePath = this.mDBFilePathText.getText();
370
			//jdbc:derby:C:\DerbyDatabases\MyDB;create=true
371
			String[] chunks = parseString(url, ";"); //$NON-NLS-1$
372
			if (chunks.length > 0) {
373
				String[] chunks2 = parseString(chunks[0], ":"); //$NON-NLS-1$
374
				if (chunks2.length > 2) {
375
					url = chunks2[0] + ":" + chunks2[1] + ":" + filePath; //$NON-NLS-1$ //$NON-NLS-2$
376
					this.mURLText.setText(url);
377
				}
378
			}
379
		}
380
	}
381
382
	/**
383
	 * Parse a string into an array based on a token
384
	 * @param str_list
385
	 * @param token
386
	 * @return
387
	 */
388
	private  String[] parseString(String str_list, String token) {
389
		StringTokenizer tk = new StringTokenizer(str_list, token);
390
		String[] pieces = new String[tk.countTokens()];
391
		int index = 0;
392
		while (tk.hasMoreTokens())
393
			pieces[index++] = tk.nextToken();
394
		return pieces;
395
	}
396
397
	/**
398
	 * @param propertyID
399
	 * @return
400
	 */
401
	private String getPropertyFromDriverInstance(String propertyID) {
402
		String returnStr = new String();
403
		if (this.mDriverInstance != null
404
				&& this.mDriverInstance.getProperty(propertyID) != null) {
405
			returnStr = this.mDriverInstance.getProperty(propertyID);
406
		}
407
		return returnStr;
408
	}
409
410
	/**
411
	 * @param parent
412
	 * @param labelText
413
	 * @param ctl
414
	 * @param style
415
	 * @param gData
416
	 * @return
417
	 */
418
	private Control createLabelTextPair(Composite parent, String labelText,
419
			Control ctl, int style, int gData) {
420
		Label label = new Label(parent, SWT.NULL);
421
		label.setLayoutData(new GridData());
422
		label.setText(labelText);
423
424
		ctl = new Text(parent, style);
425
		ctl.setLayoutData(new GridData(gData));
426
427
		return ctl;
428
	}
429
430
	/**
431
	 * @return
432
	 */
433
	public String getDriverURL() {
434
		return this.mDriverInstance
435
				.getProperty(IDBDriverDefinitionConstants.URL_PROP_ID);
436
	}
437
438
	/*
439
	 * (non-Javadoc)
440
	 * 
441
	 * @see org.eclipse.jface.preference.IPreferencePage#isValid()
442
	 */
443
	public boolean isValid() {
444
		if (getErrorMessage() != null) {
445
			return false;
446
		}
447
		return super.isValid();
448
	}
449
450
	/*
451
	 * (non-Javadoc)
452
	 * 
453
	 * @see org.eclipse.jface.dialogs.DialogPage#setErrorMessage(java.lang.String)
454
	 */
455
	public void setErrorMessage(String newMessage) {
456
		super.setErrorMessage(newMessage);
457
		isValid();
458
	}
459
460
	/**
461
	 * @return
462
	 */
463
	public String getDriverCategory() {
464
		return mDriverCategory;
465
	}
466
467
	
468
	/**
469
	 * Sets the driver category that should be used for displaying available
470
	 * driver defnitions.
471
	 * 
472
	 * @param driverCategory
473
	 */
474
	public void setDriverCategory(String driverCategory) {
475
		mDriverCategory = driverCategory;
476
		if (combo != null) {
477
			combo.setCategory(mDriverCategory);
478
		}
479
	}
480
}
(-)icons/new_db_element.gif (+4 lines)
Added Link Here
1
GIF89a÷ZcZcZc{„{„{„œœœ­­­µŒ9µ”9½½½½ÞÞÆ½ÆÖÖÖÞÞ½çΌÿÿÿÞÞÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ!ù,œt° €Áƒh?@‚‡$8A!C&ˆ8‘¢‹2näh „&
2
8 #LJJP¹rÀ–rPҀ?`D€€¢Ü
3
 ÀP	ˆàg͛-u²´i5èТG¥.]ÙôiTS«åš5çÖ±„"5Š”À€´$
4
Uª¼èeIpàÈ;
(-)src/org/eclipse/datatools/enablement/hsqldb/ui/Messages.java (+45 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 Sybase, Inc.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Brian Fitzpatrick - initial API and implementation
10
 * 			IBM Corporation - refactored plug-in
11
 ******************************************************************************/
12
package org.eclipse.datatools.enablement.hsqldb.ui;
13
14
import java.util.MissingResourceException;
15
import java.util.ResourceBundle;
16
17
/**
18
 * @author brianf
19
 *
20
 */
21
public class Messages {
22
	
23
	private static final String BUNDLE_NAME = "org.eclipse.datatools.enablement.hsqldb.ui.messages"; //$NON-NLS-1$
24
25
	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
26
			.getBundle(BUNDLE_NAME);
27
28
	/**
29
	 * 
30
	 */
31
	private Messages() {
32
	}
33
34
	/**
35
	 * @param key
36
	 * @return
37
	 */
38
	public static String getString(String key) {
39
		try {
40
			return RESOURCE_BUNDLE.getString(key);
41
		} catch (MissingResourceException e) {
42
			return '!' + key + '!';
43
		}
44
	}
45
}
(-)src/org/eclipse/datatools/enablement/hsqldb/ui/catalog/HSQLDBPipelineTreeContentProvider.java (+115 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 Sybase, Inc.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Brian Fitzpatrick - initial API and implementation
10
 * 			IBM Corporation - refactored plug-in
11
 ******************************************************************************/
12
package org.eclipse.datatools.enablement.hsqldb.ui.catalog;
13
14
import java.util.ArrayList;
15
import java.util.Arrays;
16
import java.util.Iterator;
17
import java.util.Set;
18
19
import org.eclipse.datatools.connectivity.sqm.core.internal.ui.explorer.providers.content.virtual.StoredProcedureNode;
20
import org.eclipse.datatools.connectivity.sqm.server.internal.ui.explorer.providers.content.impl.ServerExplorerContentProviderNav;
21
import org.eclipse.ui.IMemento;
22
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
23
import org.eclipse.ui.navigator.IPipelinedTreeContentProvider;
24
import org.eclipse.ui.navigator.PipelinedShapeModification;
25
import org.eclipse.ui.navigator.PipelinedViewerUpdate;
26
27
/**
28
 * @author brianf
29
 *
30
 */
31
public class HSQLDBPipelineTreeContentProvider extends ServerExplorerContentProviderNav implements IPipelinedTreeContentProvider {
32
33
	/**
34
	 * 
35
	 */
36
	public HSQLDBPipelineTreeContentProvider() {
37
		super();
38
	}
39
40
	/* (non-Javadoc)
41
	 * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#getPipelinedChildren(java.lang.Object, java.util.Set)
42
	 */
43
	public void getPipelinedChildren(Object aParent, Set theCurrentChildren) {
44
		Object[] children = getChildren(aParent);
45
		ArrayList kids = new ArrayList(Arrays.asList(children));
46
		theCurrentChildren.clear();
47
		for (Iterator iter = kids.iterator(); iter.hasNext();) {
48
			if (iter.next() instanceof StoredProcedureNode)
49
				iter.remove();
50
		}
51
		theCurrentChildren.addAll(kids);
52
	}
53
54
	/* (non-Javadoc)
55
	 * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#getPipelinedElements(java.lang.Object, java.util.Set)
56
	 */
57
	public void getPipelinedElements(Object anInput, Set theCurrentElements) {
58
		Object[] children = getElements(anInput);
59
60
		theCurrentElements.addAll(Arrays.asList(children));
61
	}
62
63
	/* (non-Javadoc)
64
	 * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#getPipelinedParent(java.lang.Object, java.lang.Object)
65
	 */
66
	public Object getPipelinedParent(Object anObject, Object aSuggestedParent) {
67
		return getParent(anObject);
68
	}
69
70
	/* (non-Javadoc)
71
	 * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#interceptAdd(org.eclipse.ui.navigator.PipelinedShapeModification)
72
	 */
73
	public PipelinedShapeModification interceptAdd(
74
			PipelinedShapeModification anAddModification) {
75
		return anAddModification;
76
	}
77
78
	/* (non-Javadoc)
79
	 * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#interceptRefresh(org.eclipse.ui.navigator.PipelinedViewerUpdate)
80
	 */
81
	public boolean interceptRefresh(
82
			PipelinedViewerUpdate aRefreshSynchronization) {
83
		return true;
84
	}
85
86
	/* (non-Javadoc)
87
	 * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#interceptRemove(org.eclipse.ui.navigator.PipelinedShapeModification)
88
	 */
89
	public PipelinedShapeModification interceptRemove(
90
			PipelinedShapeModification aRemoveModification) {
91
		return aRemoveModification;
92
	}
93
94
	/* (non-Javadoc)
95
	 * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#interceptUpdate(org.eclipse.ui.navigator.PipelinedViewerUpdate)
96
	 */
97
	public boolean interceptUpdate(PipelinedViewerUpdate anUpdateSynchronization) {
98
		return true;
99
	}
100
	/* (non-Javadoc)
101
	 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
102
	 */
103
	public void dispose() {
104
		super.dispose();
105
	}
106
107
	public void init(ICommonContentExtensionSite aConfig) {
108
	}
109
110
	public void restoreState(IMemento aMemento) {
111
	}
112
113
	public void saveState(IMemento aMemento) {
114
	}
115
}

Return to bug 203158