You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by bp...@apache.org on 2007/04/23 23:08:12 UTC

svn commit: r531597 - in /db/derby/code/branches/10.2/plugins/eclipse: org.apache.derby.plugin.doc/topics/ org.apache.derby.plugin.doc/topics/images/ org.apache.derby.ui/src/org/apache/derby/ui/util/

Author: bpendleton
Date: Mon Apr 23 14:08:11 2007
New Revision: 531597

URL: http://svn.apache.org/viewvc?view=rev&rev=531597
Log:
DERBY-2376: Make classpath entries portable in Eclipse plug-in

This patch was contributed by Aaron Tarter (ajtarter@gmail.com)

This patch merges the DERBY-2376 changes from the trunk to the 10.2 branch.
The two revisions merged were: 515864 and 531595. svn merge -r was used.

The 515864 revision contains a change to DerbyUtils to manage the classpath
entries relative to ECLIPSE_HOME. The 531595 revision contains modifications
to the Eclipse plug-in documentation to provide modified screen-shots.
The new screen-shot images show the new format of the classpath entries,
relative to ECLIPSE_HOME.


Modified:
    db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/derby_app.html
    db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/ij2.html
    db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/completed_javaapp.GIF
    db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/create_restaurant.GIF
    db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/restaurant_editor.GIF
    db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/restaurant_script.GIF
    db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/run_javaapp.GIF
    db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/util/DerbyUtils.java

Modified: db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/derby_app.html
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/derby_app.html?view=diff&rev=531597&r1=531596&r2=531597
==============================================================================
--- db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/derby_app.html (original)
+++ db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/derby_app.html Mon Apr 23 14:08:11 2007
@@ -166,10 +166,10 @@
 </pre>
 <p>
 Once Restaurants.java is compiled without errors, run the Java application by
-right-clicking it from the Package Explorer view and selecting <b>Run, Java Application</b>.  
+right-clicking it from the Package Explorer view and selecting <b>Run As, Java Application</b>.  
 </p>
 
-<img src="images/run_javaapp.GIF" alt="Running a java application" width="914" height="713"></img>
+<img src="images/run_javaapp.GIF" alt="Running a java application" width="857" height="703"></img>
 
 <p>
 The output from running <b>Restaurants.java</b> is shown below.  It shows the 
@@ -178,7 +178,7 @@
 sure the Derby Network Server has been started on port 1527 and the myDB
 database exists in the current workspace and Java project.
 </p>
-<img src="images/completed_javaapp.GIF" alt="Output from a java application" width="904" height="688"></img>
+<img src="images/completed_javaapp.GIF" alt="Output from a java application" width="857" height="703"></img>
 
 <h3>Changing the application to use the Derby Embedded Driver</h3>
 <p>

Modified: db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/ij2.html
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/ij2.html?view=diff&rev=531597&r1=531596&r2=531597
==============================================================================
--- db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/ij2.html (original)
+++ db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/ij2.html Mon Apr 23 14:08:11 2007
@@ -69,7 +69,7 @@
 Now the workspace will look like this.
 </p>
 <blockquote>
