geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r325976 - in /geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui: internal/ pages/ sections/
Date Mon, 17 Oct 2005 20:23:38 GMT
Author: sppatel
Date: Mon Oct 17 13:23:25 2005
New Revision: 325976

URL: http://svn.apache.org/viewcvs?rev=325976&view=rev
Log:
update sec section

Added:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecurityRootSection.java
Modified:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/Messages.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/Messages.properties
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/SecurityPage.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/AppGeneralSection.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/CommonGeneralSection.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ConnectorGeneralSection.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/OpenEjbJarGeneralSection.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecuritySection.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/WebGeneralSection.java

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/Messages.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/Messages.java?rev=325976&r1=325975&r2=325976&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/Messages.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/Messages.java
Mon Oct 17 13:23:25 2005
@@ -201,6 +201,14 @@
     public static String console;
     
     public static String consoleTooltip;
+    
+    //
+    
+    public static String doasCurrentCaller;
+   
+    public static String useContextHandler;
+    
+    public static String defaultRole;
 
     static {
         NLS.initializeMessages(GeronimoUIPlugin.PLUGIN_ID

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/Messages.properties
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/Messages.properties?rev=325976&r1=325975&r2=325976&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/Messages.properties
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/internal/Messages.properties
Mon Oct 17 13:23:25 2005
@@ -76,6 +76,10 @@
 wizardPageTitle_Dependency=Dependency Details
 wizardPageDescription_Dependency=Provide details for this dependency.
 
+doasCurrentCaller=Do as current caller
+useContextHandler=Use context handler
+defaultRole=Default Role:
+
 dependencyGroupLabel=Dependency type and location    
 serverRepos=Specify dependency by path    
 uri=URI:

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/SecurityPage.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/SecurityPage.java?rev=325976&r1=325975&r2=325976&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/SecurityPage.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/SecurityPage.java
Mon Oct 17 13:23:25 2005
@@ -1,6 +1,7 @@
 package org.apache.geronimo.ui.pages;
 
 import org.apache.geronimo.ui.editors.AbstractGeronimoDeploymentPlanEditor;
+import org.apache.geronimo.ui.sections.SecurityRootSection;
 import org.apache.geronimo.ui.sections.SecuritySection;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EReference;
@@ -58,6 +59,9 @@
         int style = ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
                 | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
                 | ExpandableComposite.FOCUS_TITLE;
+
+        managedForm.addPart(new SecurityRootSection(body, managedForm
+                .getToolkit(), style, plan, securityERef));
 
         managedForm.addPart(new SecuritySection(plan, body, managedForm
                 .getToolkit(), style, securityERef));

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/AppGeneralSection.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/AppGeneralSection.java?rev=325976&r1=325975&r2=325976&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/AppGeneralSection.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/AppGeneralSection.java
Mon Oct 17 13:23:25 2005
@@ -21,7 +21,6 @@
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
 
 public class AppGeneralSection extends CommonGeneralSection {
 
@@ -31,11 +30,11 @@
             EObject plan) {
         super(parent, toolkit, style, plan);
         this.plan = (ApplicationType) plan;
-        createClient(getSection(), toolkit);
+        createClient();
     }
-
-    private void createClient(Section section, FormToolkit toolkit) {
-        createConfigAndParentComposite(section, toolkit);
+    
+    protected void createClient() {
+        super.createClient();
     }
 
     /*

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/CommonGeneralSection.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/CommonGeneralSection.java?rev=325976&r1=325975&r2=325976&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/CommonGeneralSection.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/CommonGeneralSection.java
Mon Oct 17 13:23:25 2005
@@ -40,8 +40,9 @@
         super(parent, toolkit, style, plan);
     }
 
-    protected void createConfigAndParentComposite(Section section,
-            FormToolkit toolkit) {
+    protected void createClient() {
+        
+        Section section = getSection();
 
         section.setText(Messages.editorSectionGeneralTitle);
         section.setDescription(Messages.editorSectionGeneralDescription);

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ConnectorGeneralSection.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ConnectorGeneralSection.java?rev=325976&r1=325975&r2=325976&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ConnectorGeneralSection.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/ConnectorGeneralSection.java
Mon Oct 17 13:23:25 2005
@@ -21,7 +21,6 @@
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
 
 public class ConnectorGeneralSection extends CommonGeneralSection {
 
@@ -31,11 +30,11 @@
             int style, EObject plan) {
         super(parent, toolkit, style, plan);
         this.plan = (ConnectorType) plan;
-        createClient(getSection(), toolkit);
+        createClient();
     }
-
-    private void createClient(Section section, FormToolkit toolkit) {
-        createConfigAndParentComposite(section, toolkit);
+    
+    protected void createClient() {
+        super.createClient();
     }
 
     /*

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/OpenEjbJarGeneralSection.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/OpenEjbJarGeneralSection.java?rev=325976&r1=325975&r2=325976&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/OpenEjbJarGeneralSection.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/OpenEjbJarGeneralSection.java
Mon Oct 17 13:23:25 2005
@@ -19,7 +19,6 @@
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
 import org.openejb.xml.ns.openejb.jar.JarPackage;
 import org.openejb.xml.ns.openejb.jar.OpenejbJarType;
 
@@ -31,11 +30,11 @@
             int style, EObject plan) {
         super(parent, toolkit, style, plan);
         this.plan = (OpenejbJarType) plan;
-        createClient(getSection(), toolkit);
+        createClient();
     }
     
-    private void createClient(Section section, FormToolkit toolkit) {
-        createConfigAndParentComposite(section, toolkit);
+    protected void createClient() {
+        super.createClient();
     }
 
     /*

Added: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecurityRootSection.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecurityRootSection.java?rev=325976&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecurityRootSection.java
(added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecurityRootSection.java
Mon Oct 17 13:23:25 2005
@@ -0,0 +1,160 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ *  Licensed 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.ui.sections;
+
+import org.apache.geronimo.ui.internal.Messages;
+import org.apache.geronimo.xml.ns.security.SecurityFactory;
+import org.apache.geronimo.xml.ns.security.SecurityPackage;
+import org.apache.geronimo.xml.ns.security.SecurityType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.FormColors;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+public class SecurityRootSection extends AbstractSectionPart {
+
+    EReference secERef;
+
+    Text defaultRole;
+
+    Button doas;
+
+    Button useCtxHdl;
+
+    /**
+     * @param section
+     */
+    public SecurityRootSection(Section section) {
+        super(section);
+    }
+
+    /**
+     * @param parent
+     * @param toolkit
+     * @param style
+     */
+    public SecurityRootSection(Composite parent, FormToolkit toolkit,
+            int style, EObject plan, EReference secERef) {
+        super(parent, toolkit, style, plan);
+        this.secERef = secERef;
+        createClient();
+    }
+
+    protected void createClient() {
+        Section section = getSection();
+
+        section.setText(Messages.editorSectionGeneralTitle);
+        section.setDescription(Messages.editorSectionGeneralDescription);
+        section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+
+        Composite composite = toolkit.createComposite(section);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        layout.marginHeight = 5;
+        layout.marginWidth = 10;
+        layout.verticalSpacing = 5;
+        layout.horizontalSpacing = 15;
+        composite.setLayout(layout);
+        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+        section.setClient(composite);
+
+        createLabel(composite, Messages.defaultRole, toolkit);
+        defaultRole = toolkit.createText(composite, getDefaultRole(),
+                SWT.BORDER);
+        GridData gd = new GridData();
+        gd.widthHint = 150;
+        defaultRole.setLayoutData(gd);
+        defaultRole.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getSecurityType().setDefaultRole(defaultRole.getText());
+                markDirty();
+            }
+        });
+
+        doas = toolkit.createButton(composite, Messages.doasCurrentCaller,
+                SWT.CHECK);
+        doas.setLayoutData(createGridData());
+        doas.addSelectionListener(new SelectionListener() {
+            public void widgetDefaultSelected(SelectionEvent e) {
+            }
+
+            public void widgetSelected(SelectionEvent e) {
+                getSecurityType().setDoasCurrentCaller(doas.getSelection());
+                markDirty();
+            }
+        });
+
+        useCtxHdl = toolkit.createButton(composite, Messages.useContextHandler,
+                SWT.CHECK);
+        useCtxHdl.setLayoutData(createGridData());
+        useCtxHdl.addSelectionListener(new SelectionListener() {
+            public void widgetDefaultSelected(SelectionEvent e) {
+            }
+
+            public void widgetSelected(SelectionEvent e) {
+                getSecurityType().setUseContextHandler(useCtxHdl.getSelection());
+                markDirty();
+            }
+        });
+
+    }
+
+    protected GridData createGridData() {
+        GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+        gd.horizontalSpan = 2;
+        return gd;
+    }
+
+    protected Label createLabel(Composite parent, String text,
+            FormToolkit toolkit) {
+        Label label = toolkit.createLabel(parent, text);
+        label.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
+        label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+        return label;
+    }
+
+    private String getDefaultRole() {
+        SecurityType secType = (SecurityType) plan.eGet(secERef);
+        if (secType != null
+                && secType.eIsSet(SecurityPackage.eINSTANCE
+                        .getSecurityType_DefaultRole())) {
+            return secType.getDefaultRole();
+        }
+        return "";
+    }
+
+    private SecurityType getSecurityType() {
+        SecurityType secType = (SecurityType) plan.eGet(secERef);
+        if (secType == null) {
+            secType = SecurityFactory.eINSTANCE.createSecurityType();
+            plan.eSet(secERef, secType);
+        }
+        return secType;
+    }
+
+}

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecuritySection.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecuritySection.java?rev=325976&r1=325975&r2=325976&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecuritySection.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecuritySection.java
Mon Oct 17 13:23:25 2005
@@ -19,6 +19,7 @@
 import org.apache.geronimo.ui.internal.Messages;
 import org.apache.geronimo.ui.wizards.SecurityRoleWizard;
 import org.apache.geronimo.xml.ns.security.DescriptionType;
