Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortle2008-04-07 16:40:41 +0000
committertle2008-04-07 16:40:41 +0000
commitf1a53b586f847a17e4ff307353982859eb0f0310 (patch)
treeb64251b77cd93862bba16261e658df71bb421c43 /jpa/plugins
parent7690560240e5db8374fca0af900ef9e84bb482bc (diff)
downloadwebtools.dali-f1a53b586f847a17e4ff307353982859eb0f0310.tar.gz
webtools.dali-f1a53b586f847a17e4ff307353982859eb0f0310.tar.xz
webtools.dali-f1a53b586f847a17e4ff307353982859eb0f0310.zip
Initial checkin.
Diffstat (limited to 'jpa/plugins')
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/EclipseLinkLogging.java331
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/Logger.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/Logging.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/LoggingLevel.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/EclipseLinkLoggingComposite.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/ExceptionsComposite.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/LoggerComposite.java114
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/LoggingLevelComposite.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/PersistenceXmlLoggingTab.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/SessionComposite.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/ThreadComposite.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/TimestampComposite.java96
12 files changed, 1207 insertions, 0 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/EclipseLinkLogging.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/EclipseLinkLogging.java
new file mode 100644
index 0000000000..531f375dd0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/EclipseLinkLogging.java
@@ -0,0 +1,331 @@
+/*******************************************************************************
+* 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.core.internal.context.logging;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.core.context.persistence.Property;
+import org.eclipse.jpt.eclipselink.core.internal.context.EclipseLinkPersistenceUnitProperties;
+import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.model.value.ListValueModel;
+
+/**
+ * EclipseLinkLogging
+ */
+public class EclipseLinkLogging extends EclipseLinkPersistenceUnitProperties
+ implements Logging
+{
+ // ********** EclipseLink properties **********
+ private LoggingLevel level;
+ private Boolean timestamp;
+ private Boolean thread;
+ private Boolean session;
+ private Boolean exceptions;
+ private String logFileLocation;
+ private String logger; // storing EclipseLinkStringValue since value can be Logger or custom class
+
+ protected List<String> loggers;
+
+
+ // ********** constructors **********
+ public EclipseLinkLogging(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) {
+ super(parent, propertyListAdapter);
+ }
+
+ // ********** initialization **********
+ /**
+ * Initializes properties with values from the persistence unit.
+ */
+ @Override
+ protected void initializeProperties() {
+ this.loggers =
+ new ArrayList<String>();
+
+ // TOREVIEW - handle incorrect String in persistence.xml
+ this.level =
+ this.getEnumValue(ECLIPSELINK_LEVEL, LoggingLevel.values());
+ this.timestamp =
+ this.getBooleanValue(ECLIPSELINK_TIMESTAMP);
+ this.thread =
+ this.getBooleanValue(ECLIPSELINK_THREAD);
+ this.session =
+ this.getBooleanValue(ECLIPSELINK_SESSION);
+ this.exceptions =
+ this.getBooleanValue(ECLIPSELINK_EXCEPTIONS);
+ this.logFileLocation =
+ this.getStringValue(ECLIPSELINK_LOG_FILE_LOCATION);
+
+ Logger standardLogger = this.getEnumValue(ECLIPSELINK_LOGGER, Logger.values());
+ if( ! this.persistenceUnit().containsProperty(ECLIPSELINK_LOGGER)) {
+ this.logger = null;
+ }
+ else if(standardLogger == null) {
+ this.logger = this.getStringValue(ECLIPSELINK_LOGGER); // custom logger
+ }
+ else {
+ this.logger = getEclipseLinkStringValueOf(standardLogger);
+ }
+ }
+
+ // ********** behavior **********
+ /**
+ * Adds property names key/value pairs, where:
+ * key = EclipseLink property key
+ * value = property id
+ */
+ @Override
+ protected void addPropertyNames(Map<String, String> propertyNames) {
+ propertyNames.put(
+ ECLIPSELINK_LEVEL,
+ LEVEL_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_TIMESTAMP,
+ TIMESTAMP_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_THREAD,
+ THREAD_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_SESSION,
+ SESSION_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_EXCEPTIONS,
+ EXCEPTIONS_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_LOG_FILE_LOCATION,
+ LOG_FILE_LOCATION_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_LOGGER,
+ LOGGER_PROPERTY);
+ }
+
+ public void propertyChanged(PropertyChangeEvent event) {
+ String aspectName = event.getAspectName();
+ if (aspectName.equals(LEVEL_PROPERTY)) {
+ this.levelChanged(event);
+ }
+ else if (aspectName.equals(TIMESTAMP_PROPERTY)) {
+ this.timestampChanged(event);
+ }
+ else if (aspectName.equals(THREAD_PROPERTY)) {
+ this.threadChanged(event);
+ }
+ else if (aspectName.equals(SESSION_PROPERTY)) {
+ this.sessionChanged(event);
+ }
+ else if (aspectName.equals(EXCEPTIONS_PROPERTY)) {
+ this.exceptionsChanged(event);
+ }
+ else if (aspectName.equals(LOG_FILE_LOCATION_PROPERTY)) {
+ this.logFileLocationChanged(event);
+ }
+ else if (aspectName.equals(LOGGER_PROPERTY)) {
+ this.loggerChanged(event);
+ }
+ else {
+ throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName);
+ }
+ return;
+ }
+
+ // ********** LoggingLevel **********
+
+ public LoggingLevel getLevel() {
+ return this.level;
+ }
+
+ public void setLevel(LoggingLevel newLevel) {
+ LoggingLevel old = this.level;
+ this.level = newLevel;
+ this.putProperty(LEVEL_PROPERTY, newLevel);
+ this.firePropertyChanged(LEVEL_PROPERTY, old, newLevel);
+ }
+
+ private void levelChanged(PropertyChangeEvent event) {
+ String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue();
+ LoggingLevel newValue = getEnumValueOf(stringValue, LoggingLevel.values());
+ LoggingLevel old = this.level;
+ this.level = newValue;
+ this.firePropertyChanged(event.getAspectName(), old, newValue);
+ }
+
+ public LoggingLevel getDefaultLevel() {
+ return DEFAULT_LEVEL;
+ }
+
+ // ********** Timestamp **********
+ public Boolean getTimestamp() {
+ return this.timestamp;
+ }
+
+ public void setTimestamp(Boolean newTimestamp) {
+ Boolean old = this.timestamp;
+ this.timestamp = newTimestamp;
+ this.putProperty(TIMESTAMP_PROPERTY, newTimestamp);
+ this.firePropertyChanged(TIMESTAMP_PROPERTY, old, newTimestamp);
+ }
+
+ private void timestampChanged(PropertyChangeEvent event) {
+ String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue();
+ Boolean newValue = getBooleanValueOf(stringValue);
+
+ Boolean old = this.timestamp;
+ this.timestamp = newValue;
+ this.firePropertyChanged(event.getAspectName(), old, newValue);
+ }
+
+ public Boolean getDefaultTimestamp() {
+ return DEFAULT_TIMESTAMP;
+ }
+
+ // ********** Thread **********
+ public Boolean getThread() {
+ return this.thread;
+ }
+
+ public void setThread(Boolean newThread) {
+ Boolean old = this.thread;
+ this.thread = newThread;
+ this.putProperty(THREAD_PROPERTY, newThread);
+ this.firePropertyChanged(THREAD_PROPERTY, old, newThread);
+ }
+
+ private void threadChanged(PropertyChangeEvent event) {
+ String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue();
+ Boolean newValue = getBooleanValueOf(stringValue);
+
+ Boolean old = this.thread;
+ this.thread = newValue;
+ this.firePropertyChanged(event.getAspectName(), old, newValue);
+ }
+
+ public Boolean getDefaultThread() {
+ return DEFAULT_THREAD;
+ }
+
+ // ********** Session **********
+ public Boolean getSession() {
+ return this.session;
+ }
+
+ public void setSession(Boolean newSession) {
+ Boolean old = this.session;
+ this.session = newSession;
+ this.putProperty(SESSION_PROPERTY, newSession);
+ this.firePropertyChanged(SESSION_PROPERTY, old, newSession);
+ }
+
+ private void sessionChanged(PropertyChangeEvent event) {
+ String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue();
+ Boolean newValue = getBooleanValueOf(stringValue);
+
+ Boolean old = this.session;
+ this.session = newValue;
+ this.firePropertyChanged(event.getAspectName(), old, newValue);
+ }
+
+ public Boolean getDefaultSession() {
+ return DEFAULT_SESSION;
+ }
+
+ // ********** Exceptions **********
+ public Boolean getExceptions() {
+ return this.exceptions;
+ }
+
+ public void setExceptions(Boolean newExceptions) {
+ Boolean old = this.exceptions;
+ this.exceptions = newExceptions;
+ this.putProperty(EXCEPTIONS_PROPERTY, newExceptions);
+ this.firePropertyChanged(EXCEPTIONS_PROPERTY, old, newExceptions);
+ }
+
+ private void exceptionsChanged(PropertyChangeEvent event) {
+ String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue();
+ Boolean newValue = getBooleanValueOf(stringValue);
+
+ Boolean old = this.exceptions;
+ this.exceptions = newValue;
+ this.firePropertyChanged(event.getAspectName(), old, newValue);
+ }
+
+ public Boolean getDefaultExceptions() {
+ return DEFAULT_EXCEPTIONS;
+ }
+
+ // ********** logFileLocation **********
+ public String getLogFileLocation() {
+ return this.logFileLocation;
+ }
+
+ public void setLogFileLocation(String newLogFileLocation) {
+ String old = this.logFileLocation;
+ this.logFileLocation = newLogFileLocation;
+ this.putProperty(LOG_FILE_LOCATION_PROPERTY, newLogFileLocation);
+ this.firePropertyChanged(LOG_FILE_LOCATION_PROPERTY, old, newLogFileLocation);
+ }
+
+ private void logFileLocationChanged(PropertyChangeEvent event) {
+ String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue();
+ String old = this.logFileLocation;
+ this.logFileLocation = newValue;
+ this.firePropertyChanged(event.getAspectName(), old, newValue);
+ }
+
+ public String getDefaultLogFileLocation() {
+ return DEFAULT_LOG_FILE_LOCATION;
+ }
+
+ // ********** Logger **********
+ /**
+ * Returns Logger or custom logger class.
+ *
+ * @return EclipseLink string value for Logger enum or custom logger class
+ */
+ public String getLogger() {
+ return this.logger;
+ }
+
+ public void setLogger(Logger newLogger) {
+ if( newLogger == null) {
+ this.setLogger((String) null);
+ }
+ else {
+ this.setLogger(getEclipseLinkStringValueOf(newLogger));
+ }
+ }
+
+ /**
+ * Sets custom logger.
+ *
+ * @param newLogger -
+ * Fully qualified class name of a custom logger.
+ */
+ public void setLogger(String newLogger) {
+ String old = this.logger;
+ this.logger = newLogger;
+ this.putProperty(LOGGER_PROPERTY, newLogger);
+ this.firePropertyChanged(LOGGER_PROPERTY, old, newLogger);
+ }
+
+ private void loggerChanged(PropertyChangeEvent event) {
+ String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue();
+ String old = this.logger;
+ this.logger = newValue;
+ this.firePropertyChanged(event.getAspectName(), old, newValue);
+ }
+
+ public String getDefaultLogger() {
+ return DEFAULT_LOGGER;
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/Logger.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/Logger.java
new file mode 100644
index 0000000000..32b7a6b48a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/Logger.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.core.internal.context.logging;
+
+/**
+ * Logger
+ */
+public enum Logger {
+ default_logger,
+ java_logger,
+ server_logger;
+
+ // EclipseLink value string
+ static final String DEFAULT_LOGGER = "DefaultLogger";
+ static final String JAVA_LOGGER = "JavaLogger";
+ static final String SERVER_LOGGER = "ServerLogger";
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/Logging.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/Logging.java
new file mode 100644
index 0000000000..11e0b4be7d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/Logging.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * 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.core.internal.context.logging;
+
+import org.eclipse.jpt.eclipselink.core.internal.context.EclipseLinkPersistenceUnitProperties;
+import org.eclipse.jpt.eclipselink.core.internal.context.PersistenceUnitProperties;
+
+/**
+ * Logging
+ */
+public interface Logging extends PersistenceUnitProperties
+{
+ LoggingLevel getDefaultLevel();
+ LoggingLevel getLevel();
+ void setLevel(LoggingLevel level);
+ static final String LEVEL_PROPERTY = "levelProperty";
+ // EclipseLink key string
+ static final String ECLIPSELINK_LEVEL = "eclipselink.logging.level";
+ static final LoggingLevel DEFAULT_LEVEL = LoggingLevel.info;
+
+ Boolean getDefaultTimestamp();
+ Boolean getTimestamp();
+ void setTimestamp(Boolean timestamp);
+ static final String TIMESTAMP_PROPERTY = "timestampProperty";
+ // EclipseLink key string
+ static final String ECLIPSELINK_TIMESTAMP = "eclipselink.logging.timestamp";
+ static final Boolean DEFAULT_TIMESTAMP = Boolean.TRUE;
+
+ Boolean getDefaultThread();
+ Boolean getThread();
+ void setThread(Boolean thread);
+ static final String THREAD_PROPERTY = "threadProperty";
+ // EclipseLink key string
+ static final String ECLIPSELINK_THREAD = "eclipselink.logging.thread";
+ static final Boolean DEFAULT_THREAD = Boolean.TRUE;
+
+ Boolean getDefaultSession();
+ Boolean getSession();
+ void setSession(Boolean session);
+ static final String SESSION_PROPERTY = "sessionProperty";
+ // EclipseLink key string
+ static final String ECLIPSELINK_SESSION = "eclipselink.logging.session";
+ static final Boolean DEFAULT_SESSION = Boolean.TRUE;
+
+ Boolean getDefaultExceptions();
+ Boolean getExceptions();
+ void setExceptions(Boolean exceptions);
+ static final String EXCEPTIONS_PROPERTY = "exceptionsProperty";
+ // EclipseLink key string
+ static final String ECLIPSELINK_EXCEPTIONS = "eclipselink.logging.exceptions";
+ static final Boolean DEFAULT_EXCEPTIONS = Boolean.FALSE;
+
+ String getDefaultLogFileLocation();
+ String getLogFileLocation();
+ void setLogFileLocation(String newLogFileLocation);
+ static final String LOG_FILE_LOCATION_PROPERTY = "logFileLocationProperty";
+ // EclipseLink key string
+ static final String ECLIPSELINK_LOG_FILE_LOCATION = "eclipselink.logging.file";
+ static final String DEFAULT_LOG_FILE_LOCATION = null; // No Default
+
+ String getDefaultLogger();
+ String getLogger();
+ void setLogger(String newLogger);
+ void setLogger(Logger newLogger);
+ static final String LOGGER_PROPERTY = "loggerProperty";
+ // EclipseLink key string
+ static final String ECLIPSELINK_LOGGER = "eclipselink.logging.logger";
+ static final String DEFAULT_LOGGER =
+ EclipseLinkPersistenceUnitProperties.getEclipseLinkStringValueOf(Logger.default_logger);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/LoggingLevel.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/LoggingLevel.java
new file mode 100644
index 0000000000..aa75b1a90b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/logging/LoggingLevel.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.core.internal.context.logging;
+
+/**
+ * LoggingLevel
+ */
+public enum LoggingLevel {
+ off,
+ severe,
+ warning,
+ info,
+ config,
+ fine,
+ finer,
+ finest;
+
+ // EclipseLink value string
+ static final String OFF = "OFF";
+ static final String SEVERE = "SEVERE";
+ static final String WARNING = "WARNING";
+ static final String INFO = "INFO";
+ static final String CONFIG = "CONFIG";
+ static final String FINE = "FINE";
+ static final String FINER = "FINER";
+ static final String FINEST = "FINEST";
+}
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
new file mode 100644
index 0000000000..ddabf0a8fd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/EclipseLinkLoggingComposite.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * 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);
+
+ // 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
new file mode 100644
index 0000000000..d31789b013
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/ExceptionsComposite.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.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.ECLIPSELINK_EXCEPTIONS) {
+ @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
new file mode 100644
index 0000000000..a899048857
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/LoggerComposite.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+* 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.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;
+
+/**
+ * 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 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 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.buildDefaultLoggerListHolder(),
+ this.buildLoggerHolder(),
+ null // EclipseLinkHelpContextIds.LOGGER_NAME
+ );
+ combo.add(EclipseLinkUiMessages.LoggerComposite_default_logger, 1);
+ combo.add(EclipseLinkUiMessages.LoggerComposite_java_logger, 2);
+ combo.add(EclipseLinkUiMessages.LoggerComposite_server_logger, 3);
+
+ SWTUtil.attachDefaultValueHandler(combo);
+ }
+}
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
new file mode 100644
index 0000000000..c370631682
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/LoggingLevelComposite.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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 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
new file mode 100644
index 0000000000..5d3147363a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/PersistenceXmlLoggingTab.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * 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.core.context.persistence.PersistenceUnit;
+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<PersistenceUnit>
+{
+ // ********** 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
new file mode 100644
index 0000000000..81c223f41f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/SessionComposite.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.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
new file mode 100644
index 0000000000..987c5332c1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/ThreadComposite.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.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
new file mode 100644
index 0000000000..c04f8735b7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/logging/TimestampComposite.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.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_
+ );
+ }
+}

Back to the top