geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r450159 - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ org.apache.geronimo.st.ui/ org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/commands/ org.apache.geronimo.st.u...
Date Tue, 26 Sep 2006 19:28:30 GMT
Author: sppatel
Date: Tue Sep 26 12:28:29 2006
New Revision: 450159

URL: http://svn.apache.org/viewvc?view=rev&rev=450159
Log:
allow jvm args to be set through server editor and persisted in server config

Added:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/commands/SetVMArgsCommand.java
  (with props)
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/sections/ServerVMArgsSection.java
  (with props)
Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerDelegate.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/plugin.xml
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.properties

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java?view=diff&rev=450159&r1=450158&r2=450159
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
Tue Sep 26 12:28:29 2006
@@ -117,10 +117,11 @@
 
 		String existingProgArgs = wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
(String) null);
 		String serverProgArgs = getServerDelegate().getConsoleLogLevel();
-		if (existingProgArgs == null
-				|| existingProgArgs.indexOf(serverProgArgs) < 0) {
+		if (existingProgArgs == null || existingProgArgs.indexOf(serverProgArgs) < 0) {
 			wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, serverProgArgs);
 		}
+		
+		wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, getServerDelegate().getVMArgs());
 	}
 
 	/**

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerDelegate.java?view=diff&rev=450159&r1=450158&r2=450159
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerDelegate.java
Tue Sep 26 12:28:29 2006
@@ -54,6 +54,8 @@
 	public static final String PROPERTY_HTTP_PORT = "WebConnector";
 
 	public static final String PROPERTY_LOG_LEVEL = "logLevel";
+	
+	public static final String PROPERTY_VM_ARGS = "VMArgs";
 
 	public static final String CONSOLE_INFO = "--long";
 
@@ -235,6 +237,10 @@
 	public String getConsoleLogLevel() {
 		return getInstanceProperty(PROPERTY_LOG_LEVEL);
 	}
+	
+	public String getVMArgs() {
+		return getInstanceProperty(PROPERTY_VM_ARGS);
+	}
 
 	public void setAdminID(String value) {
 		setInstanceProperty(PROPERTY_ADMIN_ID, value);
@@ -254,6 +260,10 @@
 
 	public void setConsoleLogLevel(String value) {
 		setInstanceProperty(PROPERTY_LOG_LEVEL, value);
+	}
+	
+	public void setVMArgs(String value) {
+		setInstanceProperty(PROPERTY_VM_ARGS, value);
 	}
 
 	public String discoverDeploymentFactoryClassName(IPath jarPath) {

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/plugin.xml?view=diff&rev=450159&r1=450158&r2=450159
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/plugin.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/plugin.xml Tue
Sep 26 12:28:29 2006
@@ -76,6 +76,14 @@
         </section>
     </extension>
     
+    <extension point="org.eclipse.wst.server.ui.editorPageSections">
+        <section id="org.apache.server.geronimo.vmargs" order="30"
+            insertionId="org.eclipse.wst.server.editor.overview.right"
+            typeIds="org.apache.geronimo.server.*"
+            class="org.apache.geronimo.st.ui.sections.ServerVMArgsSection">
+        </section>
+    </extension>
+    
     <extension point="org.eclipse.ui.editors">
         <editor class="org.apache.geronimo.st.ui.editors.SharedDeploymentPlanEditor"
             default="true" 

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/commands/SetVMArgsCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/commands/SetVMArgsCommand.java?view=auto&rev=450159
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/commands/SetVMArgsCommand.java
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/commands/SetVMArgsCommand.java
Tue Sep 26 12:28:29 2006
@@ -0,0 +1,35 @@
+package org.apache.geronimo.st.ui.commands;
+
+import org.apache.geronimo.st.core.GeronimoServerDelegate;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+
+public class SetVMArgsCommand extends ServerCommand {
+	
+	protected String args;
+
+	protected String oldArgs;
+	
+	GeronimoServerDelegate gs;
+
+	public SetVMArgsCommand(IServerWorkingCopy server, String args) {
+		super(server, args);
+		this.args = args;
+	}
+
+	public void execute() {
+		gs = (GeronimoServerDelegate) server.getAdapter(GeronimoServerDelegate.class);
+		if (gs == null) {
+			gs = (GeronimoServerDelegate) server.loadAdapter(GeronimoServerDelegate.class, new NullProgressMonitor());
+		}
+		oldArgs = gs.getVMArgs();
+		gs.setVMArgs(args);
+	}
+
+	public void undo() {
+		if (gs != null) {
+			gs.setVMArgs(oldArgs);
+		}
+	}
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/commands/SetVMArgsCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/commands/SetVMArgsCommand.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/commands/SetVMArgsCommand.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/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/org/apache/geronimo/st/ui/internal/Messages.java?view=diff&rev=450159&r1=450158&r2=450159
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.java
Tue Sep 26 12:28:29 2006
@@ -16,6 +16,8 @@
 	public static String editorSectionPortsDescription;
 	public static String editorSectionLogLevelTitle;
 	public static String editorSectionLogLevelDescription;
+	public static String editorSectionVMArgsTitle;
+	public static String editorSectionVMArgsDescription;
 	public static String info;
 	public static String debug;
 	public static String httpPort;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/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/org/apache/geronimo/st/ui/internal/Messages.properties?view=diff&rev=450159&r1=450158&r2=450159
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.properties
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/Messages.properties
Tue Sep 26 12:28:29 2006
@@ -40,6 +40,9 @@
 info=INFO
 debug=DEBUG
 
+editorSectionVMArgsTitle=Server VM Arguments
+editorSectionVMArgsDescription=Specfiy the Java VM Arguments to be provided on server startup.
+
 editorContextRoot=Context Root:
 
 editorResourceRefTitle=Resource References

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/sections/ServerVMArgsSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/sections/ServerVMArgsSection.java?view=auto&rev=450159
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/sections/ServerVMArgsSection.java
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/sections/ServerVMArgsSection.java
Tue Sep 26 12:28:29 2006
@@ -0,0 +1,129 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.st.ui.sections;
+
+import org.apache.geronimo.st.core.GeronimoServerDelegate;
+import org.apache.geronimo.st.ui.commands.SetVMArgsCommand;
+import org.apache.geronimo.st.ui.internal.Messages;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.debug.internal.ui.SWTUtil;
+import org.eclipse.debug.ui.StringVariableSelectionDialog;
+import org.eclipse.jdt.internal.debug.ui.launcher.LauncherMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.wst.server.ui.editor.ServerEditorSection;
+
+public class ServerVMArgsSection extends ServerEditorSection {
+	
+	protected Text fVMArgumentsText;
+	private Button fPgrmArgVariableButton;
+	GeronimoServerDelegate gs;
+
+	public ServerVMArgsSection() {
+		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());
+		}
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.wst.server.ui.editor.ServerEditorSection#createSection(org.eclipse.swt.widgets.Composite)
+	 */
+	public void createSection(Composite parent) {
+		super.createSection(parent);
+		FormToolkit toolkit = getFormToolkit(parent.getDisplay());
+		
+		Section section = toolkit.createSection(parent,
+				ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
+						| ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
+						| ExpandableComposite.FOCUS_TITLE);
+		section.setText(Messages.editorSectionVMArgsTitle);
+		section.setDescription(Messages.editorSectionVMArgsDescription);
+		section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+		
+		Composite composite = toolkit.createComposite(section);
+		GridLayout layout = new GridLayout();
+		layout.numColumns = 2;
+		layout.marginHeight = 5;
+		layout.marginWidth = 10;
+		layout.verticalSpacing = 5;
+		layout.horizontalSpacing = 15;
+		composite.setLayout(layout);
+		composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+		section.setClient(composite);
+		
+		fVMArgumentsText = new Text(composite, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
+		GridData gd = new GridData(GridData.FILL_BOTH);
+		gd.heightHint = 75;
+		gd.widthHint = 100;
+		fVMArgumentsText.setLayoutData(gd);
+		fVMArgumentsText.setText(getArgs());
+		fVMArgumentsText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				execute(new SetVMArgsCommand(server, getAttributeValueFrom(fVMArgumentsText)));
+			}
+		});
+				
+		fPgrmArgVariableButton = SWTUtil.createPushButton(composite, LauncherMessages.VMArgumentsBlock_4,
null);
+		fPgrmArgVariableButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+		fPgrmArgVariableButton.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
+				dialog.open();
+				String variable = dialog.getVariableExpression();
+				if (variable != null) {
+					fVMArgumentsText.insert(variable);
+				}
+			}
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+			
+		});
+	}
+	
+	protected String getAttributeValueFrom(Text text) {
+		String content = text.getText().trim();
+		if (content.length() > 0) {
+			return content;
+		}
+		return null;
+	}
+	
+	private String getArgs() {
+		return gs != null && gs.getVMArgs() != null ? gs.getVMArgs() : "";
+	}
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/sections/ServerVMArgsSection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/sections/ServerVMArgsSection.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/sections/ServerVMArgsSection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message