geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bjr...@apache.org
Subject svn commit: r704628 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui: internal/Messages.java internal/Messages.properties pages/AbstractGeronimoFormPage.java
Date Tue, 14 Oct 2008 19:19:57 GMT
Author: bjreed
Date: Tue Oct 14 12:19:57 2008
New Revision: 704628

URL: http://svn.apache.org/viewvc?rev=704628&view=rev
Log:
GERONIMODEVTOOLS-350 to keep source page in synch with other pages.

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/pages/AbstractGeronimoFormPage.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java?rev=704628&r1=704627&r2=704628&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
Tue Oct 14 12:19:57 2008
@@ -380,4 +380,7 @@
     public static String acceptLicenseAgreement;
     public static String rejectLicenseAgreement;
     public static String confirmLicenseRejection;
+
+    public static String savePageTitle;
+    public static String savePageMessage;
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties?rev=704628&r1=704627&r2=704628&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
Tue Oct 14 12:19:57 2008
@@ -378,3 +378,6 @@
 ejb=EJB
 java=Java
 web=Web
+
+savePageTitle=Save Resource
+savePageMessage=Please save the page before proceeding to the Source page.

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/pages/AbstractGeronimoFormPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/pages/AbstractGeronimoFormPage.java?rev=704628&r1=704627&r2=704628&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/pages/AbstractGeronimoFormPage.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/pages/AbstractGeronimoFormPage.java
Tue Oct 14 12:19:57 2008
@@ -22,6 +22,8 @@
 import org.apache.geronimo.st.core.descriptor.AbstractDeploymentDescriptor;
 import org.apache.geronimo.st.ui.Activator;
 import org.apache.geronimo.st.ui.editors.AbstractGeronimoDeploymentPlanEditor;
+import org.apache.geronimo.st.ui.internal.Messages;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IToolBarManager;
@@ -44,125 +46,135 @@
  */
 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);
-	}
-
-	/*
-	 * (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.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.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();
-	}
-
+    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);
+    }
+
+    /*
+     * (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.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.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();
+    }
+
+    // Do not allow the user to go to the source page if data has not been saved.
+    @Override
+    public boolean canLeaveThePage() {
+        if (getEditor().isDirty() && 
+            getEditor().getActivePageInstance() == getEditor().findPage(Messages.editorTabSource))
{
+            MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
Messages.savePageTitle, Messages.savePageMessage);
+            return false;
+        }
+        return true;
+    }
 }



Mime
View raw message