+import org.apache.geronimo.xml.ns.security.RoleMappingsType;
 import org.apache.geronimo.xml.ns.security.RoleType;
 import org.apache.geronimo.xml.ns.security.SecurityFactory;
 import org.apache.geronimo.xml.ns.security.SecurityPackage;
@@ -56,8 +57,8 @@
      * @param toolkit
      * @param style
      */
-    public SecuritySection(EObject plan, Composite parent,
-            FormToolkit toolkit, int style, EReference securityERef) {
+    public SecuritySection(EObject plan, Composite parent, FormToolkit toolkit,
+            int style, EReference securityERef) {
         super(plan, parent, toolkit, style);
         this.securityERef = securityERef;
         create();
@@ -133,8 +134,9 @@
         return false;
     }
 
-
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.geronimo.ui.sections.DynamicTableSection#createClient()
      */
     public void createClient() {
@@ -187,20 +189,25 @@
         SecurityType secType = (SecurityType) getPlan().eGet(securityERef);
 
         if (secType != null) {
+            RoleMappingsType roleMappings = secType.getRoleMappings();
+            if (roleMappings != null) {
 
-            EList list = (EList) (secType.getRoleMappings().getRole());
+                EList list = roleMappings.getRole();
 
-            for (int j = 0; j < list.size(); j++) {
-                TableItem item = new TableItem(table, SWT.NONE);
-                String[] tableTextData = getTableText((EObject) list.get(j));
-                item.setImage(getImage());
-                item.setText(tableTextData);
-                item.setData((EObject) list.get(j));
+                for (int j = 0; j < list.size(); j++) {
+                    TableItem item = new TableItem(table, SWT.NONE);
+                    String[] tableTextData = getTableText((EObject) list.get(j));
+                    item.setImage(getImage());
+                    item.setText(tableTextData);
+                    item.setData((EObject) list.get(j));
+                }
             }
         }
     }
-    
-    /* (non-Javadoc)
+
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.geronimo.ui.sections.DynamicTableSection#getImageDescriptor()
      */
     public ImageDescriptor getImageDescriptor() {

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/WebGeneralSection.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/WebGeneralSection.java?rev=325976&r1=325975&r2=325976&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/WebGeneralSection.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/WebGeneralSection.java
Mon Oct 17 13:23:25 2005
@@ -31,7 +31,6 @@
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
 
 public class WebGeneralSection extends CommonGeneralSection {
 
@@ -49,13 +48,14 @@
             EObject plan) {
         super(parent, toolkit, style, plan);
         this.plan = (WebAppType) plan;
-        createClient(getSection(), toolkit);
-    }
+        createClient();
+    }   
 
-    private void createClient(Section section, FormToolkit toolkit) {
-
-        createConfigAndParentComposite(section, toolkit);
-        Composite composite = (Composite) section.getClient();
+    protected void createClient() {
+        
+        super.createClient();
+        
+        Composite composite = (Composite) getSection().getClient();
 
         // ------- Label and text field for the context root -------
         createLabel(composite, Messages.editorContextRoot, toolkit);



Mime
View raw message