geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r280909 [52/52] - in /geronimo/devtools/trunk/modules/eclipse-plugin: ./ features/ features/org.apache.geronimo.feature/ org.apache.geronimo.core/ org.apache.geronimo.deployment.model/ org.apache.geronimo.feature/ org.apache.geronimo.runtim...
Date Wed, 14 Sep 2005 19:01:03 GMT
Added: 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=280909&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/WebGeneralSection.java
(added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/WebGeneralSection.java
Wed Sep 14 11:59:30 2005
@@ -0,0 +1,203 @@
+/**
+ * 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.web.WebAppType;
+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.SectionPart;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+public class WebGeneralSection extends SectionPart {
+
+    protected Text configId;
+
+    protected Text parentId;
+
+    protected Text contextRoot;
+    
+    protected Text securityRealm;
+
+    protected Button cpClassLoaderWebAppFirst;
+
+    protected Button cpClassLoaderServerFirst;
+
+    WebAppType plan;
+
+    public WebGeneralSection(Section section) {
+        super(section);
+    }
+
+    public WebGeneralSection(Composite parent, FormToolkit toolkit, int style) {
+        super(parent, toolkit, style);
+    }
+
+    public WebGeneralSection(WebAppType plan, Composite parent,
+            FormToolkit toolkit, int style) {
+        this(parent, toolkit, style);
+        this.plan = plan;
+        createClient(getSection(), toolkit);
+    }
+
+    private void createClient(Section section, FormToolkit toolkit) {
+
+        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, true, false));
+        section.setClient(composite);
+
+        // ------- Label and text field for the config Id -------
+        createLabel(composite, Messages.editorConfigId, toolkit);
+
+        configId = toolkit
+                .createText(composite, plan.getConfigId(), SWT.BORDER);
+        configId.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+        configId.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                plan.setConfigId(configId.getText());
+                markDirty();
+            }
+        });
+
+        // ------- Label and text field for the parent Id -------
+        createLabel(composite, Messages.editorParentId, toolkit);
+
+        parentId = toolkit
+                .createText(composite, plan.getParentId(), SWT.BORDER);
+        parentId
+                .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+        parentId.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                plan.setParentId(parentId.getText());
+                markDirty();
+            }
+        });
+
+        // ------- Label and text field for the context root -------
+        createLabel(composite, Messages.editorContextRoot, toolkit);
+
+        contextRoot = toolkit.createText(composite, plan.getContextRoot(),
+                SWT.BORDER);
+        contextRoot.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
+                false));
+        contextRoot.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                plan.setContextRoot(contextRoot.getText());
+                markDirty();
+            }
+        });
+        
+        
+        // ------- Label and text field for the security realm -------
+        createLabel(composite, Messages.securityRealmName, toolkit);
+
+        securityRealm = toolkit.createText(composite, plan.getSecurityRealmName(),
+                SWT.BORDER);
+        securityRealm.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
+                false));
+        securityRealm.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                plan.setSecurityRealmName(securityRealm.getText());
+                markDirty();
+            }
+        });
+
+        // ------- Label and check box for the Context Priority Classloader
+        // -------
+        Label classLoaderLabel = toolkit.createLabel(composite,
+                Messages.editorClassloader);
+        GridData data = new GridData(SWT.LEFT, SWT.CENTER, false, false);
+        data.horizontalSpan = 2;
+        classLoaderLabel.setLayoutData(data);
+
+        cpClassLoaderServerFirst = toolkit.createButton(composite,
+                Messages.editorClassloaderServer, SWT.RADIO);
+        data = new GridData(SWT.FILL, SWT.CENTER, false, false);
+        data.horizontalSpan = 2;
+        cpClassLoaderServerFirst.setLayoutData(data);
+        cpClassLoaderServerFirst.setSelection(!plan
+                .isContextPriorityClassloader());
+
+        cpClassLoaderWebAppFirst = toolkit.createButton(composite,
+                Messages.editorClassloaderWebApp, SWT.RADIO);
+        data = new GridData(SWT.FILL, SWT.CENTER, false, false);
+        data.horizontalSpan = 2;
+        cpClassLoaderWebAppFirst.setLayoutData(data);
+        cpClassLoaderWebAppFirst.setSelection(plan
+                .isContextPriorityClassloader());
+
+        cpClassLoaderWebAppFirst.addSelectionListener(new SelectionListener() {
+            public void widgetSelected(SelectionEvent e) {
+                plan.setContextPriorityClassloader(cpClassLoaderWebAppFirst
+                        .getSelection());
+                markDirty();
+
+            }
+
+            public void widgetDefaultSelected(SelectionEvent e) {
+                // Not invoked
+            }
+        });
+
+    }
+
+    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;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.forms.IFormPart#commit(boolean)
+     * 
+     * Overriding this method as a workaround as switching tabs on a dirty
+     * editor commits the page and marks the part as not dirty.
+     */
+    public void commit(boolean onSave) {
+        boolean currentDirtyState = isDirty();
+        super.commit(onSave);
+        if (!onSave && currentDirtyState) {
+            markDirty();
+        }
+    }
+
+}

