You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by mc...@apache.org on 2010/04/29 02:57:15 UTC
svn commit: r939152 [4/7] - in
/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui:
./ META-INF/ icons/ src/main/java/org/apache/geronimo/st/v30/ui/
src/main/java/org/apache/geronimo/st/v30/ui/actions/
src/main/java/org/apache...
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AbstractGeronimoFormPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AbstractGeronimoFormPage.java?rev=939152&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AbstractGeronimoFormPage.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AbstractGeronimoFormPage.java Thu Apr 29 00:57:12 2010
@@ -0,0 +1,178 @@
+/*
+ * 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.v30.ui.pages;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.st.v30.core.DeploymentDescriptorUtils;
+import org.apache.geronimo.st.v30.core.descriptor.AbstractDeploymentDescriptor;
+import org.apache.geronimo.st.v30.ui.Activator;
+import org.apache.geronimo.st.v30.ui.editors.AbstractGeronimoDeploymentPlanEditor;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.PlatformUI;
+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.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractGeronimoFormPage extends FormPage {
+
+ JAXBElement deploymentPlan;
+
+ AbstractDeploymentDescriptor deploymentDescriptor;
+
+ protected FormToolkit toolkit;
+
+ protected Composite body;
+
+ /**
+ * @param editor
+ * @param id
+ * @param title
+ */
+ public AbstractGeronimoFormPage(FormEditor editor, String id, String title) {
+ super(editor, id, title);
+ }
+
+ /**
+ * @param id
+ * @param title
+ */
+ public AbstractGeronimoFormPage(String id, String title) {
+ super(id, title);
+ }
+
+ public void refresh() {
+ // clear the old composite and tool bar
+ Control[] controls = body.getChildren();
+ for (int i = 0; i < controls.length; i++) {
+ controls[i].dispose();
+ }
+ getManagedForm().getForm().getToolBarManager().removeAll();
+ createFormContent(getManagedForm());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
+ */
+ protected void createFormContent(IManagedForm managedForm) {
+ deploymentPlan = ((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan();
+ deploymentDescriptor = (AbstractDeploymentDescriptor) DeploymentDescriptorUtils
+ .getDeploymentDescriptor(getProject());
+ body = managedForm.getForm().getBody();
+ toolkit = managedForm.getToolkit();
+ final ScrolledForm form = managedForm.getForm();
+ form.setText(getFormTitle());
+ // managedForm.addPart(new BannerPart(form.getBody(), toolkit,
+ // SWT.NONE));
+ form.getBody().setLayout(getLayout());
+ fillBody(managedForm);
+
+ // header with help button
+ toolkit.decorateFormHeading(form.getForm());
+ IToolBarManager manager = form.getToolBarManager();
+
+ Action serverInfoRefresh = new Action("serverInfo") { //$NON-NLS-1$
+ public void run() {
+ BusyIndicator.showWhile(form.getDisplay(), new Runnable() {
+ public void run() {
+ triggerGeronimoServerInfoUpdate();
+ }
+ });
+ }
+ };
+ serverInfoRefresh.setToolTipText("Trigger update of GeronimoServerInfo");
+ serverInfoRefresh.setImageDescriptor(Activator.imageDescriptorFromPlugin("org.apache.geronimo.st.v30.ui",
+ "icons/obj16/update.gif"));
+ manager.add(serverInfoRefresh);
+
+ Action helpAction = new Action("help") { //$NON-NLS-1$
+ public void run() {
+ BusyIndicator.showWhile(form.getDisplay(), new Runnable() {
+ public void run() {
+ PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(getHelpResource());
+ }
+ });
+ }
+ };
+ helpAction.setToolTipText("help");
+ helpAction.setImageDescriptor(Activator.imageDescriptorFromPlugin("org.apache.geronimo.st.v30.ui",
+ "icons/obj16/help.gif"));
+ manager.add(helpAction);
+
+ manager.update(true);
+ form.reflow(true);
+ }
+
+ protected abstract void triggerGeronimoServerInfoUpdate();
+
+ protected String getHelpResource() {
+ return "http://geronimo.apache.org/development-tools.html";
+ }
+
+ protected GridLayout getLayout() {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.horizontalSpacing = 20;
+ layout.makeColumnsEqualWidth = true;
+ return layout;
+ }
+
+ protected int getStyle() {
+ return ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
+ | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
+ | ExpandableComposite.FOCUS_TITLE;
+ }
+
+ abstract protected void fillBody(IManagedForm managedForm);
+
+ public JAXBElement getDeploymentPlan() {
+ return deploymentPlan;
+ }
+
+ protected IProject getProject() {
+ IEditorInput editorInput = getEditorInput();
+ if (editorInput instanceof IFileEditorInput) {
+ return ((IFileEditorInput) editorInput).getFile().getProject();
+ }
+ return null;
+ }
+
+ public AbstractDeploymentDescriptor getDeploymentDescriptor() {
+ return deploymentDescriptor;
+ }
+
+ public String getFormTitle() {
+ return getTitle();
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AbstractGeronimoFormPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AbstractGeronimoFormPage.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AbstractGeronimoFormPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AppClientGeneralPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AppClientGeneralPage.java?rev=939152&r1=939151&r2=939152&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AppClientGeneralPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AppClientGeneralPage.java Thu Apr 29 00:57:12 2010
@@ -16,8 +16,8 @@
*/
package org.apache.geronimo.st.v30.ui.pages;
-import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage;
+import org.apache.geronimo.st.v30.ui.CommonMessages;
+import org.apache.geronimo.st.v30.ui.pages.AbstractGeronimoFormPage;
import org.apache.geronimo.st.v30.core.GeronimoServerInfo;
import org.apache.geronimo.st.v30.ui.sections.AppClientClientGeneralSection;
import org.apache.geronimo.st.v30.ui.sections.AppClientServerGeneralSection;
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AppClientSecurityPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AppClientSecurityPage.java?rev=939152&r1=939151&r2=939152&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AppClientSecurityPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AppClientSecurityPage.java Thu Apr 29 00:57:12 2010
@@ -16,8 +16,8 @@
*/
package org.apache.geronimo.st.v30.ui.pages;
-import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage;
+import org.apache.geronimo.st.v30.ui.CommonMessages;
+import org.apache.geronimo.st.v30.ui.pages.AbstractGeronimoFormPage;
import org.apache.geronimo.st.v30.core.GeronimoServerInfo;
import org.apache.geronimo.st.v30.ui.sections.AppClientSecuritySection;
import org.eclipse.swt.layout.GridLayout;
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AppGeneralPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AppGeneralPage.java?rev=939152&r1=939151&r2=939152&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AppGeneralPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/AppGeneralPage.java Thu Apr 29 00:57:12 2010
@@ -16,8 +16,8 @@
*/
package org.apache.geronimo.st.v30.ui.pages;
-import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage;
+import org.apache.geronimo.st.v30.ui.CommonMessages;
+import org.apache.geronimo.st.v30.ui.pages.AbstractGeronimoFormPage;
import org.apache.geronimo.st.v30.core.GeronimoServerInfo;
import org.apache.geronimo.st.v30.ui.sections.AppGeneralSection;
import org.eclipse.ui.forms.IManagedForm;
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/ConnectorOverviewPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/ConnectorOverviewPage.java?rev=939152&r1=939151&r2=939152&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/ConnectorOverviewPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/ConnectorOverviewPage.java Thu Apr 29 00:57:12 2010
@@ -16,8 +16,8 @@
*/
package org.apache.geronimo.st.v30.ui.pages;
-import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage;
+import org.apache.geronimo.st.v30.ui.CommonMessages;
+import org.apache.geronimo.st.v30.ui.pages.AbstractGeronimoFormPage;
import org.apache.geronimo.st.v30.core.GeronimoServerInfo;
import org.apache.geronimo.st.v30.ui.sections.ConnectorGeneralSection;
import org.eclipse.ui.forms.IManagedForm;
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/ConnectorPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/ConnectorPage.java?rev=939152&r1=939151&r2=939152&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/ConnectorPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/ConnectorPage.java Thu Apr 29 00:57:12 2010
@@ -17,9 +17,9 @@
package org.apache.geronimo.st.v30.ui.pages;
import org.apache.geronimo.jee.application.Application;
-import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.editors.AbstractGeronimoDeploymentPlanEditor;
-import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage;
+import org.apache.geronimo.st.v30.ui.CommonMessages;
+import org.apache.geronimo.st.v30.ui.editors.AbstractGeronimoDeploymentPlanEditor;
+import org.apache.geronimo.st.v30.ui.pages.AbstractGeronimoFormPage;
import org.apache.geronimo.st.v30.core.GeronimoServerInfo;
import org.apache.geronimo.st.v30.ui.sections.DBPoolSection;
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/DeploymentPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/DeploymentPage.java?rev=939152&r1=939151&r2=939152&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/DeploymentPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/DeploymentPage.java Thu Apr 29 00:57:12 2010
@@ -19,9 +19,9 @@ package org.apache.geronimo.st.v30.ui.pa
import org.apache.geronimo.jee.application.Application;
import org.apache.geronimo.jee.applicationclient.ApplicationClient;
import org.apache.geronimo.jee.connector.Connector;
-import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.editors.AbstractGeronimoDeploymentPlanEditor;
-import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage;
+import org.apache.geronimo.st.v30.ui.CommonMessages;
+import org.apache.geronimo.st.v30.ui.editors.AbstractGeronimoDeploymentPlanEditor;
+import org.apache.geronimo.st.v30.ui.pages.AbstractGeronimoFormPage;
import org.apache.geronimo.st.v30.core.GeronimoServerInfo;
import org.apache.geronimo.st.v30.core.jaxb.JAXBModelUtils;
import org.apache.geronimo.st.v30.ui.sections.AdminObjectSection;
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/DeploymentPlanSourcePage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/DeploymentPlanSourcePage.java?rev=939152&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/DeploymentPlanSourcePage.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/DeploymentPlanSourcePage.java Thu Apr 29 00:57:12 2010
@@ -0,0 +1,46 @@
+/*
+ * 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.v30.ui.pages;
+
+import org.apache.geronimo.st.v30.ui.editors.AbstractGeronimoDeploymentPlanEditor;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DeploymentPlanSourcePage extends StructuredTextEditor {
+
+ protected AbstractGeronimoDeploymentPlanEditor editor;
+
+ public DeploymentPlanSourcePage (AbstractGeronimoDeploymentPlanEditor editor) {
+ super();
+ this.editor = editor;
+ }
+
+ @Override
+ public void doSave(IProgressMonitor progressMonitor) {
+ super.doSave(progressMonitor);
+ try {
+ editor.reloadDeploymentPlan();
+ } catch (Exception e) {
+ MessageDialog.openError(Display.getCurrent().getActiveShell(),"Error", e.getMessage());
+ }
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/DeploymentPlanSourcePage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/DeploymentPlanSourcePage.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/DeploymentPlanSourcePage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/EjbOverviewPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/EjbOverviewPage.java?rev=939152&r1=939151&r2=939152&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/EjbOverviewPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/EjbOverviewPage.java Thu Apr 29 00:57:12 2010
@@ -16,7 +16,7 @@
*/
package org.apache.geronimo.st.v30.ui.pages;
-import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage;
+import org.apache.geronimo.st.v30.ui.pages.AbstractGeronimoFormPage;
import org.apache.geronimo.st.v30.core.GeronimoServerInfo;
import org.apache.geronimo.st.v30.ui.sections.OpenEjbJarCMPSection;
import org.apache.geronimo.st.v30.ui.sections.OpenEjbJarGeneralSection;
@@ -35,7 +35,7 @@ public class EjbOverviewPage extends Abs
/*
* (non-Javadoc)
*
- * @see org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
+ * @see org.apache.geronimo.st.v30.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
*/
protected void fillBody(IManagedForm managedForm) {
managedForm.addPart(new OpenEjbJarGeneralSection(body, toolkit, getStyle(), getDeploymentPlan()));
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/NamingFormPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/NamingFormPage.java?rev=939152&r1=939151&r2=939152&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/NamingFormPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/NamingFormPage.java Thu Apr 29 00:57:12 2010
@@ -19,10 +19,10 @@ package org.apache.geronimo.st.v30.ui.pa
import org.apache.geronimo.jee.applicationclient.ApplicationClient;
import org.apache.geronimo.jee.openejb.OpenejbJar;
import org.apache.geronimo.jee.web.WebApp;
-import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.editors.AbstractGeronimoDeploymentPlanEditor;
-import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage;
import org.apache.geronimo.st.v30.core.GeronimoServerInfo;
+import org.apache.geronimo.st.v30.ui.CommonMessages;
+import org.apache.geronimo.st.v30.ui.editors.AbstractGeronimoDeploymentPlanEditor;
+import org.apache.geronimo.st.v30.ui.pages.AbstractGeronimoFormPage;
import org.apache.geronimo.st.v30.ui.sections.EjbLocalRefSection;
import org.apache.geronimo.st.v30.ui.sections.EjbRefSection;
import org.apache.geronimo.st.v30.ui.sections.EjbRelationSection;
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/SecurityPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/SecurityPage.java?rev=939152&r1=939151&r2=939152&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/SecurityPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/SecurityPage.java Thu Apr 29 00:57:12 2010
@@ -16,8 +16,8 @@
*/
package org.apache.geronimo.st.v30.ui.pages;
-import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage;
+import org.apache.geronimo.st.v30.ui.CommonMessages;
+import org.apache.geronimo.st.v30.ui.pages.AbstractGeronimoFormPage;
import org.apache.geronimo.st.v30.core.GeronimoServerInfo;
import org.apache.geronimo.st.v30.core.jaxb.JAXBModelUtils;
import org.apache.geronimo.st.v30.ui.sections.SecurityAdvancedSection;
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/ServerPluginPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/ServerPluginPage.java?rev=939152&r1=939151&r2=939152&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/ServerPluginPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/ServerPluginPage.java Thu Apr 29 00:57:12 2010
@@ -16,7 +16,7 @@
*/
package org.apache.geronimo.st.v30.ui.pages;
-import org.apache.geronimo.st.ui.internal.Messages;
+import org.apache.geronimo.st.v30.ui.internal.Messages;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
@@ -31,7 +31,7 @@ import org.eclipse.wst.server.ui.editor.
import org.eclipse.wst.server.ui.internal.ImageResource;
/**
- * Server advanced editor page
+ * Server advanced editor page.
*
* @version $Rev$ $Date$
*/
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/WebGeneralPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/WebGeneralPage.java?rev=939152&r1=939151&r2=939152&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/WebGeneralPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/pages/WebGeneralPage.java Thu Apr 29 00:57:12 2010
@@ -16,9 +16,9 @@
*/
package org.apache.geronimo.st.v30.ui.pages;
-import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage;
import org.apache.geronimo.st.v30.core.GeronimoServerInfo;
+import org.apache.geronimo.st.v30.ui.CommonMessages;
+import org.apache.geronimo.st.v30.ui.pages.AbstractGeronimoFormPage;
import org.apache.geronimo.st.v30.ui.sections.WebContainerSection;
import org.apache.geronimo.st.v30.ui.sections.WebGeneralSection;
import org.eclipse.ui.forms.IManagedForm;
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanEditHelper.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanEditHelper.java?rev=939152&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanEditHelper.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanEditHelper.java Thu Apr 29 00:57:12 2010
@@ -0,0 +1,78 @@
+/*
+ * 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.v30.ui.refactoring;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DeploymentPlanEditHelper {
+ private String fileName;
+ private DeploymentPlanHandler handler;
+
+ public DeploymentPlanEditHelper(String fileName){
+ this.fileName=fileName;
+ this.handler=new DeploymentPlanHandler(fileName);
+ init();
+ }
+
+ public DeploymentPlanEditHelper(DeploymentPlanHandler deploymentPlanHandler){
+ this.fileName=deploymentPlanHandler.file;
+ this.handler=deploymentPlanHandler;
+ //parse the deployment plan, generate info
+ init();
+ }
+
+ private void init(){
+ SAXParserFactory factory=SAXParserFactory.newInstance();
+ try {
+ factory.setFeature("http://xml.org/sax/features/namespaces", true);
+ SAXParser p = factory.newSAXParser();
+ File file =new File(fileName);
+ p.parse(file, handler);
+ } catch (SAXNotRecognizedException e) {
+ e.printStackTrace();
+ } catch (SAXNotSupportedException e) {
+ e.printStackTrace();
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ } catch (SAXException e) {
+ e.printStackTrace();
+ }catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public int getNodeOffset(String nodeName){
+ return handler.getNodeOffset(nodeName);
+ }
+
+ public String getNodeValue(String nodeName){
+ return handler.getNodeValue(nodeName);
+ }
+
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanEditHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanEditHelper.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanEditHelper.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanHandler.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanHandler.java?rev=939152&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanHandler.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanHandler.java Thu Apr 29 00:57:12 2010
@@ -0,0 +1,176 @@
+/*
+ * 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.v30.ui.refactoring;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * A SAX Handler for geronimo deployment plan
+ *
+ * @version $Rev$ $Date$
+ */
+public class DeploymentPlanHandler extends DefaultHandler {
+ protected String file;
+ protected List<DeploymentPlanTextNode> nodeList = new ArrayList<DeploymentPlanTextNode>();
+
+ protected static final int START = 0, IN_ROOT_ELEMENT = 1,
+ IN_CONTEXT_ROOT = 2, IN_ENVIRONMENT = 3, IN_MODULEID = 4,
+ IN_ARTIFACTID = 5;
+
+ protected int state = START;
+
+ public DeploymentPlanHandler(String file) {
+ this.file = file;
+ }
+
+ public List<DeploymentPlanTextNode> getNodeList() {
+ return nodeList;
+ }
+
+ public int getNodeOffset(String nodeName) {
+ for (DeploymentPlanTextNode n : nodeList) {
+ if (n.getName().equals(nodeName))
+ return n.getOffset();
+ }
+ return -1;
+ }
+
+ public String getNodeValue(String nodeName) {
+ for (DeploymentPlanTextNode n : nodeList) {
+ if (n.getName().equals(nodeName))
+ return n.getValue();
+ }
+ return null;
+ }
+
+ public void characters(char[] ch, int start, int length)
+ throws SAXException {
+ DeploymentPlanTextNode wtn = null;
+ String name = null;
+
+ switch (state) {
+ case IN_CONTEXT_ROOT:
+ name = DeploymentPlanTextNode.CONTEXT_ROOT;
+ break;
+ case IN_ARTIFACTID:
+ name = DeploymentPlanTextNode.ARTIFACT_ID;
+ break;
+ default:
+ return;
+ }
+
+ String value = new String(ch, start, length);
+ wtn = new DeploymentPlanTextNode();
+
+ wtn.setName(name);
+ wtn.setValue(value);
+ try {
+ //ch doesn't contains XML declare statement at the beginning of deployment plan
+ //get the character number of first line
+ int xmlDeclareLength = getXMLDeclareLength();
+ wtn.setOffset(xmlDeclareLength + start);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ nodeList.add(wtn);
+
+ }
+
+ public void startElement(String uri, String localName, String qName,
+ Attributes attributes) throws SAXException {
+ switch (state) {
+ case START:
+ if (localName.equals("web-app") || localName.equals("openejb-jar")
+ || localName.equals("connector")
+ || localName.equals("application"))
+ state = IN_ROOT_ELEMENT;
+ break;
+ case IN_ROOT_ELEMENT:
+ if (localName.equals("environment"))
+ state = IN_ENVIRONMENT;
+ else if (localName.equals("context-root"))
+ state = IN_CONTEXT_ROOT;
+ break;
+ case IN_ENVIRONMENT:
+ if (localName.equals("moduleId"))
+ state = IN_MODULEID;
+ break;
+ case IN_MODULEID:
+ if (localName.equals("artifactId"))
+ state = IN_ARTIFACTID;
+ break;
+ default:
+ break;
+ }
+ }
+
+ public void endElement(String uri, String localName, String qName)
+ throws SAXException {
+ switch (state) {
+ case IN_ROOT_ELEMENT:
+ if (localName.equals("web-app") || localName.equals("openejb-jar")
+ || localName.equals("connector")
+ || localName.equals("application"))
+ state = START;
+ break;
+ case IN_ENVIRONMENT:
+ if (localName.equals("environment"))
+ state = IN_ROOT_ELEMENT;
+ break;
+ case IN_MODULEID:
+ if (localName.equals("moduleId"))
+ state = IN_ENVIRONMENT;
+ break;
+ case IN_ARTIFACTID:
+ if (localName.equals("artifactId"))
+ state = IN_MODULEID;
+ break;
+ case IN_CONTEXT_ROOT:
+ if (localName.equals("context-root"))
+ state = IN_ROOT_ELEMENT;
+ break;
+ default:
+ break;
+ }
+ }
+
+ // return the character number of first line in deployment plan
+ protected int getXMLDeclareLength()
+ throws IOException {
+ BufferedReader br = new BufferedReader(new FileReader(file));
+
+ int current;
+ int offset = 0;
+
+ do {
+ current = br.read();
+ offset++;
+ } while (current != '>');
+
+ br.close();
+
+ return offset;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanTextNode.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanTextNode.java?rev=939152&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanTextNode.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanTextNode.java Thu Apr 29 00:57:12 2010
@@ -0,0 +1,63 @@
+/*
+ * 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.v30.ui.refactoring;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DeploymentPlanTextNode {
+ private String name;
+ private String value;
+ private int offset;
+
+ public static final String CONTEXT_ROOT="context-root",ARTIFACT_ID="artifactId";
+
+ public DeploymentPlanTextNode() {
+ this(null,null,-1);
+ }
+
+ public DeploymentPlanTextNode(String name, String value, int offset) {
+ this.name = name;
+ this.value = value;
+ this.offset = offset;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public void setOffset(int offset) {
+ this.offset = offset;
+ }
+
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanTextNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanTextNode.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/DeploymentPlanTextNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/GeronimoProjectRenameParticipant.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/GeronimoProjectRenameParticipant.java?rev=939152&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/GeronimoProjectRenameParticipant.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/GeronimoProjectRenameParticipant.java Thu Apr 29 00:57:12 2010
@@ -0,0 +1,173 @@
+/*
+ * 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.v30.ui.refactoring;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GeronimoProjectRenameParticipant extends RenameParticipant {
+ protected IProject project;
+ protected IFile deploymentPlanFile;
+ protected String deploymentPlanName;
+
+ public RefactoringStatus checkConditions(IProgressMonitor pm,
+ CheckConditionsContext context) throws OperationCanceledException {
+ return new RefactoringStatus();
+ }
+
+ protected boolean initialize(Object element) {
+ // if not a project, then stop this refactoring
+ if (!(element instanceof IProject)) {
+ return false;
+ }
+
+ project = (IProject) element;
+
+ // if not a javaee object, then stop this refactoring
+ if (JavaEEProjectUtilities.isDynamicWebProject(project)) {
+ deploymentPlanName = "WEB-INF/geronimo-web.xml";
+ } else if (JavaEEProjectUtilities.isEJBProject(project)) {
+ deploymentPlanName = "META-INF/openejb-jar.xml";
+ } else if (JavaEEProjectUtilities.isJCAProject(project)) {
+ deploymentPlanName = "META-INF/geronimo-ra.xml";
+ } else if (JavaEEProjectUtilities.isEARProject(project)) {
+ deploymentPlanName = "META-INF/geronimo-application.xml";
+ } else {
+ return false;
+ }
+
+ // sure that project is DynamicWebProject
+ deploymentPlanFile = getDeploymentPlanFile(project);
+
+ // if no deployment plan file, then stop this refactoring
+ if (deploymentPlanFile == null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public Change createChange(IProgressMonitor pm) throws CoreException,
+ OperationCanceledException {
+ CompositeChange result = new CompositeChange(getName());
+ try {
+ pm
+ .beginTask(
+ "beging create change for context-root and artifactId",
+ 100);
+ String oldName = project.getName();
+ String underProjectFilePath = getDeploymentPlanFileUnderProjectPath(project);
+ String projectRelativeFilePath = deploymentPlanFile.getFullPath()
+ .toString();
+ String absoluteWorkspacePath = project.getParent().getLocation()
+ .toString();
+ String absoluteFilePath = absoluteWorkspacePath
+ + projectRelativeFilePath;
+
+ DeploymentPlanEditHelper editHelper = new DeploymentPlanEditHelper(
+ new DeploymentPlanHandler(absoluteFilePath));
+
+ // Before this change being applied, the project has been
+ // renamed. So, use a MovedTextFileChange instead of TextFileChange
+ String newName = this.getArguments().getNewName();
+ IProject newProject = ((IWorkspaceRoot) deploymentPlanFile
+ .getProject().getParent()).getProject(newName);
+ IFile newFile = newProject.getFile(underProjectFilePath);
+
+ // if a web project, should create a context-root change if any
+ if (JavaEEProjectUtilities.isDynamicWebProject(project)) {
+ // create change for context-root
+ String oldName1 = editHelper
+ .getNodeValue(DeploymentPlanTextNode.CONTEXT_ROOT);
+ int offset1 = editHelper
+ .getNodeOffset(DeploymentPlanTextNode.CONTEXT_ROOT);
+ if (offset1 != -1 && oldName1 != null
+ && oldName1.substring(1).equals(oldName)) {
+ MovedTextFileChange change1 = new MovedTextFileChange(
+ "Rename artifactId's value", newFile,
+ deploymentPlanFile);
+ MultiTextEdit rootEdit1 = new MultiTextEdit();
+ ReplaceEdit edit1 = new ReplaceEdit(offset1, oldName1
+ .length(), "/" + newName);
+ rootEdit1.addChild(edit1);
+ change1.setEdit(rootEdit1);
+ result.add(change1);
+ }
+ }
+
+ // create change for artifactId
+ String oldName2 = editHelper
+ .getNodeValue(DeploymentPlanTextNode.ARTIFACT_ID);
+ int offset2 = editHelper
+ .getNodeOffset(DeploymentPlanTextNode.ARTIFACT_ID);
+ if (offset2 != -1 && oldName2 != null && oldName2.equals(oldName)) {
+ MovedTextFileChange change2 = new MovedTextFileChange(
+ "Rename context-root's value", newFile,
+ deploymentPlanFile);
+ MultiTextEdit rootEdit2 = new MultiTextEdit();
+ ReplaceEdit edit2 = new ReplaceEdit(offset2, oldName2.length(),
+ newName);
+ rootEdit2.addChild(edit2);
+ change2.setEdit(rootEdit2);
+ result.add(change2);
+ }
+
+ } finally {
+ pm.done();
+ }
+ if (result.getChildren().length == 0)
+ return null;
+
+ return result;
+ }
+
+ public String getName() {
+ return "Rename project name related info in geronimo deployment plan";
+ }
+
+ protected IFile getDeploymentPlanFile(IProject project) {
+ IVirtualComponent comp = ComponentCore.createComponent(project);
+ IPath deployPlanPath = comp.getRootFolder().getUnderlyingFolder()
+ .getProjectRelativePath().append(deploymentPlanName);
+ return project.getFile(deployPlanPath);
+ }
+
+ protected String getDeploymentPlanFileUnderProjectPath(IProject project) {
+ IVirtualComponent comp = ComponentCore.createComponent(project);
+ IPath deployPlanPath = comp.getRootFolder().getUnderlyingFolder()
+ .getProjectRelativePath().append(deploymentPlanName);
+ return deployPlanPath.toString();
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/GeronimoProjectRenameParticipant.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/GeronimoProjectRenameParticipant.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/GeronimoProjectRenameParticipant.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/MovedTextFileChange.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/MovedTextFileChange.java?rev=939152&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/MovedTextFileChange.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/MovedTextFileChange.java Thu Apr 29 00:57:12 2010
@@ -0,0 +1,69 @@
+/*
+ * 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.v30.ui.refactoring;
+
+import org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.core.filebuffers.ITextFileBuffer;
+import org.eclipse.core.filebuffers.ITextFileBufferManager;
+import org.eclipse.core.filebuffers.LocationKind;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MovedTextFileChange extends TextFileChange {
+
+ private IFile fCurrentFile;
+
+ public MovedTextFileChange(String name, IFile newFile, IFile currentFile) {
+ super(name, newFile);
+ fCurrentFile = currentFile;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ltk.core.refactoring.TextChange#getCurrentDocument(org.eclipse.core.runtime.IProgressMonitor)
+ *
+ * Override getCurrentDocument to return the document of the fCurrentFile instead of the fFile. Since fFile
+ * does not exist, it creates problems when displaying preview information
+ */
+ public IDocument getCurrentDocument(IProgressMonitor pm) throws CoreException {
+ if (pm == null)
+ pm = new NullProgressMonitor();
+ IDocument result = null;
+ pm.beginTask("", 2); //$NON-NLS-1$
+ ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
+ try {
+ IPath path = fCurrentFile.getFullPath();
+ manager.connect(path, LocationKind.NORMALIZE, pm);
+ ITextFileBuffer buffer = manager.getTextFileBuffer(path, LocationKind.NORMALIZE);
+ result = buffer.getDocument();
+ } finally {
+ if (result != null)
+ manager.disconnect(fCurrentFile.getFullPath(), LocationKind.NORMALIZE, pm);
+ }
+ pm.done();
+ return result;
+ }
+
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/MovedTextFileChange.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/MovedTextFileChange.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/refactoring/MovedTextFileChange.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractListSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractListSection.java?rev=939152&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractListSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractListSection.java Thu Apr 29 00:57:12 2010
@@ -0,0 +1,372 @@
+/*
+ * 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.v30.ui.sections;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.st.v30.core.descriptor.AbstractDeploymentDescriptor;
+import org.apache.geronimo.st.v30.ui.Activator;
+import org.apache.geronimo.st.v30.ui.CommonMessages;
+import org.apache.geronimo.st.v30.ui.wizards.AbstractWizard;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Image;
+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.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractListSection extends AbstractSectionPart {
+
+ protected ColumnViewer viewer;
+
+ protected Button addButton;
+
+ protected Button editButton;
+
+ protected Button removeButton;
+
+ protected List objectContainer;
+
+ public AbstractListSection(Section section) {
+ super(section);
+ }
+
+ /**
+ * Subclasses should call createClient() in constructor
+ */
+ public AbstractListSection(Composite parent, FormToolkit toolkit, int style, JAXBElement plan) {
+ super(parent, toolkit, style, plan);
+ }
+
+ public AbstractListSection(Composite parent, FormToolkit toolkit, int style, JAXBElement plan,
+ AbstractDeploymentDescriptor descriptor) {
+ super(parent, toolkit, style, plan, descriptor);
+ }
+
+ public void createClient() {
+ getSection().setText(getTitle());
+ getSection().setDescription(getDescription());
+ getSection().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ getSection().setExpanded(false);
+ Composite clientComposite = createComposite(getSection(), 2);
+ getSection().setClient(clientComposite);
+
+ createViewer(clientComposite);
+ viewer.setContentProvider(getContentProvider());
+ viewer.setLabelProvider(getLabelProvider());
+ viewer.setInput(getInput());
+
+ Composite buttonComposite = createButtonComposite(clientComposite);
+ createAddButton(buttonComposite);
+ createRemoveButton(buttonComposite);
+ createEditButton(buttonComposite);
+ activateButtons();
+
+ if (isRequiredSyncToolbarAction()) {
+ addSyncToolbarAction();
+ }
+ }
+
+ protected boolean isRequiredSyncToolbarAction() {
+ return false;
+ }
+
+ protected void addSyncToolbarAction() {
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
+ ToolBar toolbar = toolBarManager.createControl(getSection());
+ final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
+ toolbar.setCursor(handCursor);
+ // Cursor needs to be explicitly disposed
+ toolbar.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ if ((handCursor != null) && (handCursor.isDisposed() == false)) {
+ handCursor.dispose();
+ }
+ }
+ });
+ toolBarManager.add(getSyncAction());
+ toolBarManager.update(true);
+ getSection().setTextClient(toolbar);
+ }
+
+ protected class SyncAction extends Action {
+ public SyncAction(String tooltipText) {
+ super(tooltipText, IAction.AS_PUSH_BUTTON);
+ setToolTipText(tooltipText);
+ setImageDescriptor(Activator.imageDescriptorFromPlugin("org.apache.geronimo.st.v30.ui",
+ "icons/obj16/synced.gif"));
+ }
+
+ @Override
+ public void run() {
+ }
+ }
+
+ protected IAction getSyncAction() {
+ return new SyncAction("Sync Deployment Descriptor and Deployemnt Plan");
+ }
+
+ protected Composite createComposite(Composite parent, int numColumns) {
+ Composite composite = toolkit.createComposite(parent);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = numColumns;
+ 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));
+ return composite;
+ }
+
+ protected Composite createButtonComposite(Composite parent) {
+ Composite buttonComp = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.horizontalSpacing = 2;
+ layout.verticalSpacing = 2;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.numColumns = 1;
+ buttonComp.setLayout(layout);
+ buttonComp.setBackground(toolkit.getColors().getBackground());
+ buttonComp.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false));
+ return buttonComp;
+ }
+
+ protected void createRemoveButton(Composite buttonComp) {
+ removeButton = toolkit.createButton(buttonComp, CommonMessages.remove, SWT.NONE);
+
+ removeButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ handleDelete();
+ getViewer().refresh();
+ notifyOthers();
+ markDirty();
+ activateButtons();
+ }
+ });
+ removeButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ }
+
+ protected void createAddButton(Composite buttonComp) {
+ addButton = toolkit.createButton(buttonComp, CommonMessages.add, SWT.NONE);
+ addButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ Wizard wizard = getWizard();
+ if (wizard != null) {
+ WizardDialog dialog = createWizardDialog(Display.getCurrent().getActiveShell(), wizard);
+ dialog.open();
+ if (dialog.getReturnCode() == Dialog.OK) {
+ getViewer().refresh();
+ notifyOthers();
+ markDirty();
+ }
+ }
+ }
+ });
+ addButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ }
+
+ protected void createEditButton(Composite buttonComp) {
+ editButton = toolkit.createButton(buttonComp, CommonMessages.edit, SWT.NONE);
+ editButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ Object selectedObject = ((StructuredSelection) getViewer().getSelection()).getFirstElement();
+ if (selectedObject != null) {
+ Wizard wizard = getWizard();
+ if (wizard != null) {
+ if (wizard instanceof AbstractWizard) {
+ ((AbstractWizard) wizard).setEObject(selectedObject);
+ }
+ WizardDialog dialog = createWizardDialog(Display.getCurrent().getActiveShell(), wizard);
+ dialog.open();
+ if (dialog.getReturnCode() == Dialog.OK) {
+ getViewer().refresh();
+ notifyOthers();
+ markDirty();
+ }
+ }
+ }
+ activateButtons();
+ }
+ });
+ editButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ }
+
+ /**
+ * Implemented by subclass if need to notify other component to refresh
+ */
+ protected void notifyOthers() {
+ //here, do nothing
+ }
+
+ /**
+ * Subclass can override it , if need to use another type of
+ * WizardDialog(like customer implemented WizardDialog to
+ * override some methods).
+ */
+ protected WizardDialog createWizardDialog(Shell parentShell,
+ IWizard newWizard) {
+ return new WizardDialog(parentShell, newWizard);
+ }
+
+ protected void activateButtons() {
+ activateAddButton();
+ activateRemoveButton();
+ activateEditButton();
+ }
+
+ protected void activateAddButton() {
+ addButton.setEnabled(true);
+ }
+
+ protected void activateEditButton() {
+ activateButton(editButton);
+ }
+
+ protected void activateRemoveButton() {
+ activateButton(removeButton);
+ }
+
+ public ColumnViewer getViewer() {
+ return viewer;
+ }
+
+ public List getObjectContainer() {
+ if (objectContainer == null) {
+ objectContainer = new ArrayList();
+ }
+ return objectContainer;
+ }
+
+ public Object getInput() {
+ return getPlan();
+ }
+
+ public class ContentProvider implements IStructuredContentProvider, ITreeContentProvider {
+ public Object[] getElements(Object inputElement) {
+ if (!JAXBElement.class.isInstance(inputElement)) {
+ return new String[] { "" };
+ }
+ return getObjectContainer().toArray();
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
+ }
+
+ public Object[] getChildren(Object arg0) {
+ return null;
+ }
+
+ public Object getParent(Object arg0) {
+ return null;
+ }
+
+ public boolean hasChildren(Object parentElement) {
+ return getChildren(parentElement).length > 0;
+ }
+ }
+
+ public IContentProvider getContentProvider() {
+ return new ContentProvider();
+ }
+
+ public class LabelProvider implements ITableLabelProvider, ILabelProvider {
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ return "";
+ }
+
+ public void addListener(ILabelProviderListener arg0) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object arg0, String arg1) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener arg0) {
+ }
+
+ public Image getImage(Object arg0) {
+ return null;
+ }
+
+ public String getText(Object arg0) {
+ return "";
+ }
+ }
+
+ public IBaseLabelProvider getLabelProvider() {
+ return new LabelProvider();
+ }
+
+ abstract protected void createViewer(Composite composite);
+
+ abstract protected void handleDelete();
+
+ abstract protected void activateButton(Button button);
+
+ abstract public String getTitle();
+
+ abstract public String getDescription();
+
+ abstract protected Wizard getWizard();
+
+ abstract public Class getTableEntryObjectType();
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractListSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractListSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractListSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractSectionPart.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractSectionPart.java?rev=939152&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractSectionPart.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractSectionPart.java Thu Apr 29 00:57:12 2010
@@ -0,0 +1,101 @@
+/*
+ * 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.v30.ui.sections;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.st.v30.core.descriptor.AbstractDeploymentDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.SectionPart;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractSectionPart extends SectionPart {
+
+ protected FormToolkit toolkit;
+
+ private JAXBElement plan;
+
+ private AbstractDeploymentDescriptor descriptor;
+
+ public AbstractSectionPart(Section section) {
+ super(section);
+ }
+
+ public AbstractSectionPart(Composite parent, FormToolkit toolkit, int style, JAXBElement plan) {
+ super(parent, toolkit, style);
+ this.toolkit = toolkit;
+ this.plan = plan;
+ }
+
+ public AbstractSectionPart(Composite parent, FormToolkit toolkit, int style, JAXBElement plan,
+ AbstractDeploymentDescriptor descriptor) {
+ super(parent, toolkit, style);
+ this.toolkit = toolkit;
+ this.plan = plan;
+ this.descriptor = descriptor;
+ }
+
+ /*
+ * (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();
+ }
+ }
+
+ public FormToolkit getToolkit() {
+ return toolkit;
+ }
+
+ public JAXBElement getPlan() {
+ return plan;
+ }
+
+ public AbstractDeploymentDescriptor getDescriptor() {
+ return descriptor;
+ }
+
+ protected Label createLabel(Composite parent, String text) {
+ Label label = toolkit.createLabel(parent, text);
+ label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ return label;
+ }
+
+ protected GridData createTextFieldGridData() {
+ GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ data.widthHint = 150;
+ return data;
+ }
+
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractSectionPart.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractSectionPart.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractSectionPart.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractServerEditorSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractServerEditorSection.java?rev=939152&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractServerEditorSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractServerEditorSection.java Thu Apr 29 00:57:12 2010
@@ -0,0 +1,64 @@
+/*
+ * 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.v30.ui.sections;
+
+import org.apache.geronimo.st.v30.core.GeronimoServerDelegate;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.wst.server.ui.editor.ServerEditorSection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractServerEditorSection extends ServerEditorSection {
+
+ protected GeronimoServerDelegate gs;
+
+ public AbstractServerEditorSection() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.server.ui.editor.ServerEditorSection#init(org.eclipse.ui.IEditorSite,
+ * org.eclipse.ui.IEditorInput)
+ */
+ public void init(IEditorSite site, IEditorInput input) {
+ super.init(site, input);
+ gs = (GeronimoServerDelegate) server.getAdapter(GeronimoServerDelegate.class);
+ if (gs == null) {
+ gs = (GeronimoServerDelegate) server.loadAdapter(GeronimoServerDelegate.class,
+ new NullProgressMonitor());
+ }
+ }
+
+ protected Label createLabel(Composite parent, String text,
+ FormToolkit toolkit) {
+ Label label = toolkit.createLabel(parent, text);
+ label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ return label;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractServerEditorSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractServerEditorSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractServerEditorSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractTableSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractTableSection.java?rev=939152&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractTableSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractTableSection.java Thu Apr 29 00:57:12 2010
@@ -0,0 +1,138 @@
+/*
+ * 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.v30.ui.sections;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.st.v30.core.descriptor.AbstractDeploymentDescriptor;
+import org.apache.geronimo.st.v30.ui.SortListener;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractTableSection extends AbstractListSection {
+
+ protected Table table;
+
+ protected String[] COLUMN_NAMES = new String[] {};
+
+ public Listener sortListener = null;
+
+ public AbstractTableSection(Section section) {
+ super(section);
+ }
+
+ /**
+ *
+ * Subclasses should call createClient() in constructor
+ */
+ public AbstractTableSection(JAXBElement plan, Composite parent,
+ FormToolkit toolkit, int style) {
+ super(parent, toolkit, style, plan);
+ }
+
+ public AbstractTableSection(JAXBElement plan, AbstractDeploymentDescriptor descriptor,
+ Composite parent, FormToolkit toolkit, int style) {
+ super(parent, toolkit, style, plan, descriptor);
+ }
+
+ public void createViewer(Composite composite) {
+ table = new Table(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.MULTI);
+ if (isHeaderVisible()) {
+ table.setHeaderVisible(true);
+ }
+
+ GridData data = new GridData(SWT.FILL, SWT.FILL, false, true);
+ data.heightHint = 60;
+ data.widthHint = 660;
+ //data.grabExcessVerticalSpace = true;
+ table.setLayoutData(data);
+
+ TableLayout tableLayout = new TableLayout();
+ table.setLayout(tableLayout);
+
+ sortListener = new SortListener(table, COLUMN_NAMES);
+ for (int i = 0; i < getTableColumnNames().length; i++) {
+ tableLayout.addColumnData(new ColumnWeightData(35));
+ TableColumn tableColumn = new TableColumn(table, SWT.NONE);
+ tableColumn.setText(getTableColumnNames()[i]);
+ tableColumn.addListener(SWT.Selection, sortListener);
+ }
+
+ table.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ activateButtons();
+ }
+ });
+
+ viewer = new TableViewer(table);
+ viewer.addFilter(new ViewerFilter() {
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ return AbstractTableSection.this.filter(viewer, parentElement, element);
+ }
+ });
+ if (getTableColumnNames().length > 0) {
+ viewer.setColumnProperties(getTableColumnNames());
+ }
+ }
+
+ protected boolean isHeaderVisible() {
+ return true;
+ }
+
+ protected boolean filter(Viewer viewer, Object parentElement, Object element) {
+ return getTableEntryObjectType().isInstance(element);
+ }
+
+ public void handleDelete() {
+ TableItem[] selectedItems = table.getSelection();
+ for (int i = 0; i < selectedItems.length; i++) {
+ TableItem tableItem = selectedItems[i];
+ removeItem(tableItem.getData());
+ }
+ }
+
+ protected void removeItem (Object selectedItem) {
+ getObjectContainer().remove(selectedItem);
+ }
+
+ protected void activateButton(Button button) {
+ boolean selected = table.getSelectionCount() > 0;
+ button.setEnabled(selected);
+ }
+
+ public String[] getTableColumnNames() {
+ return COLUMN_NAMES;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractTableSection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractTableSection.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/AbstractTableSection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain