You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by sp...@apache.org on 2006/10/24 20:07:30 UTC
svn commit: r467420 - in /geronimo/devtools/eclipse-plugin/trunk/plugins:
org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/
org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/
Author: sppatel
Date: Tue Oct 24 11:07:29 2006
New Revision: 467420
URL: http://svn.apache.org/viewvc?view=rev&rev=467420
Log:
update source locator and new runtime wizard to add geronimo source during debug sessions
Added:
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoRuntimeSourceWizardFragment.java (with props)
Modified:
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoRuntimeDelegate.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoSourcePathComputerDelegate.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/IGeronimoRuntime.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoRuntimeWizardFragment.java
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/GeronimoRuntimeDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoRuntimeDelegate.java?view=diff&rev=467420&r1=467419&r2=467420
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoRuntimeDelegate.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoRuntimeDelegate.java Tue Oct 24 11:07:29 2006
@@ -27,6 +27,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.IVMInstallType;
@@ -41,6 +42,8 @@
private static final String PROP_VM_INSTALL_ID = "vm-install-id";
public static final String SERVER_INSTANCE_PROPERTIES = "geronimo_server_instance_properties";
+
+ public static final String RUNTIME_SOURCE= "runtime.source";
public static final int NO_IMAGE = 0;
@@ -124,6 +127,21 @@
public void setDefaults(IProgressMonitor monitor) {
IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
setVMInstall(vmInstall.getVMInstallType().getId(), vmInstall.getId());
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.st.core.IGeronimoRuntime#getRuntimeSourceLocation()
+ */
+ public IPath getRuntimeSourceLocation() {
+ String source = (String) getServerInstanceProperties().get(RUNTIME_SOURCE);
+ if(source != null) {
+ return new Path(source);
+ }
+ return null;
+ }
+
+ public void setRuntimeSourceLocation(String path) {
+ setInstanceProperty(RUNTIME_SOURCE, path);
}
/**
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoSourcePathComputerDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoSourcePathComputerDelegate.java?view=diff&rev=467420&r1=467419&r2=467420
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoSourcePathComputerDelegate.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoSourcePathComputerDelegate.java Tue Oct 24 11:07:29 2006
@@ -15,6 +15,7 @@
*/
package org.apache.geronimo.st.core;
+import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -26,6 +27,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.DebugPlugin;
@@ -34,11 +36,13 @@
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
import org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate;
+import org.eclipse.debug.core.sourcelookup.containers.ExternalArchiveSourceContainer;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerUtil;
@@ -96,9 +100,29 @@
Trace.trace(Trace.INFO, "Number # of unique source containers: " + allContainers.size());
}
- // TODO support resolving from geronimo source distribution
+ //add source container for Geroniom Runtime
+ ISourceContainer[] runtimeContainers = processServer(server);
+ allContainers.addAll(Arrays.asList(runtimeContainers));
return (ISourceContainer[])allContainers.toArray(new ISourceContainer[allContainers.size()]);
+ }
+
+ private ISourceContainer[] processServer(IServer server) {
+ IRuntime runtime = server.getRuntime();
+ IGeronimoRuntime gRuntime = (IGeronimoRuntime) runtime.getAdapter(IGeronimoRuntime.class);
+ if (gRuntime != null) {
+ IPath sourcePath = gRuntime.getRuntimeSourceLocation();
+ if (sourcePath != null) {
+ File file = sourcePath.toFile();
+ if (file.isFile()) {
+ ExternalArchiveSourceContainer sourceContainer = new ExternalArchiveSourceContainer(file.getAbsolutePath(), true);
+ return new ISourceContainer[] { sourceContainer };
+ } else if (file.isDirectory()) {
+ // TODO implement me using DirectorySourceContainer
+ }
+ }
+ }
+ return new ISourceContainer[] {};
}
private void processModules(IModule[] modules, List javaProjectList, IServer server, IProgressMonitor monitor) {
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/IGeronimoRuntime.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/IGeronimoRuntime.java?view=diff&rev=467420&r1=467419&r2=467420
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/IGeronimoRuntime.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/IGeronimoRuntime.java Tue Oct 24 11:07:29 2006
@@ -18,6 +18,7 @@
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.jst.server.core.IJavaRuntime;
public interface IGeronimoRuntime extends IJavaRuntime {
@@ -29,5 +30,7 @@
public XmlObject fixGeronimoEjbSchema(IFile plan) throws XmlException;
public XmlObject fixGeronimoConnectorSchema(IFile plan) throws XmlException;
+
+ public IPath getRuntimeSourceLocation();
}
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoRuntimeSourceWizardFragment.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/GeronimoRuntimeSourceWizardFragment.java?view=auto&rev=467420
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoRuntimeSourceWizardFragment.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoRuntimeSourceWizardFragment.java Tue Oct 24 11:07:29 2006
@@ -0,0 +1,132 @@
+/**
+ * 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.internal;
+
+import org.apache.geronimo.st.core.GeronimoRuntimeDelegate;
+import org.apache.geronimo.st.ui.Activator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.DirectoryDialog;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.TaskModel;
+import org.eclipse.wst.server.ui.internal.SWTUtil;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+
+/**
+ * @version
+ */
+public class GeronimoRuntimeSourceWizardFragment extends WizardFragment {
+
+ private IWizardHandle fWizard;
+
+ protected Text srcLoc;
+
+ public GeronimoRuntimeSourceWizardFragment() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.server.ui.wizard.WizardFragment#hasComposite()
+ */
+ public boolean hasComposite() {
+ return true;
+ }
+
+ public Composite createComposite(Composite parent, IWizardHandle handle) {
+ this.fWizard = handle;
+ Composite container = new Composite(parent, SWT.NONE);
+ GridLayout grid = new GridLayout(1, false);
+ grid.marginWidth = 0;
+ container.setLayout(grid);
+ container.setLayoutData(new GridData(GridData.FILL_BOTH));
+ handle.setImageDescriptor(Activator.getImageDescriptor((Activator.IMG_WIZ_GERONIMO)));
+ handle.setTitle(Messages.sourceLocWizTitle);
+ handle.setDescription(Messages.sourceLocWizDescription);
+ createContent(container, handle);
+ return container;
+ }
+
+ public void createContent(Composite parent, IWizardHandle handle) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(3, false);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ addInstallDirSection(composite);
+ }
+
+ protected void addInstallDirSection(Composite composite) {
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(Messages.sourceZipFile);
+ GridData data = new GridData();
+ data.horizontalSpan = 3;
+ label.setLayoutData(data);
+ label.setToolTipText(Messages.tooltipLoc);
+
+ srcLoc = new Text(composite, SWT.BORDER);
+
+ IPath currentLocation = getRuntimeDelegate().getRuntimeSourceLocation();
+ if (currentLocation != null) {
+ srcLoc.setText(currentLocation.toOSString());
+ }
+
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 2;
+ srcLoc.setLayoutData(data);
+ srcLoc.setToolTipText(Messages.tooltipLoc);
+ srcLoc.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ getRuntimeDelegate().setRuntimeSourceLocation(srcLoc.getText());
+ }
+ });
+
+ final Composite browseComp = composite;
+ Button browse = SWTUtil.createButton(composite, Messages.browse);
+ browse.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ FileDialog dialog = new FileDialog(browseComp.getShell());
+ dialog.setText(Messages.browseSrcDialog);
+ dialog.setFilterPath(srcLoc.getText());
+ String selected = dialog.open();
+ if (selected != null)
+ srcLoc.setText(selected);
+ }
+ });
+ }
+
+ private GeronimoRuntimeDelegate getRuntimeDelegate() {
+ IRuntimeWorkingCopy wc = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+ if (wc == null)
+ return null;
+ return (GeronimoRuntimeDelegate) wc.loadAdapter(GeronimoRuntimeDelegate.class, new NullProgressMonitor());
+ }
+
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoRuntimeSourceWizardFragment.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoRuntimeSourceWizardFragment.java
------------------------------------------------------------------------------
svn:keywords = Date Rev
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoRuntimeSourceWizardFragment.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/GeronimoRuntimeWizardFragment.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/GeronimoRuntimeWizardFragment.java?view=diff&rev=467420&r1=467419&r2=467420
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoRuntimeWizardFragment.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/org/apache/geronimo/st/ui/internal/GeronimoRuntimeWizardFragment.java Tue Oct 24 11:07:29 2006
@@ -493,4 +493,11 @@
public IWizardHandle getWizard() {
return fWizard;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.server.ui.wizard.WizardFragment#createChildFragments(java.util.List)
+ */
+ protected void createChildFragments(List list) {
+ list.add(new GeronimoRuntimeSourceWizardFragment());
+ }
}
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=467420&r1=467419&r2=467420
==============================================================================
--- 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 Oct 24 11:07:29 2006
@@ -54,6 +54,11 @@
public static String tooltipJetty;
public static String tooltipTomcat;
+ public static String sourceLocWizTitle;
+ public static String sourceLocWizDescription;
+ public static String sourceZipFile;
+ public static String browseSrcDialog;
+
public static String hostName;
public static String adminId;
public static String adminPassword;
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=467420&r1=467419&r2=467420
==============================================================================
--- 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 Oct 24 11:07:29 2006
@@ -187,4 +187,9 @@
editorCorrect=There was an error opening the editor. The elements in the plan may not be qualified, do you want to try to auto-correct this? Otherwise the default text editor will be opened.
editorDefault=Could not load the deployment plan. Opening default text editor.
-errorOpenDialog=Error opening editor.
\ No newline at end of file
+errorOpenDialog=Error opening editor.
+
+sourceLocWizTitle=Geronimo Source
+sourceLocWizDescription=Choose the geronimo source zip file to locate source from during debug sessions.
+sourceZipFile=Geronimo Source Archive:
+browseSrcDialog=Select the Geronimo Source Archive.
\ No newline at end of file