-<img src="images/create_restaurant.GIF" alt="Adding an sql file to the Java project" width="899" height="609"></img>
+<img src="images/create_restaurant.GIF" alt="Adding an sql file to the Java project" width="858" height="681"></img>
 </blockquote>
 <p>
 Type the following in the restaurants.sql editor window (you may need to
@@ -94,7 +94,7 @@
 Script using 'ij'</b>.
 </p>
 <blockquote>
-<img src="images/restaurant_editor.GIF" alt="Run SQL Script using 'ij'" width="910" height="663"></img>
+<img src="images/restaurant_editor.GIF" alt="Run SQL Script using 'ij'" width="857" height="701"></img>
 </blockquote>
 <p>
 The <b>Console</b> view shows the SQL commands contained in the file
@@ -102,7 +102,7 @@
 </p>
 
 <blockquote>
-<img src="images/restaurant_script.GIF" alt="Console view of ij script output" width="910" height="663"></img>
+<img src="images/restaurant_script.GIF" alt="Console view of ij script output" width="857" height="703"></img>
 </blockquote>
 <p>
 </p>

Modified: db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/completed_javaapp.GIF
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/completed_javaapp.GIF?view=diff&rev=531597&r1=531596&r2=531597
==============================================================================
Binary files - no diff available.

Modified: db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/create_restaurant.GIF
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/create_restaurant.GIF?view=diff&rev=531597&r1=531596&r2=531597
==============================================================================
Binary files - no diff available.

Modified: db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/restaurant_editor.GIF
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/restaurant_editor.GIF?view=diff&rev=531597&r1=531596&r2=531597
==============================================================================
Binary files - no diff available.

Modified: db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/restaurant_script.GIF
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/restaurant_script.GIF?view=diff&rev=531597&r1=531596&r2=531597
==============================================================================
Binary files - no diff available.

Modified: db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/run_javaapp.GIF
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.plugin.doc/topics/images/run_javaapp.GIF?view=diff&rev=531597&r1=531596&r2=531597
==============================================================================
Binary files - no diff available.

Modified: db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/util/DerbyUtils.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/util/DerbyUtils.java?view=diff&rev=531597&r1=531596&r2=531597
==============================================================================
--- db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/util/DerbyUtils.java (original)
+++ db/derby/code/branches/10.2/plugins/eclipse/org.apache.derby.ui/src/org/apache/derby/ui/util/DerbyUtils.java Mon Apr 23 14:08:11 2007
@@ -21,6 +21,7 @@
 
 package org.apache.derby.ui.util;
 
+import java.io.File;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
@@ -31,10 +32,11 @@
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Platform; 
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchConfiguration;
@@ -55,6 +57,7 @@
 
 
 public class DerbyUtils {
+	private final static String PLUGIN_ROOT = "ECLIPSE_HOME/plugins/";
 	
 	private static ManifestElement[] getElements(String bundleName) throws BundleException {
 		String requires = (String)Platform.getBundle(bundleName).getHeaders().get(Constants.BUNDLE_CLASSPATH);
@@ -70,30 +73,28 @@
 			elements_ui=getElements(CommonNames.UI_PATH);
 			
 			Bundle bundle=Platform.getBundle(CommonNames.CORE_PATH);
-			URL pluginURL = bundle.getEntry("/");
-			URL jarURL=null;
-			URL localURL=null;
+			URL pluginURL = FileLocator.resolve(FileLocator.find(bundle, new Path("/"), null));
+			String pluginName = new File(pluginURL.getPath()).getName();
 
 			newRawCP=new IClasspathEntry[rawCP.length + (elements_core.length) + (elements_ui.length-1)];
 			System.arraycopy(rawCP, 0, newRawCP, 0, rawCP.length);
 			
 			//Add the CORE jars
 			int oldLength=rawCP.length;
-			 for(int i=0;i<elements_core.length;i++){
-				jarURL= new URL(pluginURL,elements_core[i].getValue());
-				localURL=Platform.asLocalURL(jarURL);
-				newRawCP[oldLength+i]=JavaCore.newLibraryEntry(new Path(localURL.getPath()), null, null);
+			for(int i=0;i<elements_core.length;i++){
+				// add JAR as var type entry relative to the eclipse plugins dir, so the entry is portable 
+				newRawCP[oldLength+i]=JavaCore.newVariableEntry(new Path(PLUGIN_ROOT+pluginName+"/"+elements_core[i].getValue()), null, null);				
 				
 			}
 			 // Add the UI jars
 			bundle=Platform.getBundle(CommonNames.UI_PATH);
-			pluginURL = bundle.getEntry("/");
+			pluginURL = FileLocator.resolve(FileLocator.find(bundle, new Path("/"), null));
+			pluginName = new File(pluginURL.getPath()).getName();
 			oldLength=oldLength+elements_core.length -1; 
 			for(int i=0;i<elements_ui.length;i++){
 				if(!(elements_ui[i].getValue().toLowerCase().equals("ui.jar"))){
-					jarURL= new URL(pluginURL,elements_ui[i].getValue());
-					localURL=Platform.asLocalURL(jarURL);
-					newRawCP[oldLength+i]=JavaCore.newLibraryEntry(new Path(localURL.getPath()), null, null);
+					// add JAR as var type entry relative to the eclipse plugins dir, so the entry is portable
+					newRawCP[oldLength+i]=JavaCore.newVariableEntry(new Path(PLUGIN_ROOT+pluginName+"/"+elements_ui[i].getValue()), null, null);
 				}
 			}					
 			return newRawCP;