diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org')
90 files changed, 0 insertions, 9929 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/EclipseLinkJpaUiFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/EclipseLinkJpaUiFactory.java deleted file mode 100644 index 102380be55..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/EclipseLinkJpaUiFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui; - -import org.eclipse.jpt.ui.JpaUiFactory; - -/** - * - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface EclipseLinkJpaUiFactory extends JpaUiFactory -{ - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/JptEclipseLinkUiPlugin.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/JptEclipseLinkUiPlugin.java deleted file mode 100644 index 63e2d93f19..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/JptEclipseLinkUiPlugin.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - * - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class JptEclipseLinkUiPlugin extends AbstractUIPlugin -{ - private static JptEclipseLinkUiPlugin INSTANCE; - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.jpt.eclipselink.ui"; - - // The shared instance - private static JptEclipseLinkUiPlugin plugin; - - // ********** constructors ********** - public JptEclipseLinkUiPlugin() { - super(); - INSTANCE = this; - } - - /** - * Returns the singleton Plugin - */ - public static JptEclipseLinkUiPlugin getPlugin() { - return INSTANCE; - } - - public static void log(IStatus status) { - INSTANCE.getLog().log(status); - } - - public static void log(String msg) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null)); - } - - public static void log(Throwable throwable) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable)); - } - - // ********** Image API ********** - /** - * This gets a .gif from the icons folder. - */ - public static ImageDescriptor getImageDescriptor(String key) { - if (! key.startsWith("icons/")) { - key = "icons/" + key; - } - if (! key.endsWith(".gif")) { - key = key + ".gif"; - } - return imageDescriptorFromPlugin(PLUGIN_ID, key); - } - - /** - * This returns an image for a .gif from the icons folder - */ - public static Image getImage(String key) { - ImageDescriptor desc = getImageDescriptor(key); - return (desc == null) ? null : desc.createImage(); - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static JptEclipseLinkUiPlugin getDefault() { - return plugin; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkHelpContextIds.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkHelpContextIds.java deleted file mode 100644 index 3f014db207..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkHelpContextIds.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal; - -import org.eclipse.jpt.eclipselink.ui.JptEclipseLinkUiPlugin; - -/** - * Help context ids for the Dali EclipseLink UI. - * <p> - * This interface contains constants only; it is not intended to be - * implemented. - * </p> - */ -@SuppressWarnings("nls") -public interface EclipseLinkHelpContextIds { - - //ContextID prefix - public static final String PREFIX = JptEclipseLinkUiPlugin.PLUGIN_ID + "."; - - //Persistent Type composites - public static final String CACHING_CACHE_TYPE = PREFIX + "caching_cacheType"; - public static final String CACHING_SHARED = PREFIX + "caching_shared"; - public static final String CACHING_ALWAYS_REFRESH = PREFIX + "caching_alwaysRefresh"; - public static final String CACHING_REFRESH_ONLY_IF_NEWER = PREFIX + "caching_refreshOnlyIfNewer"; - public static final String CACHING_DISABLE_HITS = PREFIX + "caching_disableHits"; - public static final String CACHING_CACHE_COORDINATION_TYPE = PREFIX + "caching_cacheCoordinationType"; - - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkJpaUiFactoryImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkJpaUiFactoryImpl.java deleted file mode 100644 index ee35381ba1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkJpaUiFactoryImpl.java +++ /dev/null @@ -1,170 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal; - -import java.util.ArrayList; -import java.util.ListIterator; -import org.eclipse.jpt.core.context.java.JavaEntity; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.eclipselink.core.internal.context.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.internal.context.caching.Caching; -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.core.internal.context.customization.Customization; -import org.eclipse.jpt.eclipselink.core.internal.context.logging.Logging; -import org.eclipse.jpt.eclipselink.core.internal.context.options.Options; -import org.eclipse.jpt.eclipselink.core.internal.context.schema.generation.SchemaGeneration; -import org.eclipse.jpt.eclipselink.ui.EclipseLinkJpaUiFactory; -import org.eclipse.jpt.eclipselink.ui.internal.caching.PersistenceXmlCachingTab; -import org.eclipse.jpt.eclipselink.ui.internal.connection.PersistenceXmlConnectionTab; -import org.eclipse.jpt.eclipselink.ui.internal.customization.PersistenceXmlCustomizationTab; -import org.eclipse.jpt.eclipselink.ui.internal.java.details.EclipseLinkJavaEntityComposite; -import org.eclipse.jpt.eclipselink.ui.internal.logging.PersistenceXmlLoggingTab; -import org.eclipse.jpt.eclipselink.ui.internal.options.PersistenceXmlOptionsTab; -import org.eclipse.jpt.eclipselink.ui.internal.schema.generation.PersistenceXmlSchemaGenerationTab; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaComposite; -import org.eclipse.jpt.ui.details.JpaPageComposite; -import org.eclipse.jpt.ui.internal.BaseJpaUiFactory; -import org.eclipse.jpt.ui.internal.persistence.details.PersistenceUnitGeneralComposite; -import org.eclipse.jpt.ui.internal.persistence.details.PersistenceUnitPropertiesComposite; -import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * EclipseLinkJpaUiFactory - */ -public class EclipseLinkJpaUiFactoryImpl extends BaseJpaUiFactory implements EclipseLinkJpaUiFactory -{ - public EclipseLinkJpaUiFactoryImpl() { - super(); - } - - @Override - public JpaComposite createJavaEntityComposite( - PropertyValueModel<JavaEntity> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - return new EclipseLinkJavaEntityComposite(subjectHolder, parent, widgetFactory); - } - - @Override - public ListIterator<JpaPageComposite> createPersistenceUnitComposites( - PropertyValueModel<PersistenceUnit> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - PropertyValueModel<EclipseLinkPersistenceUnit> eclipseLinkPersistenceUnitHolder = - this.buildEclipseLinkPersistenceUnitHolder(subjectHolder); - ArrayList<JpaPageComposite> pages = - new ArrayList<JpaPageComposite>(8); - - pages.add(new PersistenceUnitGeneralComposite(subjectHolder, parent, widgetFactory)); - - PropertyValueModel<Connection> connectionHolder = - this.buildConnectionHolder(eclipseLinkPersistenceUnitHolder); - pages.add(new PersistenceXmlConnectionTab(connectionHolder, parent, widgetFactory)); - - PropertyValueModel<Customization> customizationHolder = - this.buildCustomizationHolder(eclipseLinkPersistenceUnitHolder); - pages.add(new PersistenceXmlCustomizationTab(customizationHolder, parent, widgetFactory)); - - PropertyValueModel<Caching> cachingHolder = - this.buildCachingHolder(eclipseLinkPersistenceUnitHolder); - pages.add(new PersistenceXmlCachingTab(cachingHolder, parent, widgetFactory)); - - PropertyValueModel<Logging> loggingHolder = - this.buildLoggingHolder(eclipseLinkPersistenceUnitHolder); - pages.add(new PersistenceXmlLoggingTab(loggingHolder, parent, widgetFactory)); - - PropertyValueModel<Options> optionsHolder = - this.buildOptionsHolder(eclipseLinkPersistenceUnitHolder); - pages.add(new PersistenceXmlOptionsTab(optionsHolder, parent, widgetFactory)); - - PropertyValueModel<SchemaGeneration> schemaGenHolder = - this.buildSchemaGenerationHolder(eclipseLinkPersistenceUnitHolder); - pages.add(new PersistenceXmlSchemaGenerationTab(schemaGenHolder, parent, widgetFactory)); - - pages.add(new PersistenceUnitPropertiesComposite(subjectHolder, parent, widgetFactory)); - - return pages.listIterator(); - } - - private PropertyValueModel<Connection> buildConnectionHolder( - PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder) { - return new TransformationPropertyValueModel<EclipseLinkPersistenceUnit, Connection>(subjectHolder) { - @Override - protected Connection transform_(EclipseLinkPersistenceUnit value) { - return value.getConnection(); - } - }; - } - - private PropertyValueModel<Options> buildOptionsHolder( - PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder) { - return new TransformationPropertyValueModel<EclipseLinkPersistenceUnit, Options>(subjectHolder) { - @Override - protected Options transform_(EclipseLinkPersistenceUnit value) { - return value.getOptions(); - } - }; - } - - private PropertyValueModel<Logging> buildLoggingHolder( - PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder) { - return new TransformationPropertyValueModel<EclipseLinkPersistenceUnit, Logging>(subjectHolder) { - @Override - protected Logging transform_(EclipseLinkPersistenceUnit value) { - return value.getLogging(); - } - }; - } - - private PropertyValueModel<Customization> buildCustomizationHolder( - PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder) { - return new TransformationPropertyValueModel<EclipseLinkPersistenceUnit, Customization>(subjectHolder) { - @Override - protected Customization transform_(EclipseLinkPersistenceUnit value) { - return value.getCustomization(); - } - }; - } - - private PropertyValueModel<Caching> buildCachingHolder( - PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder) { - return new TransformationPropertyValueModel<EclipseLinkPersistenceUnit, Caching>(subjectHolder) { - @Override - protected Caching transform_(EclipseLinkPersistenceUnit value) { - return value.getCaching(); - } - }; - } - - private PropertyValueModel<SchemaGeneration> buildSchemaGenerationHolder( - PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder) { - return new TransformationPropertyValueModel<EclipseLinkPersistenceUnit, SchemaGeneration>(subjectHolder) { - @Override - protected SchemaGeneration transform_(EclipseLinkPersistenceUnit value) { - return value.getSchemaGeneration(); - } - }; - } - - private PropertyValueModel<EclipseLinkPersistenceUnit> buildEclipseLinkPersistenceUnitHolder( - PropertyValueModel<PersistenceUnit> subjectHolder) { - return new TransformationPropertyValueModel<PersistenceUnit, EclipseLinkPersistenceUnit>(subjectHolder) { - @Override - protected EclipseLinkPersistenceUnit transform_(PersistenceUnit value) { - return (EclipseLinkPersistenceUnit) value; - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java deleted file mode 100644 index c9fd5348bc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java +++ /dev/null @@ -1,284 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2007, 2008 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.eclipselink.ui.internal; - -/** - * EclipseLinkUiMessages - */ -import org.eclipse.osgi.util.NLS; - -public class EclipseLinkUiMessages extends NLS -{ - private static final String BUNDLE_NAME = "eclipselink_ui"; //$NON-NLS-1$ - - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, EclipseLinkUiMessages.class); - } - - public static String Boolean_True; - public static String Boolean_False; - - public static String DefaultWithoutValue; - public static String DefaultWithValue; - - public static String PersistenceXmlTabFolder_defaultEmpty; - public static String PersistenceXmlTabFolder_defaultWithOneParam; - - public static String PersistenceXmlGeneralTab_name; - public static String PersistenceXmlGeneralTab_provider; - public static String PersistenceXmlGeneralTab_browse; - public static String PersistenceXmlGeneralTab_description; - - // Connection - public static String PersistenceXmlConnectionTab_title; - public static String PersistenceXmlConnectionTab_sectionTitle; - public static String PersistenceXmlConnectionTab_sectionDescription; - public static String PersistenceXmlConnectionTab_defaultWithOneParam; - public static String PersistenceXmlConnectionTab_defaultEmpty; - - public static String PersistenceXmlConnectionTab_transactionTypeLabel; - - public static String ConnectionPropertiesComposite_Database_GroupBox; - - public static String JdbcPropertiesComposite_EclipseLinkConnectionPool_GroupBox; - - public static String JdbcConnectionPropertiesComposite_ConnectionDialog_Message; - public static String JdbcConnectionPropertiesComposite_ConnectionDialog_Title; - - public static String TransactionTypeComposite_jta; - public static String TransactionTypeComposite_resource_local; - - public static String PersistenceXmlConnectionTab_nativeSqlLabel; - public static String PersistenceXmlConnectionTab_nativeSqlLabelDefault; - - public static String PersistenceXmlConnectionTab_batchWritingLabel; - - public static String BatchWritingComposite_none; - public static String BatchWritingComposite_jdbc; - public static String BatchWritingComposite_buffered; - public static String BatchWritingComposite_oracle_jdbc; - - public static String PersistenceXmlConnectionTab_cacheStatementsLabel; - - public static String PersistenceXmlConnectionTab_jtaDataSourceLabel; - public static String PersistenceXmlConnectionTab_nonJtaDataSourceLabel; - - public static String PersistenceXmlConnectionTab_driverLabel; - public static String PersistenceXmlConnectionTab_urlLabel; - public static String PersistenceXmlConnectionTab_userLabel; - public static String PersistenceXmlConnectionTab_passwordLabel; - public static String PersistenceXmlConnectionTab_bindParametersLabel; - public static String PersistenceXmlConnectionTab_bindParametersLabelDefault; - - public static String PersistenceXmlConnectionTab_readConnectionsSharedLabel; - public static String PersistenceXmlConnectionTab_readConnectionsSharedLabelDefault; - public static String PersistenceXmlConnectionTab_readConnectionsSectionTitle; - public static String PersistenceXmlConnectionTab_readConnectionsMinLabel; - public static String PersistenceXmlConnectionTab_readConnectionsMaxLabel; - public static String PersistenceXmlConnectionTab_writeConnectionsSectionTitle; - public static String PersistenceXmlConnectionTab_writeConnectionsMinLabel; - public static String PersistenceXmlConnectionTab_writeConnectionsMaxLabel; - - // SchemaGeneration - public static String PersistenceXmlSchemaGenerationTab_title; - public static String PersistenceXmlSchemaGenerationTab_sectionTitle; - public static String PersistenceXmlSchemaGenerationTab_sectionDescription; - public static String PersistenceXmlSchemaGenerationTab_defaultWithOneParam; - public static String PersistenceXmlSchemaGenerationTab_defaultEmpty; - - public static String PersistenceXmlSchemaGenerationTab_ddlGenerationTypeLabel; - public static String PersistenceXmlSchemaGenerationTab_outputModeLabel; - - public static String PersistenceXmlSchemaGenerationTab_createDdlFileNameLabel; - public static String PersistenceXmlSchemaGenerationTab_dropDdlFileNameLabel; - - public static String OutputModeComposite_both; - public static String OutputModeComposite_sql_script; - public static String OutputModeComposite_database; - - public static String DdlGenerationTypeComposite_none; - public static String DdlGenerationTypeComposite_create_tables; - public static String DdlGenerationTypeComposite_drop_and_create_tables; - - public static String PersistenceXmlSchemaGenerationTab_ddlGenerationLocationLabel; - - public static String DdlGenerationLocationComposite_dialogTitle; - public static String DdlGenerationLocationComposite_dialogMessage; - - // Caching - public static String PersistenceXmlCachingTab_title; - public static String PersistenceXmlCachingTab_sectionTitle; - public static String PersistenceXmlCachingTab_sectionDescription; - - public static String PersistenceXmlCachingTab_defaultCacheTypeLabel; - public static String PersistenceXmlCachingTab_cacheTypeLabel; - - public static String PersistenceXmlCachingTab_defaultSharedCacheLabel; - public static String PersistenceXmlCachingTab_sharedCacheLabel; - - public static String PersistenceXmlCachingTab_defaultSharedCacheDefaultLabel; - public static String PersistenceXmlCachingTab_sharedCacheDefaultLabel; - - public static String CacheSizeComposite_cacheSize; - - public static String CacheTypeComposite_full; - public static String CacheTypeComposite_hard_weak; - public static String CacheTypeComposite_none; - public static String CacheTypeComposite_soft; - public static String CacheTypeComposite_soft_weak; - public static String CacheTypeComposite_weak; - - public static String DefaultCacheSizeComposite_defaultCacheSize; - - public static String DefaultCacheTypeComposite_full; - public static String DefaultCacheTypeComposite_hard_weak; - public static String DefaultCacheTypeComposite_none; - public static String DefaultCacheTypeComposite_soft; - public static String DefaultCacheTypeComposite_soft_weak; - public static String DefaultCacheTypeComposite_weak; - - public static String EntityDialog_selectEntity; - public static String EntityDialog_name; - - public static String CachingEntityListComposite_groupTitle; - public static String CachingEntityListComposite_editButton; - - public static String CachingEntityListComposite_dialogMessage; - public static String CachingEntityListComposite_dialogTitle; - - // Customization - public static String PersistenceXmlCustomizationTab_title; - public static String PersistenceXmlCustomizationTab_sectionTitle; - public static String PersistenceXmlCustomizationTab_sectionDescription; - - public static String PersistenceXmlCustomizationTab_throwExceptionsLabelDefault; - public static String PersistenceXmlCustomizationTab_throwExceptionsLabel; - - public static String PersistenceXmlCustomizationTab_weavingLabel; - - public static String PersistenceXmlCustomizationTab_weavingLazyLabelDefault; - public static String PersistenceXmlCustomizationTab_weavingLazyLabel; - - public static String PersistenceXmlCustomizationTab_weavingChangeTrackingLabelDefault; - public static String PersistenceXmlCustomizationTab_weavingChangeTrackingLabel; - - public static String PersistenceXmlCustomizationTab_weavingFetchGroupsLabelDefault; - public static String PersistenceXmlCustomizationTab_weavingFetchGroupsLabel; - - public static String WeavingComposite_true_; - public static String WeavingComposite_false_; - public static String WeavingComposite_static_; - - public static String CustomizationEntityListComposite_groupTitle; - public static String CustomizationEntityListComposite_editButton; - - public static String CustomizationEntityListComposite_dialogMessage; - public static String CustomizationEntityListComposite_dialogTitle; - - public static String PersistenceXmlCustomizationTab_customizerLabel; - public static String PersistenceXmlCustomizationTab_sessionCustomizerLabel; - - // Logging - public static String PersistenceXmlLoggingTab_title; - public static String PersistenceXmlLoggingTab_sectionTitle; - public static String PersistenceXmlLoggingTab_sectionDescription; - public static String PersistenceXmlLoggingTab_defaultWithOneParam; - public static String PersistenceXmlLoggingTab_defaultEmpty; - - public static String PersistenceXmlLoggingTab_loggingLevelLabel; - - public static String LoggingLevelComposite_off; - public static String LoggingLevelComposite_severe; - public static String LoggingLevelComposite_warning; - public static String LoggingLevelComposite_info; - public static String LoggingLevelComposite_config; - public static String LoggingLevelComposite_fine; - public static String LoggingLevelComposite_finer; - public static String LoggingLevelComposite_finest; - - public static String PersistenceXmlLoggingTab_loggerLabel; - - public static String LoggerComposite_default_logger; - public static String LoggerComposite_java_logger; - public static String LoggerComposite_server_logger; - - public static String PersistenceXmlLoggingTab_timestampLabel; - public static String PersistenceXmlLoggingTab_timestampLabelDefault; - public static String PersistenceXmlLoggingTab_threadLabel; - public static String PersistenceXmlLoggingTab_threadLabelDefault; - public static String PersistenceXmlLoggingTab_sessionLabel; - public static String PersistenceXmlLoggingTab_sessionLabelDefault; - public static String PersistenceXmlLoggingTab_exceptionsLabel; - public static String PersistenceXmlLoggingTab_exceptionsLabelDefault; - - public static String PersistenceXmlLoggingTab_loggersLabel; - public static String PersistenceXmlLoggingTab_loggingFileLabel; - public static String PersistenceXmlLoggingTab_loggingFileLabelDefault; - - public static String LoggingFileLocationComposite_dialogTitle; - public static String LoggingFileLocationComposite_dialogMessage; - - // Session Options - public static String PersistenceXmlOptionsTab_title; - public static String PersistenceXmlOptionsTab_sectionTitle; - public static String PersistenceXmlOptionsTab_sectionDescription; - public static String PersistenceXmlOptionsTab_defaultWithOneParam; - public static String PersistenceXmlOptionsTab_defaultEmpty; - - public static String PersistenceXmlOptionsTab_sessionName; - public static String PersistenceXmlOptionsTab_sessionsXml; - - public static String PersistenceXmlOptionsTab_includeDescriptorQueriesLabel; - public static String PersistenceXmlOptionsTab_includeDescriptorQueriesLabelDefault; - - public static String PersistenceXmlOptionsTab_eventListenerLabel; - public static String PersistenceXmlOptionsTab_targetDatabaseLabel; - - public static String TargetDatabaseComposite_attunity; - public static String TargetDatabaseComposite_auto; - public static String TargetDatabaseComposite_cloudscape; - public static String TargetDatabaseComposite_database; - public static String TargetDatabaseComposite_db2; - public static String TargetDatabaseComposite_db2mainframe; - public static String TargetDatabaseComposite_dbase; - public static String TargetDatabaseComposite_derby; - public static String TargetDatabaseComposite_hsql; - public static String TargetDatabaseComposite_informix; - public static String TargetDatabaseComposite_javadb; - public static String TargetDatabaseComposite_mysqlplatform; - public static String TargetDatabaseComposite_oracle; - public static String TargetDatabaseComposite_pointbase; - public static String TargetDatabaseComposite_postgresql; - public static String TargetDatabaseComposite_sqlanywhere; - public static String TargetDatabaseComposite_sqlserver; - public static String TargetDatabaseComposite_sybase; - public static String TargetDatabaseComposite_timesten; - - public static String PersistenceXmlOptionsTab_targetServerLabel; - - public static String TargetServerComposite_none; - public static String TargetServerComposite_oc4j; - public static String TargetServerComposite_sunas9; - public static String TargetServerComposite_websphere; - public static String TargetServerComposite_websphere_6_1; - public static String TargetServerComposite_weblogic; - public static String TargetServerComposite_weblogic_9; - public static String TargetServerComposite_weblogic_10; - public static String TargetServerComposite_jboss; - - // DDLGeneration - public static String EclipseLinkDDLGeneratorUi_generatingDDLWarningTitle; - public static String EclipseLinkDDLGeneratorUi_generatingDDLWarningMessage; - - private EclipseLinkUiMessages() { - throw new UnsupportedOperationException(); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EntityDialog.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EntityDialog.java deleted file mode 100644 index 3b0a649ed4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EntityDialog.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.core.context.Entity; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * EntityDialog - */ -public class EntityDialog extends Dialog -{ - private Entity entity; - - private JpaProject jpaProject; - - protected Combo nameCombo; - - private String selectedName; - - public EntityDialog(Shell parent, JpaProject jpaProject) { - super(parent); - this.jpaProject = jpaProject; - } - - public EntityDialog(Shell parent, Entity entity, JpaProject jpaProject) { - super(parent); - this.entity = entity; - this.jpaProject = jpaProject; - } - - @Override - protected void configureShell(Shell shell) { - super.configureShell(shell); - shell.setText(getTitle()); - } - - protected String getTitle() { - return EclipseLinkUiMessages.EntityDialog_selectEntity; - } - - @Override - protected Control createDialogArea(Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - GridLayout gridLayout = (GridLayout) composite.getLayout(); - gridLayout.numColumns = 2; - - Label nameLabel = new Label(composite, SWT.LEFT); - nameLabel.setText(EclipseLinkUiMessages.EntityDialog_name); - GridData gridData = new GridData(); - nameLabel.setLayoutData(gridData); - - this.nameCombo = new Combo(composite, SWT.LEFT); - gridData = new GridData(); - gridData.grabExcessHorizontalSpace = true; - gridData.horizontalAlignment = SWT.FILL; - this.nameCombo.setLayoutData(gridData); - - populateNameCombo(); - return composite; - } - - protected void populateNameCombo() { - if (selectedName != null) { - this.nameCombo.setText(selectedName); - } - } - - protected Combo getNameCombo() { - return this.nameCombo; - } - - protected Entity getEntity() { - return this.entity; - } - - public String getSelectedName() { - return this.selectedName; - } - - public void setSelectedName(String selectedName) { - this.selectedName = selectedName; - } - - @Override - public boolean close() { - this.selectedName = this.nameCombo.getText(); - return super.close(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/CacheSizeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/CacheSizeComposite.java deleted file mode 100644 index f33a87a30a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/CacheSizeComposite.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.caching; - -import org.eclipse.jpt.eclipselink.core.internal.context.caching.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.LabeledControlUpdater; -import org.eclipse.jpt.ui.internal.util.LabeledLabel; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -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.osgi.util.NLS; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Spinner; - -/** - * CacheSizeComposite - */ -@SuppressWarnings("nls") -public class CacheSizeComposite extends AbstractPane<EntityCacheProperties> -{ - /** - * Creates a new <code>CacheTypeComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public CacheSizeComposite(AbstractPane<EntityCacheProperties> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Integer> buildCacheSizeHolder() { - return new PropertyAspectAdapter<EntityCacheProperties, Integer>(getSubjectHolder(), EntityCacheProperties.CACHE_SIZE_PROPERTY) { - @Override - protected Integer buildValue_() { - Integer value = subject.getCacheSize(); - if (value == null) { - value = -1; - } - return value; - } - - @Override - protected void setValue_(Integer value) { - if (value == -1) { - value = null; - } - subject.setCacheSize(value); - } - }; - } - - private PropertyValueModel<Caching> buildCachingHolder() { - return new TransformationPropertyValueModel<EntityCacheProperties, Caching>(getSubjectHolder()) { - @Override - protected Caching transform_(EntityCacheProperties value) { - return value.getCaching(); - } - }; - } - - private PropertyValueModel<Integer> buildDefaultCacheSizeHolder() { - return new PropertyAspectAdapter<Caching, Integer>(buildCachingHolder(), Caching.CACHE_SIZE_DEFAULT_PROPERTY) { - @Override - protected Integer buildValue_() { - Integer value = subject.getCacheSizeDefault(); - if (value == null) { - value = subject.getDefaultCacheSizeDefault(); - } - return value; - } - }; - } - - private Control buildDefaultCacheSizeLabel(Composite container) { - - Label label = buildLabel( - container, - EclipseLinkUiMessages.DefaultWithoutValue - ); - - new LabeledControlUpdater( - new LabeledLabel(label), - buildDefaultCacheSizeLabelHolder() - ); - - return label; - } - - private PropertyValueModel<String> buildDefaultCacheSizeLabelHolder() { - - return new TransformationPropertyValueModel<Integer, String>(buildDefaultCacheSizeHolder()) { - - @Override - protected String transform(Integer value) { - - if (value != null) { - return NLS.bind(EclipseLinkUiMessages.DefaultWithValue, value); - } - - return ""; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - Spinner spinner = this.buildLabeledSpinner( - container, - EclipseLinkUiMessages.CacheSizeComposite_cacheSize, - this.buildCacheSizeHolder(), - -1, - -1, - Integer.MAX_VALUE, - this.buildDefaultCacheSizeLabel(container) - ); - - updateGridData(container, spinner); - } - - /** - * Changes the layout of the given container by changing which widget will - * grab the excess of horizontal space. By default, the center control grabs - * the excess space, we change it to be the right control. - * - * @param container The container containing the controls needing their - * <code>GridData</code> to be modified from the default values - * @param spinner The spinner that got created - */ - private void updateGridData(Composite container, Spinner spinner) { - - // It is possible the spinner's parent is not the container of the - // label, spinner and right control (a pane is sometimes required for - // painting the spinner's border) - Composite paneContainer = spinner.getParent(); - - while (container != paneContainer.getParent()) { - paneContainer = paneContainer.getParent(); - } - - Control[] controls = paneContainer.getChildren(); - - GridData gridData = new GridData(); - gridData.grabExcessHorizontalSpace = false; - gridData.horizontalAlignment = GridData.BEGINNING; - controls[1].setLayoutData(gridData); - - controls[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - removeAlignRight(controls[2]); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/CacheTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/CacheTypeComposite.java deleted file mode 100644 index 3eddefcb19..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/CacheTypeComposite.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.caching; - -import java.util.Collection; -import org.eclipse.jpt.eclipselink.core.internal.context.caching.CacheType; -import org.eclipse.jpt.eclipselink.core.internal.context.caching.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * CacheTypeComposite - */ -public class CacheTypeComposite extends AbstractPane<EntityCacheProperties> -{ - /** - * Creates a new <code>CacheTypeComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public CacheTypeComposite(AbstractPane<EntityCacheProperties> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildLabeledComposite( - container, - EclipseLinkUiMessages.PersistenceXmlCachingTab_cacheTypeLabel, - new CacheTypeCombo(container), - null // TODO IJpaHelpContextIds. - ); - } - - private class CacheTypeCombo extends EnumFormComboViewer<EntityCacheProperties, CacheType> { - - private CacheTypeCombo(Composite parent) { - super(CacheTypeComposite.this, parent); - } - - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(EntityCacheProperties.CACHE_TYPE_PROPERTY); - } - - private PropertyValueModel<Caching> buildCachingHolder() { - return new TransformationPropertyValueModel<EntityCacheProperties, Caching>(getSubjectHolder()) { - @Override - protected Caching transform_(EntityCacheProperties value) { - return value.getCaching(); - } - }; - } - - private PropertyValueModel<CacheType> buildDefaultCacheTypeHolder() { - return new PropertyAspectAdapter<Caching, CacheType>(buildCachingHolder(), Caching.CACHE_TYPE_DEFAULT_PROPERTY) { - @Override - protected CacheType buildValue_() { - CacheType cacheType = subject.getCacheTypeDefault(); - if (cacheType == null) { - cacheType = subject.getDefaultCacheTypeDefault(); - } - return cacheType; - } - }; - } - - private PropertyChangeListener buildDefaultCachingTypePropertyChangeListener() { - return new SWTPropertyChangeListenerWrapper( - buildDefaultCachingTypePropertyChangeListener_() - ); - } - - private PropertyChangeListener buildDefaultCachingTypePropertyChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - if ((e.getNewValue() != null) && !getCombo().isDisposed()) { - CacheTypeCombo.this.doPopulate(); - } - } - }; - } - - @Override - protected CacheType[] choices() { - return CacheType.values(); - } - - @Override - protected CacheType defaultValue() { - return this.subject().getDefaultCacheType(); - } - - @Override - protected String displayString(CacheType value) { - return buildDisplayString( - EclipseLinkUiMessages.class, - CacheTypeComposite.this, - value - ); - } - - @Override - protected void doPopulate() { - // This is required to allow the class loader to let the listener - // written above to access this method - super.doPopulate(); - } - - @Override - protected CacheType getValue() { - return this.subject().getCacheType(); - } - - @Override - protected void initialize() { - super.initialize(); - - PropertyValueModel<CacheType> defaultCacheTypeHolder = - buildDefaultCacheTypeHolder(); - - defaultCacheTypeHolder.addPropertyChangeListener( - PropertyValueModel.VALUE, - buildDefaultCachingTypePropertyChangeListener() - ); - } - - @Override - protected void setValue(CacheType value) { - this.subject().setCacheType(value); - } - - @Override - protected boolean sortChoices() { - return false; - } - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/DefaultCacheSizeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/DefaultCacheSizeComposite.java deleted file mode 100644 index e0df6d77cc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/DefaultCacheSizeComposite.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.caching; - -import org.eclipse.jpt.eclipselink.core.internal.context.caching.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.LabeledControlUpdater; -import org.eclipse.jpt.ui.internal.util.LabeledLabel; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -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.osgi.util.NLS; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Spinner; - -/** - * CacheSizeComposite - */ -@SuppressWarnings("nls") -public class DefaultCacheSizeComposite extends AbstractPane<Caching> -{ - /** - * Creates a new <code>CacheTypeComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public DefaultCacheSizeComposite(AbstractPane<Caching> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Integer> buildCacheSizeHolder() { - return new PropertyAspectAdapter<Caching, Integer>(getSubjectHolder(), Caching.CACHE_SIZE_DEFAULT_PROPERTY) { - @Override - protected Integer buildValue_() { - Integer value = subject.getCacheSizeDefault(); - - if (value == null) { - value = -1; - } - return value; - } - - @Override - protected void setValue_(Integer value) { - if (value == -1) { - value = null; - } - subject.setCacheSizeDefault(value); - } - }; - } - - private PropertyValueModel<Integer> buildDefaultCacheSizeHolder() { - return new PropertyAspectAdapter<Caching, Integer>(getSubjectHolder(), "") { - @Override - protected Integer buildValue_() { - return subject.getDefaultCacheSizeDefault(); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Integer.MIN_VALUE, newValue); - } - } - }; - } - - private Control buildDefaultCacheSizeLabel(Composite container) { - - Label label = buildLabel( - container, - EclipseLinkUiMessages.DefaultWithoutValue - ); - - new LabeledControlUpdater( - new LabeledLabel(label), - buildDefaultCacheSizeLabelHolder() - ); - - return label; - } - - private PropertyValueModel<String> buildDefaultCacheSizeLabelHolder() { - - return new TransformationPropertyValueModel<Integer, String>(buildDefaultCacheSizeHolder()) { - - @Override - protected String transform(Integer value) { - - if (value != null) { - return NLS.bind(EclipseLinkUiMessages.DefaultWithValue, value); - } - - return ""; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - Spinner spinner = this.buildLabeledSpinner( - container, - EclipseLinkUiMessages.DefaultCacheSizeComposite_defaultCacheSize, - this.buildCacheSizeHolder(), - -1, - -1, - Integer.MAX_VALUE, - this.buildDefaultCacheSizeLabel(container) - ); - - updateGridData(container, spinner); - } - - /** - * Changes the layout of the given container by changing which widget will - * grab the excess of horizontal space. By default, the center control grabs - * the excess space, we change it to be the right control. - * - * @param container The container containing the controls needing their - * <code>GridData</code> to be modified from the default values - * @param spinner The spinner that got created - */ - private void updateGridData(Composite container, Spinner spinner) { - - // It is possible the spinner's parent is not the container of the - // label, spinner and right control (a pane is sometimes required for - // painting the spinner's border) - Composite paneContainer = spinner.getParent(); - - while (container != paneContainer.getParent()) { - paneContainer = paneContainer.getParent(); - } - - Control[] controls = paneContainer.getChildren(); - - GridData gridData = new GridData(); - gridData.grabExcessHorizontalSpace = false; - gridData.horizontalAlignment = GridData.BEGINNING; - controls[1].setLayoutData(gridData); - - controls[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - removeAlignRight(controls[2]); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/DefaultCacheTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/DefaultCacheTypeComposite.java deleted file mode 100644 index ffba8d4f94..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/DefaultCacheTypeComposite.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.caching; - -import java.util.Collection; - -import org.eclipse.jpt.eclipselink.core.internal.context.caching.CacheType; -import org.eclipse.jpt.eclipselink.core.internal.context.caching.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.swt.widgets.Composite; - -/** - * DefaultCacheTypeComposite - */ -public class DefaultCacheTypeComposite extends AbstractFormPane<Caching> -{ - /** - * Creates a new <code>DefaultCacheTypeComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public DefaultCacheTypeComposite( - AbstractFormPane<? extends Caching> parentComposite, - Composite parent) { - - super( parentComposite, parent); - } - - private EnumFormComboViewer<Caching, CacheType> buildDefaultCacheTypeCombo(Composite container) { - return new EnumFormComboViewer<Caching, CacheType>(this, container) { - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(Caching.CACHE_TYPE_DEFAULT_PROPERTY); - } - - @Override - protected CacheType[] choices() { - return CacheType.values(); - } - - @Override - protected boolean sortChoices() { - return false; - } - - @Override - protected CacheType defaultValue() { - return subject().getDefaultCacheTypeDefault(); - } - - @Override - protected String displayString(CacheType value) { - return buildDisplayString(EclipseLinkUiMessages.class, DefaultCacheTypeComposite.this, value); - } - - @Override - protected CacheType getValue() { - return subject().getCacheTypeDefault(); - } - - @Override - protected void setValue(CacheType value) { - subject().setCacheTypeDefault(value); - } - }; - } - - @Override - protected void initializeLayout( Composite container) { - - this.buildLabeledComposite( - container, - EclipseLinkUiMessages.PersistenceXmlCachingTab_defaultCacheTypeLabel, - this.buildDefaultCacheTypeCombo( container), - null // TODO IJpaHelpContextIds. - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/DefaultSharedCacheComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/DefaultSharedCacheComposite.java deleted file mode 100644 index 0dbe7500bc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/DefaultSharedCacheComposite.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.caching; - -import org.eclipse.jpt.eclipselink.core.internal.context.caching.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * DefaultShareCacheComposite - */ -public class DefaultSharedCacheComposite extends AbstractFormPane<Caching> -{ - /** - * Creates a new <code>DefaultShareCacheComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public DefaultSharedCacheComposite( - AbstractFormPane<? extends Caching> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Boolean> buildDefaultSharedCacheHolder() { - return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.SHARED_CACHE_DEFAULT_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getSharedCacheDefault(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setSharedCacheDefault(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildDefaultSharedCacheStringHolder() { - return new TransformationPropertyValueModel<Boolean, String>(buildDefaultSharedCacheHolder()) { - @Override - protected String transform(Boolean value) { - if ((subject() != null) && (value == null)) { - Boolean defaultValue = subject().getDefaultSharedCacheDefault(); - if (defaultValue != null) { - String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; - return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCachingTab_defaultSharedCacheDefaultLabel, defaultStringValue); - } - } - return EclipseLinkUiMessages.PersistenceXmlCachingTab_sharedCacheDefaultLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMessages.PersistenceXmlCachingTab_sharedCacheDefaultLabel, - this.buildDefaultSharedCacheHolder(), - this.buildDefaultSharedCacheStringHolder(), - null -// EclipseLinkHelpContextIds.CACHING_SHARED_CACHE_DEFAULT - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/EclipseLinkCachingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/EclipseLinkCachingComposite.java deleted file mode 100644 index f726f88072..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/EclipseLinkCachingComposite.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.caching; - -import org.eclipse.jpt.eclipselink.core.internal.context.caching.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.swt.widgets.Composite; - -/** - * EclipseLinkCachingComposite - */ -public class EclipseLinkCachingComposite extends AbstractFormPane<Caching> -{ - public EclipseLinkCachingComposite(AbstractFormPane<Caching> subjectHolder, - Composite container) { - - super(subjectHolder, container); - } - - @Override - protected void initializeLayout(Composite container) { - - container = buildSection( - container, - EclipseLinkUiMessages.PersistenceXmlCachingTab_sectionTitle, - EclipseLinkUiMessages.PersistenceXmlCachingTab_sectionDescription - ); - - // Default pane - int groupBoxMargin = groupBoxMargin(); - - Composite defaultPane = buildSubPane( - container, - 0, groupBoxMargin, 0, groupBoxMargin - ); - - // Default Cache Type - new DefaultCacheTypeComposite(this, defaultPane); - - // Default Cache Size - new DefaultCacheSizeComposite(this, defaultPane); - - // Default Shared Cache - new DefaultSharedCacheComposite(this, defaultPane); - - // EntitiesList - new EntityListComposite(this, container); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/EntityCacheProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/EntityCacheProperties.java deleted file mode 100644 index a8c5217f44..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/EntityCacheProperties.java +++ /dev/null @@ -1,206 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.caching; - -import org.eclipse.jpt.eclipselink.core.internal.context.caching.CacheType; -import org.eclipse.jpt.eclipselink.core.internal.context.caching.Caching; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.jpt.utility.internal.model.AbstractModel; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; - -/** - * EntityCacheProperties - */ -@SuppressWarnings("nls") -public class EntityCacheProperties extends AbstractModel { - - private Caching caching; - private String entityName; - - private PropertyValueModel<CacheType> cacheTypeHolder; - private PropertyChangeListener cacheTypeListener; - private PropertyValueModel<Integer> cacheSizeHolder; - private PropertyChangeListener cacheSizeListener; - private PropertyValueModel<Boolean> sharedCacheHolder; - private PropertyChangeListener sharedCacheListener; - - private static final long serialVersionUID = 1L; - - public static final String CACHE_TYPE_PROPERTY = Caching.CACHE_TYPE_PROPERTY; - public static final String CACHE_SIZE_PROPERTY = Caching.CACHE_SIZE_PROPERTY; - public static final String SHARED_CACHE_PROPERTY = Caching.SHARED_CACHE_PROPERTY; - - // ********** constructors ********** - public EntityCacheProperties(Caching caching, String entityName) { - super(); - this.caching = caching; - this.entityName = entityName; - - PropertyValueModel<Caching> cachingHolder = new SimplePropertyValueModel<Caching>(this.caching); - this.initialize(cachingHolder); - } - - protected void initialize(PropertyValueModel<Caching> cachingHolder) { - this.cacheTypeHolder = this.buildCacheTypeAA(cachingHolder); - this.cacheTypeListener = this.buildCacheTypeChangeListener(); - this.cacheTypeHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.cacheTypeListener); - - this.cacheSizeHolder = this.buildCacheSizeAA(cachingHolder); - this.cacheSizeListener = this.buildCacheSizeChangeListener(); - this.cacheSizeHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.cacheSizeListener); - - this.sharedCacheHolder = this.buildSharedCacheAA(cachingHolder); - this.sharedCacheListener = this.buildSharedCacheChangeListener(); - this.sharedCacheHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.sharedCacheListener); - } - - // ********** behavior ********** - public boolean entityNameIsValid() { - return !StringTools.stringIsEmpty(this.entityName); - } - - public Integer getCacheSize() { - return this.caching.getCacheSize(this.entityName); - } - - public CacheType getCacheType() { - return this.caching.getCacheType(this.entityName); - } - - public Caching getCaching() { - return caching; - } - - public Integer getDefaultCacheSize() { - return this.caching.getDefaultCacheSize(); - } - - public CacheType getDefaultCacheType() { - return this.caching.getDefaultCacheType(); - } - - public String getEntityName() { - return this.entityName; - } - - public Boolean getSharedCache() { - return this.caching.getSharedCache(this.entityName); - } - - public Boolean getDefaultSharedCache() { - return this.caching.getDefaultSharedCache(); - } - - public void setCacheSize(Integer cacheSize) { - Integer oldCacheSize = this.getCacheSize(); - if (this.attributeValueHasChanged(oldCacheSize, cacheSize)) { - this.caching.setCacheSize(cacheSize, this.entityName); - this.firePropertyChanged(CACHE_SIZE_PROPERTY, oldCacheSize, cacheSize); - } - } - - public void setCacheType(CacheType cacheType) { - CacheType oldCacheType = this.getCacheType(); - if (this.attributeValueHasChanged(oldCacheType, cacheType)) { - this.caching.setCacheType(cacheType, this.entityName); - this.firePropertyChanged(CACHE_TYPE_PROPERTY, oldCacheType, cacheType); - } - } - - public void setSharedCache(Boolean sharedCache) { - Boolean oldSharedCache = this.getSharedCache(); - if (this.attributeValueHasChanged(oldSharedCache, sharedCache)) { - this.caching.setSharedCache(sharedCache, this.entityName); - this.firePropertyChanged(SHARED_CACHE_PROPERTY, oldSharedCache, sharedCache); - } - } - - // ********** PropertyChangeListener ********** - - private PropertyValueModel<CacheType> buildCacheTypeAA(PropertyValueModel<Caching> subjectHolder) { - return new PropertyAspectAdapter<Caching, CacheType>( - subjectHolder, CACHE_TYPE_PROPERTY) { - @Override - protected CacheType buildValue_() { - return this.subject.getCacheType(EntityCacheProperties.this.entityName); - } - }; - } - - private PropertyChangeListener buildCacheTypeChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - EntityCacheProperties.this.firePropertyChanged(CACHE_TYPE_PROPERTY, e.getOldValue(), e.getNewValue()); - } - }; - } - - private PropertyValueModel<Integer> buildCacheSizeAA(PropertyValueModel<Caching> subjectHolder) { - return new PropertyAspectAdapter<Caching, Integer>( - subjectHolder, CACHE_SIZE_PROPERTY) { - @Override - protected Integer buildValue_() { - return this.subject.getCacheSize(EntityCacheProperties.this.entityName); - } - }; - } - - private PropertyChangeListener buildCacheSizeChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - EntityCacheProperties.this.firePropertyChanged(CACHE_SIZE_PROPERTY, e.getOldValue(), e.getNewValue()); - } - }; - } - - private PropertyValueModel<Boolean> buildSharedCacheAA(PropertyValueModel<Caching> subjectHolder) { - return new PropertyAspectAdapter<Caching, Boolean>( - subjectHolder, SHARED_CACHE_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSharedCache(EntityCacheProperties.this.entityName); - } - }; - } - - private PropertyChangeListener buildSharedCacheChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - EntityCacheProperties.this.firePropertyChanged(SHARED_CACHE_PROPERTY, e.getOldValue(), e.getNewValue()); - } - }; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - StringTools.buildSimpleToStringOn(this, sb); - sb.append(" ("); - this.toString(sb); - sb.append(')'); - return sb.toString(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append("name: "); - sb.append(this.entityName); - sb.append(", type: "); - sb.append(this.getCacheType()); - sb.append(", size: "); - sb.append(this.getCacheSize()); - sb.append(", isShared: "); - sb.append(this.getSharedCache()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/EntityCachingPropertyComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/EntityCachingPropertyComposite.java deleted file mode 100644 index 5be8a632ce..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/EntityCachingPropertyComposite.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.caching; - -import org.eclipse.jpt.eclipselink.core.internal.context.caching.Caching; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * @version 2.0 - * @since 2.0 - */ -public class EntityCachingPropertyComposite extends AbstractPane<EntityCacheProperties> { - - /** - * Creates a new <code>EntityCachingPropertyComposite</code>. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - */ - public EntityCachingPropertyComposite(AbstractPane<Caching> parentComposite, - PropertyValueModel<EntityCacheProperties> subjectHolder, - Composite parent) { - - super(parentComposite, subjectHolder, parent); - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - // Cache Type - new CacheTypeComposite(this, container); - - // Cache Size - new CacheSizeComposite(this, container); - - // Share Cache - new SharedCacheComposite(this, container); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/EntityListComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/EntityListComposite.java deleted file mode 100644 index 76ab8848b0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/EntityListComposite.java +++ /dev/null @@ -1,239 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2007, 2008 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.eclipselink.ui.internal.caching; - -import java.util.ListIterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.search.IJavaSearchScope; -import org.eclipse.jdt.core.search.SearchEngine; -import org.eclipse.jdt.ui.IJavaElementSearchConstants; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.Entity; -import org.eclipse.jpt.core.context.PersistentType; -import org.eclipse.jpt.core.context.TypeMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.caching.Caching; -import org.eclipse.jpt.eclipselink.ui.JptEclipseLinkUiPlugin; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.PaneEnabler; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane; -import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.utility.internal.model.value.TransformationListValueModelAdapter; -import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel; -import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel; -import org.eclipse.jpt.utility.model.value.ListValueModel; -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.ui.PlatformUI; -import org.eclipse.ui.dialogs.SelectionDialog; -import org.eclipse.ui.progress.IProgressService; - -/** - * EntityListComposite - */ -public class EntityListComposite extends AbstractPane<Caching> -{ - public EntityListComposite(AbstractPane<Caching> parentComposite, Composite parent) { - - super(parentComposite, parent); - } - - @Override - protected void initializeLayout(Composite container) { - - container = this.buildTitledPane( - container, - EclipseLinkUiMessages.CachingEntityListComposite_groupTitle - ); - - WritablePropertyValueModel<EntityCacheProperties> entityHolder = this.buildEntityHolder(); - - // Entities add/remove list pane - new AddRemoveListPane<Caching>( - this, - container, - this.buildEntitiesAdapter(), - this.buildEntityCachingListHolder(), - entityHolder, - this.buildEntityLabelProvider(), - null // EclipseLinkHelpContextIds.CACHING_ENTITIES - ); - - // Entity Caching property pane - EntityCachingPropertyComposite pane = new EntityCachingPropertyComposite( - this, - entityHolder, - container - ); - this.installPaneEnabler(entityHolder, pane); - } - - private AddRemoveListPane.Adapter buildEntitiesAdapter() { - return new AddRemoveListPane.AbstractAdapter() { - public void addNewItem(ObjectListSelectionModel listSelectionModel) { - addEntities(listSelectionModel); - } - - public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) { - Caching caching = subject(); - for (Object item : listSelectionModel.selectedValues()) { - EntityCacheProperties entityCaching = (EntityCacheProperties) item; - caching.removeEntity(entityCaching.getEntityName()); - } - } - }; - } - - private void addEntities(ObjectListSelectionModel listSelectionModel) { - - IType type = this.chooseEntity(); - - if (type != null) { - String entityName = this.getEntityName(type.getFullyQualifiedName()); - if (entityName == null) { - entityName = type.getElementName(); - } - - if( ! this.subject().entityExists(entityName)) { - String entity = this.subject().addEntity(entityName); - - listSelectionModel.setSelectedValue(entity); - } - } - } - - private String getEntityName(String fullyQualifiedTypeName) { - - PersistentType persistentType = subject().persistenceUnit().getPersistentType(fullyQualifiedTypeName); - - if (persistentType != null && persistentType.getMappingKey() == MappingKeys.ENTITY_TYPE_MAPPING_KEY) { - TypeMapping mapping = persistentType.getMapping(); - if (mapping instanceof Entity) { - return ((Entity)mapping).getName(); - } - } - return null; - } - - private IType chooseEntity() { - - IPackageFragmentRoot root = packageFragmentRoot(); - if (root == null) { - return null; - } - IJavaElement[] elements = new IJavaElement[] { root.getJavaProject() }; - IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements); - IProgressService service = PlatformUI.getWorkbench().getProgressService(); - SelectionDialog typeSelectionDialog; - - try { - typeSelectionDialog = JavaUI.createTypeDialog( - shell(), - service, - scope, - IJavaElementSearchConstants.CONSIDER_CLASSES, - false, - "" - ); - } - catch (JavaModelException e) { - JptEclipseLinkUiPlugin.log(e); - return null; - } - typeSelectionDialog.setTitle(EclipseLinkUiMessages.CachingEntityListComposite_dialogTitle); - typeSelectionDialog.setMessage(EclipseLinkUiMessages.CachingEntityListComposite_dialogMessage); - - if (typeSelectionDialog.open() == Window.OK) { - return (IType) typeSelectionDialog.getResult()[0]; - } - return null; - } - - private IPackageFragmentRoot packageFragmentRoot() { - IProject project = subject().getJpaProject().getProject(); - IJavaProject root = JavaCore.create(project); - - try { - return root.getAllPackageFragmentRoots()[0]; - } - catch (JavaModelException e) { - JptEclipseLinkUiPlugin.log(e); - } - return null; - } - - private ILabelProvider buildEntityLabelProvider() { - return new LabelProvider() { - @Override - public String getText(Object element) { - EntityCacheProperties entityCaching = (EntityCacheProperties) element; - return entityCaching.getEntityName(); - } - }; - } - - private WritablePropertyValueModel<EntityCacheProperties> buildEntityHolder() { - return new SimplePropertyValueModel<EntityCacheProperties>(); - } - - private ListValueModel<EntityCacheProperties> buildEntityCachingListHolder() { - return new TransformationListValueModelAdapter<String, EntityCacheProperties>(buildEntitiesListHolder()) { - @Override - protected EntityCacheProperties transformItem(String item) { - return new EntityCacheProperties(subject(), item); - } - }; - } - - private ListValueModel<String> buildEntitiesListHolder() { - return new ListAspectAdapter<Caching, String>( - this.getSubjectHolder(), Caching.ENTITIES_LIST_PROPERTY) { - @Override - protected ListIterator<String> listIterator_() { - return this.subject.entities(); - } - @Override - protected int size_() { - return this.subject.entitiesSize(); - } - }; - } - - private void installPaneEnabler(WritablePropertyValueModel<EntityCacheProperties> entityHolder, - EntityCachingPropertyComposite pane) { - - new PaneEnabler( - this.buildPaneEnablerHolder(entityHolder), - pane - ); - } - - private PropertyValueModel<Boolean> buildPaneEnablerHolder(WritablePropertyValueModel<EntityCacheProperties> entityHolder) { - return new TransformationPropertyValueModel<EntityCacheProperties, Boolean>(entityHolder) { - @Override - protected Boolean transform_(EntityCacheProperties value) { - return value.entityNameIsValid(); - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/PersistenceXmlCachingTab.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/PersistenceXmlCachingTab.java deleted file mode 100644 index cf5e54d81c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/PersistenceXmlCachingTab.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2007, 2008 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.eclipselink.ui.internal.caching; - -import org.eclipse.jpt.eclipselink.core.internal.context.caching.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaPageComposite; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; - -/** - * PersistenceXmlCachingTab - */ -public class PersistenceXmlCachingTab - extends AbstractFormPane<Caching> - implements JpaPageComposite -{ - public PersistenceXmlCachingTab( - PropertyValueModel<Caching> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - - new EclipseLinkCachingComposite(this, container); - } - - // ********** JpaPageComposite implementation ********** - - public String getHelpID() { - return null; - } - - public Image getPageImage() { - return null; - } - public String getPageText() { - return EclipseLinkUiMessages.PersistenceXmlCachingTab_title; - } - - // ********** Layout ********** - - @Override - protected Composite buildContainer(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 = buildPane(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); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/SharedCacheComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/SharedCacheComposite.java deleted file mode 100644 index 9e6febdc88..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/caching/SharedCacheComposite.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.caching; - -import java.util.ArrayList; - -import org.eclipse.jpt.eclipselink.core.internal.context.caching.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.ui.internal.widgets.TriStateCheckBox; -import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel; -import org.eclipse.jpt.utility.internal.model.value.ListPropertyValueModelAdapter; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter; -import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel; -import org.eclipse.jpt.utility.model.value.ListValueModel; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * SharedCacheComposite - */ -public class SharedCacheComposite extends AbstractPane<EntityCacheProperties> -{ - private TriStateCheckBox sharedCacheCheckBox; - - /** - * Creates a new <code>ShareCacheComposite</code>. - * - * @param parentController The parent container of this one - * @param parent The parent container - */ - public SharedCacheComposite(AbstractPane<EntityCacheProperties> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private PropertyValueModel<Caching> buildCachingHolder() { - return new TransformationPropertyValueModel<EntityCacheProperties, Caching>(getSubjectHolder()) { - @Override - protected Caching transform_(EntityCacheProperties value) { - return value.getCaching(); - } - }; - } - - private PropertyValueModel<Boolean> buildDefaultAndNonDefaultSharedCacheHolder() { - return new ListPropertyValueModelAdapter<Boolean>( - buildDefaultAndNonDefaultSharedCacheListHolder() - ) { - @Override - protected Boolean buildValue() { - // If the number of ListValueModel equals 1, that means the shared - // Cache properties is not set (partially selected), which means we - // want to see the default value appended to the text - if (listHolder.size() == 1) { - return (Boolean) listHolder.listIterator().next(); - } - return null; - } - }; - }; - - private ListValueModel<Boolean> buildDefaultAndNonDefaultSharedCacheListHolder() { - ArrayList<ListValueModel<Boolean>> holders = new ArrayList<ListValueModel<Boolean>>(2); - holders.add(buildSharedCacheListHolder()); - holders.add(buildDefaultSharedCacheListHolder()); - - return new CompositeListValueModel<ListValueModel<Boolean>, Boolean>( - holders - ); - } - - private PropertyValueModel<Boolean> buildDefaultSharedCacheHolder() { - return new PropertyAspectAdapter<Caching, Boolean>(buildCachingHolder(), Caching.SHARED_CACHE_DEFAULT_PROPERTY) { - @Override - protected Boolean buildValue_() { - Boolean value = subject.getSharedCacheDefault(); - if (value == null) { - value = subject.getDefaultSharedCacheDefault(); - } - return value; - } - }; - } - - private ListValueModel<Boolean> buildDefaultSharedCacheListHolder() { - return new PropertyListValueModelAdapter<Boolean>( - buildDefaultSharedCacheHolder() - ); - } - - private WritablePropertyValueModel<Boolean> buildSharedCacheHolder() { - return new PropertyAspectAdapter<EntityCacheProperties, Boolean>( - getSubjectHolder(), EntityCacheProperties.SHARED_CACHE_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSharedCache(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSharedCache(value); - } - }; - } - - private ListValueModel<Boolean> buildSharedCacheListHolder() { - return new PropertyListValueModelAdapter<Boolean>( - buildSharedCacheHolder() - ); - } - - private PropertyValueModel<String> buildSharedCacheStringHolder() { - return new TransformationPropertyValueModel<Boolean, String>(buildDefaultAndNonDefaultSharedCacheHolder()) { - @Override - protected String transform(Boolean value) { - if (value != null) { - String defaultStringValue = value ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; - return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCachingTab_defaultSharedCacheLabel, defaultStringValue); - } - return EclipseLinkUiMessages.PersistenceXmlCachingTab_sharedCacheLabel; - } - }; - } - - @Override - public void enableWidgets(boolean enabled) { - super.enableWidgets(enabled); - this.sharedCacheCheckBox.setEnabled(enabled); - } - - @Override - protected void initializeLayout(Composite container) { - - this.sharedCacheCheckBox = this.buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMessages.PersistenceXmlCachingTab_sharedCacheLabel, - this.buildSharedCacheHolder(), - this.buildSharedCacheStringHolder(), - null -// EclipseLinkHelpContextIds.CACHING_SHARED_CACHE - ); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/BatchWritingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/BatchWritingComposite.java deleted file mode 100644 index 6b0152186e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/BatchWritingComposite.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import java.util.Collection; - -import org.eclipse.jpt.eclipselink.core.internal.context.connection.BatchWriting; -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.swt.widgets.Composite; - -/** - * BatchWritingComposite - */ -public class BatchWritingComposite extends AbstractFormPane<Connection> -{ - /** - * Creates a new <code>BatchWritingComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public BatchWritingComposite( - AbstractFormPane<? extends Connection> parentComposite, - Composite parent) { - - super( parentComposite, parent); - } - - private EnumFormComboViewer<Connection, BatchWriting> buildBatchWritingCombo(Composite container) { - return new EnumFormComboViewer<Connection, BatchWriting>(this, container) { - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(Connection.BATCH_WRITING_PROPERTY); - } - - @Override - protected BatchWriting[] choices() { - return BatchWriting.values(); - } - - @Override - protected BatchWriting defaultValue() { - return subject().getDefaultBatchWriting(); - } - - @Override - protected String displayString(BatchWriting value) { - return buildDisplayString(EclipseLinkUiMessages.class, BatchWritingComposite.this, value); - } - - @Override - protected BatchWriting getValue() { - return subject().getBatchWriting(); - } - - @Override - protected void setValue(BatchWriting value) { - subject().setBatchWriting(value); - } - }; - } - - @Override - protected void initializeLayout( Composite container) { - - this.buildLabeledComposite( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_batchWritingLabel, - this.buildBatchWritingCombo( container), - null // TODO IJpaHelpContextIds. - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/CacheStatementsPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/CacheStatementsPropertiesComposite.java deleted file mode 100644 index 5f702580c1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/CacheStatementsPropertiesComposite.java +++ /dev/null @@ -1,213 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.ControlEnabler; -import org.eclipse.jpt.ui.internal.util.LabeledControlUpdater; -import org.eclipse.jpt.ui.internal.util.LabeledLabel; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.ui.internal.widgets.TriStateCheckBox; -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.osgi.util.NLS; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Spinner; - -/** - * CacheStatementsPropertiesComposite - */ -@SuppressWarnings("nls") -public class CacheStatementsPropertiesComposite extends AbstractPane<Connection> -{ - public CacheStatementsPropertiesComposite(AbstractPane<Connection> parentComposite, Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Boolean> buildCacheStatementsHolder() { - return new PropertyAspectAdapter<Connection, Boolean>(getSubjectHolder(), Connection.CACHE_STATEMENTS_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getCacheStatements(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setCacheStatements(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private WritablePropertyValueModel<Integer> buildCacheStatementsSizeHolder() { - return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), Connection.CACHE_STATEMENTS_SIZE_PROPERTY) { - @Override - protected Integer buildValue_() { - Integer value = subject.getCacheStatementsSize(); - - if (value == null) { - value = -1; - } - return value; - } - - @Override - protected void setValue_(Integer value) { - if (value == -1) { - value = null; - } - subject.setCacheStatementsSize(value); - } - }; - } - - private PropertyValueModel<Integer> buildDefaultCacheStatementsSizeHolder() { - return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), "") { - @Override - protected Integer buildValue_() { - return subject.getDefaultCacheStatementsSize(); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Integer.MIN_VALUE, newValue); - } - } - }; - } - - private Label buildDefaultCacheStatementsSizeLabel(Composite container) { - - Label label = buildLabel( - container, - EclipseLinkUiMessages.DefaultWithoutValue - ); - - new LabeledControlUpdater( - new LabeledLabel(label), - buildDefaultCacheStatementsSizeLabelHolder() - ); - - return label; - } - - private PropertyValueModel<String> buildDefaultCacheStatementsSizeLabelHolder() { - - return new TransformationPropertyValueModel<Integer, String>(buildDefaultCacheStatementsSizeHolder()) { - - @Override - protected String transform(Integer value) { - - if (value != null) { - return NLS.bind(EclipseLinkUiMessages.DefaultWithValue, value); - } - - return ""; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - WritablePropertyValueModel<Boolean> cacheStatementsHolder = buildCacheStatementsHolder(); - - TriStateCheckBox checkBox = this.buildTriStateCheckBox( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_cacheStatementsLabel, - cacheStatementsHolder, - null - ); - - Spinner spinner = this.buildSpinner( - container, - this.buildCacheStatementsSizeHolder(), - -1, - -1, - Integer.MAX_VALUE - ); - - Label label = this.buildDefaultCacheStatementsSizeLabel(container); - - this.buildLabeledComposite( - container, - checkBox.getCheckBox(), - (spinner.getParent() == container) ? spinner : spinner.getParent(), - label, - null -// EclipseLinkHelpContextIds. - ); - - this.installControlEnabler(cacheStatementsHolder, label, spinner); - this.updateGridData(container, spinner); - } - - private void installControlEnabler(WritablePropertyValueModel<Boolean> cacheStatementsHolder, - Label label, - Spinner spinner) { - - new ControlEnabler(cacheStatementsHolder, label, spinner); - } - - /** - * Changes the layout of the given container by changing which widget will - * grab the excess of horizontal space. By default, the center control grabs - * the excess space, we change it to be the right control. - * - * @param container The container containing the controls needing their - * <code>GridData</code> to be modified from the default values - * @param spinner The spinner that got created - */ - private void updateGridData(Composite container, Spinner spinner) { - - // It is possible the spinner's parent is not the container of the - // label, spinner and right control (a pane is sometimes required for - // painting the spinner's border) - Composite paneContainer = spinner.getParent(); - - while (container != paneContainer.getParent()) { - paneContainer = paneContainer.getParent(); - } - - Control[] controls = paneContainer.getChildren(); - - GridData gridData = new GridData(); - gridData.grabExcessHorizontalSpace = false; - gridData.horizontalAlignment = GridData.BEGINNING; - controls[1].setLayoutData(gridData); - - controls[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - removeAlignRight(controls[2]); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/ConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/ConnectionPropertiesComposite.java deleted file mode 100644 index bdda408506..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/ConnectionPropertiesComposite.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.swt.widgets.Composite; - -/** - * ConnectionPropertiesComposite - */ -public class ConnectionPropertiesComposite extends AbstractPane<Connection> -{ - public ConnectionPropertiesComposite(AbstractPane<Connection> parentComposite, Composite parent) { - - super(parentComposite, parent); - } - - @Override - protected void initializeLayout(Composite container) { - - container = buildTitledPane( - container, - EclipseLinkUiMessages.ConnectionPropertiesComposite_Database_GroupBox - ); - - new DataSourcePropertiesComposite(this, container); - new JdbcPropertiesComposite(this, container); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/DataSourcePropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/DataSourcePropertiesComposite.java deleted file mode 100644 index 11a2533d19..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/DataSourcePropertiesComposite.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType; -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.ControlEnabler; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -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.Text; - -/** - * @version 2.0 - * @since 2.0 - */ -public class DataSourcePropertiesComposite extends AbstractPane<Connection> { - - /** - * Creates a new <code>DataSourcePropertiesComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public DataSourcePropertiesComposite(AbstractPane<Connection> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<String> buildJtaDataSourceHolder() { - return new PropertyAspectAdapter<Connection, String>(getSubjectHolder(), Connection.JTA_DATA_SOURCE_PROPERTY) { - @Override - protected String buildValue_() { - return subject.getJtaDataSource(); - } - - @Override - protected void setValue_(String value) { - if (value.length() == 0) { - value = null; - } - subject.setJtaDataSource(value); - } - }; - } - - private PropertyValueModel<Boolean> buildJTADataSourceHolder() { - return new TransformationPropertyValueModel<PersistenceUnitTransactionType, Boolean>(buildTransactionTypeHolder()) { - @Override - protected Boolean transform(PersistenceUnitTransactionType value) { - return value == null || value == PersistenceUnitTransactionType.JTA; - } - }; - } - - private WritablePropertyValueModel<String> buildNonJtaDataSourceHolder() { - return new PropertyAspectAdapter<Connection, String>(getSubjectHolder(), Connection.NON_JTA_DATA_SOURCE_PROPERTY) { - @Override - protected String buildValue_() { - return subject.getNonJtaDataSource(); - } - - @Override - protected void setValue_(String value) { - if (value.length() == 0) { - value = null; - } - subject.setNonJtaDataSource(value); - } - }; - } - - private PropertyValueModel<Boolean> buildNonJTADataSourceHolder() { - return new TransformationPropertyValueModel<PersistenceUnitTransactionType, Boolean>(buildTransactionTypeHolder()) { - @Override - protected Boolean transform(PersistenceUnitTransactionType value) { - return value == PersistenceUnitTransactionType.RESOURCE_LOCAL; - } - }; - } - - private PropertyValueModel<PersistenceUnitTransactionType> buildTransactionTypeHolder() { - return new PropertyAspectAdapter<Connection, PersistenceUnitTransactionType>(getSubjectHolder(), Connection.TRANSACTION_TYPE_PROPERTY) { - @Override - protected PersistenceUnitTransactionType buildValue_() { - return subject.getTransactionType(); - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - int groupBoxMargin = groupBoxMargin(); - - container = buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin); - - // JTA Data Source - Text text = this.buildLabeledText( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_jtaDataSourceLabel, - buildJtaDataSourceHolder() - ); - - this.installJTADataSourceControlEnabler(text); - - // Non-JTA Data Source - text = this.buildLabeledText( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_nonJtaDataSourceLabel, - buildNonJtaDataSourceHolder() - ); - - this.installNonJTADataSourceControlEnabler(text); - } - - private void installJTADataSourceControlEnabler(Text text) { - new ControlEnabler(buildJTADataSourceHolder(), text); - } - - private void installNonJTADataSourceControlEnabler(Text text) { - new ControlEnabler(buildNonJTADataSourceHolder(), text); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/EclipseLinkConnectionComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/EclipseLinkConnectionComposite.java deleted file mode 100644 index b267a226cd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/EclipseLinkConnectionComposite.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.swt.widgets.Composite; - -/** - * EclipseLinkConnectionComposite - */ -public class EclipseLinkConnectionComposite - extends AbstractFormPane<Connection> -{ - public EclipseLinkConnectionComposite( - AbstractFormPane<Connection> subjectHolder, - Composite container) { - super(subjectHolder, container, false); - } - - @Override - protected void initializeLayout(Composite container) { - - int groupBoxMargin = groupBoxMargin() * 2; - - container = buildSection( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_sectionTitle, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_sectionDescription - ); - - Composite subPane = buildSubPane( - container, - 0, groupBoxMargin, 10, groupBoxMargin - ); - - new TransactionTypeComposite(this, subPane); - - new BatchWritingComposite(this, subPane); - - new CacheStatementsPropertiesComposite(this, subPane); - - new NativeSqlComposite(this, subPane); - - new ConnectionPropertiesComposite(this, container); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcBindParametersComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcBindParametersComposite.java deleted file mode 100644 index a1f80707c7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcBindParametersComposite.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * JdbcBindParametersComposite - */ -public class JdbcBindParametersComposite extends AbstractPane<Connection> -{ - /** - * Creates a new <code>JdbcBindParametersComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public JdbcBindParametersComposite( - AbstractPane<? extends Connection> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Boolean> buildBindParametersHolder() { - return new PropertyAspectAdapter<Connection, Boolean>(getSubjectHolder(), Connection.BIND_PARAMETERS_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getBindParameters(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setBindParameters(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildBindParametersStringHolder() { - return new TransformationPropertyValueModel<Boolean, String>(buildBindParametersHolder()) { - @Override - protected String transform(Boolean value) { - if ((subject() != null) && (value == null)) { - Boolean defaultValue = subject().getDefaultBindParameters(); - if (defaultValue != null) { - String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; - return NLS.bind(EclipseLinkUiMessages.PersistenceXmlConnectionTab_bindParametersLabelDefault, defaultStringValue); - } - } - return EclipseLinkUiMessages.PersistenceXmlConnectionTab_bindParametersLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_bindParametersLabel, - this.buildBindParametersHolder(), - this.buildBindParametersStringHolder(), - null -// EclipseLinkHelpContextIds. - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcConnectionPropertiesComposite.java deleted file mode 100644 index d4b856724c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcConnectionPropertiesComposite.java +++ /dev/null @@ -1,341 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import java.util.Comparator; -import java.util.Iterator; - -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.db.ConnectionProfile; -import org.eclipse.jpt.db.ConnectionProfileFactory; -import org.eclipse.jpt.db.JptDbPlugin; -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.JptUiPlugin; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -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 AbstractPane<Connection> -{ - /** - * The constant ID used to retrieve the dialog settings. - */ - private static final String DIALOG_SETTINGS = "org.eclipse.jpt.eclipselink.ui.dialogs.ConnectionDialog"; - - public JdbcConnectionPropertiesComposite(AbstractPane<Connection> parentComposite, Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<String> buildPasswordHolder() { - return new PropertyAspectAdapter<Connection, String>(getSubjectHolder(), Connection.PASSWORD_PROPERTY) { - @Override - protected String buildValue_() { - return subject.getPassword(); - } - - @Override - protected void setValue_(String value) { - if (value.length() == 0) { - value = null; - } - subject.setPassword(value); - } - }; - } - - private Runnable buildPopulateFromConnectionAction() { - return new Runnable() { - public void run() { - promptConnection(); - } - }; - } - - private WritablePropertyValueModel<String> buildUrlHolder() { - return new PropertyAspectAdapter<Connection, String>(getSubjectHolder(), Connection.URL_PROPERTY) { - @Override - protected String buildValue_() { - return subject.getUrl(); - } - - @Override - protected void setValue_(String value) { - if (value.length() == 0) { - value = null; - } - subject.setUrl(value); - } - }; - } - - private WritablePropertyValueModel<String> buildUserHolder() { - return new PropertyAspectAdapter<Connection, String>(getSubjectHolder(), Connection.USER_PROPERTY) { - @Override - protected String buildValue_() { - return subject.getUser(); - } - - @Override - protected void setValue_(String value) { - if (value.length() == 0) { - value = null; - } - subject.setUser(value); - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - // Populate from Connection hyperlink - this.buildHyperLink( - container, - "Populate from Connection...", - buildPopulateFromConnectionAction() - ); - - // Driver - new JdbcDriverComposite(this, container); - - // Url - this.buildLabeledText( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_urlLabel, - buildUrlHolder() - ); - - // User - this.buildLabeledText( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_userLabel, - buildUserHolder() - ); - - // Password - this.buildLabeledPasswordText( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_passwordLabel, - buildPasswordHolder() - ); - - // Bind Parameters - new JdbcBindParametersComposite(this, container); - } - - 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); - - Connection connection = subject(); - 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 EclipseLink connection, so we go - // to the db plug-in directly to get the factory - return JptDbPlugin.instance().getConnectionProfileFactory(); - } - - // broaden access a bit - Shell shell_() { - return this.shell(); - } - - /** - * 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.shell_(), false); - setMessage(EclipseLinkUiMessages.JdbcConnectionPropertiesComposite_ConnectionDialog_Message); - setTitle(EclipseLinkUiMessages.JdbcConnectionPropertiesComposite_ConnectionDialog_Title); - setListLabelProvider(buildLabelProvider()); - setDetailsLabelProvider(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(); - } - }; - } - - /* - * (non-Javadoc) - */ - @Override - protected Control createExtendedContentArea(Composite parent) { - return null; - } - - /* - * (non-Javadoc) - */ - @Override - protected ItemsFilter createFilter() { - return new ConnectionItemsFilter(); - } - - /* - * (non-Javadoc) - */ - @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 (Iterator<String> stream = this.connectionProfileNames(); stream.hasNext(); ) { - provider.add(stream.next(), itemsFilter); - } - } - finally { - monitor.done(); - } - } - - private Iterator<String> connectionProfileNames() { - return JdbcConnectionPropertiesComposite.this.getConnectionProfileFactory().connectionProfileNames(); - } - - /* - * (non-Javadoc) - */ - @Override - protected IDialogSettings getDialogSettings() { - - IDialogSettings dialogSettings = JptUiPlugin.getPlugin().getDialogSettings(); - IDialogSettings settings = dialogSettings.getSection(DIALOG_SETTINGS); - - if (settings == null) { - settings = dialogSettings.addNewSection(DIALOG_SETTINGS); - } - - return settings; - } - - /* - * (non-Javadoc) - */ - @Override - public String getElementName(Object object) { - return object.toString(); - } - - /* - * (non-Javadoc) - */ - @Override - protected Comparator<String> getItemsComparator() { - return new Comparator<String>() { - public int compare(String item1, String item2) { - return item1.compareTo(item2); - } - }; - } - - /* - * (non-Javadoc) - */ - @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()); - } - } - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcDriverComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcDriverComposite.java deleted file mode 100644 index 44dde05c93..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcDriverComposite.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.JptEclipseLinkUiPlugin; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane; -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 AbstractPane<Connection> -{ - /** - * Creates a new <code>EventListenerComposite</code>. - * - * @param parentPane The parent pane of this one - * @param parent The parent container - */ - public JdbcDriverComposite(AbstractPane<? extends Connection> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private ClassChooserPane<Connection> initializeClassChooser(Composite container) { - - return new ClassChooserPane<Connection>(this, container) { - - @Override - protected WritablePropertyValueModel<String> buildTextHolder() { - return new PropertyAspectAdapter<Connection, String>( - this.getSubjectHolder(), Connection.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 className() { - return this.subject().getDriver(); - } - - @Override - protected String labelText() { - return EclipseLinkUiMessages.PersistenceXmlConnectionTab_driverLabel; - } - - @Override - protected IPackageFragmentRoot packageFragmentRoot() { - IProject project = this.subject().getJpaProject().getProject(); - IJavaProject root = JavaCore.create(project); - - try { - return root.getAllPackageFragmentRoots()[0]; - } - catch (JavaModelException e) { - JptEclipseLinkUiPlugin.log(e); - } - return null; - } - - @Override - protected void promptType() { - IType type = chooseType(); - - if (type != null) { - String className = type.getFullyQualifiedName('.'); - this.subject().setDriver(className); - } - } - }; - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - this.initializeClassChooser(container); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcPropertiesComposite.java deleted file mode 100644 index 065a074319..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcPropertiesComposite.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType; -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.PaneEnabler; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -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.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; - -/** - * JdbcPropertiesComposite - */ -public class JdbcPropertiesComposite extends AbstractPane<Connection> -{ - public JdbcPropertiesComposite(AbstractPane<Connection> 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<Connection, PersistenceUnitTransactionType>(getSubjectHolder(), Connection.TRANSACTION_TYPE_PROPERTY) { - @Override - protected PersistenceUnitTransactionType buildValue_() { - return subject.getTransactionType(); - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - container = buildTitledPane( - buildSubPane(container, 10), - EclipseLinkUiMessages.JdbcPropertiesComposite_EclipseLinkConnectionPool_GroupBox - ); - - new JdbcConnectionPropertiesComposite(this, container); - - container = buildPane(container, new GridLayout(2, true)); - - new JdbcReadConnectionPropertiesComposite(this, container); - new JdbcWriteConnectionPropertiesComposite(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.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcReadConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcReadConnectionPropertiesComposite.java deleted file mode 100644 index 94fe416459..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcReadConnectionPropertiesComposite.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; - -/** - * JdbcReadConnectionPropertiesComposite - */ -public class JdbcReadConnectionPropertiesComposite extends AbstractPane<Connection> -{ - public JdbcReadConnectionPropertiesComposite(AbstractPane<Connection> parentComposite, Composite parent) { - - super(parentComposite, parent, false); - } - - @Override - protected void initializeLayout(Composite container) { - - container = this.buildSection( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_readConnectionsSectionTitle - ); - - GridData data = (GridData) container.getLayoutData(); - data.verticalAlignment = SWT.TOP; - - data = (GridData) getControl().getLayoutData(); - data.verticalAlignment = SWT.TOP; - - // Read Connections Shared - new JdbcReadConnectionsSharedComposite(this, container); - - // Read Connections Minimum - new JdbcReadConnectionsMinComposite(this, container); - - // Read Connections Maximum - new JdbcReadConnectionsMaxComposite(this, container); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcReadConnectionsMaxComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcReadConnectionsMaxComposite.java deleted file mode 100644 index e27a93fc75..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcReadConnectionsMaxComposite.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.LabeledControlUpdater; -import org.eclipse.jpt.ui.internal.util.LabeledLabel; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -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.osgi.util.NLS; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Spinner; - -/** - * JdbcReadConnectionsMaxComposite - */ -@SuppressWarnings("nls") -public class JdbcReadConnectionsMaxComposite extends AbstractPane<Connection> -{ - /** - * Creates a new <code>JdbcReadConnectionsMaxComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public JdbcReadConnectionsMaxComposite(AbstractPane<Connection> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Integer> buildReadConnectionsMaxHolder() { - return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), Connection.READ_CONNECTIONS_MAX_PROPERTY) { - @Override - protected Integer buildValue_() { - Integer value = subject.getReadConnectionsMax(); - - if (value == null) { - value = -1; - } - return value; - } - - @Override - protected void setValue_(Integer value) { - if (value == -1) { - value = null; - } - subject.setReadConnectionsMax(value); - } - }; - } - - private PropertyValueModel<Integer> buildDefaultReadConnectionsMaxHolder() { - return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), "") { - @Override - protected Integer buildValue_() { - return subject.getDefaultReadConnectionsMax(); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Integer.MIN_VALUE, newValue); - } - } - }; - } - - private Control buildDefaultReadConnectionsMaxLabel(Composite container) { - - Label label = buildLabel( - container, - EclipseLinkUiMessages.DefaultWithoutValue - ); - - new LabeledControlUpdater( - new LabeledLabel(label), - buildDefaultReadConnectionsMaxLabelHolder() - ); - - return label; - } - - private PropertyValueModel<String> buildDefaultReadConnectionsMaxLabelHolder() { - - return new TransformationPropertyValueModel<Integer, String>(buildDefaultReadConnectionsMaxHolder()) { - - @Override - protected String transform(Integer value) { - - if (value != null) { - return NLS.bind(EclipseLinkUiMessages.DefaultWithValue, value); - } - - return ""; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - Spinner spinner = this.buildLabeledSpinner( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_readConnectionsMaxLabel, - this.buildReadConnectionsMaxHolder(), - -1, - -1, - Integer.MAX_VALUE, - this.buildDefaultReadConnectionsMaxLabel(container) - ); - - updateGridData(container, spinner); - } - - /** - * Changes the layout of the given container by changing which widget will - * grab the excess of horizontal space. By default, the center control grabs - * the excess space, we change it to be the right control. - * - * @param container The container containing the controls needing their - * <code>GridData</code> to be modified from the default values - * @param spinner The spinner that got created - */ - private void updateGridData(Composite container, Spinner spinner) { - - // It is possible the spinner's parent is not the container of the - // label, spinner and right control (a pane is sometimes required for - // painting the spinner's border) - Composite paneContainer = spinner.getParent(); - - while (container != paneContainer.getParent()) { - paneContainer = paneContainer.getParent(); - } - - Control[] controls = paneContainer.getChildren(); - - GridData gridData = new GridData(); - gridData.grabExcessHorizontalSpace = false; - gridData.horizontalAlignment = GridData.BEGINNING; - controls[1].setLayoutData(gridData); - - controls[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - removeAlignRight(controls[2]); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcReadConnectionsMinComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcReadConnectionsMinComposite.java deleted file mode 100644 index 07c5f88113..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcReadConnectionsMinComposite.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.LabeledControlUpdater; -import org.eclipse.jpt.ui.internal.util.LabeledLabel; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -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.osgi.util.NLS; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Spinner; - -/** - * JdbcReadConnectionsMinComposite - */ -@SuppressWarnings("nls") -public class JdbcReadConnectionsMinComposite extends AbstractPane<Connection> -{ - /** - * Creates a new <code>JdbcReadConnectionsMinComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public JdbcReadConnectionsMinComposite(AbstractPane<Connection> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Integer> buildReadConnectionsMinHolder() { - return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), Connection.READ_CONNECTIONS_MIN_PROPERTY) { - @Override - protected Integer buildValue_() { - Integer value = subject.getReadConnectionsMin(); - - if (value == null) { - value = -1; - } - return value; - } - - @Override - protected void setValue_(Integer value) { - if (value == -1) { - value = null; - } - subject.setReadConnectionsMin(value); - } - }; - } - - private PropertyValueModel<Integer> buildDefaultReadConnectionsMinHolder() { - return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), "") { - @Override - protected Integer buildValue_() { - return subject.getDefaultReadConnectionsMin(); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Integer.MIN_VALUE, newValue); - } - } - }; - } - - private Control buildDefaultReadConnectionsMinLabel(Composite container) { - - Label label = buildLabel( - container, - EclipseLinkUiMessages.DefaultWithoutValue - ); - - new LabeledControlUpdater( - new LabeledLabel(label), - buildDefaultReadConnectionsMinLabelHolder() - ); - - return label; - } - - private PropertyValueModel<String> buildDefaultReadConnectionsMinLabelHolder() { - - return new TransformationPropertyValueModel<Integer, String>(buildDefaultReadConnectionsMinHolder()) { - - @Override - protected String transform(Integer value) { - - if (value != null) { - return NLS.bind(EclipseLinkUiMessages.DefaultWithValue, value); - } - - return ""; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - Spinner spinner = this.buildLabeledSpinner( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_readConnectionsMinLabel, - this.buildReadConnectionsMinHolder(), - -1, - -1, - Integer.MAX_VALUE, - this.buildDefaultReadConnectionsMinLabel(container) - ); - - updateGridData(container, spinner); - } - - /** - * Changes the layout of the given container by changing which widget will - * grab the excess of horizontal space. By default, the center control grabs - * the excess space, we change it to be the right control. - * - * @param container The container containing the controls needing their - * <code>GridData</code> to be modified from the default values - * @param spinner The spinner that got created - */ - private void updateGridData(Composite container, Spinner spinner) { - - // It is possible the spinner's parent is not the container of the - // label, spinner and right control (a pane is sometimes required for - // painting the spinner's border) - Composite paneContainer = spinner.getParent(); - - while (container != paneContainer.getParent()) { - paneContainer = paneContainer.getParent(); - } - - Control[] controls = paneContainer.getChildren(); - - GridData gridData = new GridData(); - gridData.grabExcessHorizontalSpace = false; - gridData.horizontalAlignment = GridData.BEGINNING; - controls[1].setLayoutData(gridData); - - controls[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - removeAlignRight(controls[2]); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcReadConnectionsSharedComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcReadConnectionsSharedComposite.java deleted file mode 100644 index 547b654c24..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcReadConnectionsSharedComposite.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * ReadConnectionsSharedComposite - */ -public class JdbcReadConnectionsSharedComposite extends AbstractPane<Connection> -{ - /** - * Creates a new <code>ReadConnectionsSharedComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public JdbcReadConnectionsSharedComposite( - AbstractPane<? extends Connection> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Boolean> buildReadConnectionsSharedHolder() { - return new PropertyAspectAdapter<Connection, Boolean>(getSubjectHolder(), Connection.READ_CONNECTIONS_SHARED_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getReadConnectionsShared(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setReadConnectionsShared(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildReadConnectionsSharedStringHolder() { - return new TransformationPropertyValueModel<Boolean, String>(buildReadConnectionsSharedHolder()) { - @Override - protected String transform(Boolean value) { - if ((subject() != null) && (value == null)) { - Boolean defaultValue = subject().getDefaultReadConnectionsShared(); - if (defaultValue != null) { - String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; - return NLS.bind(EclipseLinkUiMessages.PersistenceXmlConnectionTab_readConnectionsSharedLabelDefault, defaultStringValue); - } - } - return EclipseLinkUiMessages.PersistenceXmlConnectionTab_readConnectionsSharedLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_readConnectionsSharedLabel, - this.buildReadConnectionsSharedHolder(), - this.buildReadConnectionsSharedStringHolder(), - null -// EclipseLinkHelpContextIds. - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcWriteConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcWriteConnectionPropertiesComposite.java deleted file mode 100644 index c62c741194..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcWriteConnectionPropertiesComposite.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -/** - * JdbcWriteConnectionPropertiesComposite - */ -@SuppressWarnings("nls") -public class JdbcWriteConnectionPropertiesComposite extends AbstractPane<Connection> -{ - public JdbcWriteConnectionPropertiesComposite(AbstractPane<Connection> parentComposite, Composite parent) { - - super(parentComposite, parent, false); - } - - @Override - protected void initializeLayout(Composite container) { - - container = this.buildSection( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_writeConnectionsSectionTitle - ); - - GridData data = (GridData) container.getLayoutData(); - data.verticalAlignment = SWT.TOP; - - data = (GridData) getControl().getLayoutData(); - data.verticalAlignment = SWT.TOP; - - // This will add space to have the same layout than read connection pool - Button space = this.getWidgetFactory().createCheckBox(container, "m"); - Point size = space.computeSize(SWT.DEFAULT, SWT.DEFAULT); - container = this.buildSubPane(container, size.y + 5); - space.dispose(); - - // Write Connections Minimum - new JdbcWriteConnectionsMinComposite(this, container); - - // Write Connections Maximum - new JdbcWriteConnectionsMaxComposite(this, container); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcWriteConnectionsMaxComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcWriteConnectionsMaxComposite.java deleted file mode 100644 index d5336af9f0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcWriteConnectionsMaxComposite.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.LabeledControlUpdater; -import org.eclipse.jpt.ui.internal.util.LabeledLabel; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -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.osgi.util.NLS; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Spinner; - -/** - * JdbcWriteConnectionsMaxComposite - */ -@SuppressWarnings("nls") -public class JdbcWriteConnectionsMaxComposite extends AbstractPane<Connection> -{ - /** - * Creates a new <code>JdbcWriteConnectionsMaxComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public JdbcWriteConnectionsMaxComposite(AbstractPane<Connection> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Integer> buildWriteConnectionsMaxHolder() { - return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), Connection.WRITE_CONNECTIONS_MAX_PROPERTY) { - @Override - protected Integer buildValue_() { - Integer value = subject.getWriteConnectionsMax(); - - if (value == null) { - value = -1; - } - return value; - } - - @Override - protected void setValue_(Integer value) { - if (value == -1) { - value = null; - } - subject.setWriteConnectionsMax(value); - } - }; - } - - private PropertyValueModel<Integer> buildDefaultWriteConnectionsMaxHolder() { - return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), "") { - @Override - protected Integer buildValue_() { - return subject.getDefaultWriteConnectionsMax(); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Integer.MIN_VALUE, newValue); - } - } - }; - } - - private Control buildDefaultWriteConnectionsMaxLabel(Composite container) { - - Label label = buildLabel( - container, - EclipseLinkUiMessages.DefaultWithoutValue - ); - - new LabeledControlUpdater( - new LabeledLabel(label), - buildDefaultWriteConnectionsMaxLabelHolder() - ); - - return label; - } - - private PropertyValueModel<String> buildDefaultWriteConnectionsMaxLabelHolder() { - - return new TransformationPropertyValueModel<Integer, String>(buildDefaultWriteConnectionsMaxHolder()) { - - @Override - protected String transform(Integer value) { - - if (value != null) { - return NLS.bind(EclipseLinkUiMessages.DefaultWithValue, value); - } - - return ""; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - Spinner spinner = this.buildLabeledSpinner( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_writeConnectionsMaxLabel, - this.buildWriteConnectionsMaxHolder(), - -1, - -1, - Integer.MAX_VALUE, - this.buildDefaultWriteConnectionsMaxLabel(container) - ); - - updateGridData(container, spinner); - } - - /** - * Changes the layout of the given container by changing which widget will - * grab the excess of horizontal space. By default, the center control grabs - * the excess space, we change it to be the right control. - * - * @param container The container containing the controls needing their - * <code>GridData</code> to be modified from the default values - * @param spinner The spinner that got created - */ - private void updateGridData(Composite container, Spinner spinner) { - - // It is possible the spinner's parent is not the container of the - // label, spinner and right control (a pane is sometimes required for - // painting the spinner's border) - Composite paneContainer = spinner.getParent(); - - while (container != paneContainer.getParent()) { - paneContainer = paneContainer.getParent(); - } - - Control[] controls = paneContainer.getChildren(); - - GridData gridData = new GridData(); - gridData.grabExcessHorizontalSpace = false; - gridData.horizontalAlignment = GridData.BEGINNING; - controls[1].setLayoutData(gridData); - - controls[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - removeAlignRight(controls[2]); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcWriteConnectionsMinComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcWriteConnectionsMinComposite.java deleted file mode 100644 index bc39035de9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/JdbcWriteConnectionsMinComposite.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.LabeledControlUpdater; -import org.eclipse.jpt.ui.internal.util.LabeledLabel; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -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.osgi.util.NLS; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Spinner; - -/** - * JdbcWriteConnectionsMinComposite - */ -@SuppressWarnings("nls") -public class JdbcWriteConnectionsMinComposite extends AbstractPane<Connection> -{ - /** - * Creates a new <code>JdbcWriteConnectionsMinComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public JdbcWriteConnectionsMinComposite(AbstractPane<Connection> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Integer> buildWriteConnectionsMinHolder() { - return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), Connection.WRITE_CONNECTIONS_MIN_PROPERTY) { - @Override - protected Integer buildValue_() { - Integer value = subject.getWriteConnectionsMin(); - - if (value == null) { - value = -1; - } - return value; - } - - @Override - protected void setValue_(Integer value) { - if (value == -1) { - value = null; - } - subject.setWriteConnectionsMin(value); - } - }; - } - - private PropertyValueModel<Integer> buildDefaultWriteConnectionsMinHolder() { - return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), "") { - @Override - protected Integer buildValue_() { - return subject.getDefaultWriteConnectionsMin(); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Integer.MIN_VALUE, newValue); - } - } - }; - } - - private Control buildDefaultWriteConnectionsMinLabel(Composite container) { - - Label label = buildLabel( - container, - EclipseLinkUiMessages.DefaultWithoutValue - ); - - new LabeledControlUpdater( - new LabeledLabel(label), - buildDefaultWriteConnectionsMinLabelHolder() - ); - - return label; - } - - private PropertyValueModel<String> buildDefaultWriteConnectionsMinLabelHolder() { - - return new TransformationPropertyValueModel<Integer, String>(buildDefaultWriteConnectionsMinHolder()) { - - @Override - protected String transform(Integer value) { - - if (value != null) { - return NLS.bind(EclipseLinkUiMessages.DefaultWithValue, value); - } - - return ""; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - Spinner spinner = this.buildLabeledSpinner( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_writeConnectionsMinLabel, - this.buildWriteConnectionsMinHolder(), - -1, - -1, - Integer.MAX_VALUE, - this.buildDefaultWriteConnectionsMinLabel(container) - ); - - updateGridData(container, spinner); - } - - /** - * Changes the layout of the given container by changing which widget will - * grab the excess of horizontal space. By default, the center control grabs - * the excess space, we change it to be the right control. - * - * @param container The container containing the controls needing their - * <code>GridData</code> to be modified from the default values - * @param spinner The spinner that got created - */ - private void updateGridData(Composite container, Spinner spinner) { - - // It is possible the spinner's parent is not the container of the - // label, spinner and right control (a pane is sometimes required for - // painting the spinner's border) - Composite paneContainer = spinner.getParent(); - - while (container != paneContainer.getParent()) { - paneContainer = paneContainer.getParent(); - } - - Control[] controls = paneContainer.getChildren(); - - GridData gridData = new GridData(); - gridData.grabExcessHorizontalSpace = false; - gridData.horizontalAlignment = GridData.BEGINNING; - controls[1].setLayoutData(gridData); - - controls[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - removeAlignRight(controls[2]); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/NativeSqlComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/NativeSqlComposite.java deleted file mode 100644 index ea891c7860..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/NativeSqlComposite.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * NativeSqlComposite - */ -public class NativeSqlComposite extends AbstractPane<Connection> -{ - /** - * Creates a new <code>NativeSqlComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public NativeSqlComposite( - AbstractPane<? extends Connection> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Boolean> buildNativeSqlHolder() { - return new PropertyAspectAdapter<Connection, Boolean>(getSubjectHolder(), Connection.NATIVE_SQL_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getNativeSql(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setNativeSql(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildNativeSqlStringHolder() { - return new TransformationPropertyValueModel<Boolean, String>(buildNativeSqlHolder()) { - @Override - protected String transform(Boolean value) { - if ((subject() != null) && (value == null)) { - Boolean defaultValue = subject().getDefaultNativeSql(); - if (defaultValue != null) { - String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; - return NLS.bind(EclipseLinkUiMessages.PersistenceXmlConnectionTab_nativeSqlLabelDefault, defaultStringValue); - } - } - return EclipseLinkUiMessages.PersistenceXmlConnectionTab_nativeSqlLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_nativeSqlLabel, - this.buildNativeSqlHolder(), - this.buildNativeSqlStringHolder(), - null -// EclipseLinkHelpContextIds. - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/PersistenceXmlConnectionTab.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/PersistenceXmlConnectionTab.java deleted file mode 100644 index b1c3058679..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/PersistenceXmlConnectionTab.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 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.eclipselink.ui.internal.connection; - -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaPageComposite; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; - -/** - * PersistenceXmlConnectionTab - */ -public class PersistenceXmlConnectionTab - extends AbstractFormPane<Connection> - implements JpaPageComposite -{ - // ********** constructors/initialization ********** - public PersistenceXmlConnectionTab( - PropertyValueModel<Connection> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - new EclipseLinkConnectionComposite(this, container); - } - - // ********** JpaPageComposite implementation ********** - public String getHelpID() { - return null; - } - - public Image getPageImage() { - return null; - } - - public String getPageText() { - return EclipseLinkUiMessages.PersistenceXmlConnectionTab_title; - } - - // ********** Layout ********** - @Override - protected Composite buildContainer(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.buildPane(parent, layout); - this.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); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/TransactionTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/TransactionTypeComposite.java deleted file mode 100644 index f8432780e6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/connection/TransactionTypeComposite.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.connection; - -import java.util.Collection; -import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType; -import org.eclipse.jpt.eclipselink.core.internal.context.connection.Connection; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.swt.widgets.Composite; - -/** - * TransactionTypeComposite - */ -public class TransactionTypeComposite extends AbstractFormPane<Connection> -{ - /** - * Creates a new <code>TransactionTypeComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public TransactionTypeComposite( - AbstractFormPane<? extends Connection> parentComposite, - Composite parent) { - - super( parentComposite, parent); - } - - private EnumFormComboViewer<Connection, PersistenceUnitTransactionType> buildTransactionTypeCombo(Composite container) { - return new EnumFormComboViewer<Connection, PersistenceUnitTransactionType>(this, container) { - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(Connection.TRANSACTION_TYPE_PROPERTY); - } - - @Override - protected PersistenceUnitTransactionType[] choices() { - return PersistenceUnitTransactionType.values(); - } - - @Override - protected PersistenceUnitTransactionType defaultValue() { - return subject().getDefaultTransactionType(); - } - - @Override - protected String displayString(PersistenceUnitTransactionType value) { - return buildDisplayString(EclipseLinkUiMessages.class, TransactionTypeComposite.this, value); - } - - @Override - protected PersistenceUnitTransactionType getValue() { - return subject().getTransactionType(); - } - - @Override - protected void setValue(PersistenceUnitTransactionType value) { - subject().setTransactionType(value); - - if (value == PersistenceUnitTransactionType.RESOURCE_LOCAL) { - clearJTAProperties(); - } - else { - clearResourceLocalProperties(); - } - } - }; - } - - private void clearJTAProperties() { - subject().setJtaDataSource(null); - } - - private void clearResourceLocalProperties() { - Connection connection = subject(); - connection.setNonJtaDataSource(null); - connection.setDriver(null); - connection.setUrl(null); - connection.setUser(null); - connection.setPassword(null); - connection.setBindParameters(null); - connection.setWriteConnectionsMax(null); - connection.setWriteConnectionsMin(null); - connection.setReadConnectionsMax(null); - connection.setReadConnectionsMin(null); - connection.setReadConnectionsShared(null); - } - - @Override - protected void initializeLayout( Composite container) { - - this.buildLabeledComposite( - container, - EclipseLinkUiMessages.PersistenceXmlConnectionTab_transactionTypeLabel, - this.buildTransactionTypeCombo( container), - null // TODO IJpaHelpContextIds. - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/CustomizerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/CustomizerComposite.java deleted file mode 100644 index b68e09205f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/CustomizerComposite.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.customization; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.eclipselink.core.internal.context.customization.Customization; -import org.eclipse.jpt.eclipselink.ui.JptEclipseLinkUiPlugin; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * CustomizerComposite - */ -public class CustomizerComposite extends AbstractPane<EntityCustomizerProperties> -{ - /** - * Creates a new <code>CustomizerComposite</code>. - * - * @param parentPane The parent pane of this one - * @param parent The parent container - */ - public CustomizerComposite(AbstractPane<? extends EntityCustomizerProperties> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private ClassChooserPane<EntityCustomizerProperties> initializeClassChooser(Composite container) { - - return new ClassChooserPane<EntityCustomizerProperties>(this, container) { - - @Override - protected WritablePropertyValueModel<String> buildTextHolder() { - return new PropertyAspectAdapter<EntityCustomizerProperties, String>( - getSubjectHolder(), Customization.DESCRIPTOR_CUSTOMIZER_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getDescriptorCustomizer(); - } - - @Override - protected void setValue_(String value) { - - if (value.length() == 0) { - value = null; - } - this.subject.setDescriptorCustomizer(value); - } - }; - } - - @Override - protected String className() { - return subject().getDescriptorCustomizer(); - } - - @Override - protected String labelText() { - return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_customizerLabel; - } - - @Override - protected IPackageFragmentRoot packageFragmentRoot() { - IProject project = subject().getJpaProject().getProject(); - IJavaProject root = JavaCore.create(project); - - try { - return root.getAllPackageFragmentRoots()[0]; - } - catch (JavaModelException e) { - JptEclipseLinkUiPlugin.log(e); - } - return null; - } - - @Override - protected void promptType() { - IType type = chooseType(); - - if (type != null) { - String className = type.getFullyQualifiedName('.'); - subject().setDescriptorCustomizer(className); - } - } - }; - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - this.initializeClassChooser(container); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/EclipseLinkCustomizationComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/EclipseLinkCustomizationComposite.java deleted file mode 100644 index 648b7fc1ae..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/EclipseLinkCustomizationComposite.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.customization; - -import org.eclipse.jpt.eclipselink.core.internal.context.customization.Customization; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.forms.widgets.ExpandableComposite; -import org.eclipse.ui.forms.widgets.Section; - -/** - * PersistenceUnitCustomizationComposite - */ -public class EclipseLinkCustomizationComposite extends AbstractFormPane<Customization> -{ - public EclipseLinkCustomizationComposite(AbstractFormPane<Customization> subjectHolder, - Composite container) { - - super(subjectHolder, container); - } - - @Override - protected void initializeLayout(Composite parent) { - Section section = getWidgetFactory().createSection(parent, SWT.FLAT | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION); - section.setText(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_sectionTitle); - section.setDescription(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_sectionDescription); - section.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Composite composite = this.buildSubPane(section); - section.setClient(composite); - - // Default pane - int groupBoxMargin = this.groupBoxMargin(); - - Composite defaultPane = this.buildSubPane( - composite, - 0, groupBoxMargin, 0, groupBoxMargin - ); - - // Weaving - new WeavingComposite(this, defaultPane); - - // Weaving Lazy - new WeavingLazyComposite(this, defaultPane); - - // Weaving Fetch Groups - new WeavingFetchGroupsComposite(this, defaultPane); - - // Weaving Change Tracking - new WeavingChangeTrackingComposite(this, defaultPane); - - // Throw Exceptions - new ThrowExceptionsComposite(this, defaultPane); - - // Session Customizer - new SessionCustomizerComposite(this, defaultPane); - - // EntitiesList - new EntityListComposite(this, composite); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/EntityCustomizationPropertyComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/EntityCustomizationPropertyComposite.java deleted file mode 100644 index bdbfcb5d75..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/EntityCustomizationPropertyComposite.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.customization; - -import org.eclipse.jpt.eclipselink.core.internal.context.customization.Customization; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * EntityCustomizationPropertyComposite - */ -public class EntityCustomizationPropertyComposite extends AbstractPane<EntityCustomizerProperties> { - - /** - * Creates a new <code>EntityCustomizationPropertyComposite</code>. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - */ - public EntityCustomizationPropertyComposite(AbstractPane<Customization> parentComposite, - PropertyValueModel<EntityCustomizerProperties> subjectHolder, - Composite parent) { - - super(parentComposite, subjectHolder, parent); - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - // Customizer - new CustomizerComposite(this, container); - - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/EntityCustomizerProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/EntityCustomizerProperties.java deleted file mode 100644 index 1d619b1a46..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/EntityCustomizerProperties.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.customization; - -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.eclipselink.core.internal.context.customization.Customization; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.jpt.utility.internal.model.AbstractModel; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; - -/** - * EntityCustomizerProperties - */ -public class EntityCustomizerProperties extends AbstractModel { - - private Customization customization; - - private String entityName; - - public static final String DESCRIPTOR_CUSTOMIZER_PROPERTY = Customization.DESCRIPTOR_CUSTOMIZER_PROPERTY; - - SimplePropertyValueModel<Customization> customizationHolder; - PropertyValueModel<String> descriptorCustomizerHolder; - PropertyChangeListener descriptorCustomizerListener; - - private static final long serialVersionUID = 1L; - - // ********** constructors ********** - public EntityCustomizerProperties(Customization customization, String entityName) { - super(); - this.customization = customization; - this.entityName = entityName; - this.customizationHolder = new SimplePropertyValueModel<Customization>(this.customization); - - this.descriptorCustomizerHolder = this.buildDescriptorCustomizerAA(this.customizationHolder); - this.descriptorCustomizerListener = this.buildDescriptorCustomizerChangeListener(); - this.descriptorCustomizerHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.descriptorCustomizerListener); - } - - // ********** behavior ********** - public boolean entityNameIsValid() { - return !StringTools.stringIsEmpty(this.entityName); - } - - public String getEntityName() { - return this.entityName; - } - - public String getDescriptorCustomizer() { - return this.customization.getDescriptorCustomizer(this.entityName); - } - - public String getDefaultDescriptorCustomizer() { - return this.customization.getDefaultDescriptorCustomizer(); - } - - public void setDescriptorCustomizer(String descriptorCustomizer) { - String old = this.getDescriptorCustomizer(); - if (this.attributeValueHasChanged(old, descriptorCustomizer)) { - this.customization.setDescriptorCustomizer(descriptorCustomizer, this.entityName); - this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, descriptorCustomizer); - } - } - - public JpaProject getJpaProject() { - return this.customization.getJpaProject(); - } - - // ********** PropertyChangeListener ********** - - private PropertyValueModel<String> buildDescriptorCustomizerAA(PropertyValueModel<Customization> subjectHolder) { - return new PropertyAspectAdapter<Customization, String>( - subjectHolder, DESCRIPTOR_CUSTOMIZER_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getDescriptorCustomizer(EntityCustomizerProperties.this.entityName); - } - }; - } - - private PropertyChangeListener buildDescriptorCustomizerChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - EntityCustomizerProperties.this.descriptorCustomizerChanged(e); - } - }; - } - - protected void descriptorCustomizerChanged(PropertyChangeEvent e) { - String old = (String) e.getOldValue(); - String newDescriptorCustomizer = (String) e.getNewValue(); - this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, newDescriptorCustomizer); - return; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - StringTools.buildSimpleToStringOn(this, sb); - sb.append(" ("); - this.toString(sb); - sb.append(')'); - return sb.toString(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append("name: "); - sb.append(this.entityName); - sb.append(", descriptorCustomizer: "); - sb.append(this.getDescriptorCustomizer()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/EntityListComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/EntityListComposite.java deleted file mode 100644 index c34b8d9b5b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/EntityListComposite.java +++ /dev/null @@ -1,248 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2007, 2008 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.eclipselink.ui.internal.customization; - -import java.util.ListIterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.search.IJavaSearchScope; -import org.eclipse.jdt.core.search.SearchEngine; -import org.eclipse.jdt.ui.IJavaElementSearchConstants; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.Entity; -import org.eclipse.jpt.core.context.PersistentType; -import org.eclipse.jpt.core.context.TypeMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.customization.Customization; -import org.eclipse.jpt.eclipselink.ui.JptEclipseLinkUiPlugin; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.PaneEnabler; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.utility.internal.model.value.TransformationListValueModelAdapter; -import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel; -import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel; -import org.eclipse.jpt.utility.model.value.ListValueModel; -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.ui.PlatformUI; -import org.eclipse.ui.dialogs.SelectionDialog; -import org.eclipse.ui.progress.IProgressService; - -/** - * EntityListComposite - */ -public class EntityListComposite extends AbstractPane<Customization> -{ - private WritablePropertyValueModel<EntityCustomizerProperties> entityHolder; - - public EntityListComposite(AbstractPane<Customization> parentComposite, Composite parent) { - - super(parentComposite, parent); - } - - @Override - protected void initialize() { - super.initialize(); - entityHolder = this.buildEntityHolder(); - } - - @Override - protected void initializeLayout(Composite container) { - - container = this.buildTitledPane( - container, - EclipseLinkUiMessages.CustomizationEntityListComposite_groupTitle - ); - - // Entities add/remove list pane - new AddRemoveListPane<Customization>( - this, - container, - this.buildEntitiesAdapter(), - this.buildEntityCustomizationListHolder(), - entityHolder, - this.buildEntityLabelProvider(), - null // EclipseLinkHelpContextIds.CUSTOMIZATION_ENTITIES - ); - - // Entity Customization property pane - EntityCustomizationPropertyComposite pane = new EntityCustomizationPropertyComposite( - this, - entityHolder, - container - ); - this.installPaneEnabler(entityHolder, pane); - } - - private AddRemoveListPane.Adapter buildEntitiesAdapter() { - return new AddRemoveListPane.AbstractAdapter() { - public void addNewItem(ObjectListSelectionModel listSelectionModel) { - addEntities(listSelectionModel); - } - - public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) { - Customization customization = subject(); - for (Object item : listSelectionModel.selectedValues()) { - EntityCustomizerProperties entityCustomization = (EntityCustomizerProperties) item; - customization.removeEntity(entityCustomization.getEntityName()); - } - } - }; - } - - private void addEntities(ObjectListSelectionModel listSelectionModel) { - - IType type = this.chooseEntity(); - - if (type != null) { - String entityName = this.getEntityName(type.getFullyQualifiedName()); - if (entityName == null) { - entityName = type.getElementName(); - } - - if( ! this.subject().entityExists(entityName)) { - String entity = this.subject().addEntity(entityName); - - int index = CollectionTools.indexOf(this.subject().entities(), entityName); - EntityCustomizerProperties item = (EntityCustomizerProperties) listSelectionModel.getListModel().getElementAt(index); - entityHolder.setValue(item); - } - } - } - - private String getEntityName(String fullyQualifiedTypeName) { - - PersistentType persistentType = subject().persistenceUnit().getPersistentType(fullyQualifiedTypeName); - - if (persistentType != null && persistentType.getMappingKey() == MappingKeys.ENTITY_TYPE_MAPPING_KEY) { - TypeMapping mapping = persistentType.getMapping(); - if (mapping instanceof Entity) { - return ((Entity)mapping).getName(); - } - } - return null; - } - - private IType chooseEntity() { - - IPackageFragmentRoot root = packageFragmentRoot(); - if (root == null) { - return null; - } - IJavaElement[] elements = new IJavaElement[] { root.getJavaProject() }; - IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements); - IProgressService service = PlatformUI.getWorkbench().getProgressService(); - SelectionDialog typeSelectionDialog; - - try { - typeSelectionDialog = JavaUI.createTypeDialog( - shell(), - service, - scope, - IJavaElementSearchConstants.CONSIDER_CLASSES, - false, - "" - ); - } - catch (JavaModelException e) { - JptEclipseLinkUiPlugin.log(e); - return null; - } - typeSelectionDialog.setTitle(EclipseLinkUiMessages.CustomizationEntityListComposite_dialogTitle); - typeSelectionDialog.setMessage(EclipseLinkUiMessages.CustomizationEntityListComposite_dialogMessage); - - if (typeSelectionDialog.open() == Window.OK) { - return (IType) typeSelectionDialog.getResult()[0]; - } - return null; - } - - private IPackageFragmentRoot packageFragmentRoot() { - IProject project = subject().getJpaProject().getProject(); - IJavaProject root = JavaCore.create(project); - - try { - return root.getAllPackageFragmentRoots()[0]; - } - catch (JavaModelException e) { - JptEclipseLinkUiPlugin.log(e); - } - return null; - } - - private ILabelProvider buildEntityLabelProvider() { - return new LabelProvider() { - @Override - public String getText(Object element) { - EntityCustomizerProperties entityCustomization = (EntityCustomizerProperties) element; - return entityCustomization.getEntityName(); - } - }; - } - - private WritablePropertyValueModel<EntityCustomizerProperties> buildEntityHolder() { - return new SimplePropertyValueModel<EntityCustomizerProperties>(); - } - - private ListValueModel<EntityCustomizerProperties> buildEntityCustomizationListHolder() { - return new TransformationListValueModelAdapter<String, EntityCustomizerProperties>(buildEntitiesListHolder()) { - @Override - protected EntityCustomizerProperties transformItem(String item) { - return new EntityCustomizerProperties(subject(), item); - } - }; - } - - private ListValueModel<String> buildEntitiesListHolder() { - return new ListAspectAdapter<Customization, String>( - this.getSubjectHolder(), Customization.ENTITIES_LIST_PROPERTY) { - @Override - protected ListIterator<String> listIterator_() { - return this.subject.entities(); - } - @Override - protected int size_() { - return this.subject.entitiesSize(); - } - }; - } - - private void installPaneEnabler(WritablePropertyValueModel<EntityCustomizerProperties> entityHolder, - EntityCustomizationPropertyComposite pane) { - - new PaneEnabler( - this.buildPaneEnablerHolder(entityHolder), - pane - ); - } - - private PropertyValueModel<Boolean> buildPaneEnablerHolder(WritablePropertyValueModel<EntityCustomizerProperties> entityHolder) { - return new TransformationPropertyValueModel<EntityCustomizerProperties, Boolean>(entityHolder) { - @Override - protected Boolean transform_(EntityCustomizerProperties value) { - return value.entityNameIsValid(); - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/PersistenceXmlCustomizationTab.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/PersistenceXmlCustomizationTab.java deleted file mode 100644 index c547986f4c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/PersistenceXmlCustomizationTab.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.customization; - -import org.eclipse.jpt.eclipselink.core.internal.context.customization.Customization; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaPageComposite; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; - -/** - * PersistenceXmlCustomizationTabItem - */ -public class PersistenceXmlCustomizationTab - extends AbstractFormPane<Customization> - implements JpaPageComposite -{ - public PersistenceXmlCustomizationTab( - PropertyValueModel<Customization> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - - new EclipseLinkCustomizationComposite(this, container); - } - - // ********** JpaPageComposite implementation ********** - - public String getHelpID() { - return null; - } - - public Image getPageImage() { - return null; - } - public String getPageText() { - return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_title; - } - - // ********** Layout ********** - - @Override - protected Composite buildContainer(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 = buildPane(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); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/SessionCustomizerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/SessionCustomizerComposite.java deleted file mode 100644 index 5cc9cecfff..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/SessionCustomizerComposite.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.customization; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.eclipselink.core.internal.context.customization.Customization; -import org.eclipse.jpt.eclipselink.ui.JptEclipseLinkUiPlugin; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * SessionCustomizerComposite - */ -public class SessionCustomizerComposite extends AbstractPane<Customization> -{ - /** - * Creates a new <code>SessionCustomizerComposite</code>. - * - * @param parentPane The parent pane of this one - * @param parent The parent container - */ - public SessionCustomizerComposite(AbstractPane<? extends Customization> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private ClassChooserPane<Customization> initializeClassChooser(Composite container) { - - return new ClassChooserPane<Customization>(this, container) { - - @Override - protected WritablePropertyValueModel<String> buildTextHolder() { - return new PropertyAspectAdapter<Customization, String>(getSubjectHolder(), Customization.SESSION_CUSTOMIZER_PROPERTY) { - @Override - protected String buildValue_() { - return subject.getSessionCustomizer(); - } - - @Override - protected void setValue_(String value) { - - if (value.length() == 0) { - value = null; - } - - subject.setSessionCustomizer(value); - } - }; - } - - @Override - protected String className() { - return subject().getSessionCustomizer(); - } - - @Override - protected String labelText() { - return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_sessionCustomizerLabel; - } - - @Override - protected IPackageFragmentRoot packageFragmentRoot() { - IProject project = subject().getJpaProject().getProject(); - IJavaProject root = JavaCore.create(project); - - try { - return root.getAllPackageFragmentRoots()[0]; - } - catch (JavaModelException e) { - JptEclipseLinkUiPlugin.log(e); - } - return null; - } - - @Override - protected void promptType() { - IType type = chooseType(); - - if (type != null) { - String className = type.getFullyQualifiedName('.'); - subject().setSessionCustomizer(className); - } - } - }; - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - this.initializeClassChooser(container); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/ThrowExceptionsComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/ThrowExceptionsComposite.java deleted file mode 100644 index 9257a1ca24..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/ThrowExceptionsComposite.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.customization; - -import org.eclipse.jpt.eclipselink.core.internal.context.customization.Customization; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * ThrowExceptionsComposite - */ -public class ThrowExceptionsComposite extends AbstractFormPane<Customization> -{ - /** - * Creates a new <code>ThrowExceptionsComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public ThrowExceptionsComposite( - AbstractFormPane<? extends Customization> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Boolean> buildThrowExceptionsHolder() { - return new PropertyAspectAdapter<Customization, Boolean>(getSubjectHolder(), Customization.THROW_EXCEPTIONS_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getThrowExceptions(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setThrowExceptions(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildThrowExceptionsStringHolder() { - return new TransformationPropertyValueModel<Boolean, String>(buildThrowExceptionsHolder()) { - @Override - protected String transform(Boolean value) { - if ((subject() != null) && (value == null)) { - Boolean defaultValue = subject().getDefaultThrowExceptions(); - if (defaultValue != null) { - String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; - return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_throwExceptionsLabelDefault, defaultStringValue); - } - } - return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_throwExceptionsLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMessages.PersistenceXmlCustomizationTab_throwExceptionsLabel, - this.buildThrowExceptionsHolder(), - this.buildThrowExceptionsStringHolder(), - null -// EclipseLinkHelpContextIds.CUSTOMIZATION_THROW_EXCEPTIONS - ); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/WeavingChangeTrackingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/WeavingChangeTrackingComposite.java deleted file mode 100644 index ff2b0d7d75..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/WeavingChangeTrackingComposite.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.customization; - -import org.eclipse.jpt.eclipselink.core.internal.context.customization.Customization; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * WeavingChangeTrackingComposite - */ -public class WeavingChangeTrackingComposite extends AbstractFormPane<Customization> -{ - /** - * Creates a new <code>WeavingChangeTrackingComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public WeavingChangeTrackingComposite( - AbstractFormPane<? extends Customization> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Boolean> buildWeavingChangeTrackingHolder() { - return new PropertyAspectAdapter<Customization, Boolean>(getSubjectHolder(), Customization.WEAVING_CHANGE_TRACKING_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getWeavingChangeTracking(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setWeavingChangeTracking(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildWeavingChangeTrackingStringHolder() { - return new TransformationPropertyValueModel<Boolean, String>(buildWeavingChangeTrackingHolder()) { - @Override - protected String transform(Boolean value) { - if ((subject() != null) && (value == null)) { - Boolean defaultValue = subject().getDefaultWeavingChangeTracking(); - if (defaultValue != null) { - String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; - return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingChangeTrackingLabelDefault, defaultStringValue); - } - } - return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingChangeTrackingLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingChangeTrackingLabel, - this.buildWeavingChangeTrackingHolder(), - this.buildWeavingChangeTrackingStringHolder(), - null -// EclipseLinkHelpContextIds.CUSTOMIZATION_WEAVING_CHANGE_TRACKING - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/WeavingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/WeavingComposite.java deleted file mode 100644 index d1b078a77d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/WeavingComposite.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.customization; - -import java.util.Collection; - -import org.eclipse.jpt.eclipselink.core.internal.context.customization.Customization; -import org.eclipse.jpt.eclipselink.core.internal.context.customization.Weaving; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.swt.widgets.Composite; - -/** - * WeavingComposite - */ -public class WeavingComposite extends AbstractFormPane<Customization> -{ - /** - * Creates a new <code>WeavingComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public WeavingComposite( - AbstractFormPane<? extends Customization> parentComposite, - Composite parent) { - - super( parentComposite, parent); - } - - private EnumFormComboViewer<Customization, Weaving> buildWeavingCombo(Composite container) { - return new EnumFormComboViewer<Customization, Weaving>(this, container) { - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(Customization.WEAVING_PROPERTY); - } - - @Override - protected Weaving[] choices() { - return Weaving.values(); - } - - @Override - protected Weaving defaultValue() { - return subject().getDefaultWeaving(); - } - - @Override - protected String displayString(Weaving value) { - return buildDisplayString(EclipseLinkUiMessages.class, WeavingComposite.this, value); - } - - @Override - protected Weaving getValue() { - return subject().getWeaving(); - } - - @Override - protected void setValue(Weaving value) { - subject().setWeaving(value); - } - }; - } - - @Override - protected void initializeLayout( Composite container) { - - this.buildLabeledComposite( - container, - EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingLabel, - this.buildWeavingCombo( container), - null // TODO IJpaHelpContextIds. - ); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/WeavingFetchGroupsComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/WeavingFetchGroupsComposite.java deleted file mode 100644 index 7e1f1829d8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/WeavingFetchGroupsComposite.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.customization; - -import org.eclipse.jpt.eclipselink.core.internal.context.customization.Customization; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * WeavingFetchGroupsComposite - */ -public class WeavingFetchGroupsComposite extends AbstractFormPane<Customization> -{ - /** - * Creates a new <code>WeavingFetchGroupsComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public WeavingFetchGroupsComposite( - AbstractFormPane<? extends Customization> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Boolean> buildWeavingLazyHolder() { - return new PropertyAspectAdapter<Customization, Boolean>(getSubjectHolder(), Customization.WEAVING_FETCH_GROUPS_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getWeavingFetchGroups(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setWeavingFetchGroups(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildWeavingLazyStringHolder() { - return new TransformationPropertyValueModel<Boolean, String>(buildWeavingLazyHolder()) { - @Override - protected String transform(Boolean value) { - if ((subject() != null) && (value == null)) { - Boolean defaultValue = subject().getDefaultWeavingLazy(); - if (defaultValue != null) { - String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; - return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingFetchGroupsLabelDefault, defaultStringValue); - } - } - return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingFetchGroupsLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingFetchGroupsLabel, - this.buildWeavingLazyHolder(), - this.buildWeavingLazyStringHolder(), - null -// EclipseLinkHelpContextIds.CUSTOMIZATION_WEAVING_FETCH_GROUPS - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/WeavingLazyComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/WeavingLazyComposite.java deleted file mode 100644 index 67d4adf1c5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/customization/WeavingLazyComposite.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.customization; - -import org.eclipse.jpt.eclipselink.core.internal.context.customization.Customization; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * WeavingLazyComposite - */ -public class WeavingLazyComposite extends AbstractFormPane<Customization> -{ - /** - * Creates a new <code>WeavingLazyComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public WeavingLazyComposite( - AbstractFormPane<? extends Customization> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Boolean> buildWeavingLazyHolder() { - return new PropertyAspectAdapter<Customization, Boolean>(getSubjectHolder(), Customization.WEAVING_LAZY_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getWeavingLazy(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setWeavingLazy(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildWeavingLazyStringHolder() { - return new TransformationPropertyValueModel<Boolean, String>(buildWeavingLazyHolder()) { - @Override - protected String transform(Boolean value) { - if ((subject() != null) && (value == null)) { - Boolean defaultValue = subject().getDefaultWeavingLazy(); - if (defaultValue != null) { - String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; - return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingLazyLabelDefault, defaultStringValue); - } - } - return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingLazyLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMessages.PersistenceXmlCustomizationTab_weavingLazyLabel, - this.buildWeavingLazyHolder(), - this.buildWeavingLazyStringHolder(), - null -// EclipseLinkHelpContextIds.CUSTOMIZATION_WEAVING_LAZY - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/ddlgen/EclipseLinkDDLGeneratorUi.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/ddlgen/EclipseLinkDDLGeneratorUi.java deleted file mode 100644 index 2e80963ce9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/ddlgen/EclipseLinkDDLGeneratorUi.java +++ /dev/null @@ -1,175 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2007, 2008 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.eclipselink.ui.internal.ddlgen; - -import java.text.MessageFormat; -import java.util.Iterator; - -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.jpt.core.JpaPlatform; -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.core.context.persistence.Persistence; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.eclipselink.core.internal.ddlgen.EclipseLinkDDLGenerator; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.eclipselink.ui.internal.ddlgen.wizards.GenerateDDLWizard; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -/** - * EclipseLinkDLLGeneratorUi is used by the EclipseLinkPlatformUi to initiate - * the execution of EclipseLink DDL generator. - */ -public class EclipseLinkDDLGeneratorUi -{ - private JpaProject project; - private String projectLocation; - private IStructuredSelection selection; - - // ********** constructors ********** - - public static void generate(JpaProject project, String projectLocation, IStructuredSelection selection) { - if (project == null) { - throw new NullPointerException(); - } - new EclipseLinkDDLGeneratorUi(project, projectLocation, selection).generate(); - } - - private EclipseLinkDDLGeneratorUi() { - super(); - } - - private EclipseLinkDDLGeneratorUi(JpaProject project, String projectLocation, IStructuredSelection selection) { - super(); - this.project = project; - this.selection = selection; - this.projectLocation = projectLocation; - } - - // ********** behavior ********** - - protected void generate() { - - PersistenceUnit persistenceUnit = this.getPersistenceUnits().next(); // Take the first persistenceUnit - String puName = persistenceUnit.getName(); - if( ! this.displayGeneratingDDLWarning()) { - return; - } - - GenerateDDLWizard wizard = new GenerateDDLWizard(this.project); - WizardDialog dialog = new WizardDialog(this.getCurrentShell(), wizard); - dialog.create(); - if(wizard.getPageCount() > 0) { - int returnCode = dialog.open(); - if (returnCode == Window.CANCEL) { - return; - } - } - IWorkspaceRunnable runnable = new GenerateDDLRunnable(puName, this.project, projectLocation); - try { - ResourcesPlugin.getWorkspace().run(runnable, new NullProgressMonitor()); - } - catch (CoreException ex) { - throw new RuntimeException(ex); - } - } - - private Shell getCurrentShell() { - return Display.getCurrent().getActiveShell(); - } - - private boolean displayGeneratingDDLWarning() { - String message = org.eclipse.osgi.util.NLS.bind( - EclipseLinkUiMessages.EclipseLinkDDLGeneratorUi_generatingDDLWarningMessage, - System.getProperty("line.separator"), - System.getProperty("line.separator") + System.getProperty( "line.separator")); - - return MessageDialog.openQuestion( - this.getCurrentShell(), - EclipseLinkUiMessages.EclipseLinkDDLGeneratorUi_generatingDDLWarningTitle, - message); - } - - // ********** Persistence Unit ********** - - protected JpaPlatform getPlatform() { - return this.project.getJpaPlatform(); - } - - protected Iterator<PersistenceUnit> getPersistenceUnits() { - return this.getPersistence().persistenceUnits(); - } - - protected Persistence getPersistence() { - return this.project.getRootContext().getPersistenceXml().getPersistence(); - } - - // ********** runnable ********** - - static class GenerateDDLRunnable implements IWorkspaceRunnable { - private final String puName; - private final JpaProject project; - private String projectLocation; - - GenerateDDLRunnable(String puName, JpaProject project, String projectLocation) { - super(); - this.puName = puName; - this.project = project; - this.projectLocation = projectLocation; - } - - public void run(IProgressMonitor monitor) throws CoreException { - try { - EclipseLinkDDLGenerator.generate(this.puName, this.project, this.projectLocation, monitor); - } - catch (OperationCanceledException e) { - return; - // fall through and tell monitor we are done - } - catch (RuntimeException re) { - String msg = re.getMessage(); - String message = (msg == null) ? re.toString() : msg; - - this.logError(message); - throw new RuntimeException(re); - } - } - - protected void logError(String message) { - this.displayError(message); - } - - private void displayError(String message) { - - String msg = MessageFormat.format(message, new String [] {message}); - MessageDialog.openError(getShell(), "Error", msg); - } - - private Shell getShell() { - Display display = Display.getCurrent(); - Shell shell = (display == null) ? null : display.getActiveShell(); - if (shell == null && display != null) { - Shell[] shells = display.getShells(); - if (shells.length > 0) - shell = shells[0]; - } - return shell; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/ddlgen/wizards/GenerateDDLWizard.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/ddlgen/wizards/GenerateDDLWizard.java deleted file mode 100644 index 1f5be988d3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/ddlgen/wizards/GenerateDDLWizard.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2007, 2008 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.eclipselink.ui.internal.ddlgen.wizards; - -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.core.JptCorePlugin; -import org.eclipse.jpt.db.ConnectionProfile; -import org.eclipse.jpt.ui.internal.wizards.DatabaseConnectionWizardPage; - -/** - * GenerateDDLWizard - */ -public class GenerateDDLWizard extends Wizard { - - private JpaProject jpaProject; - - private DatabaseConnectionWizardPage dbSettingsPage; - - public GenerateDDLWizard(JpaProject jpaProject) { - super(); - this.jpaProject = jpaProject; - this.setWindowTitle("DDL Generation"); // TODO - } - - @Override - public void addPages() { - super.addPages(); - if (this.getProjectConnectionProfile() == null) { - this.dbSettingsPage = new DatabaseConnectionWizardPage(this.jpaProject); - this.addPage(this.dbSettingsPage); - } - } - - @Override - public boolean performFinish() { - if (this.getProjectConnectionProfile() != null) { - return true; - } - ConnectionProfile cp = this.dbSettingsPage.getSelectedConnectionProfile(); - if (cp == null) { - return false; - } - this.setProjectConnectionProfileName(cp.getName()); - return true; - } - - @Override - public boolean canFinish() { - return this.dbSettingsPage.isPageComplete(); - } - - private ConnectionProfile getProjectConnectionProfile() { - return this.jpaProject.getConnectionProfile(); - } - - private void setProjectConnectionProfileName(String connectionProfileName) { - this.jpaProject.getDataSource().setConnectionProfileName(connectionProfileName); - JptCorePlugin.setConnectionProfileName(this.jpaProject.getProject(), connectionProfileName); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaEntityComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaEntityComposite.java deleted file mode 100644 index c01aa2e3b8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/java/details/EclipseLinkJavaEntityComposite.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.java.details; - -import org.eclipse.jpt.core.context.java.JavaEntity; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEntity; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.CachingComposite; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.internal.java.details.JavaInheritanceComposite; -import org.eclipse.jpt.ui.internal.java.details.JavaSecondaryTablesComposite; -import org.eclipse.jpt.ui.internal.mappings.details.AbstractEntityComposite; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * The pane used for an EclipseLink Java entity. - * - * @see EclipseLinkJavaEntity - * @see EclipselinkJpaUiFactory - The factory creating this pane - * - * @version 2.0 - * @since 1.0 - */ -public class EclipseLinkJavaEntityComposite extends AbstractEntityComposite<JavaEntity> -{ - /** - * Creates a new <code>JavaEntityComposite</code>. - * - * @param subjectHolder The holder of the subject <code>JavaEntity</code> - * @param parent The parent container - * @param widgetFactory The factory used to create various common widgets - */ - public EclipseLinkJavaEntityComposite(PropertyValueModel<? extends JavaEntity> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - - @Override - protected void initializeLayout(Composite container) { - initializeGeneralPane(container); - initializeCachingPane(container); - initializeQueriesPane(container); - initializeInheritancePane(container); - initializeAttributeOverridesPane(container); - initializeGeneratorsPane(container); - initializeSecondaryTablesPane(container); - } - - protected void initializeCachingPane(Composite container) { - - container = buildCollapsableSection( - buildSubPane(container, 5), - EclipseLinkUiMappingsMessages.EclipseLinkJavaEntityComposite_caching - ); - - new CachingComposite(this, buildCachingHolder(), container); - } - - private PropertyAspectAdapter<JavaEntity, EclipseLinkCaching> buildCachingHolder() { - return new PropertyAspectAdapter<JavaEntity, EclipseLinkCaching>( - getSubjectHolder()) - { - @Override - protected EclipseLinkCaching buildValue_() { - return ((EclipseLinkJavaEntity) this.subject).getCaching(); - } - }; - - } - - @Override - protected void buildSecondaryTablesComposite(Composite container) { - new JavaSecondaryTablesComposite(this, container); - } - - @Override - protected void buildInheritanceComposite(Composite container) { - new JavaInheritanceComposite(this, container); - } - -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/EclipseLinkLoggingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/EclipseLinkLoggingComposite.java deleted file mode 100644 index 2ec15d0a07..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/EclipseLinkLoggingComposite.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.logging; - -import org.eclipse.jpt.eclipselink.core.internal.context.logging.Logging; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.forms.widgets.ExpandableComposite; -import org.eclipse.ui.forms.widgets.Section; - -/** - * EclipseLinkLoggingComposite - */ -public class EclipseLinkLoggingComposite - extends AbstractFormPane<Logging> -{ - public EclipseLinkLoggingComposite( - AbstractFormPane<Logging> subjectHolder, - Composite container) { - super(subjectHolder, container, false); - } - - @Override - protected void initializeLayout(Composite parent) { - Section section = getWidgetFactory().createSection(parent, SWT.FLAT | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION); - section.setText(EclipseLinkUiMessages.PersistenceXmlLoggingTab_sectionTitle); - section.setDescription(EclipseLinkUiMessages.PersistenceXmlLoggingTab_sectionDescription); - Composite composite = getWidgetFactory().createComposite(section); - composite.setLayout(new GridLayout(1, false)); - section.setClient(composite); - this.updateGridData(composite); - this.updateGridData(composite.getParent()); - - // LoggingLevel: - new LoggingLevelComposite(this, composite); - - // Timestamp: - new TimestampComposite(this, composite); - - // Thread: - new ThreadComposite(this, composite); - - // Session: - new SessionComposite(this, composite); - - // Exceptions: - new ExceptionsComposite(this, composite); - - // LoggingFile: - new LoggingFileLocationComposite(this, composite); - - // Logger: - new LoggerComposite(this, composite); - - return; - } - - 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); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/ExceptionsComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/ExceptionsComposite.java deleted file mode 100644 index 80e6dbc130..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/ExceptionsComposite.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.logging; - -import org.eclipse.jpt.eclipselink.core.internal.context.logging.Logging; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * ExceptionsComposite - */ -public class ExceptionsComposite extends AbstractFormPane<Logging> -{ - /** - * Creates a new <code>ExceptionsComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public ExceptionsComposite( - AbstractFormPane<? extends Logging> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Boolean> buildExceptionsHolder() { - return new PropertyAspectAdapter<Logging, Boolean>(getSubjectHolder(), Logging.EXCEPTIONS_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getExceptions(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setExceptions(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildExceptionsStringHolder() { - return new TransformationPropertyValueModel<Boolean, String>(buildExceptionsHolder()) { - @Override - protected String transform(Boolean value) { - if ((subject() != null) && (value == null)) { - Boolean defaultValue = subject().getDefaultExceptions(); - if (defaultValue != null) { - String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; - return NLS.bind(EclipseLinkUiMessages.PersistenceXmlLoggingTab_exceptionsLabelDefault, defaultStringValue); - } - } - return EclipseLinkUiMessages.PersistenceXmlLoggingTab_exceptionsLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMessages.PersistenceXmlLoggingTab_exceptionsLabel, - this.buildExceptionsHolder(), - this.buildExceptionsStringHolder(), - null -// EclipseLinkHelpContextIds.LOGGING_ - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/LoggerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/LoggerComposite.java deleted file mode 100644 index c7d60bf24d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/LoggerComposite.java +++ /dev/null @@ -1,197 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.logging; - -import java.text.Collator; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.Iterator; - -import org.eclipse.jpt.eclipselink.core.internal.context.logging.Logger; -import org.eclipse.jpt.eclipselink.core.internal.context.logging.Logging; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.SWTUtil; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.StringConverter; -import org.eclipse.jpt.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter; -import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter; -import org.eclipse.jpt.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.utility.model.value.ListValueModel; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.widgets.Composite; - -/** - * LoggerComposite - */ -public class LoggerComposite extends AbstractPane<Logging> -{ - /** - * Creates a new <code>LoggerComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public LoggerComposite( - AbstractPane<? extends Logging> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private PropertyValueModel<String> buildDefaultLoggerHolder() { - return new PropertyAspectAdapter<Logging, String>(this.getSubjectHolder(), Logging.DEFAULT_LOGGER) { - @Override - protected String buildValue_() { - return LoggerComposite.this.defaultValue(subject); - } - }; - } - - private ListValueModel<String> buildDefaultLoggerListHolder() { - return new PropertyListValueModelAdapter<String>( - this.buildDefaultLoggerHolder() - ); - } - - private String buildDisplayString(String loggerName) { - - switch (Logger.valueOf(loggerName)) { - case default_logger: { - return EclipseLinkUiMessages.LoggerComposite_default_logger; - } - case java_logger: { - return EclipseLinkUiMessages.LoggerComposite_java_logger; - } - case server_logger: { - return EclipseLinkUiMessages.LoggerComposite_server_logger; - } - default: { - return null; - } - } - } - - private Comparator<String> buildLoggerComparator() { - return new Comparator<String>() { - public int compare(String logger1, String logger2) { - logger1 = buildDisplayString(logger1); - logger2 = buildDisplayString(logger2); - return Collator.getInstance().compare(logger1, logger2); - } - }; - } - - private StringConverter<String> buildLoggerConverter() { - return new StringConverter<String>() { - public String convertToString(String value) { - try { - Logger.valueOf(value); - value = buildDisplayString(value); - } - catch (Exception e) { - // Ignore since the value is not a Logger - } - return value; - } - }; - } - - private WritablePropertyValueModel<String> buildLoggerHolder() { - return new PropertyAspectAdapter<Logging, String>(this.getSubjectHolder(), Logging.LOGGER_PROPERTY) { - @Override - protected String buildValue_() { - - String name = subject.getLogger(); - if (name == null) { - name = LoggerComposite.this.defaultValue(subject); - } - return name; - } - - @Override - protected void setValue_(String value) { - - if (defaultValue(subject).equals(value)) { - value = null; - } - subject.setLogger(value); - } - }; - } - - private ListValueModel<String> buildLoggerListHolder() { - ArrayList<ListValueModel<String>> holders = new ArrayList<ListValueModel<String>>(2); - holders.add(buildDefaultLoggerListHolder()); - holders.add(buildLoggersListHolder()); - return new CompositeListValueModel<ListValueModel<String>, String>(holders); - } - - private Iterator<String> buildLoggers() { - return new TransformationIterator<Logger, String>(CollectionTools.iterator(Logger.values())) { - @Override - protected String transform(Logger next) { - return next.name(); - } - }; - } - - private CollectionValueModel<String> buildLoggersCollectionHolder() { - return new SimpleCollectionValueModel<String>( - CollectionTools.collection(buildLoggers()) - ); - } - - private ListValueModel<String> buildLoggersListHolder() { - return new SortedListValueModelAdapter<String>( - buildLoggersCollectionHolder(), - buildLoggerComparator() - ); - } - - private String defaultValue(Logging subject) { - String defaultValue = subject.getDefaultLogger(); - - if (defaultValue != null) { - return NLS.bind( - EclipseLinkUiMessages.PersistenceXmlLoggingTab_defaultWithOneParam, - defaultValue - ); - } - else { - return EclipseLinkUiMessages.PersistenceXmlLoggingTab_defaultEmpty; - } - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - CCombo combo = buildLabeledEditableCCombo( - container, - EclipseLinkUiMessages.PersistenceXmlLoggingTab_loggerLabel, - this.buildLoggerListHolder(), - this.buildLoggerHolder(), - this.buildLoggerConverter(), - null // EclipseLinkHelpContextIds.LOGGER_NAME - ); - - SWTUtil.attachDefaultValueHandler(combo); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/LoggingFileLocationComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/LoggingFileLocationComposite.java deleted file mode 100644 index e034c2d729..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/LoggingFileLocationComposite.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.logging; - -import org.eclipse.jpt.eclipselink.core.internal.context.logging.Logging; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.ui.internal.widgets.FolderChooserPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * LoggingFileLocationComposite - */ -public class LoggingFileLocationComposite extends AbstractPane<Logging> -{ - public LoggingFileLocationComposite(AbstractPane<? extends Logging> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - @Override - protected void initializeLayout(Composite container) { - - new FolderChooserPane<Logging>(this, container) { - - @Override - protected WritablePropertyValueModel<String> buildTextHolder() { - return new PropertyAspectAdapter<Logging, String>( - getSubjectHolder(), Logging.LOG_FILE_LOCATION_PROPERTY) { - @Override - protected String buildValue_() { - - String name = subject.getLogFileLocation(); - if (name == null) { - name = defaultValue(subject); - } - return name; - } - - @Override - protected void setValue_(String value) { - - if (defaultValue(subject).equals(value)) { - value = null; - } - subject.setLogFileLocation(value); - } - }; - } - - private String defaultValue(Logging subject) { - String defaultValue = subject.getDefaultLogFileLocation(); - - if (defaultValue != null) { - return NLS.bind( - EclipseLinkUiMessages.PersistenceXmlLoggingTab_defaultWithOneParam, - defaultValue - ); - } - else { - return EclipseLinkUiMessages.PersistenceXmlLoggingTab_defaultEmpty; - } - } - - @Override - protected String dialogMessage() { - return EclipseLinkUiMessages.LoggingFileLocationComposite_dialogMessage; - } - - @Override - protected String dialogTitle() { - return EclipseLinkUiMessages.LoggingFileLocationComposite_dialogTitle; - } - - @Override - protected String labelText() { - return EclipseLinkUiMessages.PersistenceXmlLoggingTab_loggingFileLabel; - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/LoggingLevelComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/LoggingLevelComposite.java deleted file mode 100644 index 6b862f69d6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/LoggingLevelComposite.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.logging; - -import java.util.Collection; -import org.eclipse.jpt.eclipselink.core.internal.context.logging.Logging; -import org.eclipse.jpt.eclipselink.core.internal.context.logging.LoggingLevel; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.swt.widgets.Composite; - -/** - * LoggingLevelComposite - */ -public class LoggingLevelComposite extends AbstractFormPane<Logging> -{ - /** - * Creates a new <code>LoggingLevelComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public LoggingLevelComposite( - AbstractFormPane<? extends Logging> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private EnumFormComboViewer<Logging, LoggingLevel> buildLoggingLevelCombo(Composite container) { - return new EnumFormComboViewer<Logging, LoggingLevel>(this, container) { - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(Logging.LEVEL_PROPERTY); - } - - @Override - protected LoggingLevel[] choices() { - return LoggingLevel.values(); - } - - @Override - protected boolean sortChoices() { - return false; - } - - @Override - protected LoggingLevel defaultValue() { - return this.subject().getDefaultLevel(); - } - - @Override - protected String displayString(LoggingLevel value) { - return this.buildDisplayString(EclipseLinkUiMessages.class, LoggingLevelComposite.this, value); - } - - @Override - protected LoggingLevel getValue() { - return this.subject().getLevel(); - } - - @Override - protected void setValue(LoggingLevel value) { - this.subject().setLevel(value); - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - this.buildLabeledComposite( - container, - EclipseLinkUiMessages.PersistenceXmlLoggingTab_loggingLevelLabel, - this.buildLoggingLevelCombo(container), - null // TODO IJpaHelpContextIds. - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/PersistenceXmlLoggingTab.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/PersistenceXmlLoggingTab.java deleted file mode 100644 index 25f2c860f8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/PersistenceXmlLoggingTab.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 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.eclipselink.ui.internal.logging; - -import org.eclipse.jpt.eclipselink.core.internal.context.logging.Logging; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaPageComposite; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; - -/** - * PersistenceXmlLoggingTab - */ -public class PersistenceXmlLoggingTab - extends AbstractFormPane<Logging> - implements JpaPageComposite -{ - // ********** constructors/initialization ********** - public PersistenceXmlLoggingTab( - PropertyValueModel<Logging> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - new EclipseLinkLoggingComposite(this, container); - } - - // ********** JpaPageComposite implementation ********** - public String getHelpID() { - return null; - } - - public Image getPageImage() { - return null; - } - - public String getPageText() { - return EclipseLinkUiMessages.PersistenceXmlLoggingTab_title; - } - - // ********** Layout ********** - @Override - protected Composite buildContainer(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.buildPane(parent, layout); - this.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); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/SessionComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/SessionComposite.java deleted file mode 100644 index 81c223f41f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/SessionComposite.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.logging; - -import org.eclipse.jpt.eclipselink.core.internal.context.logging.Logging; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * SessionComposite - */ -public class SessionComposite extends AbstractFormPane<Logging> -{ - /** - * Creates a new <code>SessionComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public SessionComposite( - AbstractFormPane<? extends Logging> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Boolean> buildSessionHolder() { - return new PropertyAspectAdapter<Logging, Boolean>(getSubjectHolder(), Logging.SESSION_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getSession(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setSession(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildSessionStringHolder() { - return new TransformationPropertyValueModel<Boolean, String>(buildSessionHolder()) { - @Override - protected String transform(Boolean value) { - if ((subject() != null) && (value == null)) { - Boolean defaultValue = subject().getDefaultSession(); - if (defaultValue != null) { - String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; - return NLS.bind(EclipseLinkUiMessages.PersistenceXmlLoggingTab_sessionLabelDefault, defaultStringValue); - } - } - return EclipseLinkUiMessages.PersistenceXmlLoggingTab_sessionLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMessages.PersistenceXmlLoggingTab_sessionLabel, - this.buildSessionHolder(), - this.buildSessionStringHolder(), - null -// EclipseLinkHelpContextIds.LOGGING_ - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/ThreadComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/ThreadComposite.java deleted file mode 100644 index 987c5332c1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/ThreadComposite.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.logging; - -import org.eclipse.jpt.eclipselink.core.internal.context.logging.Logging; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * ThreadComposite - */ -public class ThreadComposite extends AbstractFormPane<Logging> -{ - /** - * Creates a new <code>ThreadComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public ThreadComposite( - AbstractFormPane<? extends Logging> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Boolean> buildThreadHolder() { - return new PropertyAspectAdapter<Logging, Boolean>(getSubjectHolder(), Logging.THREAD_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getThread(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setThread(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildThreadStringHolder() { - return new TransformationPropertyValueModel<Boolean, String>(buildThreadHolder()) { - @Override - protected String transform(Boolean value) { - if ((subject() != null) && (value == null)) { - Boolean defaultValue = subject().getDefaultThread(); - if (defaultValue != null) { - String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; - return NLS.bind(EclipseLinkUiMessages.PersistenceXmlLoggingTab_threadLabelDefault, defaultStringValue); - } - } - return EclipseLinkUiMessages.PersistenceXmlLoggingTab_threadLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMessages.PersistenceXmlLoggingTab_threadLabel, - this.buildThreadHolder(), - this.buildThreadStringHolder(), - null -// EclipseLinkHelpContextIds.LOGGING_ - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/TimestampComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/TimestampComposite.java deleted file mode 100644 index c04f8735b7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/TimestampComposite.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.logging; - -import org.eclipse.jpt.eclipselink.core.internal.context.logging.Logging; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * TimestampComposite - */ -public class TimestampComposite extends AbstractFormPane<Logging> -{ - /** - * Creates a new <code>TimestampComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public TimestampComposite( - AbstractFormPane<? extends Logging> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Boolean> buildTimestampHolder() { - return new PropertyAspectAdapter<Logging, Boolean>(getSubjectHolder(), Logging.TIMESTAMP_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getTimestamp(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setTimestamp(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildTimestampStringHolder() { - return new TransformationPropertyValueModel<Boolean, String>(buildTimestampHolder()) { - @Override - protected String transform(Boolean value) { - if ((subject() != null) && (value == null)) { - Boolean defaultValue = subject().getDefaultTimestamp(); - if (defaultValue != null) { - String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; - return NLS.bind(EclipseLinkUiMessages.PersistenceXmlLoggingTab_timestampLabelDefault, defaultStringValue); - } - } - return EclipseLinkUiMessages.PersistenceXmlLoggingTab_timestampLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMessages.PersistenceXmlLoggingTab_timestampLabel, - this.buildTimestampHolder(), - this.buildTimestampStringHolder(), - null -// EclipseLinkHelpContextIds.LOGGING_ - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java deleted file mode 100644 index 35b9c3793f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.mappings; - -import org.eclipse.osgi.util.NLS; - -/** - * The localized strings used by the mapping panes. - * - * @version 2.0 - * @since 1.0 - */ -@SuppressWarnings("nls") -public class EclipseLinkUiMappingsMessages extends NLS { - - public static String CacheTypeComposite_label; - public static String CacheTypeComposite_full; - public static String CacheTypeComposite_weak; - public static String CacheTypeComposite_soft; - public static String CacheTypeComposite_soft_weak; - public static String CacheTypeComposite_hard_weak; - public static String CacheTypeComposite_cache; - public static String CacheTypeComposite_none; - public static String EclipseLinkJavaEntityComposite_caching; - - public static String CacheSizeComposite_size; - public static String CacheCoordinationTypeComposite_label; - public static String CacheCoordinationTypeComposite_send_object_changes; - public static String CacheCoordinationTypeComposite_invalidate_changed_objects; - public static String CacheCoordinationTypeComposite_send_new_objects_with_changes; - public static String CacheCoordinationTypeComposite_none; - - public static String CachingComposite_sharedLabelDefault; - public static String CachingComposite_sharedLabel; - public static String CachingComposite_advanced; - public static String AlwaysRefreshComposite_alwaysRefreshDefault; - public static String AlwaysRefreshComposite_alwaysRefreshLabel; - public static String RefreshOnlyIfNewerComposite_refreshOnlyIfNewerDefault; - public static String RefreshOnlyIfNewerComposite_refreshOnlyIfNewerLabel; - public static String DisableHitsComposite_disableHitsDefault; - public static String DisableHitsComposite_disableHitsLabel; - - public static String ExistenceCheckingComposite_label; - public static String ExistenceCheckingComposite_check_cache; - public static String ExistenceCheckingComposite_check_database; - public static String ExistenceCheckingComposite_assume_existence; - public static String ExistenceCheckingComposite_assume_non_existence; - - - - static { - NLS.initializeMessages("eclipselink_ui_mappings", EclipseLinkUiMappingsMessages.class); - } - - private EclipseLinkUiMappingsMessages() { - throw new UnsupportedOperationException(); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/AlwaysRefreshComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/AlwaysRefreshComposite.java deleted file mode 100644 index 28b8b8bfe5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/AlwaysRefreshComposite.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - - -/** - * This composite simply shows a tri-state check box for the Always Refresh option. - * - * @see EclipseLinkCaching - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class AlwaysRefreshComposite extends AbstractFormPane<EclipseLinkCaching> -{ - /** - * Creates a new <code>OptionalComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public AlwaysRefreshComposite(AbstractFormPane<? extends EclipseLinkCaching> parentPane, - Composite parent) - { - super(parentPane, parent); - } - - private WritablePropertyValueModel<Boolean> buildAlwaysRefreshHolder() { - return new PropertyAspectAdapter<EclipseLinkCaching, Boolean>(getSubjectHolder(), EclipseLinkCaching.SPECIFIED_ALWAYS_REFRESH_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSpecifiedAlwaysRefresh(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSpecifiedAlwaysRefresh(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildAlwaysRefreshStringHolder() { - - return new TransformationPropertyValueModel<Boolean, String>(buildAlwaysRefreshHolder()) { - - @Override - protected String transform(Boolean value) { - - if ((subject() != null) && (value == null)) { - - Boolean defaultValue = subject().getDefaultAlwaysRefresh(); - - if (defaultValue != null) { - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - EclipseLinkUiMappingsMessages.AlwaysRefreshComposite_alwaysRefreshDefault, - defaultStringValue - ); - } - } - - return EclipseLinkUiMappingsMessages.AlwaysRefreshComposite_alwaysRefreshLabel; - } - }; - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMappingsMessages.AlwaysRefreshComposite_alwaysRefreshLabel, - buildAlwaysRefreshHolder(), - buildAlwaysRefreshStringHolder(), - EclipseLinkHelpContextIds.CACHING_ALWAYS_REFRESH - ); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheCoordinationTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheCoordinationTypeComposite.java deleted file mode 100644 index f2bd9cb60e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheCoordinationTypeComposite.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.mappings.details; - -import java.util.Collection; -import org.eclipse.jpt.eclipselink.core.context.CacheCoordinationType; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.swt.widgets.Composite; - -/** - * Here is the layout of this pane: - * <pre> - * ---------------------------------------------------------------------------- - * | ----------------------------------------------------- | - * | Coordination Type: | |v| | - * | ----------------------------------------------------- | - * ----------------------------------------------------------------------------</pre> - * - * @see EclipseLinkCaching - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class CacheCoordinationTypeComposite extends AbstractFormPane<EclipseLinkCaching> { - - /** - * Creates a new <code>CacheTypeComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public CacheCoordinationTypeComposite(AbstractFormPane<? extends EclipseLinkCaching> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private EnumFormComboViewer<EclipseLinkCaching, CacheCoordinationType> buildCacheCoordinationTypeCombo(Composite container) { - - return new EnumFormComboViewer<EclipseLinkCaching, CacheCoordinationType>(this, container) { - - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(EclipseLinkCaching.DEFAULT_COORDINATION_TYPE_PROPERTY); - propertyNames.add(EclipseLinkCaching.SPECIFIED_COORDINATION_TYPE_PROPERTY); - } - - @Override - protected CacheCoordinationType[] choices() { - return CacheCoordinationType.values(); - } - - @Override - protected CacheCoordinationType defaultValue() { - return subject().getDefaultCoordinationType(); - } - - @Override - protected String displayString(CacheCoordinationType value) { - return buildDisplayString( - EclipseLinkUiMappingsMessages.class, - CacheCoordinationTypeComposite.this, - value - ); - } - - @Override - protected CacheCoordinationType getValue() { - return subject().getSpecifiedCoordinationType(); - } - - @Override - protected void setValue(CacheCoordinationType value) { - subject().setSpecifiedCoordinationType(value); - } - - @Override - protected boolean sortChoices() { - return false; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - buildLabeledComposite( - container, - EclipseLinkUiMappingsMessages.CacheCoordinationTypeComposite_label, - buildCacheCoordinationTypeCombo(container), - EclipseLinkHelpContextIds.CACHING_CACHE_COORDINATION_TYPE - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheSizeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheSizeComposite.java deleted file mode 100644 index 3cf27cf686..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheSizeComposite.java +++ /dev/null @@ -1,176 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -import org.eclipse.jpt.ui.internal.util.LabeledControlUpdater; -import org.eclipse.jpt.ui.internal.util.LabeledLabel; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -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.osgi.util.NLS; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Spinner; - -/** - * Here is the layout of this pane: - * <pre> - * ---------------------------------------------------------------------------- - * | --------------- | - * | Size: | I |I| Default (XXX) | - * | --------------- | - * ----------------------------------------------------------------------------</pre> - * - * @see EclipseLinkCaching - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class CacheSizeComposite extends AbstractFormPane<EclipseLinkCaching> { - - /** - * Creates a new <code>CacheSizeComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public CacheSizeComposite(AbstractFormPane<? extends EclipseLinkCaching> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - @Override - protected void initializeLayout(Composite container) { - - // Size widgets - Spinner sizeSpinner = buildLabeledSpinner( - container, - EclipseLinkUiMappingsMessages.CacheSizeComposite_size, - buildSizeHolder(), - -1, - -1, - Integer.MAX_VALUE, - buildDefaultSizeLabel(container)//, - //TODO JpaHelpContextIds.MAPPING_COLUMN_LENGTH - ); - - updateGridData(container, sizeSpinner); - } - - private WritablePropertyValueModel<Integer> buildSizeHolder() { - return new PropertyAspectAdapter<EclipseLinkCaching, Integer>(getSubjectHolder(), EclipseLinkCaching.SPECIFIED_SIZE_PROPERTY) { - @Override - protected Integer buildValue_() { - return subject.getSpecifiedSize(); - } - - @Override - protected void setValue_(Integer value) { - if (value == -1) { - value = null; - } - subject.setSpecifiedSize(value); - } - }; - } - - private WritablePropertyValueModel<Integer> buildDefaultSizeHolder() { - return new PropertyAspectAdapter<EclipseLinkCaching, Integer>(getSubjectHolder(), EclipseLinkCaching.DEFAULT_SIZE_PROPERTY) { - @Override - protected Integer buildValue_() { - return subject.getDefaultSize(); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Integer.MIN_VALUE, newValue); - } - } - }; - } - - private Control buildDefaultSizeLabel(Composite container) { - - Label label = buildLabel( - container, - JptUiMappingsMessages.DefaultWithoutValue - ); - - new LabeledControlUpdater( - new LabeledLabel(label), - buildDefaultSizeLabelHolder() - ); - - return label; - } - - private PropertyValueModel<String> buildDefaultSizeLabelHolder() { - - return new TransformationPropertyValueModel<Integer, String>(buildDefaultSizeHolder()) { - - @Override - protected String transform(Integer value) { - - Integer defaultValue = (subject() != null) ? subject().getDefaultSize() : - EclipseLinkCaching.DEFAULT_SIZE; - - return NLS.bind( - JptUiMappingsMessages.DefaultWithValue, - defaultValue - ); - } - }; - } - - /** - * Changes the layout of the given container by changing which widget will - * grab the excess of horizontal space. By default, the center control grabs - * the excess space, we change it to be the right control. - * - * @param container The container containing the controls needing their - * <code>GridData</code> to be modified from the default values - * @param spinner The spinner that got created - */ - private void updateGridData(Composite container, Spinner spinner) { - - // It is possible the spinner's parent is not the container of the - // label, spinner and right control (a pane is sometimes required for - // painting the spinner's border) - Composite paneContainer = spinner.getParent(); - - while (container != paneContainer.getParent()) { - paneContainer = paneContainer.getParent(); - } - - Control[] controls = paneContainer.getChildren(); - - GridData gridData = new GridData(); - gridData.grabExcessHorizontalSpace = false; - gridData.horizontalAlignment = GridData.BEGINNING; - controls[1].setLayoutData(gridData); - - controls[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - removeAlignRight(controls[2]); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheTypeComposite.java deleted file mode 100644 index 2dae68f452..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheTypeComposite.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.mappings.details; - -import java.util.Collection; -import org.eclipse.jpt.eclipselink.core.context.CacheType; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.swt.widgets.Composite; - -/** - * Here is the layout of this pane: - * <pre> - * ---------------------------------------------------------------------------- - * | ------------------------------------------------------------------ | - * | Type: | |v| | - * | ------------------------------------------------------------------ | - * ----------------------------------------------------------------------------</pre> - * - * @see EclipseLinkCaching - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class CacheTypeComposite extends AbstractFormPane<EclipseLinkCaching> { - - /** - * Creates a new <code>CacheTypeComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public CacheTypeComposite(AbstractFormPane<? extends EclipseLinkCaching> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private EnumFormComboViewer<EclipseLinkCaching, CacheType> buildCacheTypeCombo(Composite container) { - - return new EnumFormComboViewer<EclipseLinkCaching, CacheType>(this, container) { - - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(EclipseLinkCaching.DEFAULT_TYPE_PROPERTY); - propertyNames.add(EclipseLinkCaching.SPECIFIED_TYPE_PROPERTY); - } - - @Override - protected CacheType[] choices() { - return CacheType.values(); - } - - @Override - protected CacheType defaultValue() { - return subject().getDefaultType(); - } - - @Override - protected String displayString(CacheType value) { - return buildDisplayString( - EclipseLinkUiMappingsMessages.class, - CacheTypeComposite.this, - value - ); - } - - @Override - protected CacheType getValue() { - return subject().getSpecifiedType(); - } - - @Override - protected void setValue(CacheType value) { - subject().setSpecifiedType(value); - } - - @Override - protected boolean sortChoices() { - return false; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - buildLabeledComposite( - container, - EclipseLinkUiMappingsMessages.CacheTypeComposite_label, - buildCacheTypeCombo(container), - EclipseLinkHelpContextIds.CACHING_CACHE_TYPE - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CachingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CachingComposite.java deleted file mode 100644 index 9fbc9dbcb1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CachingComposite.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.mappings.details; - -import java.util.ArrayList; -import java.util.Collection; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -import org.eclipse.jpt.ui.internal.util.PaneEnabler; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * This pane shows the caching options. - * <p> - * Here the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | x Shared | - * | CacheTypeComposite | - * | AlwaysRefreshComposite | - * | RefreshOnlyIfNewerComposite | - * | DisableHitsComposite | - * -----------------------------------------------------------------------------</pre> - * - * @see Entity - * @see EclipseLinkCaching - * @see EclipseLinkJavaEntityComposite - The parent container - * @see CacheTypeComposite - * @see AlwaysRefreshComposite - * @see RefreshOnlyIfNewerComposite - * @see DisableHitsComposite - * - * @version 2.1 - * @since 2.1 - */ -public class CachingComposite extends AbstractFormPane<EclipseLinkCaching> -{ - - public CachingComposite(AbstractFormPane<?> parentPane, - PropertyValueModel<EclipseLinkCaching> subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected void initializeLayout(Composite container) { - - //Shared Check box, uncheck this and the rest of the panel is disabled - buildTriStateCheckBoxWithDefault( - buildSubPane(container, 8), - EclipseLinkUiMappingsMessages.CachingComposite_sharedLabel, - buildSharedHolder(), - buildSharedStringHolder(), - EclipseLinkHelpContextIds.CACHING_SHARED - ); - - Composite subPane = buildSubPane(container, 0, 16); - - Collection<AbstractPane<?>> panes = new ArrayList<AbstractPane<?>>(); - - panes.add(new CacheTypeComposite(this, subPane)); - panes.add(new CacheSizeComposite(this, subPane)); - - // Advanced sub-pane - Composite advancedSection = buildCollapsableSubSection( - subPane, - EclipseLinkUiMappingsMessages.CachingComposite_advanced, - new SimplePropertyValueModel<Boolean>(Boolean.FALSE) - ); - - initializeAdvancedPane(buildSubPane(advancedSection, 0, 16), panes); - - new PaneEnabler(buildSharedCacheEnabler(), panes); - - new ExistenceCheckingComposite(this, buildSubPane(container, 8)); - } - - private void initializeAdvancedPane(Composite container, Collection<AbstractPane<?>> panes) { - panes.add(new AlwaysRefreshComposite(this, container)); - panes.add(new RefreshOnlyIfNewerComposite(this, container)); - panes.add(new DisableHitsComposite(this, container)); - panes.add(new CacheCoordinationTypeComposite(this, container)); - } - - private PropertyValueModel<Boolean> buildSharedCacheEnabler() { - return new PropertyAspectAdapter<EclipseLinkCaching, Boolean>(getSubjectHolder(), EclipseLinkCaching.SPECIFIED_SHARED_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getShared(); - } - }; - } - private WritablePropertyValueModel<Boolean> buildSharedHolder() { - return new PropertyAspectAdapter<EclipseLinkCaching, Boolean>(getSubjectHolder(), EclipseLinkCaching.SPECIFIED_SHARED_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSpecifiedShared(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSpecifiedShared(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildSharedStringHolder() { - - return new TransformationPropertyValueModel<Boolean, String>(buildSharedHolder()) { - - @Override - protected String transform(Boolean value) { - - if ((subject() != null) && (value == null)) { - - Boolean defaultValue = subject().getDefaultShared(); - - if (defaultValue != null) { - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - EclipseLinkUiMappingsMessages.CachingComposite_sharedLabelDefault, - defaultStringValue - ); - } - } - - return EclipseLinkUiMappingsMessages.CachingComposite_sharedLabel; - } - }; - } - -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/DisableHitsComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/DisableHitsComposite.java deleted file mode 100644 index f509f4d3cb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/DisableHitsComposite.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * This composite simply shows a tri-state check box for the Disable Hits option. - * - * @see EclipseLinkCaching - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class DisableHitsComposite extends AbstractFormPane<EclipseLinkCaching> -{ - /** - * Creates a new <code>OptionalComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public DisableHitsComposite(AbstractFormPane<? extends EclipseLinkCaching> parentPane, - Composite parent) - { - super(parentPane, parent); - } - - private WritablePropertyValueModel<Boolean> buildDisableHitsHolder() { - return new PropertyAspectAdapter<EclipseLinkCaching, Boolean>(getSubjectHolder(), EclipseLinkCaching.SPECIFIED_DISABLE_HITS_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSpecifiedDisableHits(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSpecifiedDisableHits(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildDisableHitsStringHolder() { - - return new TransformationPropertyValueModel<Boolean, String>(buildDisableHitsHolder()) { - - @Override - protected String transform(Boolean value) { - - if ((subject() != null) && (value == null)) { - - Boolean defaultValue = subject().getDefaultDisableHits(); - - if (defaultValue != null) { - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - EclipseLinkUiMappingsMessages.DisableHitsComposite_disableHitsDefault, - defaultStringValue - ); - } - } - - return EclipseLinkUiMappingsMessages.DisableHitsComposite_disableHitsLabel; - } - }; - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMappingsMessages.DisableHitsComposite_disableHitsLabel, - buildDisableHitsHolder(), - buildDisableHitsStringHolder(), - EclipseLinkHelpContextIds.CACHING_DISABLE_HITS - ); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ExistenceCheckingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ExistenceCheckingComposite.java deleted file mode 100644 index b8689bc377..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ExistenceCheckingComposite.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.mappings.details; - -import java.util.Collection; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.context.ExistenceType; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * Here is the layout of this pane: - * <pre> - * ------------------------------------------------------------------------- - * | ---------------------------------------------- | - * | x Existence Checking: | |v| | - * | ---------------------------------------------- | - * -------------------------------------------------------------------------</pre> - * - * @see EclipseLinkCaching - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class ExistenceCheckingComposite extends AbstractFormPane<EclipseLinkCaching> { - - /** - * Creates a new <code>ExistenceCheckingComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public ExistenceCheckingComposite(AbstractFormPane<? extends EclipseLinkCaching> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - @Override - protected void initializeLayout(Composite container) { - Composite subPane = buildSubPane(container, 2, 8, 0, 0, 0); - - - buildCheckBox( - subPane, - EclipseLinkUiMappingsMessages.ExistenceCheckingComposite_label, - buildExistenceCheckingHolder()); - - - buildExistenceCheckingTypeCombo(subPane); - } - - private EnumFormComboViewer<EclipseLinkCaching, ExistenceType> buildExistenceCheckingTypeCombo(Composite container) { - - return new EnumFormComboViewer<EclipseLinkCaching, ExistenceType>(this, container) { - - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(EclipseLinkCaching.DEFAULT_EXISTENCE_TYPE_PROPERTY); - propertyNames.add(EclipseLinkCaching.SPECIFIED_EXISTENCE_TYPE_PROPERTY); - } - - @Override - protected ExistenceType[] choices() { - return ExistenceType.values(); - } - - @Override - protected ExistenceType defaultValue() { - return subject().getDefaultExistenceType(); - } - - @Override - protected String displayString(ExistenceType value) { - return buildDisplayString( - EclipseLinkUiMappingsMessages.class, - ExistenceCheckingComposite.this, - value - ); - } - - @Override - protected ExistenceType getValue() { - return subject().getSpecifiedExistenceType(); - } - - @Override - protected void setValue(ExistenceType value) { - subject().setSpecifiedExistenceType(value); - } - - @Override - protected boolean sortChoices() { - return false; - } - }; - } - - private WritablePropertyValueModel<Boolean> buildExistenceCheckingHolder() { - return new PropertyAspectAdapter<EclipseLinkCaching, Boolean>(getSubjectHolder(), EclipseLinkCaching.EXISTENCE_CHECKING_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.hasExistenceChecking(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setExistenceChecking(value); - } - }; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/RefreshOnlyIfNewerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/RefreshOnlyIfNewerComposite.java deleted file mode 100644 index 8f99e664b3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/RefreshOnlyIfNewerComposite.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * This composite simply shows a tri-state check box for the Refresh Only If Newer option. - * - * @see EclipseLinkCaching - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class RefreshOnlyIfNewerComposite extends AbstractFormPane<EclipseLinkCaching> -{ - /** - * Creates a new <code>OptionalComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public RefreshOnlyIfNewerComposite(AbstractFormPane<? extends EclipseLinkCaching> parentPane, - Composite parent) - { - super(parentPane, parent); - } - - private WritablePropertyValueModel<Boolean> buildRefreshOnlyIfNewerHolder() { - return new PropertyAspectAdapter<EclipseLinkCaching, Boolean>(getSubjectHolder(), EclipseLinkCaching.SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSpecifiedRefreshOnlyIfNewer(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSpecifiedRefreshOnlyIfNewer(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildRefreshOnlyIfNewerStringHolder() { - - return new TransformationPropertyValueModel<Boolean, String>(buildRefreshOnlyIfNewerHolder()) { - - @Override - protected String transform(Boolean value) { - - if ((subject() != null) && (value == null)) { - - Boolean defaultValue = subject().getDefaultRefreshOnlyIfNewer(); - - if (defaultValue != null) { - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - EclipseLinkUiMappingsMessages.RefreshOnlyIfNewerComposite_refreshOnlyIfNewerDefault, - defaultStringValue - ); - } - } - - return EclipseLinkUiMappingsMessages.RefreshOnlyIfNewerComposite_refreshOnlyIfNewerLabel; - } - }; - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMappingsMessages.RefreshOnlyIfNewerComposite_refreshOnlyIfNewerLabel, - buildRefreshOnlyIfNewerHolder(), - buildRefreshOnlyIfNewerStringHolder(), - EclipseLinkHelpContextIds.CACHING_REFRESH_ONLY_IF_NEWER - ); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/EclipseLinkOptionsComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/EclipseLinkOptionsComposite.java deleted file mode 100644 index 930b858ce9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/EclipseLinkOptionsComposite.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.options; - -import org.eclipse.jpt.eclipselink.core.internal.context.options.Options; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.forms.widgets.ExpandableComposite; -import org.eclipse.ui.forms.widgets.Section; - -/** - * EclipseLinkOptionsComposite - */ -public class EclipseLinkOptionsComposite - extends AbstractFormPane<Options> -{ - public EclipseLinkOptionsComposite( - AbstractFormPane<Options> subjectHolder, - Composite container) { - super(subjectHolder, container, false); - } - - @Override - protected void initializeLayout(Composite parent) { - Section section = getWidgetFactory().createSection(parent, SWT.FLAT | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION); - section.setText(EclipseLinkUiMessages.PersistenceXmlOptionsTab_sectionTitle); - section.setDescription(EclipseLinkUiMessages.PersistenceXmlOptionsTab_sectionDescription); - Composite composite = getWidgetFactory().createComposite(section); - composite.setLayout(new GridLayout(1, false)); - section.setClient(composite); - this.updateGridData(composite); - this.updateGridData(composite.getParent()); - - new SessionNameComposite(this, composite); - - new SessionsXmlComposite(this, composite); - - new TargetDatabaseComposite(this, composite); - - new TargetServerComposite(this, composite); - - new EventListenerComposite(this, composite); - - new IncludeDescriptorQueriesComposite(this, composite); - - return; - } - - 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); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/EventListenerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/EventListenerComposite.java deleted file mode 100644 index 6e7dca94d0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/EventListenerComposite.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.options; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.eclipselink.core.internal.context.options.Options; -import org.eclipse.jpt.eclipselink.ui.JptEclipseLinkUiPlugin; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * EventListenerComposite - */ -public class EventListenerComposite extends AbstractPane<Options> -{ - /** - * Creates a new <code>EventListenerComposite</code>. - * - * @param parentPane The parent pane of this one - * @param parent The parent container - */ - public EventListenerComposite(AbstractPane<? extends Options> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private ClassChooserPane<Options> initializeClassChooser(Composite container) { - - return new ClassChooserPane<Options>(this, container) { - - @Override - protected WritablePropertyValueModel<String> buildTextHolder() { - return new PropertyAspectAdapter<Options, String>( - this.getSubjectHolder(), Options.SESSION_EVENT_LISTENER_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getEventListener(); - } - - @Override - protected void setValue_(String value) { - - if (value.length() == 0) { - value = null; - } - this.subject.setEventListener(value); - } - }; - } - - @Override - protected String className() { - return this.subject().getEventListener(); - } - - @Override - protected String labelText() { - return EclipseLinkUiMessages.PersistenceXmlOptionsTab_eventListenerLabel; - } - - @Override - protected IPackageFragmentRoot packageFragmentRoot() { - IProject project = this.subject().getJpaProject().getProject(); - IJavaProject root = JavaCore.create(project); - - try { - return root.getAllPackageFragmentRoots()[0]; - } - catch (JavaModelException e) { - JptEclipseLinkUiPlugin.log(e); - } - return null; - } - - @Override - protected void promptType() { - IType type = chooseType(); - - if (type != null) { - String className = type.getFullyQualifiedName('.'); - this.subject().setEventListener(className); - } - } - }; - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - this.initializeClassChooser(container); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/IncludeDescriptorQueriesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/IncludeDescriptorQueriesComposite.java deleted file mode 100644 index dc37254192..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/IncludeDescriptorQueriesComposite.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.options; - -import org.eclipse.jpt.eclipselink.core.internal.context.options.Options; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * IncludeDescriptorQueriesComposite - */ -public class IncludeDescriptorQueriesComposite extends AbstractFormPane<Options> -{ - /** - * Creates a new <code>IncludeDescriptorQueriesComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public IncludeDescriptorQueriesComposite( - AbstractFormPane<? extends Options> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private WritablePropertyValueModel<Boolean> buildIncludeDescriptorQueriesHolder() { - return new PropertyAspectAdapter<Options, Boolean>(getSubjectHolder(), Options.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getIncludeDescriptorQueries(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setIncludeDescriptorQueries(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildIncludeDescriptorQueriesStringHolder() { - return new TransformationPropertyValueModel<Boolean, String>(buildIncludeDescriptorQueriesHolder()) { - @Override - protected String transform(Boolean value) { - if ((subject() != null) && (value == null)) { - Boolean defaultValue = subject().getDefaultIncludeDescriptorQueries(); - if (defaultValue != null) { - String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; - return NLS.bind(EclipseLinkUiMessages.PersistenceXmlOptionsTab_includeDescriptorQueriesLabelDefault, defaultStringValue); - } - } - return EclipseLinkUiMessages.PersistenceXmlOptionsTab_includeDescriptorQueriesLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMessages.PersistenceXmlOptionsTab_includeDescriptorQueriesLabel, - this.buildIncludeDescriptorQueriesHolder(), - this.buildIncludeDescriptorQueriesStringHolder(), - null -// EclipseLinkHelpContextIds. - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/PersistenceXmlOptionsTab.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/PersistenceXmlOptionsTab.java deleted file mode 100644 index 1ba4b2f8af..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/PersistenceXmlOptionsTab.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 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.eclipselink.ui.internal.options; - -import org.eclipse.jpt.eclipselink.core.internal.context.options.Options; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaPageComposite; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; - -/** - * PersistenceXmlOptionsTab - */ -public class PersistenceXmlOptionsTab - extends AbstractFormPane<Options> - implements JpaPageComposite -{ - // ********** constructors/initialization ********** - public PersistenceXmlOptionsTab( - PropertyValueModel<Options> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - new EclipseLinkOptionsComposite(this, container); - } - - // ********** JpaPageComposite implementation ********** - public String getHelpID() { - return null; - } - - public Image getPageImage() { - return null; - } - - public String getPageText() { - return EclipseLinkUiMessages.PersistenceXmlOptionsTab_title; - } - - // ********** Layout ********** - @Override - protected Composite buildContainer(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.buildPane(parent, layout); - this.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); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/SessionNameComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/SessionNameComposite.java deleted file mode 100644 index 81148be0ce..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/SessionNameComposite.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.options; - -import org.eclipse.jpt.eclipselink.core.internal.context.options.Options; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.SWTUtil; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter; -import org.eclipse.jpt.utility.model.value.ListValueModel; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.widgets.Composite; - -/** - * SessionNameComposite - */ -public class SessionNameComposite extends AbstractPane<Options> -{ - /** - * Creates a new <code>SessionNameComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public SessionNameComposite( - AbstractPane<? extends Options> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private PropertyValueModel<String> buildDefaultSessionNameHolder() { - return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.DEFAULT_SESSION_NAME) { - @Override - protected String buildValue_() { - return SessionNameComposite.this.defaultValue(subject); - } - }; - } - - private ListValueModel<String> buildDefaultSessionNameListHolder() { - return new PropertyListValueModelAdapter<String>( - this.buildDefaultSessionNameHolder() - ); - } - - private WritablePropertyValueModel<String> buildSessionNameHolder() { - return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.SESSION_NAME_PROPERTY) { - @Override - protected String buildValue_() { - - String name = subject.getSessionName(); - if (name == null) { - name = SessionNameComposite.this.defaultValue(subject); - } - return name; - } - - @Override - protected void setValue_(String value) { - - if (defaultValue(subject).equals(value)) { - value = null; - } - subject.setSessionName(value); - } - }; - } - - private String defaultValue(Options subject) { - String defaultValue = subject.getDefaultSessionName(); - - if (defaultValue != null) { - return NLS.bind( - EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultWithOneParam, - defaultValue - ); - } - else { - return EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultEmpty; - } - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - CCombo combo = buildLabeledEditableCCombo( - container, - EclipseLinkUiMessages.PersistenceXmlOptionsTab_sessionName, - this.buildDefaultSessionNameListHolder(), - this.buildSessionNameHolder(), - null // EclipseLinkHelpContextIds. - ); - SWTUtil.attachDefaultValueHandler(combo); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/SessionsXmlComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/SessionsXmlComposite.java deleted file mode 100644 index e6596c6e6b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/SessionsXmlComposite.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.options; - -import org.eclipse.jpt.eclipselink.core.internal.context.options.Options; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.SWTUtil; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter; -import org.eclipse.jpt.utility.model.value.ListValueModel; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.widgets.Composite; - -/** - * SessionsXmlComposite - */ -public class SessionsXmlComposite extends AbstractPane<Options> -{ - /** - * Creates a new <code>SessionsXmlComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public SessionsXmlComposite( - AbstractPane<? extends Options> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private PropertyValueModel<String> buildDefaultSessionsXmlFileNameHolder() { - return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.DEFAULT_SESSIONS_XML) { - @Override - protected String buildValue_() { - return SessionsXmlComposite.this.defaultValue(subject); - } - }; - } - - private ListValueModel<String> buildDefaultSessionsXmlFileNameListHolder() { - return new PropertyListValueModelAdapter<String>( - this.buildDefaultSessionsXmlFileNameHolder() - ); - } - - private WritablePropertyValueModel<String> buildSessionsXmlFileNameHolder() { - return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.SESSIONS_XML_PROPERTY) { - @Override - protected String buildValue_() { - - String name = subject.getSessionsXml(); - if (name == null) { - name = SessionsXmlComposite.this.defaultValue(subject); - } - return name; - } - - @Override - protected void setValue_(String value) { - - if (defaultValue(subject).equals(value)) { - value = null; - } - subject.setSessionsXml(value); - } - }; - } - - private String defaultValue(Options subject) { - String defaultValue = subject.getDefaultSessionsXml(); - - if (defaultValue != null) { - return NLS.bind( - EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultWithOneParam, - defaultValue - ); - } - else { - return EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultEmpty; - } - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - CCombo combo = buildLabeledEditableCCombo( - container, - EclipseLinkUiMessages.PersistenceXmlOptionsTab_sessionsXml, - this.buildDefaultSessionsXmlFileNameListHolder(), - this.buildSessionsXmlFileNameHolder(), - null // EclipseLinkHelpContextIds. - ); - SWTUtil.attachDefaultValueHandler(combo); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/TargetDatabaseComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/TargetDatabaseComposite.java deleted file mode 100644 index 3a0bd59e11..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/TargetDatabaseComposite.java +++ /dev/null @@ -1,187 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.options; - -import java.text.Collator; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.Iterator; - -import org.eclipse.jpt.eclipselink.core.internal.context.options.Options; -import org.eclipse.jpt.eclipselink.core.internal.context.options.TargetDatabase; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.SWTUtil; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.StringConverter; -import org.eclipse.jpt.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter; -import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter; -import org.eclipse.jpt.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.utility.model.value.ListValueModel; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.widgets.Composite; - -/** - * TargetDatabaseComposite - */ -public class TargetDatabaseComposite extends AbstractPane<Options> -{ - /** - * Creates a new <code>TargetDatabaseComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public TargetDatabaseComposite( - AbstractPane<? extends Options> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private PropertyValueModel<String> buildDefaultTargetDatabaseHolder() { - return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.DEFAULT_TARGET_DATABASE) { - @Override - protected String buildValue_() { - return TargetDatabaseComposite.this.defaultValue(subject); - } - }; - } - - private ListValueModel<String> buildDefaultTargetDatabaseListHolder() { - return new PropertyListValueModelAdapter<String>( - this.buildDefaultTargetDatabaseHolder() - ); - } - - private String buildDisplayString(String targetDatabaseName) { - - return SWTUtil.buildDisplayString( - EclipseLinkUiMessages.class, - this.getClass(), - TargetDatabase.valueOf(targetDatabaseName)); - } - - private Comparator<String> buildTargetDatabaseComparator() { - return new Comparator<String>() { - public int compare(String targetDatabase1, String targetDatabase2) { - targetDatabase1 = buildDisplayString(targetDatabase1); - targetDatabase2 = buildDisplayString(targetDatabase2); - return Collator.getInstance().compare(targetDatabase1, targetDatabase2); - } - }; - } - - private StringConverter<String> buildTargetDatabaseConverter() { - return new StringConverter<String>() { - public String convertToString(String value) { - try { - TargetDatabase.valueOf(value); - value = buildDisplayString(value); - } - catch (Exception e) { - // Ignore since the value is not a TargetDatabase - } - return value; - } - }; - } - - private WritablePropertyValueModel<String> buildTargetDatabaseHolder() { - return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.TARGET_DATABASE_PROPERTY) { - @Override - protected String buildValue_() { - - String name = subject.getTargetDatabase(); - if (name == null) { - name = TargetDatabaseComposite.this.defaultValue(subject); - } - return name; - } - - @Override - protected void setValue_(String value) { - - if (defaultValue(subject).equals(value)) { - value = null; - } - subject.setTargetDatabase(value); - } - }; - } - - private ListValueModel<String> buildTargetDatabaseListHolder() { - ArrayList<ListValueModel<String>> holders = new ArrayList<ListValueModel<String>>(2); - holders.add(buildDefaultTargetDatabaseListHolder()); - holders.add(buildTargetDatabasesListHolder()); - return new CompositeListValueModel<ListValueModel<String>, String>(holders); - } - - private Iterator<String> buildTargetDatabases() { - return new TransformationIterator<TargetDatabase, String>(CollectionTools.iterator(TargetDatabase.values())) { - @Override - protected String transform(TargetDatabase next) { - return next.name(); - } - }; - } - - private CollectionValueModel<String> buildTargetDatabasesCollectionHolder() { - return new SimpleCollectionValueModel<String>( - CollectionTools.collection(buildTargetDatabases()) - ); - } - - private ListValueModel<String> buildTargetDatabasesListHolder() { - return new SortedListValueModelAdapter<String>( - buildTargetDatabasesCollectionHolder(), - buildTargetDatabaseComparator() - ); - } - - private String defaultValue(Options subject) { - String defaultValue = subject.getDefaultTargetDatabase(); - - if (defaultValue != null) { - return NLS.bind( - EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultWithOneParam, - defaultValue - ); - } - else { - return EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultEmpty; - } - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - CCombo combo = buildLabeledEditableCCombo( - container, - EclipseLinkUiMessages.PersistenceXmlOptionsTab_targetDatabaseLabel, - this.buildTargetDatabaseListHolder(), - this.buildTargetDatabaseHolder(), - this.buildTargetDatabaseConverter(), - null // EclipseLinkHelpContextIds.TARGET_DATABASE_NAME - ); - - SWTUtil.attachDefaultValueHandler(combo); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/TargetServerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/TargetServerComposite.java deleted file mode 100644 index 54d8cf3823..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/options/TargetServerComposite.java +++ /dev/null @@ -1,187 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.options; - -import java.text.Collator; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.Iterator; - -import org.eclipse.jpt.eclipselink.core.internal.context.options.Options; -import org.eclipse.jpt.eclipselink.core.internal.context.options.TargetServer; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.SWTUtil; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.StringConverter; -import org.eclipse.jpt.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter; -import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter; -import org.eclipse.jpt.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.utility.model.value.ListValueModel; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.widgets.Composite; - -/** - * TargetServerComposite - */ -public class TargetServerComposite extends AbstractPane<Options> -{ - /** - * Creates a new <code>TargetServerComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public TargetServerComposite( - AbstractPane<? extends Options> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private PropertyValueModel<String> buildDefaultTargetServerHolder() { - return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.DEFAULT_TARGET_SERVER) { - @Override - protected String buildValue_() { - return TargetServerComposite.this.defaultValue(subject); - } - }; - } - - private ListValueModel<String> buildDefaultTargetServerListHolder() { - return new PropertyListValueModelAdapter<String>( - this.buildDefaultTargetServerHolder() - ); - } - - private String buildDisplayString(String targetServerName) { - - return SWTUtil.buildDisplayString( - EclipseLinkUiMessages.class, - this.getClass(), - TargetServer.valueOf(targetServerName)); - } - - private Comparator<String> buildTargetServerComparator() { - return new Comparator<String>() { - public int compare(String targetServer1, String targetServer2) { - targetServer1 = buildDisplayString(targetServer1); - targetServer2 = buildDisplayString(targetServer2); - return Collator.getInstance().compare(targetServer1, targetServer2); - } - }; - } - - private StringConverter<String> buildTargetServerConverter() { - return new StringConverter<String>() { - public String convertToString(String value) { - try { - TargetServer.valueOf(value); - value = buildDisplayString(value); - } - catch (Exception e) { - // Ignore since the value is not a TargetServer - } - return value; - } - }; - } - - private WritablePropertyValueModel<String> buildTargetServerHolder() { - return new PropertyAspectAdapter<Options, String>(this.getSubjectHolder(), Options.TARGET_SERVER_PROPERTY) { - @Override - protected String buildValue_() { - - String name = subject.getTargetServer(); - if (name == null) { - name = TargetServerComposite.this.defaultValue(subject); - } - return name; - } - - @Override - protected void setValue_(String value) { - - if (defaultValue(subject).equals(value)) { - value = null; - } - subject.setTargetServer(value); - } - }; - } - - private ListValueModel<String> buildTargetServerListHolder() { - ArrayList<ListValueModel<String>> holders = new ArrayList<ListValueModel<String>>(2); - holders.add(buildDefaultTargetServerListHolder()); - holders.add(buildTargetServersListHolder()); - return new CompositeListValueModel<ListValueModel<String>, String>(holders); - } - - private Iterator<String> buildTargetServers() { - return new TransformationIterator<TargetServer, String>(CollectionTools.iterator(TargetServer.values())) { - @Override - protected String transform(TargetServer next) { - return next.name(); - } - }; - } - - private CollectionValueModel<String> buildTargetServersCollectionHolder() { - return new SimpleCollectionValueModel<String>( - CollectionTools.collection(buildTargetServers()) - ); - } - - private ListValueModel<String> buildTargetServersListHolder() { - return new SortedListValueModelAdapter<String>( - buildTargetServersCollectionHolder(), - buildTargetServerComparator() - ); - } - - private String defaultValue(Options subject) { - String defaultValue = subject.getDefaultTargetServer(); - - if (defaultValue != null) { - return NLS.bind( - EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultWithOneParam, - defaultValue - ); - } - else { - return EclipseLinkUiMessages.PersistenceXmlOptionsTab_defaultEmpty; - } - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - CCombo combo = buildLabeledEditableCCombo( - container, - EclipseLinkUiMessages.PersistenceXmlOptionsTab_targetServerLabel, - this.buildTargetServerListHolder(), - this.buildTargetServerHolder(), - this.buildTargetServerConverter(), - null // EclipseLinkHelpContextIds.TARGET_SERVER_NAME - ); - - SWTUtil.attachDefaultValueHandler(combo); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemContentProviderFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemContentProviderFactory.java deleted file mode 100644 index 6601edda8d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemContentProviderFactory.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.persistencexml.details; - -import org.eclipse.jpt.ui.internal.platform.generic.GenericNavigatorItemContentProviderFactory; -import org.eclipse.jpt.ui.jface.TreeItemContentProviderFactory; - -/** - * EclipseLinkNavigatorItemContentProviderFactory - */ -public class EclipseLinkNavigatorItemContentProviderFactory - extends GenericNavigatorItemContentProviderFactory - implements TreeItemContentProviderFactory -{ - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemLabelProviderFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemLabelProviderFactory.java deleted file mode 100644 index 6fa03d383d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemLabelProviderFactory.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.persistencexml.details; - -import org.eclipse.jpt.ui.internal.platform.generic.GenericNavigatorItemLabelProviderFactory; -import org.eclipse.jpt.ui.jface.ItemLabelProviderFactory; - -/** - * EclipseLinkNavigatorItemLabelProviderFactory - */ -public class EclipseLinkNavigatorItemLabelProviderFactory - extends GenericNavigatorItemLabelProviderFactory - implements ItemLabelProviderFactory -{ - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/PersistenceDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/PersistenceDetailsProvider.java deleted file mode 100644 index 78c0b862ba..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/PersistenceDetailsProvider.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 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.eclipselink.ui.internal.persistencexml.details; - -import org.eclipse.jpt.core.JpaStructureNode; -import org.eclipse.jpt.core.JptCorePlugin; -import org.eclipse.jpt.core.context.persistence.PersistenceStructureNodes; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaDetailsPage; -import org.eclipse.jpt.ui.details.JpaDetailsProvider; -import org.eclipse.swt.widgets.Composite; - -/** - * PersistenceDetailsProvider - */ -public class PersistenceDetailsProvider implements JpaDetailsProvider -{ - public PersistenceDetailsProvider() { - super(); - } - - public JpaDetailsPage<? extends JpaStructureNode> buildDetailsPage( - Composite parent, - Object contentNodeId, - WidgetFactory widgetFactory) { - - if (contentNodeId == PersistenceStructureNodes.PERSISTENCE_ID) { - return new PersistenceXmlDetailsPage(parent, widgetFactory); - } - else if (contentNodeId == PersistenceStructureNodes.PERSISTENCE_UNIT_ID) { - return new PersistenceXmlDetailsPage(parent, widgetFactory); - } - return null; - } - - public String fileContentType() { - return JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/PersistenceXmlDetailsPage.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/PersistenceXmlDetailsPage.java deleted file mode 100644 index cc4c6eb673..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/PersistenceXmlDetailsPage.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 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.eclipselink.ui.internal.persistencexml.details; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.internal.details.AbstractJpaDetailsPage; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; - -/** - * PersistenceXmlDetailsPage - */ -public class PersistenceXmlDetailsPage extends AbstractJpaDetailsPage<PersistenceUnit> -{ - - public PersistenceXmlDetailsPage(Composite parent, WidgetFactory widgetFactory) { - super(parent, widgetFactory); - } - - protected void initialize() { - super.initialize(); - } - - @Override - protected void initializeLayout(Composite composite) { - composite.setLayout(new FillLayout()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUI.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUI.java deleted file mode 100644 index 176e2eefd0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUI.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.platform; - -import java.text.MessageFormat; -import java.util.Collection; -import java.util.List; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.core.context.AttributeMapping; -import org.eclipse.jpt.core.context.TypeMapping; -import org.eclipse.jpt.eclipselink.ui.EclipseLinkJpaUiFactory; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkJpaUiFactoryImpl; -import org.eclipse.jpt.eclipselink.ui.internal.ddlgen.EclipseLinkDDLGeneratorUi; -import org.eclipse.jpt.eclipselink.ui.internal.persistencexml.details.PersistenceDetailsProvider; -import org.eclipse.jpt.ui.details.AttributeMappingUiProvider; -import org.eclipse.jpt.ui.details.JpaDetailsProvider; -import org.eclipse.jpt.ui.details.TypeMappingUiProvider; -import org.eclipse.jpt.ui.internal.platform.base.BaseJpaPlatformUi; -import org.eclipse.jpt.ui.navigator.JpaNavigatorProvider; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -/** - * EclipseLinkPlatformUI - */ -public class EclipseLinkJpaPlatformUI extends BaseJpaPlatformUi -{ - public EclipseLinkJpaPlatformUI() { - super(); - } - - // ********* navigator content ********* - public JpaNavigatorProvider buildNavigatorProvider() { - return new EclipseLinkNavigatorProvider(); - } - - @Override - protected EclipseLinkJpaUiFactory createJpaUiFactory() { - return new EclipseLinkJpaUiFactoryImpl(); - } - - public void generateDDL(JpaProject project, IStructuredSelection selection) { - - String projectLocation = project.getProject().getLocation().toString(); - - EclipseLinkDDLGeneratorUi.generate(project, projectLocation, selection); - } - - protected void displayNotSupportedMessage(String title, String message) { - String formattedMessage = MessageFormat.format(message, message); - Shell currentShell = Display.getCurrent().getActiveShell(); - MessageDialog.openInformation(currentShell, title, formattedMessage); - } - - @Override - protected void addDetailsProvidersTo(Collection<JpaDetailsProvider> providers) { - super.addDetailsProvidersTo(providers); - providers.add(new PersistenceDetailsProvider()); - } - - @Override - protected void addJavaAttributeMappingUiProvidersTo( - List<AttributeMappingUiProvider<? extends AttributeMapping>> providers) { - super.addJavaAttributeMappingUiProvidersTo(providers); - } - - @Override - protected void addJavaTypeMappingUiProvidersTo( - List<TypeMappingUiProvider<? extends TypeMapping>> providers) { - super.addJavaTypeMappingUiProvidersTo(providers); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkNavigatorProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkNavigatorProvider.java deleted file mode 100644 index f8e5c4b3d3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkNavigatorProvider.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.platform; - -import org.eclipse.jpt.eclipselink.ui.internal.persistencexml.details.EclipseLinkNavigatorItemContentProviderFactory; -import org.eclipse.jpt.eclipselink.ui.internal.persistencexml.details.EclipseLinkNavigatorItemLabelProviderFactory; -import org.eclipse.jpt.ui.jface.ItemLabelProviderFactory; -import org.eclipse.jpt.ui.jface.TreeItemContentProviderFactory; -import org.eclipse.jpt.ui.navigator.JpaNavigatorProvider; - -/** - * EclipseLinkNavigatorProvider - */ -public class EclipseLinkNavigatorProvider implements JpaNavigatorProvider -{ - public ItemLabelProviderFactory getItemLabelProviderFactory() { - return new EclipseLinkNavigatorItemLabelProviderFactory(); - } - - public TreeItemContentProviderFactory getTreeItemContentProviderFactory() { - return new EclipseLinkNavigatorItemContentProviderFactory(); - } - - public void dispose() { - - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/CreateDdlFileNameComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/CreateDdlFileNameComposite.java deleted file mode 100644 index 52f159c2e7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/CreateDdlFileNameComposite.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.schema.generation; - -import org.eclipse.jpt.eclipselink.core.internal.context.schema.generation.SchemaGeneration; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.SWTUtil; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter; -import org.eclipse.jpt.utility.model.value.ListValueModel; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.widgets.Composite; - -/** - * CreateDdlFileNameComposite - */ -public class CreateDdlFileNameComposite extends AbstractPane<SchemaGeneration> -{ - /** - * Creates a new <code>CreateDdlFileNameComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public CreateDdlFileNameComposite( - AbstractPane<? extends SchemaGeneration> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private PropertyValueModel<String> buildDefaultCreateDdlFileNameHolder() { - return new PropertyAspectAdapter<SchemaGeneration, String>(this.getSubjectHolder(), SchemaGeneration.DEFAULT_SCHEMA_GENERATION_CREATE_FILE_NAME) { - @Override - protected String buildValue_() { - return CreateDdlFileNameComposite.this.defaultValue(subject); - } - }; - } - - private ListValueModel<String> buildDefaultCreateDdlFileNameListHolder() { - return new PropertyListValueModelAdapter<String>( - this.buildDefaultCreateDdlFileNameHolder() - ); - } - - private WritablePropertyValueModel<String> buildCreateDdlFileNameHolder() { - return new PropertyAspectAdapter<SchemaGeneration, String>(this.getSubjectHolder(), SchemaGeneration.CREATE_FILE_NAME_PROPERTY) { - @Override - protected String buildValue_() { - - String name = subject.getCreateFileName(); - if (name == null) { - name = CreateDdlFileNameComposite.this.defaultValue(subject); - } - return name; - } - - @Override - protected void setValue_(String value) { - - if (defaultValue(subject).equals(value)) { - value = null; - } - subject.setCreateFileName(value); - } - }; - } - - private String defaultValue(SchemaGeneration subject) { - String defaultValue = subject.getDefaultCreateFileName(); - - if (defaultValue != null) { - return NLS.bind( - EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_defaultWithOneParam, - defaultValue - ); - } - else { - return EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_defaultEmpty; - } - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - CCombo combo = buildLabeledEditableCCombo( - container, - EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_createDdlFileNameLabel, - this.buildDefaultCreateDdlFileNameListHolder(), - this.buildCreateDdlFileNameHolder(), - null // EclipseLinkHelpContextIds.CREATE_DDL_FILE_NAME - ); - SWTUtil.attachDefaultValueHandler(combo); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/DdlGenerationLocationComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/DdlGenerationLocationComposite.java deleted file mode 100644 index 83c370228c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/DdlGenerationLocationComposite.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.schema.generation; - -import org.eclipse.jpt.eclipselink.core.internal.context.schema.generation.SchemaGeneration; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.ui.internal.widgets.FolderChooserPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * DdlGenerationLocationComposite - */ -public class DdlGenerationLocationComposite extends AbstractPane<SchemaGeneration> -{ - public DdlGenerationLocationComposite(AbstractPane<? extends SchemaGeneration> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - @Override - protected void initializeLayout(Composite container) { - - new FolderChooserPane<SchemaGeneration>(this, container) { - - @Override - protected WritablePropertyValueModel<String> buildTextHolder() { - return new PropertyAspectAdapter<SchemaGeneration, String>( - getSubjectHolder(), SchemaGeneration.APPLICATION_LOCATION_PROPERTY) { - @Override - protected String buildValue_() { - - String name = subject.getApplicationLocation(); - if (name == null) { - name = defaultValue(subject); - } - return name; - } - - @Override - protected void setValue_(String value) { - - if (defaultValue(subject).equals(value)) { - value = null; - } - subject.setApplicationLocation(value); - } - }; - } - - private String defaultValue(SchemaGeneration subject) { - String defaultValue = subject.getDefaultApplicationLocation(); - - if (defaultValue != null) { - return NLS.bind( - EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_defaultWithOneParam, - defaultValue - ); - } - else { - return EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_defaultEmpty; - } - } - - @Override - protected String dialogMessage() { - return EclipseLinkUiMessages.DdlGenerationLocationComposite_dialogMessage; - } - - @Override - protected String dialogTitle() { - return EclipseLinkUiMessages.DdlGenerationLocationComposite_dialogTitle; - } - - @Override - protected String labelText() { - return EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_ddlGenerationLocationLabel; - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/DdlGenerationTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/DdlGenerationTypeComposite.java deleted file mode 100644 index cba5e59fb8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/DdlGenerationTypeComposite.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.schema.generation; - -import java.util.Collection; - -import org.eclipse.jpt.eclipselink.core.internal.context.schema.generation.DdlGenerationType; -import org.eclipse.jpt.eclipselink.core.internal.context.schema.generation.SchemaGeneration; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.swt.widgets.Composite; - -/** - * DdlGenerationTypeComposite - */ -public class DdlGenerationTypeComposite - extends AbstractFormPane<SchemaGeneration> -{ - /** - * Creates a new <code>DdlGenerationTypeComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public DdlGenerationTypeComposite( - AbstractFormPane<? extends SchemaGeneration> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private EnumFormComboViewer<SchemaGeneration, DdlGenerationType> buildDdlGenerationTypeCombo(Composite container) { - return new EnumFormComboViewer<SchemaGeneration, DdlGenerationType>(this, container) { - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(SchemaGeneration.DDL_GENERATION_TYPE_PROPERTY); - } - - @Override - protected DdlGenerationType[] choices() { - return DdlGenerationType.values(); - } - - @Override - protected DdlGenerationType defaultValue() { - return this.subject().getDefaultDdlGenerationType(); - } - - @Override - protected String displayString(DdlGenerationType value) { - return this.buildDisplayString(EclipseLinkUiMessages.class, DdlGenerationTypeComposite.this, value); - } - - @Override - protected DdlGenerationType getValue() { - return this.subject().getDdlGenerationType(); - } - - @Override - protected void setValue(DdlGenerationType value) { - this.subject().setDdlGenerationType(value); - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - this.buildLabeledComposite( - container, - EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_ddlGenerationTypeLabel, - buildDdlGenerationTypeCombo( container), - null // TODO IJpaHelpContextIds. - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/DropDdlFileNameComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/DropDdlFileNameComposite.java deleted file mode 100644 index 986ce3762c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/DropDdlFileNameComposite.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.ui.internal.schema.generation; - -import org.eclipse.jpt.eclipselink.core.internal.context.schema.generation.SchemaGeneration; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.util.SWTUtil; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter; -import org.eclipse.jpt.utility.model.value.ListValueModel; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.widgets.Composite; - -/** - * DropDdlFileNameComposite - */ -public class DropDdlFileNameComposite extends AbstractPane<SchemaGeneration> -{ - /** - * Creates a new <code>DropDdlFileNameComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public DropDdlFileNameComposite( - AbstractPane<? extends SchemaGeneration> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private PropertyValueModel<String> buildDefaultDropDdlFileNameHolder() { - return new PropertyAspectAdapter<SchemaGeneration, String>(this.getSubjectHolder(), SchemaGeneration.DEFAULT_SCHEMA_GENERATION_DROP_FILE_NAME) { - @Override - protected String buildValue_() { - return DropDdlFileNameComposite.this.defaultValue(subject); - } - }; - } - - private ListValueModel<String> buildDefaultDropDdlFileNameListHolder() { - return new PropertyListValueModelAdapter<String>( - this.buildDefaultDropDdlFileNameHolder() - ); - } - - private WritablePropertyValueModel<String> buildDropDdlFileNameHolder() { - return new PropertyAspectAdapter<SchemaGeneration, String>(this.getSubjectHolder(), SchemaGeneration.DROP_FILE_NAME_PROPERTY) { - @Override - protected String buildValue_() { - - String name = subject.getDropFileName(); - if (name == null) { - name = DropDdlFileNameComposite.this.defaultValue(subject); - } - return name; - } - - @Override - protected void setValue_(String value) { - - if (DropDdlFileNameComposite.this.defaultValue(subject).equals(value)) { - value = null; - } - subject.setDropFileName(value); - } - }; - } - - private String defaultValue(SchemaGeneration subject) { - String defaultValue = subject.getDefaultDropFileName(); - - if (defaultValue != null) { - return NLS.bind( - EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_defaultWithOneParam, - defaultValue - ); - } - else { - return EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_defaultEmpty; - } - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - CCombo combo = buildLabeledEditableCCombo( - container, - EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_dropDdlFileNameLabel, - this.buildDefaultDropDdlFileNameListHolder(), - this.buildDropDdlFileNameHolder(), - null // EclipseLinkHelpContextIds.DROP_DDL_FILE_NAME - ); - SWTUtil.attachDefaultValueHandler(combo); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/EclipseLinkSchemaGenerationComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/EclipseLinkSchemaGenerationComposite.java deleted file mode 100644 index 993483bc59..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/EclipseLinkSchemaGenerationComposite.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.schema.generation; - -import org.eclipse.jpt.eclipselink.core.internal.context.schema.generation.SchemaGeneration; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.swt.widgets.Composite; - -/** - * EclipseLinkSchemaGenerationComposite - */ -public class EclipseLinkSchemaGenerationComposite - extends AbstractFormPane<SchemaGeneration> -{ - public EclipseLinkSchemaGenerationComposite( - AbstractFormPane<SchemaGeneration> subjectHolder, - Composite container) { - super(subjectHolder, container, false); - } - - @Override - protected void initializeLayout(Composite container) { - - container = buildSection( - container, - EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_sectionTitle, - EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_sectionDescription - ); - - // DDL Generation Type: - new DdlGenerationTypeComposite(this, container); - // Output Mode: - new OutputModeComposite(this, container); - // DDL Generation Location - new DdlGenerationLocationComposite(this, container); - // Create DDL File Name: - new CreateDdlFileNameComposite(this, container); - // Drop DDL File Name: - new DropDdlFileNameComposite(this, container); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/OutputModeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/OutputModeComposite.java deleted file mode 100644 index 6bfac27ba1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/OutputModeComposite.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.eclipselink.ui.internal.schema.generation; - -import java.util.Collection; - -import org.eclipse.jpt.eclipselink.core.internal.context.schema.generation.OutputMode; -import org.eclipse.jpt.eclipselink.core.internal.context.schema.generation.SchemaGeneration; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.swt.widgets.Composite; - -/** - * OutputModeComposite - */ -public class OutputModeComposite extends AbstractFormPane<SchemaGeneration> -{ - /** - * Creates a new <code>OutputModeComposite</code>. - * - * @param parentController - * The parent container of this one - * @param parent - * The parent container - */ - public OutputModeComposite( - AbstractFormPane<? extends SchemaGeneration> parentComposite, - Composite parent) { - - super(parentComposite, parent); - } - - private EnumFormComboViewer<SchemaGeneration, OutputMode> buildOutputModeCombo(Composite container) { - return new EnumFormComboViewer<SchemaGeneration, OutputMode>(this, container) { - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(SchemaGeneration.OUTPUT_MODE_PROPERTY); - } - - @Override - protected OutputMode[] choices() { - return OutputMode.values(); - } - - @Override - protected OutputMode defaultValue() { - return this.subject().getDefaultOutputMode(); - } - - @Override - protected String displayString(OutputMode value) { - return this.buildDisplayString(EclipseLinkUiMessages.class, OutputModeComposite.this, value); - } - - @Override - protected OutputMode getValue() { - return this.subject().getOutputMode(); - } - - @Override - protected void setValue(OutputMode value) { - this.subject().setOutputMode(value); - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - this.buildLabeledComposite( - container, - EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_outputModeLabel, - this.buildOutputModeCombo(container), - null // TODO IJpaHelpContextIds. - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/PersistenceXmlSchemaGenerationTab.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/PersistenceXmlSchemaGenerationTab.java deleted file mode 100644 index 2fcc449065..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/schema/generation/PersistenceXmlSchemaGenerationTab.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 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.eclipselink.ui.internal.schema.generation; - -import org.eclipse.jpt.eclipselink.core.internal.context.schema.generation.SchemaGeneration; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaPageComposite; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; - -/** - * PersistenceXmlSchemaGenerationTab - */ -public class PersistenceXmlSchemaGenerationTab - extends AbstractFormPane<SchemaGeneration> - implements JpaPageComposite -{ - // ********** constructors/initialization ********** - public PersistenceXmlSchemaGenerationTab( - PropertyValueModel<SchemaGeneration> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - new EclipseLinkSchemaGenerationComposite(this, container); - } - - // ********** JpaPageComposite implementation ********** - public String getHelpID() { - return null; - } - - public Image getPageImage() { - return null; - } - - public String getPageText() { - return EclipseLinkUiMessages.PersistenceXmlSchemaGenerationTab_title; - } -}
\ No newline at end of file |