You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2011/11/17 03:12:28 UTC
svn commit: r1203012 [15/28] - in /geronimo/devtools/eclipse-plugin/trunk:
eclipse/ plugins/org.apache.geronimo.j2ee.v11.jaxbmodel/
plugins/org.apache.geronimo.j2ee.v11.jaxbmodel/src/test/resources/application/
plugins/org.apache.geronimo.j2ee.v11.jaxb...
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/SecurityRoleMappingSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/SecurityRoleMappingSection.java?rev=1203012&r1=1203011&r2=1203012&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/SecurityRoleMappingSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/SecurityRoleMappingSection.java Thu Nov 17 02:12:14 2011
@@ -1,296 +1,296 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.geronimo.st.v11.ui.sections;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.JAXBElement;
-
-import org.apache.geronimo.j2ee.jaxbmodel.operations.JAXBModelUtils;
-import org.apache.geronimo.j2ee.security.DistinguishedNameType;
-import org.apache.geronimo.j2ee.security.LoginDomainPrincipalType;
-import org.apache.geronimo.j2ee.security.PrincipalType;
-import org.apache.geronimo.j2ee.security.RealmPrincipalType;
-import org.apache.geronimo.j2ee.security.RoleMappingsType;
-import org.apache.geronimo.j2ee.security.RoleType;
-import org.apache.geronimo.j2ee.security.SecurityType;
-import org.apache.geronimo.jaxbmodel.common.operations.JAXBUtils;
-import org.apache.geronimo.st.core.descriptor.AbstractDeploymentDescriptor;
-import org.apache.geronimo.st.core.descriptor.ApplicationDeploymentDescriptor;
-import org.apache.geronimo.st.core.descriptor.EjbDeploymentDescriptor;
-import org.apache.geronimo.st.core.descriptor.WebDeploymentDescriptor;
-import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.internal.Messages;
-import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
-import org.apache.geronimo.st.v11.ui.Activator;
-import org.apache.geronimo.st.v11.ui.wizards.SecurityRoleMappingWizard;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @version $Rev: 707635 $ $Date: 2008-10-24 21:55:28 +0800 (Fri, 24 Oct 2008) $
- */
-public class SecurityRoleMappingSection extends AbstractTreeSection {
-
- public SecurityRoleMappingSection(JAXBElement plan, Composite parent, FormToolkit toolkit, int style) {
- super(plan, parent, toolkit, style);
- createClient();
- }
-
- public SecurityRoleMappingSection(JAXBElement plan, AbstractDeploymentDescriptor descriptor, Composite parent,
- FormToolkit toolkit, int style) {
- super(plan, descriptor, parent, toolkit, style);
- createClient();
- }
-
- @Override
- protected boolean isRequiredSyncToolbarAction() {
- return true;
- }
-
- @Override
- protected IAction getSyncAction() {
- return new SyncAction(CommonMessages.securityRefreshRoles) {
- @Override
- public void run() {
- if( addRolesFromDeploymentDescriptor() ) {
- markDirty();
- }
- }
- };
- }
-
- @Override
- protected void activateRemoveButton() {
- if (tree.getSelectionCount() > 0 && tree.getSelection()[0].getParentItem() != null) {
- removeButton.setEnabled(true);
- } else {
- removeButton.setEnabled(false);
- }
- }
-
- @Override
- protected void activateEditButton() {
- if (tree.getSelectionCount() > 0 && tree.getSelection()[0].getParentItem() != null) {
- editButton.setEnabled(true);
- } else {
- editButton.setEnabled(false);
- }
- }
-
- @Override
- protected void activateAddButton() {
- if (tree.getSelectionCount() > 0 && tree.getSelection()[0].getParentItem() == null) {
- addButton.setEnabled(true);
- } else {
- addButton.setEnabled(false);
- }
- }
-
- @Override
- public void handleDelete() {
- TreeItem selectedItem = tree.getSelection()[0];
- Object selectedObject = selectedItem.getData();
- RoleType role = (RoleType) selectedItem.getParentItem().getData();
- try {
- ((ArrayList) JAXBUtils.getValue(role, selectedObject.getClass().getSimpleName())).remove(selectedObject);
- } catch (Exception e) {
- MessageDialog.openError(Display.getCurrent().getActiveShell(),Messages.error, e.getMessage());
- }
- }
-
- public RoleType getSelectedObject() {
- return (RoleType) tree.getSelection()[0].getData();
- }
-
- @Override
- public String getTitle() {
- return CommonMessages.editorSectionSecurityRolesTitle;
- }
-
- @Override
- public String getDescription() {
- return CommonMessages.editorSectionSecurityRolesDescription;
- }
-
- @Override
- public Wizard getWizard() {
- return new SecurityRoleMappingWizard(this);
- }
-
- @Override
- public Class getTableEntryObjectType() {
- return RoleType.class;
- }
-
- @Override
- public List getObjectContainer() {
- return getRoles(getPlan(), false);
- }
-
- public static List<RoleType> getRoles(JAXBElement plan, boolean create) {
- RoleMappingsType roleMappings = getRoleMappings(plan, create);
- if (roleMappings != null) {
- return roleMappings.getRole();
- }
- return null;
- }
-
- public static RoleMappingsType getRoleMappings(JAXBElement plan, boolean create) {
- SecurityType security = JAXBModelUtils.getSecurity(plan);
- if (security == null && create) {
- security = new SecurityType();
- JAXBModelUtils.setSecurity(plan, security);
- }
- if (security != null) {
- RoleMappingsType roleMappings = security.getRoleMappings();
- if (roleMappings == null && create) {
- roleMappings = new RoleMappingsType();
- security.setRoleMappings(roleMappings);
- }
- return roleMappings;
- }
- return null;
- }
-
- protected boolean addRolesFromDeploymentDescriptor() {
- List<String> declaredRoleNames = null;
- if (WebDeploymentDescriptor.class.isInstance(getDescriptor())) {
- declaredRoleNames = ((WebDeploymentDescriptor)getDescriptor()).getSecurityRoles();
- }
- else if (ApplicationDeploymentDescriptor.class.isInstance(getDescriptor())) {
- declaredRoleNames = ((ApplicationDeploymentDescriptor)getDescriptor()).getSecurityRoles();
- }
- else if (EjbDeploymentDescriptor.class.isInstance(getDescriptor())) {
- declaredRoleNames = ((EjbDeploymentDescriptor)getDescriptor()).getSecurityRoles();
- }
-
- if (declaredRoleNames == null || declaredRoleNames.size() <= 0) {
- return false;
- }
- List<RoleType> definedRoles = getRoles(getPlan(), true);
- List<RoleType> newRoles = new ArrayList<RoleType>();
- for (int i = 0; i < declaredRoleNames.size(); i++) {
- String roleName = declaredRoleNames.get(i);
- boolean roleExists = false;
- for (int j = 0; j < definedRoles.size(); j++) {
- if (definedRoles.get(j).getRoleName().equals(roleName)) {
- roleExists = true;
- break;
- }
- }
- if (!roleExists) {
- RoleType newRole = new RoleType();
- newRole.setRoleName(roleName);
- newRoles.add(newRole);
- }
- }
- definedRoles.addAll(newRoles);
- return newRoles.size() > 0;
- }
-
- @Override
- public Object getInput() {
- addRolesFromDeploymentDescriptor();
- return getRoleMappings(getPlan(), false);
- }
-
- @Override
- public ITreeContentProvider getContentProvider() {
- return new ContentProvider() {
- @Override
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- @Override
- public Object[] getChildren(Object parentElement) {
- if (RoleMappingsType.class.isInstance(parentElement)) {
- return ((RoleMappingsType) parentElement).getRole().toArray();
- }
- if (parentElement instanceof RoleType) {
- RoleType role = (RoleType) parentElement;
- return concat(role.getDistinguishedName().toArray(), role.getPrincipal().toArray(),
- role.getLoginDomainPrincipal().toArray(), role.getRealmPrincipal().toArray());
- }
- return new String[] {};
- }
-
- private Object[] concat(Object[] arr1, Object[] arr2, Object[] arr3, Object[] arr4) {
- Object[] all = new Object[arr1.length + arr2.length + arr3.length + arr4.length];
- System.arraycopy(arr1, 0, all, 0, arr1.length);
- System.arraycopy(arr2, 0, all, arr1.length, arr2.length);
- System.arraycopy(arr3, 0, all, arr1.length + arr2.length, arr3.length);
- System.arraycopy(arr4, 0, all, arr1.length + arr2.length + arr3.length, arr4.length);
- return all;
- }
- };
- }
-
- @Override
- public ILabelProvider getLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (RoleType.class.isInstance(element)) {
- RoleType role = (RoleType) element;
- return Messages.roleName + ": \"" + role.getRoleName() + "\"";
- }
- else if (element instanceof DistinguishedNameType) {
- DistinguishedNameType object = (DistinguishedNameType) element;
- return Messages.distinguishedName + ": \"" + object.getName() + "\"";
- }
- else if (element instanceof RealmPrincipalType) {
- RealmPrincipalType object = (RealmPrincipalType) element;
- return Messages.realmPrincipal + ": \"" + object.getName() +
- "\", " + Messages.clazz + " = \"" + object.getClazz() +
- "\", " + Messages.domainName + " = \"" + object.getDomainName() +
- "\", " + Messages.realmName + " = \"" + object.getRealmName() +"\"";
-
- }
- else if (element instanceof LoginDomainPrincipalType) {
- LoginDomainPrincipalType object = (LoginDomainPrincipalType) element;
- return Messages.loginDomainPrincipal + ": = \"" + object.getName() +
- "\", " + Messages.clazz + " = \"" + object.getClazz() +
- "\", " + Messages.domainName + " = \"" + object.getDomainName() +"\"";
- }
- else if (element instanceof PrincipalType) {
- PrincipalType object = (PrincipalType) element;
- return Messages.principal + " = \"" + object.getName() +
- "\", " + Messages.clazz + " = \"" + object.getClazz() + "\"";
- }
-
- return null;
- }
-
- @Override
- public Image getImage(Object arg0) {
- return Activator.imageDescriptorFromPlugin("org.eclipse.jst.j2ee",
- "icons/full/obj16/security_role.gif").createImage();
- }
- };
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v11.ui.sections;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.j2ee.jaxbmodel.operations.JAXBModelUtils;
+import org.apache.geronimo.j2ee.security.DistinguishedNameType;
+import org.apache.geronimo.j2ee.security.LoginDomainPrincipalType;
+import org.apache.geronimo.j2ee.security.PrincipalType;
+import org.apache.geronimo.j2ee.security.RealmPrincipalType;
+import org.apache.geronimo.j2ee.security.RoleMappingsType;
+import org.apache.geronimo.j2ee.security.RoleType;
+import org.apache.geronimo.j2ee.security.SecurityType;
+import org.apache.geronimo.jaxbmodel.common.operations.JAXBUtils;
+import org.apache.geronimo.st.core.descriptor.AbstractDeploymentDescriptor;
+import org.apache.geronimo.st.core.descriptor.ApplicationDeploymentDescriptor;
+import org.apache.geronimo.st.core.descriptor.EjbDeploymentDescriptor;
+import org.apache.geronimo.st.core.descriptor.WebDeploymentDescriptor;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.internal.Messages;
+import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
+import org.apache.geronimo.st.v11.ui.Activator;
+import org.apache.geronimo.st.v11.ui.wizards.SecurityRoleMappingWizard;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SecurityRoleMappingSection extends AbstractTreeSection {
+
+ public SecurityRoleMappingSection(JAXBElement plan, Composite parent, FormToolkit toolkit, int style) {
+ super(plan, parent, toolkit, style);
+ createClient();
+ }
+
+ public SecurityRoleMappingSection(JAXBElement plan, AbstractDeploymentDescriptor descriptor, Composite parent,
+ FormToolkit toolkit, int style) {
+ super(plan, descriptor, parent, toolkit, style);
+ createClient();
+ }
+
+ @Override
+ protected boolean isRequiredSyncToolbarAction() {
+ return true;
+ }
+
+ @Override
+ protected IAction getSyncAction() {
+ return new SyncAction(CommonMessages.securityRefreshRoles) {
+ @Override
+ public void run() {
+ if( addRolesFromDeploymentDescriptor() ) {
+ markDirty();
+ }
+ }
+ };
+ }
+
+ @Override
+ protected void activateRemoveButton() {
+ if (tree.getSelectionCount() > 0 && tree.getSelection()[0].getParentItem() != null) {
+ removeButton.setEnabled(true);
+ } else {
+ removeButton.setEnabled(false);
+ }
+ }
+
+ @Override
+ protected void activateEditButton() {
+ if (tree.getSelectionCount() > 0 && tree.getSelection()[0].getParentItem() != null) {
+ editButton.setEnabled(true);
+ } else {
+ editButton.setEnabled(false);
+ }
+ }
+
+ @Override
+ protected void activateAddButton() {
+ if (tree.getSelectionCount() > 0 && tree.getSelection()[0].getParentItem() == null) {
+ addButton.setEnabled(true);
+ } else {
+ addButton.setEnabled(false);
+ }
+ }
+
+ @Override
+ public void handleDelete() {
+ TreeItem selectedItem = tree.getSelection()[0];
+ Object selectedObject = selectedItem.getData();
+ RoleType role = (RoleType) selectedItem.getParentItem().getData();
+ try {
+ ((ArrayList) JAXBUtils.getValue(role, selectedObject.getClass().getSimpleName())).remove(selectedObject);
+ } catch (Exception e) {
+ MessageDialog.openError(Display.getCurrent().getActiveShell(),Messages.error, e.getMessage());
+ }
+ }
+
+ public RoleType getSelectedObject() {
+ return (RoleType) tree.getSelection()[0].getData();
+ }
+
+ @Override
+ public String getTitle() {
+ return CommonMessages.editorSectionSecurityRolesTitle;
+ }
+
+ @Override
+ public String getDescription() {
+ return CommonMessages.editorSectionSecurityRolesDescription;
+ }
+
+ @Override
+ public Wizard getWizard() {
+ return new SecurityRoleMappingWizard(this);
+ }
+
+ @Override
+ public Class getTableEntryObjectType() {
+ return RoleType.class;
+ }
+
+ @Override
+ public List getObjectContainer() {
+ return getRoles(getPlan(), false);
+ }
+
+ public static List<RoleType> getRoles(JAXBElement plan, boolean create) {
+ RoleMappingsType roleMappings = getRoleMappings(plan, create);
+ if (roleMappings != null) {
+ return roleMappings.getRole();
+ }
+ return null;
+ }
+
+ public static RoleMappingsType getRoleMappings(JAXBElement plan, boolean create) {
+ SecurityType security = JAXBModelUtils.getSecurity(plan);
+ if (security == null && create) {
+ security = new SecurityType();
+ JAXBModelUtils.setSecurity(plan, security);
+ }
+ if (security != null) {
+ RoleMappingsType roleMappings = security.getRoleMappings();
+ if (roleMappings == null && create) {
+ roleMappings = new RoleMappingsType();
+ security.setRoleMappings(roleMappings);
+ }
+ return roleMappings;
+ }
+ return null;
+ }
+
+ protected boolean addRolesFromDeploymentDescriptor() {
+ List<String> declaredRoleNames = null;
+ if (WebDeploymentDescriptor.class.isInstance(getDescriptor())) {
+ declaredRoleNames = ((WebDeploymentDescriptor)getDescriptor()).getSecurityRoles();
+ }
+ else if (ApplicationDeploymentDescriptor.class.isInstance(getDescriptor())) {
+ declaredRoleNames = ((ApplicationDeploymentDescriptor)getDescriptor()).getSecurityRoles();
+ }
+ else if (EjbDeploymentDescriptor.class.isInstance(getDescriptor())) {
+ declaredRoleNames = ((EjbDeploymentDescriptor)getDescriptor()).getSecurityRoles();
+ }
+
+ if (declaredRoleNames == null || declaredRoleNames.size() <= 0) {
+ return false;
+ }
+ List<RoleType> definedRoles = getRoles(getPlan(), true);
+ List<RoleType> newRoles = new ArrayList<RoleType>();
+ for (int i = 0; i < declaredRoleNames.size(); i++) {
+ String roleName = declaredRoleNames.get(i);
+ boolean roleExists = false;
+ for (int j = 0; j < definedRoles.size(); j++) {
+ if (definedRoles.get(j).getRoleName().equals(roleName)) {
+ roleExists = true;
+ break;
+ }
+ }
+ if (!roleExists) {
+ RoleType newRole = new RoleType();
+ newRole.setRoleName(roleName);
+ newRoles.add(newRole);
+ }
+ }
+ definedRoles.addAll(newRoles);
+ return newRoles.size() > 0;
+ }
+
+ @Override
+ public Object getInput() {
+ addRolesFromDeploymentDescriptor();
+ return getRoleMappings(getPlan(), false);
+ }
+
+ @Override
+ public ITreeContentProvider getContentProvider() {
+ return new ContentProvider() {
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (RoleMappingsType.class.isInstance(parentElement)) {
+ return ((RoleMappingsType) parentElement).getRole().toArray();
+ }
+ if (parentElement instanceof RoleType) {
+ RoleType role = (RoleType) parentElement;
+ return concat(role.getDistinguishedName().toArray(), role.getPrincipal().toArray(),
+ role.getLoginDomainPrincipal().toArray(), role.getRealmPrincipal().toArray());
+ }
+ return new String[] {};
+ }
+
+ private Object[] concat(Object[] arr1, Object[] arr2, Object[] arr3, Object[] arr4) {
+ Object[] all = new Object[arr1.length + arr2.length + arr3.length + arr4.length];
+ System.arraycopy(arr1, 0, all, 0, arr1.length);
+ System.arraycopy(arr2, 0, all, arr1.length, arr2.length);
+ System.arraycopy(arr3, 0, all, arr1.length + arr2.length, arr3.length);
+ System.arraycopy(arr4, 0, all, arr1.length + arr2.length + arr3.length, arr4.length);
+ return all;
+ }
+ };
+ }
+
+ @Override
+ public ILabelProvider getLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getText(Object element) {
+ if (RoleType.class.isInstance(element)) {
+ RoleType role = (RoleType) element;
+ return Messages.roleName + ": \"" + role.getRoleName() + "\"";
+ }
+ else if (element instanceof DistinguishedNameType) {
+ DistinguishedNameType object = (DistinguishedNameType) element;
+ return Messages.distinguishedName + ": \"" + object.getName() + "\"";
+ }
+ else if (element instanceof RealmPrincipalType) {
+ RealmPrincipalType object = (RealmPrincipalType) element;
+ return Messages.realmPrincipal + ": \"" + object.getName() +
+ "\", " + Messages.clazz + " = \"" + object.getClazz() +
+ "\", " + Messages.domainName + " = \"" + object.getDomainName() +
+ "\", " + Messages.realmName + " = \"" + object.getRealmName() +"\"";
+
+ }
+ else if (element instanceof LoginDomainPrincipalType) {
+ LoginDomainPrincipalType object = (LoginDomainPrincipalType) element;
+ return Messages.loginDomainPrincipal + ": = \"" + object.getName() +
+ "\", " + Messages.clazz + " = \"" + object.getClazz() +
+ "\", " + Messages.domainName + " = \"" + object.getDomainName() +"\"";
+ }
+ else if (element instanceof PrincipalType) {
+ PrincipalType object = (PrincipalType) element;
+ return Messages.principal + " = \"" + object.getName() +
+ "\", " + Messages.clazz + " = \"" + object.getClazz() + "\"";
+ }
+
+ return null;
+ }
+
+ @Override
+ public Image getImage(Object arg0) {
+ return Activator.imageDescriptorFromPlugin("org.eclipse.jst.j2ee",
+ "icons/full/obj16/security_role.gif").createImage();
+ }
+ };
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/SecurityRoleMappingSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/SecurityRoleMappingSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/SecurityRoleMappingSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/ServiceRefSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/ServiceRefSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/ServiceRefSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/WebContainerSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/WebContainerSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/WebContainerSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/WebGeneralSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/WebGeneralSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/sections/WebGeneralSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/AdminObjectWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/AdminObjectWizard.java?rev=1203012&r1=1203011&r2=1203012&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/AdminObjectWizard.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/AdminObjectWizard.java Thu Nov 17 02:12:14 2011
@@ -1,190 +1,190 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.geronimo.st.v11.ui.wizards;
-
-import java.util.List;
-
-import org.apache.geronimo.j2ee.connector.AdminobjectInstanceType;
-import org.apache.geronimo.j2ee.connector.AdminobjectType;
-import org.apache.geronimo.j2ee.connector.ConfigPropertySettingType;
-import org.apache.geronimo.jaxbmodel.common.operations.JAXBObjectFactory;
-import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
-import org.apache.geronimo.st.ui.wizards.AbstractTreeWizard;
-import org.apache.geronimo.j2ee.jaxbmodel.operations.JAXBObjectFactoryImpl;
-import org.apache.geronimo.st.v11.ui.sections.AdminObjectSection;
-
-/**
- * @version $Rev: 720616 $ $Date: 2008-11-26 05:49:55 +0800 (Wed, 26 Nov 2008) $
- */
-public class AdminObjectWizard extends AbstractTreeWizard {
-
- private final int ADMIN_OBJECT = 0;
- private final int ADMIN_OBJECT_INSTANCE = 1;
- private final int CONFIG_PROPERTY_SETTING = 2;
-
- public AdminObjectWizard(AbstractTreeSection section) {
- super(section, 3, 2);
- elementTypes[ADMIN_OBJECT] = "Admin Object";
- elementTypes[ADMIN_OBJECT_INSTANCE] = "Admin Object Instance";
- elementTypes[CONFIG_PROPERTY_SETTING] = "Config Property";
- }
-
- public class EjbRelationWizardPage extends AbstractTreeWizardPage {
-
- public EjbRelationWizardPage(String pageName) {
- super(pageName);
- }
-
- protected void initControl () {
- if (eObject == null) {
- element.select(ADMIN_OBJECT);
- if (AdminobjectType.class.isInstance(((AdminObjectSection)section).getSelectedObject())) {
- element.remove(elementTypes[CONFIG_PROPERTY_SETTING]);
- }
- else if (AdminobjectInstanceType.class.isInstance(((AdminObjectSection)section).getSelectedObject())) {
- element.select(CONFIG_PROPERTY_SETTING);
- element.setEnabled(false);
- }
- else {
- element.setEnabled(false);
- }
- }
- else {
- if (AdminobjectType.class.isInstance(eObject)) {
- textList.get(0).setText(((AdminobjectType)eObject).getAdminobjectInterface());
- textList.get(1).setText(((AdminobjectType)eObject).getAdminobjectClass());
- element.select(ADMIN_OBJECT);
- }
- else if (AdminobjectInstanceType.class.isInstance(eObject)) {
- textList.get(0).setText(((AdminobjectInstanceType)eObject).getMessageDestinationName());
- element.select(ADMIN_OBJECT_INSTANCE);
- }
- else if (ConfigPropertySettingType.class.isInstance(eObject)) {
- textList.get(0).setText(((ConfigPropertySettingType)eObject).getName());
- textList.get(1).setText(((ConfigPropertySettingType)eObject).getValue());
- element.select(CONFIG_PROPERTY_SETTING);
- }
- element.setEnabled(false);
- }
- }
-
- protected void toggleFields (boolean clearFields) {
- if (element.getText().equals(elementTypes[ADMIN_OBJECT])) {
- for (int i = 0; i < maxTextFields; i++) {
- labelList.get(i).setVisible(true);
- textList.get(i).setVisible(true);
- if (clearFields == true) {
- textList.get(i).setText("");
- }
- }
- labelList.get(0).setText(CommonMessages.interfaceName);
- labelList.get(1).setText(CommonMessages.className);
- }
- else if (element.getText().equals(elementTypes[ADMIN_OBJECT_INSTANCE])) {
- for (int i = 0; i < maxTextFields; i++) {
- labelList.get(i).setVisible(i < 1 ? true : false);
- textList.get(i).setVisible(i < 1 ? true : false);
- if (clearFields == true) {
- textList.get(i).setText("");
- }
- }
- labelList.get(0).setText(CommonMessages.messageDestinationName);
- }
- else if (element.getText().equals(elementTypes[CONFIG_PROPERTY_SETTING])) {
- for (int i = 0; i < maxTextFields; i++) {
- labelList.get(i).setVisible(true);
- textList.get(i).setVisible(true);
- if (clearFields == true) {
- textList.get(i).setText("");
- }
- }
- labelList.get(0).setText(CommonMessages.name);
- labelList.get(1).setText(CommonMessages.value);
- }
- }
-
- public String getWizardPageTitle() {
- return CommonMessages.wizardPageTitle_AdminObject;
- }
-
- public String getWizardPageDescription() {
- return CommonMessages.wizardPageDescription_AdminObject;
- }
- }
-
- @Override
- public void addPages() {
- addPage(new EjbRelationWizardPage("Page0"));
- }
-
- @Override
- public boolean performFinish() {
- AdminobjectType admin;
- if (element.getText().equals(elementTypes[ADMIN_OBJECT])) {
- if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
- return false;
- }
- admin = (AdminobjectType)eObject;
- if (admin == null) {
- admin = (AdminobjectType)getEFactory().create(AdminobjectType.class);
- List objectList = (List)section.getInput();
- objectList.add (admin);
- }
- admin.setAdminobjectInterface(textList.get(0).getText());
- admin.setAdminobjectClass(textList.get(1).getText());
- }
- else if (element.getText().equals(elementTypes[ADMIN_OBJECT_INSTANCE])) {
- if (isEmpty(textList.get(0).getText())) {
- return false;
- }
- AdminobjectInstanceType aoInstance = (AdminobjectInstanceType)eObject;
- if (aoInstance == null) {
- aoInstance = (AdminobjectInstanceType)getEFactory().create(AdminobjectInstanceType.class);
- admin = (AdminobjectType)((AdminObjectSection)section).getSelectedObject();
- admin.getAdminobjectInstance().add(aoInstance);
- }
- aoInstance.setMessageDestinationName(textList.get(0).getText());
- }
- else if (element.getText().equals(elementTypes[CONFIG_PROPERTY_SETTING])) {
- if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
- return false;
- }
- ConfigPropertySettingType property = (ConfigPropertySettingType)eObject;
- if (property == null) {
- property = (ConfigPropertySettingType)getEFactory().create(ConfigPropertySettingType.class);
- AdminobjectInstanceType aoInstance = (AdminobjectInstanceType)((AdminObjectSection)section).getSelectedObject();
- aoInstance.getConfigPropertySetting().add(property);
- }
- property.setName(textList.get(0).getText());
- property.setValue(textList.get(1).getText());
- }
- return true;
- }
-
- public JAXBObjectFactory getEFactory() {
- return JAXBObjectFactoryImpl.getInstance();
- }
-
- public String getAddWizardWindowTitle() {
- return CommonMessages.wizardNewTitle_AdminObject;
- }
-
- public String getEditWizardWindowTitle() {
- return CommonMessages.wizardEditTitle_AdminObject;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v11.ui.wizards;
+
+import java.util.List;
+
+import org.apache.geronimo.j2ee.connector.AdminobjectInstanceType;
+import org.apache.geronimo.j2ee.connector.AdminobjectType;
+import org.apache.geronimo.j2ee.connector.ConfigPropertySettingType;
+import org.apache.geronimo.jaxbmodel.common.operations.JAXBObjectFactory;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
+import org.apache.geronimo.st.ui.wizards.AbstractTreeWizard;
+import org.apache.geronimo.j2ee.jaxbmodel.operations.JAXBObjectFactoryImpl;
+import org.apache.geronimo.st.v11.ui.sections.AdminObjectSection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AdminObjectWizard extends AbstractTreeWizard {
+
+ private final int ADMIN_OBJECT = 0;
+ private final int ADMIN_OBJECT_INSTANCE = 1;
+ private final int CONFIG_PROPERTY_SETTING = 2;
+
+ public AdminObjectWizard(AbstractTreeSection section) {
+ super(section, 3, 2);
+ elementTypes[ADMIN_OBJECT] = "Admin Object";
+ elementTypes[ADMIN_OBJECT_INSTANCE] = "Admin Object Instance";
+ elementTypes[CONFIG_PROPERTY_SETTING] = "Config Property";
+ }
+
+ public class EjbRelationWizardPage extends AbstractTreeWizardPage {
+
+ public EjbRelationWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ protected void initControl () {
+ if (eObject == null) {
+ element.select(ADMIN_OBJECT);
+ if (AdminobjectType.class.isInstance(((AdminObjectSection)section).getSelectedObject())) {
+ element.remove(elementTypes[CONFIG_PROPERTY_SETTING]);
+ }
+ else if (AdminobjectInstanceType.class.isInstance(((AdminObjectSection)section).getSelectedObject())) {
+ element.select(CONFIG_PROPERTY_SETTING);
+ element.setEnabled(false);
+ }
+ else {
+ element.setEnabled(false);
+ }
+ }
+ else {
+ if (AdminobjectType.class.isInstance(eObject)) {
+ textList.get(0).setText(((AdminobjectType)eObject).getAdminobjectInterface());
+ textList.get(1).setText(((AdminobjectType)eObject).getAdminobjectClass());
+ element.select(ADMIN_OBJECT);
+ }
+ else if (AdminobjectInstanceType.class.isInstance(eObject)) {
+ textList.get(0).setText(((AdminobjectInstanceType)eObject).getMessageDestinationName());
+ element.select(ADMIN_OBJECT_INSTANCE);
+ }
+ else if (ConfigPropertySettingType.class.isInstance(eObject)) {
+ textList.get(0).setText(((ConfigPropertySettingType)eObject).getName());
+ textList.get(1).setText(((ConfigPropertySettingType)eObject).getValue());
+ element.select(CONFIG_PROPERTY_SETTING);
+ }
+ element.setEnabled(false);
+ }
+ }
+
+ protected void toggleFields (boolean clearFields) {
+ if (element.getText().equals(elementTypes[ADMIN_OBJECT])) {
+ for (int i = 0; i < maxTextFields; i++) {
+ labelList.get(i).setVisible(true);
+ textList.get(i).setVisible(true);
+ if (clearFields == true) {
+ textList.get(i).setText("");
+ }
+ }
+ labelList.get(0).setText(CommonMessages.interfaceName);
+ labelList.get(1).setText(CommonMessages.className);
+ }
+ else if (element.getText().equals(elementTypes[ADMIN_OBJECT_INSTANCE])) {
+ for (int i = 0; i < maxTextFields; i++) {
+ labelList.get(i).setVisible(i < 1 ? true : false);
+ textList.get(i).setVisible(i < 1 ? true : false);
+ if (clearFields == true) {
+ textList.get(i).setText("");
+ }
+ }
+ labelList.get(0).setText(CommonMessages.messageDestinationName);
+ }
+ else if (element.getText().equals(elementTypes[CONFIG_PROPERTY_SETTING])) {
+ for (int i = 0; i < maxTextFields; i++) {
+ labelList.get(i).setVisible(true);
+ textList.get(i).setVisible(true);
+ if (clearFields == true) {
+ textList.get(i).setText("");
+ }
+ }
+ labelList.get(0).setText(CommonMessages.name);
+ labelList.get(1).setText(CommonMessages.value);
+ }
+ }
+
+ public String getWizardPageTitle() {
+ return CommonMessages.wizardPageTitle_AdminObject;
+ }
+
+ public String getWizardPageDescription() {
+ return CommonMessages.wizardPageDescription_AdminObject;
+ }
+ }
+
+ @Override
+ public void addPages() {
+ addPage(new EjbRelationWizardPage("Page0"));
+ }
+
+ @Override
+ public boolean performFinish() {
+ AdminobjectType admin;
+ if (element.getText().equals(elementTypes[ADMIN_OBJECT])) {
+ if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+ return false;
+ }
+ admin = (AdminobjectType)eObject;
+ if (admin == null) {
+ admin = (AdminobjectType)getEFactory().create(AdminobjectType.class);
+ List objectList = (List)section.getInput();
+ objectList.add (admin);
+ }
+ admin.setAdminobjectInterface(textList.get(0).getText());
+ admin.setAdminobjectClass(textList.get(1).getText());
+ }
+ else if (element.getText().equals(elementTypes[ADMIN_OBJECT_INSTANCE])) {
+ if (isEmpty(textList.get(0).getText())) {
+ return false;
+ }
+ AdminobjectInstanceType aoInstance = (AdminobjectInstanceType)eObject;
+ if (aoInstance == null) {
+ aoInstance = (AdminobjectInstanceType)getEFactory().create(AdminobjectInstanceType.class);
+ admin = (AdminobjectType)((AdminObjectSection)section).getSelectedObject();
+ admin.getAdminobjectInstance().add(aoInstance);
+ }
+ aoInstance.setMessageDestinationName(textList.get(0).getText());
+ }
+ else if (element.getText().equals(elementTypes[CONFIG_PROPERTY_SETTING])) {
+ if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+ return false;
+ }
+ ConfigPropertySettingType property = (ConfigPropertySettingType)eObject;
+ if (property == null) {
+ property = (ConfigPropertySettingType)getEFactory().create(ConfigPropertySettingType.class);
+ AdminobjectInstanceType aoInstance = (AdminobjectInstanceType)((AdminObjectSection)section).getSelectedObject();
+ aoInstance.getConfigPropertySetting().add(property);
+ }
+ property.setName(textList.get(0).getText());
+ property.setValue(textList.get(1).getText());
+ }
+ return true;
+ }
+
+ public JAXBObjectFactory getEFactory() {
+ return JAXBObjectFactoryImpl.getInstance();
+ }
+
+ public String getAddWizardWindowTitle() {
+ return CommonMessages.wizardNewTitle_AdminObject;
+ }
+
+ public String getEditWizardWindowTitle() {
+ return CommonMessages.wizardEditTitle_AdminObject;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/AdminObjectWizard.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/AdminObjectWizard.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/AdminObjectWizard.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ClassFilterWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ClassFilterWizard.java?rev=1203012&r1=1203011&r2=1203012&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ClassFilterWizard.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ClassFilterWizard.java Thu Nov 17 02:12:14 2011
@@ -1,112 +1,112 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.geronimo.st.v11.ui.wizards;
-
-import javax.xml.bind.JAXBElement;
-
-import org.apache.geronimo.j2ee.deployment.ClassFilterType;
-import org.apache.geronimo.j2ee.deployment.EnvironmentType;
-import org.apache.geronimo.jaxbmodel.common.operations.JAXBObjectFactory;
-import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.sections.AbstractTableSection;
-import org.apache.geronimo.st.ui.wizards.AbstractTableWizard;
-import org.apache.geronimo.j2ee.jaxbmodel.operations.JAXBModelUtils;
-import org.apache.geronimo.j2ee.jaxbmodel.operations.JAXBObjectFactoryImpl;
-import org.apache.geronimo.st.v11.ui.sections.ClassFilterSection;
-
-/**
- * @version $Rev: 720616 $ $Date: 2008-11-26 05:49:55 +0800 (Wed, 26 Nov 2008) $
- */
-public class ClassFilterWizard extends AbstractTableWizard {
-
- protected boolean isServerEnvironment;
-
- public ClassFilterWizard(AbstractTableSection section, boolean isServerEnvironment) {
- super(section);
- this.isServerEnvironment = isServerEnvironment;
- }
-
- public JAXBObjectFactory getEFactory() {
- return JAXBObjectFactoryImpl.getInstance();
- }
-
- public String[] getTableColumnEAttributes() {
- return new String[] { "Value" };
- }
-
- public void addPages() {
- addPage(new ClassFilterWizardPage("Page0"));
- }
-
- public String getAddWizardWindowTitle() {
- return CommonMessages.wizardNewTitle_Dependency;
- }
-
- public String getEditWizardWindowTitle() {
- return CommonMessages.wizardEditTitle_Dependency;
- }
-
- public class ClassFilterWizardPage extends AbstractTableWizardPage {
- public ClassFilterWizardPage(String pageName) {
- super(pageName);
- }
-
- public String getWizardPageTitle() {
- return CommonMessages.wizardPageTitle_Dependency;
- }
-
- public String getWizardPageDescription() {
- return CommonMessages.wizardPageDescription_Dependency;
- }
- }
-
- /* (non-Javadoc)
- * @see org.apache.geronimo.st.ui.wizards.AbstractTableWizard#performFinish()
- */
- public boolean performFinish() {
- AbstractTableWizardPage page = (AbstractTableWizardPage) getPages()[0];
-
- if (eObject == null) {
- eObject = new String();
- JAXBElement plan = section.getPlan();
-
- EnvironmentType environment = null;
- environment = JAXBModelUtils.getEnvironment(plan, isServerEnvironment);
- if (environment == null) {
- environment = (EnvironmentType)getEFactory().create(EnvironmentType.class);
- JAXBModelUtils.setEnvironment (plan, environment, isServerEnvironment);
- }
-
- ClassFilterType filter = ((ClassFilterSection)section).getClassFilter();
- if (filter == null) {
- filter = (ClassFilterType)getEFactory().create(ClassFilterType.class);
- ((ClassFilterSection)section).setClassFilter (filter);
- }
- filter.getFilter().add(page.getTextEntry(0).getText());
- }
- else {
- ClassFilterType filter = ((ClassFilterSection)section).getClassFilter();
- filter.getFilter().set(filter.getFilter().indexOf(eObject), page.getTextEntry(0).getText());
- }
-
- if (section.getViewer().getInput() == null) {
- section.getViewer().setInput(section.getInput());
- }
-
- return true;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v11.ui.wizards;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.j2ee.deployment.ClassFilterType;
+import org.apache.geronimo.j2ee.deployment.EnvironmentType;
+import org.apache.geronimo.jaxbmodel.common.operations.JAXBObjectFactory;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.ui.wizards.AbstractTableWizard;
+import org.apache.geronimo.j2ee.jaxbmodel.operations.JAXBModelUtils;
+import org.apache.geronimo.j2ee.jaxbmodel.operations.JAXBObjectFactoryImpl;
+import org.apache.geronimo.st.v11.ui.sections.ClassFilterSection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ClassFilterWizard extends AbstractTableWizard {
+
+ protected boolean isServerEnvironment;
+
+ public ClassFilterWizard(AbstractTableSection section, boolean isServerEnvironment) {
+ super(section);
+ this.isServerEnvironment = isServerEnvironment;
+ }
+
+ public JAXBObjectFactory getEFactory() {
+ return JAXBObjectFactoryImpl.getInstance();
+ }
+
+ public String[] getTableColumnEAttributes() {
+ return new String[] { "Value" };
+ }
+
+ public void addPages() {
+ addPage(new ClassFilterWizardPage("Page0"));
+ }
+
+ public String getAddWizardWindowTitle() {
+ return CommonMessages.wizardNewTitle_Dependency;
+ }
+
+ public String getEditWizardWindowTitle() {
+ return CommonMessages.wizardEditTitle_Dependency;
+ }
+
+ public class ClassFilterWizardPage extends AbstractTableWizardPage {
+ public ClassFilterWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ public String getWizardPageTitle() {
+ return CommonMessages.wizardPageTitle_Dependency;
+ }
+
+ public String getWizardPageDescription() {
+ return CommonMessages.wizardPageDescription_Dependency;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.st.ui.wizards.AbstractTableWizard#performFinish()
+ */
+ public boolean performFinish() {
+ AbstractTableWizardPage page = (AbstractTableWizardPage) getPages()[0];
+
+ if (eObject == null) {
+ eObject = new String();
+ JAXBElement plan = section.getPlan();
+
+ EnvironmentType environment = null;
+ environment = JAXBModelUtils.getEnvironment(plan, isServerEnvironment);
+ if (environment == null) {
+ environment = (EnvironmentType)getEFactory().create(EnvironmentType.class);
+ JAXBModelUtils.setEnvironment (plan, environment, isServerEnvironment);
+ }
+
+ ClassFilterType filter = ((ClassFilterSection)section).getClassFilter();
+ if (filter == null) {
+ filter = (ClassFilterType)getEFactory().create(ClassFilterType.class);
+ ((ClassFilterSection)section).setClassFilter (filter);
+ }
+ filter.getFilter().add(page.getTextEntry(0).getText());
+ }
+ else {
+ ClassFilterType filter = ((ClassFilterSection)section).getClassFilter();
+ filter.getFilter().set(filter.getFilter().indexOf(eObject), page.getTextEntry(0).getText());
+ }
+
+ if (section.getViewer().getInput() == null) {
+ section.getViewer().setInput(section.getInput());
+ }
+
+ return true;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ClassFilterWizard.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ClassFilterWizard.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ClassFilterWizard.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/DependencyWizard.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/DependencyWizard.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/DependencyWizard.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbLocalRefWizard.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbLocalRefWizard.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbLocalRefWizard.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbRefWizard.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbRefWizard.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbRefWizard.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbRelationWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbRelationWizard.java?rev=1203012&r1=1203011&r2=1203012&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbRelationWizard.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbRelationWizard.java Thu Nov 17 02:12:14 2011
@@ -1,223 +1,223 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.geronimo.st.v11.ui.wizards;
-
-import javax.xml.bind.JAXBElement;
-
-import org.apache.geronimo.j2ee.openejb_jar.EjbRelationType;
-import org.apache.geronimo.j2ee.openejb_jar.EjbRelationshipRoleType;
-import org.apache.geronimo.j2ee.openejb_jar.RelationshipsType;
-import org.apache.geronimo.jaxbmodel.common.operations.JAXBObjectFactory;
-import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
-import org.apache.geronimo.st.ui.wizards.AbstractTreeWizard;
-import org.apache.geronimo.j2ee.jaxbmodel.operations.JAXBModelUtils;
-import org.apache.geronimo.j2ee.jaxbmodel.operations.JAXBObjectFactoryImpl;
-import org.apache.geronimo.st.v11.ui.sections.EjbRelationSection;
-
-/**
- * @version $Rev: 720616 $ $Date: 2008-11-26 05:49:55 +0800 (Wed, 26 Nov 2008) $
- */
-public class EjbRelationWizard extends AbstractTreeWizard {
-
- private final int EJB_RELATION = 0;
- private final int RELATIONSHIP_ROLE = 1;
- private final int CMR_FIELD_MAPPING = 2;
-
- public EjbRelationWizard(AbstractTreeSection section) {
- super(section, 3, 3);
- elementTypes[EJB_RELATION] = "EJB Relation";
- elementTypes[RELATIONSHIP_ROLE] = "EJB Relationship Role";
- elementTypes[CMR_FIELD_MAPPING] = "CMR Field Mapping";
- }
-
- public class EjbRelationWizardPage extends AbstractTreeWizardPage {
-
- public EjbRelationWizardPage(String pageName) {
- super(pageName);
- }
-
- protected void initControl () {
- if (eObject == null) {
- element.select(EJB_RELATION);
- if (EjbRelationType.class.isInstance(((EjbRelationSection)section).getSelectedObject())) {
- element.remove(elementTypes[CMR_FIELD_MAPPING]);
- }
- else if (EjbRelationshipRoleType.class.isInstance(((EjbRelationSection)section).getSelectedObject())) {
- element.select(CMR_FIELD_MAPPING);
- element.setEnabled(false);
- }
- else {
- element.setEnabled(false);
- }
- }
- else {
- if (EjbRelationType.class.isInstance(eObject)) {
- textList.get(0).setText(((EjbRelationType)eObject).getEjbRelationName());
- textList.get(1).setText(((EjbRelationType)eObject).getManyToManyTableName());
- element.select(EJB_RELATION);
- }
- else if (EjbRelationshipRoleType.class.isInstance(eObject)) {
- EjbRelationshipRoleType role = (EjbRelationshipRoleType)eObject;
- textList.get(0).setText(role.getEjbRelationshipRoleName());
- textList.get(1).setText(role.getRelationshipRoleSource().getEjbName());
- textList.get(2).setText(role.getCmrField().getCmrFieldName());
- element.select(RELATIONSHIP_ROLE);
- }
- else if (EjbRelationshipRoleType.RoleMapping.CmrFieldMapping.class.isInstance(eObject)) {
- EjbRelationshipRoleType.RoleMapping.CmrFieldMapping fieldMapping =
- (EjbRelationshipRoleType.RoleMapping.CmrFieldMapping)eObject;
- textList.get(0).setText(fieldMapping.getKeyColumn());
- textList.get(1).setText(fieldMapping.getForeignKeyColumn());
- element.select(CMR_FIELD_MAPPING);
- }
- element.setEnabled(false);
- }
- }
-
- protected void toggleFields (boolean clearFields) {
- if (element.getText().equals(elementTypes[EJB_RELATION])) {
- for (int i = 0; i < maxTextFields; i++) {
- labelList.get(i).setVisible(i < 2 ? true : false);
- textList.get(i).setVisible(i < 2 ? true : false);
- if (clearFields == true) {
- textList.get(i).setText("");
- }
- }
- labelList.get(0).setText(CommonMessages.name);
- labelList.get(1).setText(CommonMessages.mtmTableName);
- // if we are doing an add, then we need to make sure that the longest
- // text can be handled
- labelList.get(2).setText(CommonMessages.foreignKeyColumn);
- }
- else if (element.getText().equals(elementTypes[RELATIONSHIP_ROLE])) {
- for (int i = 0; i < maxTextFields; i++) {
- labelList.get(i).setVisible(true);
- textList.get(i).setVisible(true);
- if (clearFields == true) {
- textList.get(i).setText("");
- }
- }
- labelList.get(0).setText(CommonMessages.name);
- labelList.get(1).setText(CommonMessages.ejbSourceName);
- labelList.get(2).setText(CommonMessages.cmrFieldName);
- }
- else if (element.getText().equals(elementTypes[CMR_FIELD_MAPPING])) {
- for (int i = 0; i < maxTextFields; i++) {
- labelList.get(i).setVisible(i < 2 ? true : false);
- textList.get(i).setVisible(i < 2 ? true : false);
- if (clearFields == true) {
- textList.get(i).setText("");
- }
- }
- labelList.get(0).setText(CommonMessages.keyColumn);
- labelList.get(1).setText(CommonMessages.foreignKeyColumn);
- }
- }
-
- public String getWizardPageTitle() {
- return CommonMessages.wizardPageTitle_EjbRelation;
- }
-
- public String getWizardPageDescription() {
- return CommonMessages.wizardPageDescription_EjbRelation;
- }
- }
-
- @Override
- public void addPages() {
- addPage(new EjbRelationWizardPage("Page0"));
- }
-
- @Override
- public boolean performFinish() {
- EjbRelationType relation;
- if (element.getText().equals(elementTypes[EJB_RELATION])) {
- relation = (EjbRelationType)eObject;
- if (relation == null) {
- relation = (EjbRelationType)getEFactory().create(EjbRelationType.class);
- JAXBElement plan = section.getPlan();
-
- if (JAXBModelUtils.getEjbRelationships(plan) == null) {
- RelationshipsType relationships = (RelationshipsType)getEFactory().create(RelationshipsType.class);
-
- JAXBModelUtils.setEjbRelationships(plan, relationships);
- ((EjbRelationSection)section).resetInput(relationships);
- }
- JAXBModelUtils.getEjbRelationships(plan).add(relation);
- }
- relation.setEjbRelationName(textList.get(0).getText());
- relation.setManyToManyTableName(textList.get(1).getText());
- }
- else if (element.getText().equals(elementTypes[RELATIONSHIP_ROLE])) {
- if (isEmpty(textList.get(1).getText())) {
- return false;
- }
- EjbRelationshipRoleType role = (EjbRelationshipRoleType)eObject;
- if (role == null) {
- role = (EjbRelationshipRoleType)getEFactory().create(EjbRelationshipRoleType.class);
- relation = (EjbRelationType)((EjbRelationSection)section).getSelectedObject();
- relation.getEjbRelationshipRole().add(role);
- }
- role.setEjbRelationshipRoleName(textList.get(0).getText());
- EjbRelationshipRoleType.RelationshipRoleSource source = role.getRelationshipRoleSource();
- if (source == null) {
- source = (EjbRelationshipRoleType.RelationshipRoleSource)getEFactory().create(EjbRelationshipRoleType.RelationshipRoleSource.class);
- role.setRelationshipRoleSource(source);
- }
- source.setEjbName(textList.get(1).getText());
- EjbRelationshipRoleType.CmrField cmrField = role.getCmrField();
- if (cmrField == null) {
- cmrField = (EjbRelationshipRoleType.CmrField)getEFactory().create(EjbRelationshipRoleType.CmrField.class);
- role.setCmrField(cmrField);
- }
- cmrField.setCmrFieldName(textList.get(2).getText());
- }
- else if (element.getText().equals(elementTypes[CMR_FIELD_MAPPING])) {
- if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
- return false;
- }
- EjbRelationshipRoleType.RoleMapping.CmrFieldMapping fieldMapping =
- (EjbRelationshipRoleType.RoleMapping.CmrFieldMapping)eObject;
- if (fieldMapping == null) {
- fieldMapping = (EjbRelationshipRoleType.RoleMapping.CmrFieldMapping)getEFactory().create(EjbRelationshipRoleType.RoleMapping.CmrFieldMapping.class);
- EjbRelationshipRoleType role = (EjbRelationshipRoleType)((EjbRelationSection)section).getSelectedObject();
- EjbRelationshipRoleType.RoleMapping roleMapping = role.getRoleMapping();
- if (roleMapping == null) {
- roleMapping = (EjbRelationshipRoleType.RoleMapping)getEFactory().create(EjbRelationshipRoleType.RoleMapping.class);
- role.setRoleMapping(roleMapping);
- }
- role.getRoleMapping().getCmrFieldMapping().add(fieldMapping);
- }
- fieldMapping.setKeyColumn(textList.get(0).getText());
- fieldMapping.setForeignKeyColumn(textList.get(1).getText());
- }
- return true;
- }
-
- public JAXBObjectFactory getEFactory() {
- return JAXBObjectFactoryImpl.getInstance();
- }
-
- public String getAddWizardWindowTitle() {
- return CommonMessages.wizardNewTitle_EjbRelation;
- }
-
- public String getEditWizardWindowTitle() {
- return CommonMessages.wizardEditTitle_EjbRelation;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v11.ui.wizards;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.j2ee.openejb_jar.EjbRelationType;
+import org.apache.geronimo.j2ee.openejb_jar.EjbRelationshipRoleType;
+import org.apache.geronimo.j2ee.openejb_jar.RelationshipsType;
+import org.apache.geronimo.jaxbmodel.common.operations.JAXBObjectFactory;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
+import org.apache.geronimo.st.ui.wizards.AbstractTreeWizard;
+import org.apache.geronimo.j2ee.jaxbmodel.operations.JAXBModelUtils;
+import org.apache.geronimo.j2ee.jaxbmodel.operations.JAXBObjectFactoryImpl;
+import org.apache.geronimo.st.v11.ui.sections.EjbRelationSection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EjbRelationWizard extends AbstractTreeWizard {
+
+ private final int EJB_RELATION = 0;
+ private final int RELATIONSHIP_ROLE = 1;
+ private final int CMR_FIELD_MAPPING = 2;
+
+ public EjbRelationWizard(AbstractTreeSection section) {
+ super(section, 3, 3);
+ elementTypes[EJB_RELATION] = "EJB Relation";
+ elementTypes[RELATIONSHIP_ROLE] = "EJB Relationship Role";
+ elementTypes[CMR_FIELD_MAPPING] = "CMR Field Mapping";
+ }
+
+ public class EjbRelationWizardPage extends AbstractTreeWizardPage {
+
+ public EjbRelationWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ protected void initControl () {
+ if (eObject == null) {
+ element.select(EJB_RELATION);
+ if (EjbRelationType.class.isInstance(((EjbRelationSection)section).getSelectedObject())) {
+ element.remove(elementTypes[CMR_FIELD_MAPPING]);
+ }
+ else if (EjbRelationshipRoleType.class.isInstance(((EjbRelationSection)section).getSelectedObject())) {
+ element.select(CMR_FIELD_MAPPING);
+ element.setEnabled(false);
+ }
+ else {
+ element.setEnabled(false);
+ }
+ }
+ else {
+ if (EjbRelationType.class.isInstance(eObject)) {
+ textList.get(0).setText(((EjbRelationType)eObject).getEjbRelationName());
+ textList.get(1).setText(((EjbRelationType)eObject).getManyToManyTableName());
+ element.select(EJB_RELATION);
+ }
+ else if (EjbRelationshipRoleType.class.isInstance(eObject)) {
+ EjbRelationshipRoleType role = (EjbRelationshipRoleType)eObject;
+ textList.get(0).setText(role.getEjbRelationshipRoleName());
+ textList.get(1).setText(role.getRelationshipRoleSource().getEjbName());
+ textList.get(2).setText(role.getCmrField().getCmrFieldName());
+ element.select(RELATIONSHIP_ROLE);
+ }
+ else if (EjbRelationshipRoleType.RoleMapping.CmrFieldMapping.class.isInstance(eObject)) {
+ EjbRelationshipRoleType.RoleMapping.CmrFieldMapping fieldMapping =
+ (EjbRelationshipRoleType.RoleMapping.CmrFieldMapping)eObject;
+ textList.get(0).setText(fieldMapping.getKeyColumn());
+ textList.get(1).setText(fieldMapping.getForeignKeyColumn());
+ element.select(CMR_FIELD_MAPPING);
+ }
+ element.setEnabled(false);
+ }
+ }
+
+ protected void toggleFields (boolean clearFields) {
+ if (element.getText().equals(elementTypes[EJB_RELATION])) {
+ for (int i = 0; i < maxTextFields; i++) {
+ labelList.get(i).setVisible(i < 2 ? true : false);
+ textList.get(i).setVisible(i < 2 ? true : false);
+ if (clearFields == true) {
+ textList.get(i).setText("");
+ }
+ }
+ labelList.get(0).setText(CommonMessages.name);
+ labelList.get(1).setText(CommonMessages.mtmTableName);
+ // if we are doing an add, then we need to make sure that the longest
+ // text can be handled
+ labelList.get(2).setText(CommonMessages.foreignKeyColumn);
+ }
+ else if (element.getText().equals(elementTypes[RELATIONSHIP_ROLE])) {
+ for (int i = 0; i < maxTextFields; i++) {
+ labelList.get(i).setVisible(true);
+ textList.get(i).setVisible(true);
+ if (clearFields == true) {
+ textList.get(i).setText("");
+ }
+ }
+ labelList.get(0).setText(CommonMessages.name);
+ labelList.get(1).setText(CommonMessages.ejbSourceName);
+ labelList.get(2).setText(CommonMessages.cmrFieldName);
+ }
+ else if (element.getText().equals(elementTypes[CMR_FIELD_MAPPING])) {
+ for (int i = 0; i < maxTextFields; i++) {
+ labelList.get(i).setVisible(i < 2 ? true : false);
+ textList.get(i).setVisible(i < 2 ? true : false);
+ if (clearFields == true) {
+ textList.get(i).setText("");
+ }
+ }
+ labelList.get(0).setText(CommonMessages.keyColumn);
+ labelList.get(1).setText(CommonMessages.foreignKeyColumn);
+ }
+ }
+
+ public String getWizardPageTitle() {
+ return CommonMessages.wizardPageTitle_EjbRelation;
+ }
+
+ public String getWizardPageDescription() {
+ return CommonMessages.wizardPageDescription_EjbRelation;
+ }
+ }
+
+ @Override
+ public void addPages() {
+ addPage(new EjbRelationWizardPage("Page0"));
+ }
+
+ @Override
+ public boolean performFinish() {
+ EjbRelationType relation;
+ if (element.getText().equals(elementTypes[EJB_RELATION])) {
+ relation = (EjbRelationType)eObject;
+ if (relation == null) {
+ relation = (EjbRelationType)getEFactory().create(EjbRelationType.class);
+ JAXBElement plan = section.getPlan();
+
+ if (JAXBModelUtils.getEjbRelationships(plan) == null) {
+ RelationshipsType relationships = (RelationshipsType)getEFactory().create(RelationshipsType.class);
+
+ JAXBModelUtils.setEjbRelationships(plan, relationships);
+ ((EjbRelationSection)section).resetInput(relationships);
+ }
+ JAXBModelUtils.getEjbRelationships(plan).add(relation);
+ }
+ relation.setEjbRelationName(textList.get(0).getText());
+ relation.setManyToManyTableName(textList.get(1).getText());
+ }
+ else if (element.getText().equals(elementTypes[RELATIONSHIP_ROLE])) {
+ if (isEmpty(textList.get(1).getText())) {
+ return false;
+ }
+ EjbRelationshipRoleType role = (EjbRelationshipRoleType)eObject;
+ if (role == null) {
+ role = (EjbRelationshipRoleType)getEFactory().create(EjbRelationshipRoleType.class);
+ relation = (EjbRelationType)((EjbRelationSection)section).getSelectedObject();
+ relation.getEjbRelationshipRole().add(role);
+ }
+ role.setEjbRelationshipRoleName(textList.get(0).getText());
+ EjbRelationshipRoleType.RelationshipRoleSource source = role.getRelationshipRoleSource();
+ if (source == null) {
+ source = (EjbRelationshipRoleType.RelationshipRoleSource)getEFactory().create(EjbRelationshipRoleType.RelationshipRoleSource.class);
+ role.setRelationshipRoleSource(source);
+ }
+ source.setEjbName(textList.get(1).getText());
+ EjbRelationshipRoleType.CmrField cmrField = role.getCmrField();
+ if (cmrField == null) {
+ cmrField = (EjbRelationshipRoleType.CmrField)getEFactory().create(EjbRelationshipRoleType.CmrField.class);
+ role.setCmrField(cmrField);
+ }
+ cmrField.setCmrFieldName(textList.get(2).getText());
+ }
+ else if (element.getText().equals(elementTypes[CMR_FIELD_MAPPING])) {
+ if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+ return false;
+ }
+ EjbRelationshipRoleType.RoleMapping.CmrFieldMapping fieldMapping =
+ (EjbRelationshipRoleType.RoleMapping.CmrFieldMapping)eObject;
+ if (fieldMapping == null) {
+ fieldMapping = (EjbRelationshipRoleType.RoleMapping.CmrFieldMapping)getEFactory().create(EjbRelationshipRoleType.RoleMapping.CmrFieldMapping.class);
+ EjbRelationshipRoleType role = (EjbRelationshipRoleType)((EjbRelationSection)section).getSelectedObject();
+ EjbRelationshipRoleType.RoleMapping roleMapping = role.getRoleMapping();
+ if (roleMapping == null) {
+ roleMapping = (EjbRelationshipRoleType.RoleMapping)getEFactory().create(EjbRelationshipRoleType.RoleMapping.class);
+ role.setRoleMapping(roleMapping);
+ }
+ role.getRoleMapping().getCmrFieldMapping().add(fieldMapping);
+ }
+ fieldMapping.setKeyColumn(textList.get(0).getText());
+ fieldMapping.setForeignKeyColumn(textList.get(1).getText());
+ }
+ return true;
+ }
+
+ public JAXBObjectFactory getEFactory() {
+ return JAXBObjectFactoryImpl.getInstance();
+ }
+
+ public String getAddWizardWindowTitle() {
+ return CommonMessages.wizardNewTitle_EjbRelation;
+ }
+
+ public String getEditWizardWindowTitle() {
+ return CommonMessages.wizardEditTitle_EjbRelation;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbRelationWizard.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbRelationWizard.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/EjbRelationWizard.java
------------------------------------------------------------------------------
svn:mime-type = text/plain