Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection')
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/ConnectionPropertiesComposite.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/DataSourcePropertiesComposite.java142
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/GenericPersistenceUnit2_0ConnectionComposite.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/GenericPersistenceUnit2_0ConnectionTab.java90
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/JdbcConnectionPropertiesComposite.java314
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/JdbcDriverComposite.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/JdbcPropertiesComposite.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/TransactionTypeComposite.java123
8 files changed, 0 insertions, 929 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/ConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/ConnectionPropertiesComposite.java
deleted file mode 100644
index 663434600c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/ConnectionPropertiesComposite.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.ui.internal.jpa2.persistence.connection;
-
-import org.eclipse.jpt.common.ui.internal.widgets.Pane;
-import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
-import org.eclipse.jpt.ui.internal.jpa2.persistence.JptUiPersistence2_0Messages;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * ConnectionPropertiesComposite
- */
-public class ConnectionPropertiesComposite extends Pane<JpaConnection2_0>
-{
- public ConnectionPropertiesComposite(Pane<JpaConnection2_0> parentComposite, Composite parent) {
-
- super(parentComposite, parent);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- container = addTitledGroup(
- container,
- JptUiPersistence2_0Messages.ConnectionPropertiesComposite_Database_GroupBox
- );
-
- new DataSourcePropertiesComposite(this, container);
- new JdbcPropertiesComposite(this, container);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/DataSourcePropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/DataSourcePropertiesComposite.java
deleted file mode 100644
index 23b8058069..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/DataSourcePropertiesComposite.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.ui.internal.jpa2.persistence.connection;
-
-import org.eclipse.jpt.common.ui.internal.widgets.Pane;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
-import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.jpa2.persistence.JptUiPersistence2_0Messages;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * DataSourcePropertiesComposite
- */
-public class DataSourcePropertiesComposite extends Pane<JpaConnection2_0>
-{
- /**
- * Creates a new <code>DataSourcePropertiesComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
- public DataSourcePropertiesComposite(Pane<JpaConnection2_0> parentComposite,
- Composite parent) {
-
- super(parentComposite, parent);
- }
-
- private WritablePropertyValueModel<String> buildJtaDataSourceHolder() {
- return new PropertyAspectAdapter<PersistenceUnit, String>(this.buildPersistenceUnitHolder(), PersistenceUnit.JTA_DATA_SOURCE_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getJtaDataSource();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setJtaDataSource(value);
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildJTADataSourceHolder() {
- return new TransformationPropertyValueModel<PersistenceUnitTransactionType, Boolean>(buildTransactionTypeHolder()) {
- @Override
- protected Boolean transform(PersistenceUnitTransactionType value) {
- return Boolean.valueOf(this.transform2(value));
- }
- private boolean transform2(PersistenceUnitTransactionType value) {
- return value == null || value == PersistenceUnitTransactionType.JTA;
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildNonJtaDataSourceHolder() {
- return new PropertyAspectAdapter<PersistenceUnit, String>(buildPersistenceUnitHolder(), PersistenceUnit.NON_JTA_DATA_SOURCE_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getNonJtaDataSource();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setNonJtaDataSource(value);
- }
- };
- }
-
- private PropertyValueModel<Boolean> buildNonJTADataSourceHolder() {
- return new TransformationPropertyValueModel<PersistenceUnitTransactionType, Boolean>(buildTransactionTypeHolder()) {
- @Override
- protected Boolean transform(PersistenceUnitTransactionType value) {
- return Boolean.valueOf(value == PersistenceUnitTransactionType.RESOURCE_LOCAL);
- }
- };
- }
-
- private PropertyValueModel<PersistenceUnitTransactionType> buildTransactionTypeHolder() {
- return new PropertyAspectAdapter<PersistenceUnit, PersistenceUnitTransactionType>(
- buildPersistenceUnitHolder(),
- PersistenceUnit.SPECIFIED_TRANSACTION_TYPE_PROPERTY,
- PersistenceUnit.DEFAULT_TRANSACTION_TYPE_PROPERTY) {
- @Override
- protected PersistenceUnitTransactionType buildValue_() {
- return this.subject.getTransactionType();
- }
- };
- }
-
- private PropertyValueModel<PersistenceUnit> buildPersistenceUnitHolder() {
- return new PropertyAspectAdapter<JpaConnection2_0, PersistenceUnit>(getSubjectHolder()) {
- @Override
- protected PersistenceUnit buildValue_() {
- return this.subject.getPersistenceUnit();
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- int groupBoxMargin = this.getGroupBoxMargin();
-
- container = this.addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
-
- // JTA Data Source
- PropertyValueModel<Boolean> jtaEnabled = this.buildJTADataSourceHolder();
- Label jtaLabel = this.addLabel(container, JptUiPersistence2_0Messages.DataSourcePropertiesComposite_jtaDataSourceLabel, jtaEnabled);
- Text jtaText = this.addText(container, this.buildJtaDataSourceHolder(), this.getHelpID(), jtaEnabled);
- this.addLabeledComposite(container, jtaLabel, jtaText, this.getHelpID());
-
- // Non-JTA Data Source
- PropertyValueModel<Boolean> nonJTAEnabled = this.buildNonJTADataSourceHolder();
- Label nonJtaLabel = this.addLabel(container, JptUiPersistence2_0Messages.DataSourcePropertiesComposite_nonJtaDataSourceLabel, nonJTAEnabled);
- Text nonJtaText = this.addText(container, this.buildNonJtaDataSourceHolder(), this.getHelpID(), nonJTAEnabled);
- this.addLabeledComposite(container, nonJtaLabel, nonJtaText, this.getHelpID());
- }
-
- public String getHelpID() {
- return JpaHelpContextIds.PERSISTENCE_XML_CONNECTION; // TODO - Review for JPA 2.0
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/GenericPersistenceUnit2_0ConnectionComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/GenericPersistenceUnit2_0ConnectionComposite.java
deleted file mode 100644
index 245de6e65f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/GenericPersistenceUnit2_0ConnectionComposite.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.internal.jpa2.persistence.connection;
-
-import org.eclipse.jpt.common.ui.internal.widgets.Pane;
-import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
-import org.eclipse.jpt.ui.internal.jpa2.persistence.JptUiPersistence2_0Messages;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * GenericPersistenceUnit2_0ConnectionComposite
- */
-public class GenericPersistenceUnit2_0ConnectionComposite extends Pane<JpaConnection2_0>
-{
- public GenericPersistenceUnit2_0ConnectionComposite(
- Pane<JpaConnection2_0> subjectHolder,
- Composite container) {
- super(subjectHolder, container, false);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- int groupBoxMargin = this.getGroupBoxMargin() * 2;
-
- container = this.addSection(
- container,
- JptUiPersistence2_0Messages.GenericPersistenceUnit2_0ConnectionComposite_sectionTitle,
- JptUiPersistence2_0Messages.GenericPersistenceUnit2_0ConnectionComposite_sectionDescription
- );
-
- Composite subPane = this.addSubPane(
- container,
- 0, groupBoxMargin, 10, groupBoxMargin
- );
-
- new TransactionTypeComposite(this, subPane);
-
- new ConnectionPropertiesComposite(this, container);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/GenericPersistenceUnit2_0ConnectionTab.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/GenericPersistenceUnit2_0ConnectionTab.java
deleted file mode 100644
index ff3991ca98..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/GenericPersistenceUnit2_0ConnectionTab.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.internal.jpa2.persistence.connection;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jpt.common.ui.WidgetFactory;
-import org.eclipse.jpt.common.ui.internal.widgets.Pane;
-import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
-import org.eclipse.jpt.ui.details.JpaPageComposite;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.jpa2.persistence.JptUiPersistence2_0Messages;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * GenericPersistenceUnit2_0ConnectionTab
- */
-public class GenericPersistenceUnit2_0ConnectionTab extends Pane<JpaConnection2_0>
- implements JpaPageComposite
-{
- // ********** constructors/initialization **********
- /**
- * Creates a new <code>GenericPersistenceUnit2_0ConnectionTab</code>.
- *
- * @param subjectHolder The holder of this pane's subject
- * @param parent The parent container
- * @param widgetFactory The factory used to create various common widgets
- */
- public GenericPersistenceUnit2_0ConnectionTab(
- PropertyValueModel<JpaConnection2_0> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- new GenericPersistenceUnit2_0ConnectionComposite(this, container);
- }
-
- // ********** Layout **********
- @Override
- protected Composite addContainer(Composite parent) {
- GridLayout layout = new GridLayout(1, true);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.marginTop = 0;
- layout.marginLeft = 0;
- layout.marginBottom = 0;
- layout.marginRight = 0;
- layout.verticalSpacing = 15;
- Composite container = this.addPane(parent, layout);
- updateGridData(container);
- return container;
- }
-
- private void updateGridData(Composite container) {
- GridData gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- container.setLayoutData(gridData);
- }
-
- // ********** JpaPageComposite implementation **********
-
- public String getHelpID() {
- return JpaHelpContextIds.PERSISTENCE_XML_CONNECTION; // TODO - Review for JPA 2.0
- }
-
- public ImageDescriptor getPageImageDescriptor() {
- return null;
- }
-
- public String getPageText() {
- return JptUiPersistence2_0Messages.GenericPersistenceUnit2_0ConnectionTab_title;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/JdbcConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/JdbcConnectionPropertiesComposite.java
deleted file mode 100644
index 853e892fe1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/JdbcConnectionPropertiesComposite.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.ui.internal.jpa2.persistence.connection;
-
-import java.util.Comparator;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jpt.common.ui.internal.widgets.Pane;
-import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.ConnectionProfileFactory;
-import org.eclipse.jpt.db.JptDbPlugin;
-import org.eclipse.jpt.ui.JptUiPlugin;
-import org.eclipse.jpt.ui.internal.jpa2.persistence.JptUiPersistence2_0Messages;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog;
-
-/**
- * JdbcConnectionPropertiesComposite
- */
-@SuppressWarnings("nls")
-public class JdbcConnectionPropertiesComposite extends Pane<JpaConnection2_0>
-{
- /**
- * The constant ID used to retrieve the dialog settings.
- */
- private static final String DIALOG_SETTINGS = "org.eclipse.jpt.ui.internal.jpa2.dialogs.ConnectionDialog";
-
- public JdbcConnectionPropertiesComposite(Pane<JpaConnection2_0> parentComposite, Composite parent) {
-
- super(parentComposite, parent);
- }
-
- private WritablePropertyValueModel<String> buildPasswordHolder() {
- return new PropertyAspectAdapter<JpaConnection2_0, String>(this.getSubjectHolder(), JpaConnection2_0.PASSWORD_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getPassword();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setPassword(value);
- }
- };
- }
-
- private Runnable buildPopulateFromConnectionAction() {
- return new Runnable() {
- public void run() {
- promptConnection();
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildUrlHolder() {
- return new PropertyAspectAdapter<JpaConnection2_0, String>(this.getSubjectHolder(), JpaConnection2_0.URL_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getUrl();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setUrl(value);
- }
- };
- }
-
- private WritablePropertyValueModel<String> buildUserHolder() {
- return new PropertyAspectAdapter<JpaConnection2_0, String>(this.getSubjectHolder(), JpaConnection2_0.USER_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getUser();
- }
-
- @Override
- protected void setValue_(String value) {
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setUser(value);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- // Populate from Connection hyperlink
- this.addHyperlink(
- container,
- JptUiPersistence2_0Messages.JdbcConnectionPropertiesComposite_populateFromConnectionHyperLink,
- this.buildPopulateFromConnectionAction()
- );
-
- // Driver
- new JdbcDriverComposite(this, container);
-
- // Url
- this.addLabeledText(
- container,
- JptUiPersistence2_0Messages.JdbcConnectionPropertiesComposite_urlLabel,
- this.buildUrlHolder()
- );
-
- // User
- this.addLabeledText(
- container,
- JptUiPersistence2_0Messages.JdbcConnectionPropertiesComposite_userLabel,
- this.buildUserHolder()
- );
-
- // Password
- this.addLabeledPasswordText(
- container,
- JptUiPersistence2_0Messages.JdbcConnectionPropertiesComposite_passwordLabel,
- this.buildPasswordHolder()
- );
- }
-
- void promptConnection() {
-
- ConnectionSelectionDialog dialog = new ConnectionSelectionDialog();
-
- if (dialog.open() != IDialogConstants.OK_ID) {
- return;
- }
-
- String name = (String) dialog.getResult()[0];
- ConnectionProfile cp = this.getConnectionProfileFactory().buildConnectionProfile(name);
-
- JpaConnection2_0 connection = getSubject();
- connection.setUrl((cp == null) ? "" : cp.getURL());
- connection.setUser((cp == null) ? "" : cp.getUserName());
- connection.setPassword((cp == null) ? "" : cp.getUserPassword());
- connection.setDriver((cp == null) ? "" : cp.getDriverClassName());
- }
-
- ConnectionProfileFactory getConnectionProfileFactory() {
- // we allow the user to select any connection profile and simply
- // take the settings from it (user, password, etc.) and give them
- // to the persistence connection, so we go
- // to the db plug-in directly to get the factory
- return JptDbPlugin.getConnectionProfileFactory();
- }
-
- // broaden access a bit
- Shell getShell_() {
- return this.getShell();
- }
-
- /**
- * This dialog shows the list of possible connection names and lets the user
- * the option to filter them using a search field.
- */
- protected class ConnectionSelectionDialog extends FilteredItemsSelectionDialog {
-
- /**
- * Creates a new <code>MappingSelectionDialog</code>.
- */
- protected ConnectionSelectionDialog() {
- super(JdbcConnectionPropertiesComposite.this.getShell_(), false);
- this.setMessage(JptUiPersistence2_0Messages.JdbcConnectionPropertiesComposite_ConnectionDialog_Message);
- this.setTitle(JptUiPersistence2_0Messages.JdbcConnectionPropertiesComposite_ConnectionDialog_Title);
- this.setListLabelProvider(this.buildLabelProvider());
- this.setDetailsLabelProvider(this.buildLabelProvider());
- }
-
- protected ILabelProvider buildLabelProvider() {
- return new LabelProvider() {
- @Override
- public Image getImage(Object element) {
- return null;
- }
-
- @Override
- public String getText(Object element) {
- return (element == null) ? "" : element.toString();
- }
- };
- }
-
- @Override
- protected Control createExtendedContentArea(Composite parent) {
- return null;
- }
-
- @Override
- protected ItemsFilter createFilter() {
- return new ConnectionItemsFilter();
- }
-
- @Override
- protected void fillContentProvider(AbstractContentProvider provider,
- ItemsFilter itemsFilter,
- IProgressMonitor monitor) throws CoreException {
-
- monitor.beginTask(null, -1);
-
- try {
- // Add the connection names to the dialog
- for (String name : this.getConnectionProfileNames()) {
- provider.add(name, itemsFilter);
- }
- }
- finally {
- monitor.done();
- }
- }
-
- private Iterable<String> getConnectionProfileNames() {
- return JdbcConnectionPropertiesComposite.this.getConnectionProfileFactory().getConnectionProfileNames();
- }
-
- @Override
- protected IDialogSettings getDialogSettings() {
-
- IDialogSettings dialogSettings = JptUiPlugin.instance().getDialogSettings();
- IDialogSettings settings = dialogSettings.getSection(DIALOG_SETTINGS);
-
- if (settings == null) {
- settings = dialogSettings.addNewSection(DIALOG_SETTINGS);
- }
- return settings;
- }
-
- @Override
- public String getElementName(Object object) {
- return object.toString();
- }
-
- @Override
- protected Comparator<String> getItemsComparator() {
- return new Comparator<String>() {
- public int compare(String item1, String item2) {
- return item1.compareTo(item2);
- }
- };
- }
-
- @Override
- protected IStatus validateItem(Object item) {
-
- if (item == null) {
- return new Status(IStatus.ERROR, JptUiPlugin.PLUGIN_ID, IStatus.ERROR, "", null);
- }
- return Status.OK_STATUS;
- }
-
- /**
- * Create the filter responsible to remove any connection name based on
- * the pattern entered in the text field.
- */
- private class ConnectionItemsFilter extends ItemsFilter {
-
- /**
- * Creates a new <code>ConnectionItemsFilter</code>.
- */
- ConnectionItemsFilter() {
-
- super();
-
- // Make sure that if the pattern is empty, we specify * in order
- // to show all the mapping types
- if (StringTools.stringIsEmpty(getPattern())) {
- patternMatcher.setPattern("*");
- }
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- public boolean isConsistentItem(Object item) {
- return true;
- }
-
- /*
- * (non-Javadoc)
- */
- @Override
- public boolean matchItem(Object item) {
- return matches(item.toString());
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/JdbcDriverComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/JdbcDriverComposite.java
deleted file mode 100644
index 4ed8c46dbf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/JdbcDriverComposite.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2011 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.ui.internal.jpa2.persistence.connection;
-
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jpt.common.ui.internal.widgets.ClassChooserPane;
-import org.eclipse.jpt.common.ui.internal.widgets.Pane;
-import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
-import org.eclipse.jpt.ui.internal.jpa2.persistence.JptUiPersistence2_0Messages;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * JdbcDriverComposite
- */
-public class JdbcDriverComposite extends Pane<JpaConnection2_0>
-{
- /**
- * Creates a new <code>JdbcDriverComposite</code>.
- *
- * @param parentPane The parent pane of this one
- * @param parent The parent container
- */
- public JdbcDriverComposite(Pane<? extends JpaConnection2_0> parentPane,
- Composite parent) {
-
- super(parentPane, parent);
- }
-
- private ClassChooserPane<JpaConnection2_0> initializeClassChooser(Composite container) {
-
- return new ClassChooserPane<JpaConnection2_0>(this, container) {
-
- @Override
- protected WritablePropertyValueModel<String> buildTextHolder() {
- return new PropertyAspectAdapter<JpaConnection2_0, String>(
- this.getSubjectHolder(), JpaConnection2_0.DRIVER_PROPERTY) {
- @Override
- protected String buildValue_() {
- return this.subject.getDriver();
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (value.length() == 0) {
- value = null;
- }
- this.subject.setDriver(value);
- }
- };
- }
-
- @Override
- protected String getClassName() {
- return this.getSubject().getDriver();
- }
-
- @Override
- protected String getLabelText() {
- return JptUiPersistence2_0Messages.JdbcConnectionPropertiesComposite_driverLabel;
- }
-
- @Override
- protected IJavaProject getJavaProject() {
- return getSubject().getJpaProject().getJavaProject();
- }
-
- @Override
- protected void setClassName(String className) {
- this.getSubject().setDriver(className);
- }
-
- @Override
- protected boolean allowTypeCreation() {
- //Does not make sense to allow the user to create a new Driver class
- return false;
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
- this.initializeClassChooser(container);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/JdbcPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/JdbcPropertiesComposite.java
deleted file mode 100644
index e6344b4194..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/JdbcPropertiesComposite.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.ui.internal.jpa2.persistence.connection;
-
-import org.eclipse.jpt.common.ui.internal.util.PaneEnabler;
-import org.eclipse.jpt.common.ui.internal.widgets.Pane;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
-import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
-import org.eclipse.jpt.ui.internal.jpa2.persistence.JptUiPersistence2_0Messages;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * JdbcPropertiesComposite
- */
-public class JdbcPropertiesComposite extends Pane<JpaConnection2_0>
-{
- public JdbcPropertiesComposite(Pane<JpaConnection2_0> parentComposite, Composite parent) {
-
- super(parentComposite, parent);
- }
-
- private PropertyValueModel<Boolean> buildPaneEnablerHolder() {
- return new TransformationPropertyValueModel<PersistenceUnitTransactionType, Boolean>(buildTransactionTypeHolder()) {
- @Override
- protected Boolean transform(PersistenceUnitTransactionType value) {
- return value == PersistenceUnitTransactionType.RESOURCE_LOCAL;
- }
- };
- }
-
- private PropertyValueModel<PersistenceUnitTransactionType> buildTransactionTypeHolder() {
- return new PropertyAspectAdapter<PersistenceUnit, PersistenceUnitTransactionType>(
- buildPersistenceUnitHolder(),
- PersistenceUnit.SPECIFIED_TRANSACTION_TYPE_PROPERTY,
- PersistenceUnit.DEFAULT_TRANSACTION_TYPE_PROPERTY) {
- @Override
- protected PersistenceUnitTransactionType buildValue_() {
- return this.subject.getTransactionType();
- }
- };
- }
-
- private PropertyValueModel<PersistenceUnit> buildPersistenceUnitHolder() {
- return new PropertyAspectAdapter<JpaConnection2_0, PersistenceUnit>(getSubjectHolder()) {
- @Override
- protected PersistenceUnit buildValue_() {
- return this.subject.getPersistenceUnit();
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite container) {
-
- container = addTitledGroup(
- addSubPane(container, 10),
- JptUiPersistence2_0Messages.JdbcPropertiesComposite_JdbcConnectionProperties_GroupBox
- );
-
- new JdbcConnectionPropertiesComposite(this, container);
-
- this.installPaneEnabler();
- }
-
- private void installPaneEnabler() {
- new PaneEnabler(buildPaneEnablerHolder(), this);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/TransactionTypeComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/TransactionTypeComposite.java
deleted file mode 100644
index 93e4d4e59a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/connection/TransactionTypeComposite.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.ui.internal.jpa2.persistence.connection;
-
-import java.util.Collection;
-
-import org.eclipse.jpt.common.ui.internal.widgets.EnumFormComboViewer;
-import org.eclipse.jpt.common.ui.internal.widgets.Pane;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
-import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.jpa2.persistence.JptUiPersistence2_0Messages;
-import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * TransactionTypeComposite
- */
-public class TransactionTypeComposite extends Pane<JpaConnection2_0>
-{
- /**
- * Creates a new <code>TransactionTypeComposite</code>.
- *
- * @param parentController
- * The parent container of this one
- * @param parent
- * The parent container
- */
- public TransactionTypeComposite(
- Pane<? extends JpaConnection2_0> parentComposite,
- Composite parent) {
-
- super( parentComposite, parent);
- }
-
- private EnumFormComboViewer<PersistenceUnit, PersistenceUnitTransactionType> buildTransactionTypeCombo(Composite container) {
-
- return new EnumFormComboViewer<PersistenceUnit, PersistenceUnitTransactionType>(this,
- this.buildPersistenceUnitHolder(),
- container) {
- @Override
- protected void addPropertyNames(Collection<String> propertyNames) {
- super.addPropertyNames(propertyNames);
- propertyNames.add(PersistenceUnit.SPECIFIED_TRANSACTION_TYPE_PROPERTY);
- propertyNames.add(PersistenceUnit.DEFAULT_TRANSACTION_TYPE_PROPERTY);
- }
-
- @Override
- protected PersistenceUnitTransactionType[] getChoices() {
- return PersistenceUnitTransactionType.values();
- }
-
- @Override
- protected PersistenceUnitTransactionType getDefaultValue() {
- return this.getSubject().getDefaultTransactionType();
- }
-
- @Override
- protected String displayString(PersistenceUnitTransactionType value) {
- return this.buildDisplayString(JptUiPersistence2_0Messages.class, TransactionTypeComposite.this, value);
- }
-
- @Override
- protected PersistenceUnitTransactionType getValue() {
- return this.getSubject().getSpecifiedTransactionType();
- }
-
- @Override
- protected void setValue(PersistenceUnitTransactionType value) {
- this.getSubject().setSpecifiedTransactionType(value);
-
- if (value == PersistenceUnitTransactionType.RESOURCE_LOCAL) {
- clearJTAProperties();
- }
- else {
- clearResourceLocalProperties();
- }
- }
- };
- }
-
- private PropertyValueModel<PersistenceUnit> buildPersistenceUnitHolder() {
- return new PropertyAspectAdapter<JpaConnection2_0, PersistenceUnit>(this.getSubjectHolder()) {
- @Override
- protected PersistenceUnit buildValue_() {
- return this.subject.getPersistenceUnit();
- }
- };
- }
-
- private void clearJTAProperties() {
- this.getSubject().getPersistenceUnit().setJtaDataSource(null);
- }
-
- private void clearResourceLocalProperties() {
- JpaConnection2_0 connection = this.getSubject();
- connection.getPersistenceUnit().setNonJtaDataSource(null);
- connection.setDriver(null);
- connection.setUrl(null);
- connection.setUser(null);
- connection.setPassword(null);
- }
-
- @Override
- protected void initializeLayout( Composite container) {
-
- this.addLabeledComposite(
- container,
- JptUiPersistence2_0Messages.TransactionTypeComposite_transactionTypeLabel,
- this.buildTransactionTypeCombo( container),
- JpaHelpContextIds.PERSISTENCE_XML_CONNECTION // TODO - Review for JPA 2.0
- );
- }
-}

Back to the top