diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal')
7 files changed, 413 insertions, 7 deletions
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 index 01ef06d0e9..6e517877ed 100644 --- 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 @@ -174,15 +174,17 @@ public class EclipseLinkUiMessages { public static String CachingEntityListComposite_dialogMessage; public static String CachingEntityListComposite_dialogTitle; + public static String PersistenceXmlCachingTab_FlushClearCacheLabel; + + public static String FlushClearCacheComposite_drop; + public static String FlushClearCacheComposite_drop_invalidate; + public static String FlushClearCacheComposite_merge; + // Customization public static String PersistenceXmlCustomizationTab_title; public static String PersistenceXmlCustomizationTab_sectionTitle; public static String PersistenceXmlCustomizationTab_sectionDescription; public static String PersistenceXmlCustomizationTab_defaultWithOneParam; - public static String PersistenceXmlCustomizationTab_defaultEmpty; - - public static String PersistenceXmlCustomizationTab_throwExceptionsLabelDefault; - public static String PersistenceXmlCustomizationTab_throwExceptionsLabel; public static String PersistenceXmlCustomizationTab_weavingLabel; @@ -200,6 +202,12 @@ public class EclipseLinkUiMessages { public static String PersistenceXmlCustomizationTab_weavingEagerLabelDefault; public static String PersistenceXmlCustomizationTab_weavingEagerLabel; + public static String PersistenceXmlCustomizationTab_defaultEmpty; + + public static String PersistenceXmlCustomizationTab_throwExceptionsLabelDefault; + public static String PersistenceXmlCustomizationTab_throwExceptionsLabel; + + public static String PersistenceXmlCustomizationTab_exceptionHandlerLabel; public static String WeavingComposite_true_; public static String WeavingComposite_false_; @@ -214,6 +222,11 @@ public class EclipseLinkUiMessages { public static String PersistenceXmlCustomizationTab_customizerLabel; public static String PersistenceXmlCustomizationTab_sessionCustomizerLabel; public static String PersistenceXmlCustomizationTab_noName; + + public static String PersistenceXmlCustomizationTab_validationOnlyLabel; + public static String PersistenceXmlCustomizationTab_validationOnlyLabelDefault; + + public static String PersistenceXmlCustomizationTab_classLoaderLabel; public static String PersistenceXmlCustomizationTab_profilerLabel; public static String PersistenceXmlCustomizationTab_browse; @@ -239,6 +252,7 @@ public class EclipseLinkUiMessages { public static String LoggingLevelComposite_fine; public static String LoggingLevelComposite_finer; public static String LoggingLevelComposite_finest; + public static String LoggingLevelComposite_all; public static String PersistenceXmlLoggingTab_loggerLabel; public static String PersistenceXmlLoggingTab_browse; diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EclipseLinkCachingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EclipseLinkCachingComposite.java index 3852009073..225909b3a7 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EclipseLinkCachingComposite.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EclipseLinkCachingComposite.java @@ -28,16 +28,16 @@ public class EclipseLinkCachingComposite extends FormPane<Caching> @Override protected void initializeLayout(Composite container) { - container = addSection( + container = this.addSection( container, EclipseLinkUiMessages.PersistenceXmlCachingTab_sectionTitle, EclipseLinkUiMessages.PersistenceXmlCachingTab_sectionDescription ); // Default pane - int groupBoxMargin = getGroupBoxMargin(); + int groupBoxMargin = this.getGroupBoxMargin(); - Composite defaultPane = addSubPane( + Composite defaultPane = this.addSubPane( container, 0, groupBoxMargin, 0, groupBoxMargin ); @@ -53,5 +53,8 @@ public class EclipseLinkCachingComposite extends FormPane<Caching> // EntitiesList new EntityListComposite(this, container); + + // Flush Clear Cache + new FlushClearCacheComposite(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/persistence/caching/FlushClearCacheComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/FlushClearCacheComposite.java new file mode 100644 index 0000000000..c2a1ddeb72 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/FlushClearCacheComposite.java @@ -0,0 +1,90 @@ +/******************************************************************************* + * 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.persistence.caching; + +import java.util.Collection; + +import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching; +import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.FlushClearCache; +import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; +import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; +import org.eclipse.jpt.ui.internal.widgets.FormPane; +import org.eclipse.swt.widgets.Composite; + +/** + * FlushClearCacheComposite + */ +public class FlushClearCacheComposite extends FormPane<Caching> +{ + /** + * Creates a new <code>FlushClearCacheComposite</code>. + * + * @param parentController + * The parent container of this one + * @param parent + * The parent container + */ + public FlushClearCacheComposite( + FormPane<? extends Caching> parentComposite, + Composite parent) { + + super(parentComposite, parent); + } + + private EnumFormComboViewer<Caching, FlushClearCache> addFlushClearCacheCombo(Composite container) { + return new EnumFormComboViewer<Caching, FlushClearCache>(this, container) { + @Override + protected void addPropertyNames(Collection<String> propertyNames) { + super.addPropertyNames(propertyNames); + propertyNames.add(Caching.FLUSH_CLEAR_CACHE_PROPERTY); + } + + @Override + protected FlushClearCache[] getChoices() { + return FlushClearCache.values(); + } + + @Override + protected boolean sortChoices() { + return false; + } + + @Override + protected FlushClearCache getDefaultValue() { + return this.getSubject().getDefaultFlushClearCache(); + } + + @Override + protected String displayString(FlushClearCache value) { + return this.buildDisplayString(EclipseLinkUiMessages.class, FlushClearCacheComposite.this, value); + } + + @Override + protected FlushClearCache getValue() { + return this.getSubject().getFlushClearCache(); + } + + @Override + protected void setValue(FlushClearCache value) { + this.getSubject().setFlushClearCache(value); + } + }; + } + + @Override + protected void initializeLayout(Composite container) { + this.addLabeledComposite( + container, + EclipseLinkUiMessages.PersistenceXmlCachingTab_FlushClearCacheLabel, + this.addFlushClearCacheCombo(container), + null // TODO IJpaHelpContextIds. + ); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ClassLoaderComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ClassLoaderComposite.java new file mode 100644 index 0000000000..6d03022be6 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ClassLoaderComposite.java @@ -0,0 +1,97 @@ +/******************************************************************************* +* 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.persistence.customization; + +import org.eclipse.jdt.core.IType; +import org.eclipse.jpt.core.JpaProject; +import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization; +import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; +import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane; +import org.eclipse.jpt.ui.internal.widgets.Pane; +import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; +import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; +import org.eclipse.swt.widgets.Composite; + +/** + * ClassLoaderComposite + */ +public class ClassLoaderComposite extends Pane<Customization> +{ + /** + * Creates a new <code>ClassLoaderComposite</code>. + * + * @param parentPane The parent pane of this one + * @param parent The parent container + */ + public ClassLoaderComposite(Pane<? 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>( + this.getSubjectHolder(), Customization.CLASSLOADER_PROPERTY) { + @Override + protected String buildValue_() { + return this.subject.getClassLoader(); + } + + @Override + protected void setValue_(String value) { + + if (value.length() == 0) { + value = null; + } + this.subject.setClassLoader(value); + } + }; + } + + @Override + protected String getClassName() { + return this.getSubject().getClassLoader(); + } + + @Override + protected String getLabelText() { + return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_classLoaderLabel; + } + + @Override + protected JpaProject getJpaProject() { + return getSubject().getJpaProject(); + } + + @Override + protected void promptType() { + IType type = chooseType(); + + if (type != null) { + String className = type.getFullyQualifiedName('.'); + this.getSubject().setClassLoader(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/persistence/customization/EclipseLinkCustomizationComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EclipseLinkCustomizationComposite.java index 0f4ea53aa3..49a9fd3232 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EclipseLinkCustomizationComposite.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EclipseLinkCustomizationComposite.java @@ -68,11 +68,20 @@ public class EclipseLinkCustomizationComposite extends FormPane<Customization> // Throw Exceptions new ThrowExceptionsComposite(this, defaultPane); + // Exception Handler + new ExceptionHandlerComposite(this, defaultPane); + // Session Customizer new SessionCustomizersComposite(this, defaultPane); // EntitiesList new EntityListComposite(this, composite); + + // Validation Only + new ValidationOnlyComposite(this, composite); + + // Class Loader + new ClassLoaderComposite(this, composite); // Profiler: new ProfilerComposite(this, composite); diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ExceptionHandlerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ExceptionHandlerComposite.java new file mode 100644 index 0000000000..6fd3242a46 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ExceptionHandlerComposite.java @@ -0,0 +1,97 @@ +/******************************************************************************* +* 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.persistence.customization; + +import org.eclipse.jdt.core.IType; +import org.eclipse.jpt.core.JpaProject; +import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization; +import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; +import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane; +import org.eclipse.jpt.ui.internal.widgets.Pane; +import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; +import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; +import org.eclipse.swt.widgets.Composite; + +/** + * ExceptionHandlerComposite + */ +public class ExceptionHandlerComposite extends Pane<Customization> +{ + /** + * Creates a new <code>ExceptionHandlerComposite</code>. + * + * @param parentPane The parent pane of this one + * @param parent The parent container + */ + public ExceptionHandlerComposite(Pane<? 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>( + this.getSubjectHolder(), Customization.EXCEPTION_HANDLER_PROPERTY) { + @Override + protected String buildValue_() { + return this.subject.getExceptionHandler(); + } + + @Override + protected void setValue_(String value) { + + if (value.length() == 0) { + value = null; + } + this.subject.setExceptionHandler(value); + } + }; + } + + @Override + protected String getClassName() { + return this.getSubject().getExceptionHandler(); + } + + @Override + protected String getLabelText() { + return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_exceptionHandlerLabel; + } + + @Override + protected JpaProject getJpaProject() { + return getSubject().getJpaProject(); + } + + @Override + protected void promptType() { + IType type = chooseType(); + + if (type != null) { + String className = type.getFullyQualifiedName('.'); + this.getSubject().setExceptionHandler(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/persistence/customization/ValidationOnlyComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ValidationOnlyComposite.java new file mode 100644 index 0000000000..7af56bc4d4 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ValidationOnlyComposite.java @@ -0,0 +1,96 @@ +/******************************************************************************* + * 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.persistence.customization; + +import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization; +import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; +import org.eclipse.jpt.ui.internal.widgets.FormPane; +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; + +/** + * ValidationOnlyComposite + */ +public class ValidationOnlyComposite extends FormPane<Customization> +{ + /** + * Creates a new <code>ValidationOnlyComposite</code>. + * + * @param parentController + * The parent container of this one + * @param parent + * The parent container + */ + public ValidationOnlyComposite( + FormPane<? extends Customization> parentComposite, + Composite parent) { + + super(parentComposite, parent); + } + + private WritablePropertyValueModel<Boolean> buildValidationOnlyHolder() { + return new PropertyAspectAdapter<Customization, Boolean>(getSubjectHolder(), Customization.VALIDATION_ONLY_PROPERTY) { + @Override + protected Boolean buildValue_() { + return subject.getValidationOnly(); + } + + @Override + protected void setValue_(Boolean value) { + subject.setValidationOnly(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> buildValidationOnlyStringHolder() { + return new TransformationPropertyValueModel<Boolean, String>(buildValidationOnlyHolder()) { + @Override + protected String transform(Boolean value) { + if ((getSubject() != null) && (value == null)) { + Boolean defaultValue = getSubject().getDefaultValidationOnly(); + if (defaultValue != null) { + String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; + return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_validationOnlyLabelDefault, defaultStringValue); + } + } + return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_validationOnlyLabel; + } + }; + } + + @Override + protected void initializeLayout(Composite container) { + + this.addTriStateCheckBoxWithDefault( + container, + EclipseLinkUiMessages.PersistenceXmlCustomizationTab_validationOnlyLabel, + this.buildValidationOnlyHolder(), + this.buildValidationOnlyStringHolder(), + null +// EclipseLinkHelpContextIds. + ); + } +} |