Added: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DynamicAddEditWizard.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DynamicAddEditWizard.java?rev=280909&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DynamicAddEditWizard.java
(added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DynamicAddEditWizard.java
Wed Sep 14 11:59:30 2005
@@ -0,0 +1,194 @@
+/**
+ * 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.wizards;
+
+import org.apache.geronimo.ui.sections.DynamicTableSection;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+public abstract class DynamicAddEditWizard extends Wizard {
+
+    DynamicTableSection section;
+
+    EObject eObject;
+
+    /**
+     * 
+     */
+    public DynamicAddEditWizard(DynamicTableSection section) {
+        super();
+        this.section = section;
+        setWindowTitle(getAddWizardWindowTitle());
+    }
+
+    /**
+     * @return
+     */
+    abstract public String getAddWizardWindowTitle();
+
+    /**
+     * @return
+     */
+    abstract public String getEditWizardWindowTitle();
+
+    /**
+     * @return
+     */
+    abstract public String getWizardFirstPageTitle();
+
+    /**
+     * @return
+     */
+    abstract public String getWizardFirstPageDescription();
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.wizard.Wizard#performFinish()
+     */
+    public boolean performFinish() {
+        DynamicWizardPage page = (DynamicWizardPage) getPages()[0];
+
+        boolean isNew = false;
+
+        if (eObject == null) {
+            eObject = section.getEFactory().create(
+                    section.getTableColumnEAttributes()[0]
+                            .getEContainingClass());
+            EObject plan = section.getPlan();           
+            
+            ((EList) plan.eGet(section.getEReference())).add(eObject);
+            isNew = true;
+        }
+
+        for (int i = 0; i < section.getTableColumnEAttributes().length; i++) {
+            String value = page.textEntries[i].getText();
+            eObject.eSet(section.getTableColumnEAttributes()[i], value);
+        }
+
+        String[] tableText = section.getTableText(eObject);
+
+        if (isNew) {
+            TableItem item = new TableItem(section.getTableViewer().getTable(),
+                    SWT.NONE);
+            item.setImage(section.getImage());
+            item.setData(eObject);
+            item.setText(tableText);
+        } else {
+            int index = section.getTableViewer().getTable().getSelectionIndex();
+            if (index != -1) {
+                TableItem item = section.getTableViewer().getTable().getItem(
+                        index);
+                item.setText(tableText);
+            }
+        }
+
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.wizard.IWizard#addPages()
+     */
+    public void addPages() {
+        WizardPage page = new DynamicWizardPage("Page0");
+        addPage(page);
+    }
+
+    /**
+     * @param section
+     */
+    public void setSection(DynamicTableSection section) {
+        this.section = section;
+    }
+
+    /**
+     * @param object
+     */
+    public void setEObject(EObject object) {
+        eObject = object;
+    }
+
+    public class DynamicWizardPage extends WizardPage {
+
+        Text[] textEntries = new Text[section.getTableColumnEAttributes().length];
+
+        public DynamicWizardPage(String pageName) {
+            super(pageName);
+            setTitle(getWizardFirstPageTitle());
+            setDescription(getWizardFirstPageDescription());
+        }
+
+        public DynamicWizardPage(String pageName, String title,
+                ImageDescriptor titleImage) {
+            super(pageName, title, titleImage);
+        }
+
+        public void createControl(Composite parent) {
+            Composite composite = new Composite(parent, SWT.NULL);
+            GridLayout layout = new GridLayout();
+            layout.numColumns = 2;
+            composite.setLayout(layout);
+            GridData data = new GridData();
+            data.verticalAlignment = GridData.FILL;
+            data.horizontalAlignment = GridData.FILL;
+            data.widthHint = 300;
+            composite.setLayoutData(data);
+
+            for (int i = 0; i < section.getTableColumnNames().length; i++) {
+                Label label = new Label(composite, SWT.LEFT);
+                label.setText(section.getTableColumnNames()[i] + ":");
+                data = new GridData();
+                data.horizontalAlignment = GridData.FILL;
+                label.setLayoutData(data);
+
+                Text text = new Text(composite, SWT.SINGLE | SWT.BORDER);
+                data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+                        | GridData.VERTICAL_ALIGN_FILL);
+                data.grabExcessHorizontalSpace = true;
+                data.widthHint = 100;
+                text.setLayoutData(data);
+
+                if (eObject != null) {
+                    String value = (String) eObject.eGet(section
+                            .getTableColumnEAttributes()[i]);
+                    if (value != null) {
+                        text.setText(value);
+                    }
+                }
+                textEntries[i] = text;
+            }
+
+            setControl(composite);
+                        
+            textEntries[0].setFocus();
+
+        }
+
+    }
+
+}

