[205510] security constraint display name synching
diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/common/internal/impl/SecurityConstraintAdapter.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/common/internal/impl/SecurityConstraintAdapter.java
new file mode 100644
index 0000000..bf668f7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/common/internal/impl/SecurityConstraintAdapter.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2005 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.common.internal.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.jst.j2ee.common.CommonPackage;
+import org.eclipse.jst.j2ee.common.DisplayName;
+import org.eclipse.jst.j2ee.webapplication.SecurityConstraint;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+/**
+ */
+ public class SecurityConstraintAdapter extends AdapterImpl {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ */
+ public void notifyChanged(Notification msg) {
+ if (msg.getFeature() == WebapplicationPackage.eINSTANCE.getSecurityConstraint_DisplayNames()) {
+ synchDisplayName();
+ return;
+ } else if (msg.getFeature() == CommonPackage.eINSTANCE.getDescriptionGroup_DisplayNames() ||
+ msg.getFeature() == CommonPackage.eINSTANCE.getDisplayName_Value()) {
+ synchDisplayName();
+ return;
+ }
+ }
+
+ /**
+ *
+ */
+ private void synchDisplayName() {
+ SecurityConstraint myTarget = (SecurityConstraint)getTarget();
+ if (myTarget.getDisplayNames().isEmpty())
+ myTarget.setDisplayName(null);
+ else {
+ DisplayName aDisplayName = (DisplayName)myTarget.getDisplayNames().get(0);
+ if (!aDisplayName.eAdapters().contains(this))
+ aDisplayName.eAdapters().add(this);
+ myTarget.setDisplayName(aDisplayName.getValue());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common.notify.Notifier)
+ */
+ public void setTarget(Notifier newTarget) {
+ if (newTarget instanceof SecurityConstraint)
+ super.setTarget(newTarget);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/webapplication/internal/impl/SecurityConstraintImpl.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/webapplication/internal/impl/SecurityConstraintImpl.java
index b10b454..18ec2c8 100644
--- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/webapplication/internal/impl/SecurityConstraintImpl.java
+++ b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/webapplication/internal/impl/SecurityConstraintImpl.java
@@ -24,6 +24,7 @@
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jst.j2ee.common.DisplayName;
import org.eclipse.jst.j2ee.common.internal.impl.J2EEEObjectImpl;
+import org.eclipse.jst.j2ee.common.internal.impl.SecurityConstraintAdapter;
import org.eclipse.jst.j2ee.webapplication.AuthConstraint;
import org.eclipse.jst.j2ee.webapplication.SecurityConstraint;
import org.eclipse.jst.j2ee.webapplication.UserDataConstraint;
@@ -31,7 +32,6 @@
import org.eclipse.jst.j2ee.webapplication.WebResourceCollection;
import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
-
/**
* The security-constraint element is used to associate security constraints with one or more web resource collections
* @generated
@@ -85,6 +85,7 @@
public SecurityConstraintImpl() {
super();
+ eAdapters().add(new SecurityConstraintAdapter());
}
/**
* <!-- begin-user-doc -->