geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r292738 - in /geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui: ./ src/org/apache/geronimo/ui/editors/ src/org/apache/geronimo/ui/pages/ src/org/apache/geronimo/ui/sections/
Date Fri, 30 Sep 2005 14:00:12 GMT
Author: sppatel
Date: Fri Sep 30 07:00:08 2005
New Revision: 292738

URL: http://svn.apache.org/viewcvs?rev=292738&view=rev
Log:
initial drop for app editor

Added:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/editors/ApplicationPlanEditor.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AppGeneralPage.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/AppGeneralSection.java
Modified:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/plugin.properties
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/plugin.xml

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/plugin.properties
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/plugin.properties?rev=292738&r1=292737&r2=292738&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/plugin.properties
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/plugin.properties
Fri Sep 30 07:00:08 2005
@@ -2,5 +2,6 @@
 providerName=Apache Software Foundation
 
 webEditorName=Geronimo Web Deployment Plan Editor
+appEditorName=Geronimo Application Deployment Plan Editor
 
 PopupMenus.launchconsole=Launch Geronimo Console

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/plugin.xml
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/plugin.xml?rev=292738&r1=292737&r2=292738&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/plugin.xml
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/plugin.xml
Fri Sep 30 07:00:08 2005
@@ -33,6 +33,14 @@
             id="org.apache.geronimo.ui.editors.WebEditor"
             name="%webEditorName">
       </editor>
+      <editor
+            class="org.apache.geronimo.ui.editors.ApplicationPlanEditor"
+            default="true"
+            filenames="geronimo-application.xml"
+            icon="icons/obj16/geronimo.gif"
+            id="org.apache.geronimo.ui.editors.ApplicationPlanEditor"
+            name="%appEditorName">
+      </editor>
   </extension>
   
   <extension point = "org.eclipse.ui.popupMenus">

Added: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/editors/ApplicationPlanEditor.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/editors/ApplicationPlanEditor.java?rev=292738&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/editors/ApplicationPlanEditor.java
(added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/editors/ApplicationPlanEditor.java
Fri Sep 30 07:00:08 2005
@@ -0,0 +1,46 @@
+/**
+ * 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.editors;
+
+import org.apache.geronimo.core.internal.GeronimoUtils;
+import org.apache.geronimo.ui.internal.Messages;
+import org.apache.geronimo.ui.pages.AppGeneralPage;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.ui.PartInitException;
+
+public class ApplicationPlanEditor extends AbstractGeronimoDeploymentPlanEditor {
+
+    public ApplicationPlanEditor() {
+        super();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ui.editors.AbstractGeronimoDeploymentPlanEditor#doAddPages()
+     */
+    public void doAddPages() throws PartInitException {
+        addPage(new AppGeneralPage(this, "appgeneralpage",
+                Messages.editorTabGeneral));
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ui.editors.AbstractGeronimoDeploymentPlanEditor#loadDeploymentPlan(org.eclipse.core.resources.IFile)
+     */
+    public EObject loadDeploymentPlan(IFile file) {
+        return GeronimoUtils.getApplicationDeploymentPlan(file);
+    }
+
+}

Added: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AppGeneralPage.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AppGeneralPage.java?rev=292738&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AppGeneralPage.java
(added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/pages/AppGeneralPage.java
Fri Sep 30 07:00:08 2005
@@ -0,0 +1,76 @@
+/**
+ * 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.pages;
+
+import org.apache.geronimo.ui.editors.ApplicationPlanEditor;
+import org.apache.geronimo.ui.sections.AppGeneralSection;
+import org.apache.geronimo.xml.ns.j2ee.application.ApplicationType;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * 
+ * 
+ */
+public class AppGeneralPage extends FormPage {
+
+    /**
+     * @param editor
+     * @param id
+     * @param title
+     */
+    public AppGeneralPage(FormEditor editor, String id, String title) {
+        super(editor, id, title);
+    }
+
+    /**
+     * @param id
+     * @param title
+     */
+    public AppGeneralPage(String id, String title) {
+        super(id, title);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
+     */
+    protected void createFormContent(IManagedForm managedForm) {
+
+        ApplicationType plan = (ApplicationType) ((ApplicationPlanEditor) getEditor())
+                .getDeploymentPlan();
+
+        ScrolledForm form = managedForm.getForm();
+        form.setText(getTitle());
+        form.getBody().setLayout(new GridLayout());
+
+        AppGeneralSection sec = new AppGeneralSection(plan, form.getBody(),
+                managedForm.getToolkit(), ExpandableComposite.TWISTIE
+                        | ExpandableComposite.EXPANDED
+                        | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
+                        | ExpandableComposite.FOCUS_TITLE);
+        managedForm.addPart(sec);
+
+        form.reflow(true);
+    }
+
+}

Added: 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=292738&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/AppGeneralSection.java
(added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/AppGeneralSection.java
Fri Sep 30 07:00:08 2005
@@ -0,0 +1,140 @@
+/**
+ * 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.j2ee.application.ApplicationType;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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.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 AppGeneralSection extends SectionPart {
+    
+    ApplicationType plan;
+    
+    protected Text configId;
+
+    protected Text parentId;
+
+    /**
+     * @param section
+     */
+    public AppGeneralSection(Section section) {
+        super(section);
+        // TODO Auto-generated constructor stub
+    }
+
+    /**
+     * @param parent
+     * @param toolkit
+     * @param style
+     */
+    public AppGeneralSection(Composite parent, FormToolkit toolkit, int style) {
+        super(parent, toolkit, style);
+        // TODO Auto-generated constructor stub
+    }
+    
+    public AppGeneralSection(ApplicationType 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();
+            }
+        });
+
+    }
+
+    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();
+        }
+    }
+
+}



Mime
View raw message