Added: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/EjbLocalRefWizard.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/EjbLocalRefWizard.java?rev=280909&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/EjbLocalRefWizard.java
(added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/EjbLocalRefWizard.java
Wed Sep 14 11:59:30 2005
@@ -0,0 +1,56 @@
+/**
+ * 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.wizards;
+
+import org.apache.geronimo.ui.internal.Messages;
+import org.apache.geronimo.ui.sections.DynamicTableSection;
+
+public class EjbLocalRefWizard extends DynamicAddEditWizard {
+
+    public EjbLocalRefWizard(DynamicTableSection section) {
+        super(section);
+        // TODO Auto-generated constructor stub
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getAddWizardWindowTitle()
+     */
+    public String getAddWizardWindowTitle() {
+        return Messages.wizardNewTitle_EjbLocalRef;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getEditWizardWindowTitle()
+     */
+    public String getEditWizardWindowTitle() {
+        return Messages.wizardEditTitle_EjbLocalRef;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getWizardFirstPageTitle()
+     */
+    public String getWizardFirstPageTitle() {
+        return Messages.wizardPageTitle_EjbLocalRef;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getWizardFirstPageDescription()
+     */
+    public String getWizardFirstPageDescription() {
+        return Messages.wizardPageDescription_EjbLocalRef;
+    }
+
+}

Added: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/EjbRefWizard.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/EjbRefWizard.java?rev=280909&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/EjbRefWizard.java
(added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/EjbRefWizard.java
Wed Sep 14 11:59:30 2005
@@ -0,0 +1,64 @@
+/**
+ * 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.wizards;
+
+import org.apache.geronimo.ui.internal.Messages;
+import org.apache.geronimo.ui.sections.DynamicTableSection;
+
+public class EjbRefWizard extends DynamicAddEditWizard {
+
+    public EjbRefWizard(DynamicTableSection section) {
+        super(section);
+        // TODO Auto-generated constructor stub
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getAddWizardWindowTitle()
+     */
+    public String getAddWizardWindowTitle() {
+        return Messages.wizardNewTitle_EjbRef;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getEditWizardWindowTitle()
+     */
+    public String getEditWizardWindowTitle() {
+        return Messages.wizardEditTitle_EjbRef;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getWizardFirstPageTitle()
+     */
+    public String getWizardFirstPageTitle() {
+        return Messages.wizardPageTitle_EjbRef;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getWizardFirstPageDescription()
+     */
+    public String getWizardFirstPageDescription() {
+        return Messages.wizardPageDescription_EjbRef;
+    }
+
+}

Added: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/ResourceEnvRefWizard.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/ResourceEnvRefWizard.java?rev=280909&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/ResourceEnvRefWizard.java
(added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/ResourceEnvRefWizard.java
Wed Sep 14 11:59:30 2005
@@ -0,0 +1,66 @@
+/**
+ * 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.wizards;
+
+import org.apache.geronimo.ui.internal.Messages;
+import org.apache.geronimo.ui.sections.DynamicTableSection;
+
+public class ResourceEnvRefWizard extends DynamicAddEditWizard {
+
+    /**
+     * @param section
+     */
+    public ResourceEnvRefWizard(DynamicTableSection section) {
+        super(section);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getAddWizardWindowTitle()
+     */
+    public String getAddWizardWindowTitle() {
+        return Messages.wizardPageTitle_ResEnvRef;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getEditWizardWindowTitle()
+     */
+    public String getEditWizardWindowTitle() {
+        return Messages.wizardEditTitle_ResEnvRef;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getWizardFirstPageTitle()
+     */
+    public String getWizardFirstPageTitle() {
+        return Messages.wizardPageTitle_ResEnvRef;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getWizardFirstPageDescription()
+     */
+    public String getWizardFirstPageDescription() {
+        return Messages.wizardPageDescription_ResEnvRef;
+    }
+
+}

Added: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/ResourceRefWizard.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/ResourceRefWizard.java?rev=280909&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/ResourceRefWizard.java
(added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/ResourceRefWizard.java
Wed Sep 14 11:59:30 2005
@@ -0,0 +1,66 @@
+/**
+ * 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.wizards;
+
+import org.apache.geronimo.ui.internal.Messages;
+import org.apache.geronimo.ui.sections.DynamicTableSection;
+
+public class ResourceRefWizard extends DynamicAddEditWizard {
+
+    /**
+     * @param section
+     */
+    public ResourceRefWizard(DynamicTableSection section) {
+        super(section);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getAddWizardWindowTitle()
+     */
+    public String getAddWizardWindowTitle() {
+        return Messages.wizardPageTitle_ResRef;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getEditWizardWindowTitle()
+     */
+    public String getEditWizardWindowTitle() {
+        return Messages.wizardEditTitle_ResRef;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getWizardFirstPageTitle()
+     */
+    public String getWizardFirstPageTitle() {
+        return Messages.wizardPageTitle_ResRef;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard#getWizardFirstPageDescription()
+     */
+    public String getWizardFirstPageDescription() {
+        return Messages.wizardPageDescription_ResRef;
+    }
+
+}

Added: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/SecurityRoleWizard.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/SecurityRoleWizard.java?rev=280909&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/SecurityRoleWizard.java
(added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/SecurityRoleWizard.java
Wed Sep 14 11:59:30 2005
@@ -0,0 +1,125 @@
+/**
+ * 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.wizards;
+
+import org.apache.geronimo.ui.internal.Messages;
+import org.apache.geronimo.ui.sections.DynamicTableSection;
+import org.apache.geronimo.ui.sections.SecuritySection;
+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;
+import org.apache.geronimo.xml.ns.security.SecurityType;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.TableItem;
+
+public class SecurityRoleWizard extends DynamicAddEditWizard {
+
+    public SecurityRoleWizard(DynamicTableSection section) {
+        super(section);
+    }
+
+    public String getAddWizardWindowTitle() {
+        return Messages.wizardNewTitle_SecurityRole;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return Messages.wizardEditTitle_SecurityRole;
+    }
+
+    public String getWizardFirstPageTitle() {
+        return Messages.wizardPageTitle_SecurityRole;
+    }
+
+    public String getWizardFirstPageDescription() {
+        return Messages.wizardPageDescription_SecurityRole;
+    }
+
+    public boolean performFinish() {
+        DynamicWizardPage page = (DynamicWizardPage) getPages()[0];
+
+        boolean isNew = false;
+
+        if (eObject == null) {
+            eObject = section.getEFactory().create(
+                    section.getTableColumnEAttributes()[0]
+                            .getEContainingClass());
+            EObject plan = section.getPlan();
+
+            SecurityType securityType = (SecurityType) plan
+                    .eGet(SecuritySection.securityERef);
+            if (securityType == null) {
+                securityType = SecurityFactory.eINSTANCE.createSecurityType();
+                plan.eSet(SecuritySection.securityERef, securityType);
+            }
+
+            RoleMappingsType roleMappingsType = securityType.getRoleMappings();
+            if (roleMappingsType == null) {
+                roleMappingsType = SecurityFactory.eINSTANCE
+                        .createRoleMappingsType();
+                securityType.setRoleMappings(roleMappingsType);
+            }
+
+            roleMappingsType.getRole().add(eObject);
+            isNew = true;
+        }
+
+        for (int i = 0; i < section.getTableColumnEAttributes().length; i++) {
+            String value = page.textEntries[i].getText();
+            EAttribute attribute = section.getTableColumnEAttributes()[i];
+            if (attribute.getEContainingClass().equals(eObject.eClass())) {
+                eObject.eSet(attribute, value);
+            } else {
+                if (attribute.getFeatureID() == SecurityPackage.DESCRIPTION_TYPE__LANG) {
+                    DescriptionType type = null;
+                    RoleType roleType = ((RoleType) eObject);
+                    if (roleType.getDescription().isEmpty()) {
+                        type = SecurityFactory.eINSTANCE
+                                .createDescriptionType();
+                        roleType.getDescription().add(type);
+                    } else {
+                        type = (DescriptionType) roleType.getDescription().get(
+                                0);
+                    }
+                    type.setLang(value);
+                }
+            }
+        }
+
+        String[] tableText = section.getTableText(eObject);
+
+        if (isNew) {
+            TableItem item = new TableItem(section.getTableViewer().getTable(),
+                    SWT.NONE);
+            item.setImage(section.getImage());
+            item.setData(eObject);
+            item.setText((String) eObject.eGet(SecurityPackage.eINSTANCE
+                    .getRoleType_RoleName()));
+        } else {
+            int index = section.getTableViewer().getTable().getSelectionIndex();
+            if (index != -1) {
+                TableItem item = section.getTableViewer().getTable().getItem(
+                        index);
+                item.setText(tableText);
+            }
+        }
+
+        return true;
+    }
+}



Mime
View raw message