Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2008-07-25 17:27:32 +0000
committerkmoore2008-07-25 17:27:32 +0000
commit75726a151172cc9db06c577e69eba8db577771f3 (patch)
tree4cb64cb28e67f34346624f2ccd7d9db9d6d72f24 /jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheTypeComposite.java
parentbc37e1ac643524dda604f91c80aba09c3bfa8d1d (diff)
downloadwebtools.dali-75726a151172cc9db06c577e69eba8db577771f3.tar.gz
webtools.dali-75726a151172cc9db06c577e69eba8db577771f3.tar.xz
webtools.dali-75726a151172cc9db06c577e69eba8db577771f3.zip
partial support for EclipseLink platform java entity caching
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheTypeComposite.java')
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheTypeComposite.java109
1 files changed, 109 insertions, 0 deletions
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
new file mode 100644
index 0000000000..4fccac255b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheTypeComposite.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * 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>FetchTypeComposite</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_CACHE_TYPE_PROPERTY);
+ propertyNames.add(EclipseLinkCaching.SPECIFIED_CACHE_TYPE_PROPERTY);
+ }
+
+ @Override
+ protected CacheType[] choices() {
+ return CacheType.values();
+ }
+
+ @Override
+ protected CacheType defaultValue() {
+ return subject().getDefaultCacheType();
+ }
+
+ @Override
+ protected String displayString(CacheType value) {
+ return buildDisplayString(
+ EclipseLinkUiMappingsMessages.class,
+ CacheTypeComposite.this,
+ value
+ );
+ }
+
+ @Override
+ protected CacheType getValue() {
+ return subject().getSpecifiedCacheType();
+ }
+
+ @Override
+ protected void setValue(CacheType value) {
+ subject().setSpecifiedCacheType(value);
+ }
+
+ @Override
+ protected boolean sortChoices() {
+ return false;
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ buildLabeledComposite(
+ container,
+ EclipseLinkUiMappingsMessages.CacheTypeComposite_label,
+ buildCacheTypeCombo(container),
+ EclipseLinkHelpContextIds.CACHING_CACHE_TYPE
+ );
+ }
+}

Back to the top