Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 82685 Details for
Bug 209434
[GWT] Make EMF-Common compile with GWT-Compiler
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Patch as discussed in one file
patch.txt (text/plain), 119.06 KB, created by
Thomas Schindl
on 2007-11-12 13:38:56 EST
(
hide
)
Description:
Patch as discussed in one file
Filename:
MIME Type:
Creator:
Thomas Schindl
Created:
2007-11-12 13:38:56 EST
Size:
119.06 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.emf.common >Index: src/org/eclipse/emf/common/command/AbstractCommand.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/command/AbstractCommand.java,v >retrieving revision 1.4 >diff -u -r1.4 AbstractCommand.java >--- src/org/eclipse/emf/common/command/AbstractCommand.java 8 Jun 2005 05:44:08 -0000 1.4 >+++ src/org/eclipse/emf/common/command/AbstractCommand.java 12 Nov 2007 18:36:19 -0000 >@@ -22,6 +22,8 @@ > > import org.eclipse.emf.common.CommonPlugin; > >+//XXX GWT CHANGE >+import org.eclipse.core.internal.runtime.Util; > > /** > * An abstract implementation of a basic command. >@@ -132,10 +134,11 @@ > */ > public void undo() > { >+//XXX GWT CHANGE > throw > new UnsupportedOperationException > (CommonPlugin.INSTANCE.getString >- ("_EXC_Method_not_implemented", new String [] { this.getClass().getName() + ".undo()" })); >+ ("_EXC_Method_not_implemented", new String [] { Util.getClassNameAsString(this) + ".undo()" })); > } > > /** >@@ -231,7 +234,8 @@ > */ > public String toString() > { >- String className = getClass().getName(); >+//XXX GWT CHANGE >+ String className = Util.getClassNameAsString(this); > int lastDotIndex = className.lastIndexOf('.'); > StringBuffer result = new StringBuffer(lastDotIndex == -1 ? className : className.substring(lastDotIndex + 1)); > result.append(" (label: " + label + ")"); >Index: src/org/eclipse/emf/common/command/UnexecutableCommand.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/command/UnexecutableCommand.java,v >retrieving revision 1.2 >diff -u -r1.2 UnexecutableCommand.java >--- src/org/eclipse/emf/common/command/UnexecutableCommand.java 8 Jun 2005 05:44:08 -0000 1.2 >+++ src/org/eclipse/emf/common/command/UnexecutableCommand.java 12 Nov 2007 18:36:19 -0000 >@@ -19,6 +19,8 @@ > > import org.eclipse.emf.common.CommonPlugin; > >+//XXX GWT CHANGE >+import org.eclipse.core.internal.runtime.Util; > > /** > * A singleton {@link UnexecutableCommand#INSTANCE} that cannot execute. >@@ -55,9 +57,10 @@ > */ > public void execute() > { >+//XXX GWT CHANGE > throw > new UnsupportedOperationException >- (CommonPlugin.INSTANCE.getString("_EXC_Method_not_implemented", new String [] { this.getClass().getName() + ".execute()" })); >+ (CommonPlugin.INSTANCE.getString("_EXC_Method_not_implemented", new String [] { Util.getClassNameAsString(this) + ".execute()" })); > } > > /** >@@ -75,8 +78,9 @@ > */ > public void redo() > { >+//XXX CHANGE CHANGE > throw > new UnsupportedOperationException >- (CommonPlugin.INSTANCE.getString("_EXC_Method_not_implemented", new String [] { this.getClass().getName() + ".redo()" })); >+ (CommonPlugin.INSTANCE.getString("_EXC_Method_not_implemented", new String [] { Util.getClassNameAsString(this) + ".redo()" })); > } > } >Index: src/org/eclipse/emf/common/archive/Handler.java >=================================================================== >RCS file: src/org/eclipse/emf/common/archive/Handler.java >diff -N src/org/eclipse/emf/common/archive/Handler.java >--- src/org/eclipse/emf/common/archive/Handler.java 8 Jun 2005 05:43:18 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,128 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2004-2005 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM - Initial API and implementation >- * >- * </copyright> >- * >- * $Id$ >- */ >-package org.eclipse.emf.common.archive; >- >-import java.io.IOException; >-import java.io.InputStream; >-import java.net.URL; >-import java.net.URLConnection; >-import java.net.URLStreamHandler; >- >-/** >- * A URL stream handler that can be {@link #register() registered} to support archive access protocol. >- * It uses {@link ArchiveURLConnection} to implement the connection. >- */ >-public class Handler extends URLStreamHandler >-{ >- /** >- * Registers this class. >- * A handler for protocol "xyz" is registered >- * by providing a class named Handler implementing {@link URLStreamHandler} >- * in a package called named xyz in a package of your choosing, >- * and then registering that chosen prefix package name >- * in the system property for <code>"java.protocol.handler.pkgs"</code>, >- * which is an "|" separated list of package prefixes to search for handlers. >- */ >- public static void register() >- { >- String javaProtocolHandlerPkgs = System.getProperty("java.protocol.handler.pkgs"); >- if (javaProtocolHandlerPkgs == null || javaProtocolHandlerPkgs.length() == 0) >- { >- javaProtocolHandlerPkgs = "org.eclipse.emf.common"; >- } >- else >- { >- javaProtocolHandlerPkgs += "|org.eclipse.emf.common"; >- } >- System.setProperty("java.protocol.handler.pkgs", javaProtocolHandlerPkgs); >- } >- >- /** >- * Registers this handler and interprets each argument as URL to be opened, read in, and written out to System.out. >- * @param args URLs to open, read, and write to System.out >- * @throws IOException if there are problems opening or reading from the URLs, or writing to System.out. >- */ >- public static void main(String[] args) throws IOException >- { >- register(); >- >- for (int i = 0; i < args.length; ++i) >- { >- InputStream inputStream = new URL(args[i]).openStream(); >- byte [] bytes = new byte [4048]; >- for (int size; (size = inputStream.read(bytes, 0, bytes.length)) > -1; ) >- { >- System.out.write(bytes, 0, size); >- } >- } >- } >- >- /** >- * Creates an instance. >- */ >- public Handler() >- { >- super(); >- } >- >- /** >- * Overrides parsing the URL to validate constraints on well formed archive syntax. >- * @see URLStreamHandler#parseURL(java.net.URL, java.lang.String, int, int) >- */ >- protected void parseURL(URL url, String specification, int start, int limit) >- { >- super.parseURL(url, specification, start, limit); >- >- // There needs to be another URL protocol right after the archive protocol, and not a "/". >- // >- if (start > limit || specification.charAt(start) == '/') >- { >- throw >- new IllegalArgumentException >- ("archive protocol must be immediately followed by another URL protocol " + specification); >- } >- >- // There must be at least one archive path. >- // >- int archiveSeparator = specification.indexOf("!/", start); >- if (archiveSeparator < 0) >- { >- throw new IllegalArgumentException("missing archive separators " + specification.substring(start, limit)); >- } >- >- // Parse to count the archive paths that must will be delegated to the nested URL based on the number of schemes at the start. >- // >- for (int i = start, end = specification.indexOf('/', start) - 1; (i = specification.indexOf(':', i)) < end; ++i) >- { >- // There should be at least one archive separator per scheme. >- // >- archiveSeparator = specification.indexOf("!/", archiveSeparator + 2); >- if (archiveSeparator < 0) >- { >- throw new IllegalArgumentException("too few archive separators " + specification); >- } >- } >- } >- >- /** >- * Returns a new {@link ArchiveURLConnection}. >- */ >- protected URLConnection openConnection(URL url) throws IOException >- { >- return new ArchiveURLConnection(url); >- } >-} >Index: src/org/eclipse/emf/common/archive/package.html >=================================================================== >RCS file: src/org/eclipse/emf/common/archive/package.html >diff -N src/org/eclipse/emf/common/archive/package.html >--- src/org/eclipse/emf/common/archive/package.html 8 Jun 2005 05:43:18 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,31 +0,0 @@ >-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> >-<html xmlns="http://www.w3.org/1999/xhtml"> >-<head> >-<meta name="generator" content="HTML Tidy, see www.w3.org" /> >-<meta http-equiv="Content-Type" >-content="text/html; charset=ISO-8859-1" /><!-- >-/** >- * <copyright> >- * >- * Copyright (c) 2005 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM - Initial API and implementation >- * >- * </copyright> >- * >- * $Id$ >- */ >---> >-<title> </title> >-</head> >-<body> >-Provides support for archive URLs. >-</body> >-</html> >- >Index: src/org/eclipse/emf/common/archive/ArchiveURLConnection.java >=================================================================== >RCS file: src/org/eclipse/emf/common/archive/ArchiveURLConnection.java >diff -N src/org/eclipse/emf/common/archive/ArchiveURLConnection.java >--- src/org/eclipse/emf/common/archive/ArchiveURLConnection.java 24 Oct 2005 17:26:32 -0000 1.4 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,553 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2004-2005 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM - Initial API and implementation >- * >- * </copyright> >- * >- * $Id$ >- */ >-package org.eclipse.emf.common.archive; >- >-import java.io.File; >-import java.io.FileInputStream; >-import java.io.FileOutputStream; >-import java.io.FilterInputStream; >-import java.io.FilterOutputStream; >-import java.io.IOException; >-import java.io.InputStream; >-import java.io.OutputStream; >-import java.net.MalformedURLException; >-import java.net.URL; >-import java.net.URLConnection; >-import java.util.zip.ZipEntry; >-import java.util.zip.ZipFile; >-import java.util.zip.ZipInputStream; >-import java.util.zip.ZipOutputStream; >- >-/** >- * A connection that can access an entry in an archive, and then recursively an entry in that archive, and so on. >- * For example, it can be used just like jar: or zip:, only the archive paths can repeat, e.g., >- *<pre> >- * archive:file:///c:/temp/example.zip!/org/example/nested.zip!/org/example/deeply-nested.html >- *</pre> >- * The general recursive pattern is >- *<pre> >- * archive:$nestedURL${/!$archivePath$}+ >- *</pre> >- * So the nested URL for the example above is >- *<pre> >- * file:///c:/temp/example.zip >- *</pre> >- * >- * <p> >- * Since the nested URL may itself contain archive schemes, >- * the subsequence of the archive paths that should be associated with the nested URL >- * is determined by finding the nth archive separator, i.e., the nth !/, >- * where n is the number of ":"s before the first "/" of the nested URL, i.e., the number of nested schemes. >- * For example, for a more complex case where the nested URL is itself an archive-based scheme, e.g., >- *<pre> >- * archive:jar:file:///c:/temp/example.zip!/org/example/nested.zip!/org/example/deeply-nested.html >- *</pre> >- * the nested URL is correctly parsed to skip to the second archive separator as >- *<pre> >- * jar:file:///c:/temp/example.zip!/org/example/nested.zip >- *</pre> >- * </p> >- * >- * <p> >- * The logic for accessing archives can be tailored and reused independant from its usage as a URL connection. >- * This is normally done by using the constructor {@link #ArchiveURLConnection(String)} >- * and overriding {@link #createInputStream(String)} and {@link #createOutputStream(String)}. >- * The behavior can be tailored by overriding {@link #emulateArchiveScheme()} and {@link #useZipFile()}. >- * </p> >- */ >-public class ArchiveURLConnection extends URLConnection >-{ >- /** >- * The cached string version of the {@link #url URL}. >- */ >- protected String urlString; >- >- /** >- * Constructs a new connection for the URL. >- * @param url the URL of this connection. >- */ >- public ArchiveURLConnection(URL url) >- { >- super(url); >- urlString = url.toString(); >- } >- >- /** >- * Constructs a new archive accessor. >- * This constructor forwards a null URL to be super constructor, >- * so an instance built with this constructor <b>cannot</b> be used as a URLConnection. >- * The logic for accessing archives and for delegating to the nested URL can be reused in other applications, >- * without creating an URLs. >- * @param url the URL of the archive. >- */ >- protected ArchiveURLConnection(String url) >- { >- super(null); >- urlString = url; >- } >- >- /** >- * </p> >- * Returns whether the implementation will handle all the archive accessors directly. >- * For example, whether >- *<pre> >- * archive:jar:file:///c:/temp/example.zip!/org/example/nested.zip!/org/example/deeply-nested.html >- *</pre> >- * will be handled as if it were specified as >- *<pre> >- * archive:file:///c:/temp/example.zip!/org/example/nested.zip!/org/example/deeply-nested.html >- *</pre> >- * Override this only if you are reusing the logic of retrieving an input stream into an archive >- * and hence are likely to be overriding createInputStream, >- * which is the point of delegation to the nested URL for recursive stream creation. >- * </p> >- * @return whether the implementation will handle all the archive accessors directly. >- */ >- protected boolean emulateArchiveScheme() >- { >- return false; >- } >- >- /** >- * Returns whether to handle the special case of a nested URL with file: schema using a {@link ZipFile}. >- * This gives more efficient direct access to the root entry, e.g., >- *<pre> >- * archive:file:///c:/temp/example.zip!/org/example/nested.html >- *</pre> >- * @return whether to handle the special case of a nested URL with file: schema using a ZipFile. >- */ >- protected boolean useZipFile() >- { >- return false; >- } >- >- /** >- * Record that this is connected. >- */ >- public void connect() throws IOException >- { >- connected = true; >- } >- >- /** >- * Creates the input stream for the URL. >- * @return the input stream for the URL. >- */ >- public InputStream getInputStream() throws IOException >- { >- // There must be at least one archive path. >- // >- int archiveSeparator = urlString.indexOf("!/"); >- if (archiveSeparator < 0) >- { >- throw new MalformedURLException("missing archive separators " + urlString); >- } >- >- // There needs to be another URL protocol right after the archive protocol, and not a "/". >- // >- int start = urlString.indexOf(':') + 1; >- if (start > urlString.length() || urlString.charAt(start) == '/') >- { >- throw >- new IllegalArgumentException >- ("archive protocol must be immediately followed by another URL protocol " + urlString); >- } >- >- // Parse to extract the archives that will be delegated to the nested URL based on the number of schemes at the start. >- // >- for (int i = start, end = urlString.indexOf("/") - 1; (i = urlString.indexOf(":", i)) < end; ) >- { >- if (emulateArchiveScheme()) >- { >- // Skip a scheme for the achive accessor to be handled directly here. >- // >- start = ++i; >- } >- else >- { >- // Skip an archive accessor to be handled by delegation to the scheme in nested URL. >- // >- archiveSeparator = urlString.indexOf("!/", archiveSeparator + 2); >- if (archiveSeparator < 0) >- { >- throw new MalformedURLException("too few archive separators " + urlString); >- } >- ++i; >- } >- } >- >- // System.out.println("archive: " + urlString.substring(start, archiveSeparator) + " -> " + urlString.substring(archiveSeparator + 2)); >- >- // Create the delegate URL. >- // >- String nestedURL = urlString.substring(start, archiveSeparator); >- >- // The cutoff point to the next archive. >- // >- int nextArchiveSeparator = urlString.indexOf("!/", archiveSeparator + 2); >- >- // Construct the input stream in a special efficient way for case of a file scheme. >- // >- InputStream inputStream; >- if (!useZipFile() || !nestedURL.startsWith("file:")) >- { >- // Just get the stream from the URL. >- // >- inputStream = createInputStream(nestedURL); >- } >- else >- { >- // The name to be used for the entry. >- // >- String entry = >- nextArchiveSeparator < 0 ? >- urlString.substring(archiveSeparator + 2) : >- urlString.substring(archiveSeparator + 2, nextArchiveSeparator); >- >- // Skip over this archive path to the next one, since we are handling this one special. >- // >- archiveSeparator = nextArchiveSeparator; >- nextArchiveSeparator = urlString.indexOf("!/", archiveSeparator + 2); >- >- // Go directly to the right entry in the zip file, >- // get the stream, >- // and wrap it so that closing it closes the zip file. >- // >- final ZipFile zipFile = new ZipFile(nestedURL.substring(5)); >- ZipEntry zipEntry = zipFile.getEntry(entry); >- if (zipEntry == null) >- { >- throw new IOException("archive entry not found " + entry); >- } >- inputStream = >- new FilterInputStream(zipFile.getInputStream(zipEntry)) >- { >- public void close() throws IOException >- { >- super.close(); >- zipFile.close(); >- } >- }; >- } >- >- // Loop over the archive paths. >- // >- LOOP: >- while (archiveSeparator > 0) >- { >- // The entry name to be matched. >- // >- String entry = >- nextArchiveSeparator < 0 ? >- urlString.substring(archiveSeparator + 2) : >- urlString.substring(archiveSeparator + 2, nextArchiveSeparator); >- >- // Wrap the input stream as a zip stream to scan it's contents for a match. >- // >- ZipInputStream zipInputStream = new ZipInputStream(inputStream); >- while (zipInputStream.available() >= 0) >- { >- ZipEntry zipEntry = zipInputStream.getNextEntry(); >- if (zipEntry == null) >- { >- break; >- } >- else if (entry.equals(zipEntry.getName())) >- { >- inputStream = zipInputStream; >- >- // Skip to the next archive path and continue the loop. >- // >- archiveSeparator = nextArchiveSeparator; >- nextArchiveSeparator = urlString.indexOf("!/", archiveSeparator + 2); >- continue LOOP; >- } >- } >- >- // Unless we matched an entry, we're done. >- // >- break; >- } >- >- return inputStream; >- } >- >- /** >- * Creates an input stream for the nested URL by calling {@link URL#openStream()opening} a stream on it. >- * @param nestedURL the nested URL for which a stream is required. >- * @return the open stream of the nested URL. >- */ >- protected InputStream createInputStream(String nestedURL) throws IOException >- { >- return new URL(nestedURL).openStream(); >- } >- >- /** >- * Creates the output stream for the URL. >- * @return the output stream for the URL. >- */ >- public OutputStream getOutputStream() throws IOException >- { >- // There must be at least one archive separator. >- // >- int archiveSeparator = urlString.indexOf("!/"); >- if (archiveSeparator < 0) >- { >- throw new MalformedURLException("missing archive separator in " + urlString); >- } >- >- // There needs to be another URL protocol right after the archive protocol, and not a "/". >- // >- int start = urlString.indexOf(':') + 1; >- if (start > urlString.length() || urlString.charAt(start) == '/') >- { >- throw >- new IllegalArgumentException >- ("archive protocol must be immediately followed by another URL protocol " + urlString); >- } >- >- // Parse the URI to extract the nested/delegate URI based on preference and the number of schemes at the start. >- // >- for (int i = start, end = urlString.indexOf("/") - 1; (i = urlString.indexOf(":", i)) < end; ) >- { >- if (emulateArchiveScheme()) >- { >- // Skip a scheme for the achive accessor to be handled directly here. >- // >- start = ++i; >- } >- else >- { >- // Skip an archive accessor to be handled by delegation to the scheme in nested URI. >- // >- archiveSeparator = urlString.indexOf("!/", archiveSeparator + 2); >- if (archiveSeparator < 0) >- { >- throw new MalformedURLException("too few archive separators in " + urlString); >- } >- ++i; >- } >- } >- >- // System.out.println("archive: -> " + urlString.substring(start, archiveSeparator) + " -> " + urlString.substring(archiveSeparator + 2)); >- >- // Create the delegate URL >- // >- final String nestedURL = urlString.substring(start, archiveSeparator); >- >- // Create a temporary file where the existing contents of the archive can be written >- // before the new contents are added. >- // >- final File tempFile = File.createTempFile("Archive", "zip"); >- >- // Record the input and output streams for closing in case of failure so that handles are not left open. >- // >- InputStream sourceInputStream = null; >- OutputStream tempOutputStream = null; >- try >- { >- // Create the output stream to the temporary file and the input stream for the delegate URL. >- // >- tempOutputStream = new FileOutputStream(tempFile); >- try >- { >- sourceInputStream = createInputStream(nestedURL); >- } >- catch (IOException exception) >- { >- // Continue processing if the file doesn't exist so that we try create a new empty one. >- } >- >- // Record them as generic streams to record state during the loop that emulates recursion. >- // >- OutputStream outputStream = tempOutputStream; >- InputStream inputStream = sourceInputStream; >- >- // The cutoff point to the next archive. >- // >- int nextArchiveSeparator = urlString.indexOf("!/", archiveSeparator + 2); >- >- // The most deeply nested output stream that will be returned wrapped as the result. >- // >- ZipOutputStream zipOutputStream; >- >- // A buffer for transferring archive contents. >- // >- final byte [] bytes = new byte [4096]; >- >- // We expect there to be at least one archive path. >- // >- do >- { >- // The name that will be used as the archive entry. >- // >- String entry = >- nextArchiveSeparator < 0 ? >- urlString.substring(archiveSeparator + 2) : >- urlString.substring(archiveSeparator + 2, nextArchiveSeparator); >- >- // Wrap the current result as a zip stream, and record it for loop-based recursion. >- // >- zipOutputStream = new ZipOutputStream(outputStream); >- outputStream = zipOutputStream; >- >- // Wrap the current input as a zip stream, and record it for loop-based recursion. >- // >- ZipInputStream zipInputStream = inputStream == null ? null : new ZipInputStream(inputStream); >- inputStream = zipInputStream; >- >- // Loop over the entries in the zip stream. >- // >- while (zipInputStream != null && zipInputStream.available() >= 0) >- { >- // If this entry isn't the end marker >- // and isn't the matching one that we are replacing... >- // >- ZipEntry zipEntry = zipInputStream.getNextEntry(); >- if (zipEntry == null) >- { >- break; >- } >- else if (!entry.equals(zipEntry.getName())) >- { >- // Transfer the entry and its contents. >- // >- zipOutputStream.putNextEntry(zipEntry); >- for (int size; (size = zipInputStream.read(bytes, 0, bytes.length)) > -1; ) >- { >- zipOutputStream.write(bytes, 0, size); >- } >- } >- } >- >- // Create a new or replaced entry. >- // >- zipOutputStream.putNextEntry(new ZipEntry(entry)); >- >- // Find the next archive path and continue "recursively" if there is one. >- // >- archiveSeparator = nextArchiveSeparator; >- nextArchiveSeparator = urlString.indexOf("!/", archiveSeparator + 2); >- } >- while (archiveSeparator > 0); >- >- // Ensure that it won't be closed in the finally block. >- // >- tempOutputStream = null; >- >- // Wrap the deepest result so that on close, the results are finally transferred. >- // >- final boolean deleteRequired = sourceInputStream != null; >- return >- new FilterOutputStream(zipOutputStream) >- { >- protected boolean isClosed; >- >- public void close() throws IOException >- { >- // Make sure we close only once. >- // >- if (!isClosed) >- { >- isClosed = true; >- >- // Close for real so that the temporary file is ready to be read. >- // >- super.close(); >- >- boolean useRenameTo = nestedURL.startsWith("file:"); >- >- // If the delegate URI can be handled as a file, >- // we'll hope that renaming it will be really efficient. >- // >- if (useRenameTo) >- { >- File targetFile = new File(nestedURL.substring(5)); >- if (deleteRequired && !targetFile.delete()) >- { >- throw new IOException("cannot delete " + targetFile.getPath()); >- } >- else if (!tempFile.renameTo(targetFile)) >- { >- useRenameTo = false; >- } >- } >- if (!useRenameTo) >- { >- // Try to transfer it by reading the contents of the temporary file >- // and writing them to the output stream of the delegate. >- // >- InputStream inputStream = null; >- OutputStream outputStream = null; >- try >- { >- inputStream = new FileInputStream(tempFile); >- outputStream = createOutputStream(nestedURL); >- for (int size; (size = inputStream.read(bytes, 0, bytes.length)) > -1; ) >- { >- outputStream.write(bytes, 0, size); >- } >- } >- finally >- { >- // Make sure they are closed no matter what bad thing happens. >- // >- if (inputStream != null) >- { >- inputStream.close(); >- } >- if (outputStream != null) >- { >- outputStream.close(); >- } >- } >- } >- } >- } >- }; >- } >- finally >- { >- // Close in case of failure to complete. >- // >- if (tempOutputStream != null) >- { >- tempOutputStream.close(); >- } >- >- // Close if we created this. >- // >- if (sourceInputStream != null) >- { >- sourceInputStream.close(); >- } >- } >- } >- >- /** >- * Creates an input stream for the nested URL by calling {@link URL#openStream()opening} a stream on it. >- * @param nestedURL the nested URL for which a stream is required. >- * @return the open stream of the nested URL. >- */ >- protected OutputStream createOutputStream(String nestedURL) throws IOException >- { >- URL url = new URL(nestedURL.toString()); >- URLConnection urlConnection = url.openConnection(); >- urlConnection.setDoOutput(true); >- return urlConnection.getOutputStream(); >- } >-} >Index: .classpath >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.common/.classpath,v >retrieving revision 1.1 >diff -u -r1.1 .classpath >--- .classpath 6 Mar 2004 17:31:31 -0000 1.1 >+++ .classpath 12 Nov 2007 18:36:19 -0000 >@@ -1,7 +1,8 @@ > <?xml version="1.0" encoding="UTF-8"?> > <classpath> >- <classpathentry kind="src" path="src/"/> >- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> >- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> >- <classpathentry kind="output" path="bin"/> >+ <classpathentry kind="src" path="src"/> >+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> >+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> >+ <classpathentry kind="lib" path="/org.eclipse.equinox.common.gwt/dist/org.eclipse.equinox.common.jar"/> >+ <classpathentry kind="output" path="bin"/> > </classpath> >Index: src/org/eclipse/emf/common/util/BasicEList.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/util/BasicEList.java,v >retrieving revision 1.13 >diff -u -r1.13 BasicEList.java >--- src/org/eclipse/emf/common/util/BasicEList.java 24 Jan 2006 20:28:49 -0000 1.13 >+++ src/org/eclipse/emf/common/util/BasicEList.java 12 Nov 2007 18:36:21 -0000 >@@ -17,11 +17,12 @@ > package org.eclipse.emf.common.util; > > >-import java.io.IOException; >-import java.io.ObjectInputStream; >-import java.io.ObjectOutputStream; >+//XXX GWT CHANGE >+//import java.io.IOException; >+//import java.io.ObjectInputStream; >+//import java.io.ObjectOutputStream; > import java.io.Serializable; >-import java.lang.reflect.Array; >+//import java.lang.reflect.Array; > import java.util.AbstractList; > import java.util.Collection; > import java.util.ConcurrentModificationException; >@@ -47,6 +48,10 @@ > */ > protected transient Object data[]; > >+//XXX GWT CHANGE (modcount not available in upstream GWT maybe a feature request >+// should be raised) >+ protected transient int modCount = 0; >+ > /** > * Creates an empty instance with no initial capacity. > * The data storage will be null. >@@ -444,7 +449,9 @@ > { > if (array.length < size) > { >- array = (Object[])Array.newInstance(array.getClass().getComponentType(), size); >+//FIXME GWT CHANGE DO WE NEED TO FIX THIS? >+ array = new Object[size]; >+// array = (Object[])Array.newInstance(array.getClass().getComponentType(), size); > } > > System.arraycopy(data, 0, array, 0, size); >@@ -1071,44 +1078,45 @@ > } > } > >- private synchronized void writeObject(ObjectOutputStream objectOutputStream) throws IOException >- { >- objectOutputStream.defaultWriteObject(); >- if (data == null) >- { >- objectOutputStream.writeInt(0); >- } >- else >- { >- objectOutputStream.writeInt(data.length); >- for (int i = 0; i < size; ++i) >- { >- objectOutputStream.writeObject(data[i]); >- } >- } >- } >- >- private synchronized void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException >- { >- objectInputStream.defaultReadObject(); >- int arrayLength = objectInputStream.readInt(); >- if (arrayLength > 0) >- { >- try >- { >- data = newData(arrayLength); >- } >- catch (Throwable exception) >- { >- data = new Object[arrayLength]; >- } >- >- for (int i = 0; i < size; ++i) >- { >- didAdd(i, assign(i, objectInputStream.readObject())); >- } >- } >- } >+//XXX GWT CHANGE Serialization not available >+// private synchronized void writeObject(ObjectOutputStream objectOutputStream) throws IOException >+// { >+// objectOutputStream.defaultWriteObject(); >+// if (data == null) >+// { >+// objectOutputStream.writeInt(0); >+// } >+// else >+// { >+// objectOutputStream.writeInt(data.length); >+// for (int i = 0; i < size; ++i) >+// { >+// objectOutputStream.writeObject(data[i]); >+// } >+// } >+// } >+// >+// private synchronized void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException >+// { >+// objectInputStream.defaultReadObject(); >+// int arrayLength = objectInputStream.readInt(); >+// if (arrayLength > 0) >+// { >+// try >+// { >+// data = newData(arrayLength); >+// } >+// catch (Throwable exception) >+// { >+// data = new Object[arrayLength]; >+// } >+// >+// for (int i = 0; i < size; ++i) >+// { >+// didAdd(i, assign(i, objectInputStream.readObject())); >+// } >+// } >+// } > > /** > * Returns a shallow copy of this list. >@@ -1116,9 +1124,13 @@ > */ > public Object clone() > { >- try >- { >- BasicEList clone = (BasicEList)super.clone(); >+//FIXME GWT CHANGE .clone is not supported by GWT >+// but creating a new list is not 100% the same! >+// Should we raise a bug against GWT and ask for clone-support for lists? >+// try >+// { >+// BasicEList clone = (BasicEList)super.clone(); >+ BasicEList clone = new BasicEList(this); > if (size > 0) > { > clone.size = size; >@@ -1126,11 +1138,11 @@ > System.arraycopy(data, 0, clone.data, 0, size); > } > return clone; >- } >- catch (CloneNotSupportedException exception) >- { >- throw new InternalError(); >- } >+// } >+// catch (CloneNotSupportedException exception) >+// { >+// throw new InternalError(); >+// } > } > > /** >Index: src/org/eclipse/emf/common/util/ResourceLocator.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/util/ResourceLocator.java,v >retrieving revision 1.3 >diff -u -r1.3 ResourceLocator.java >--- src/org/eclipse/emf/common/util/ResourceLocator.java 8 Jun 2005 06:19:08 -0000 1.3 >+++ src/org/eclipse/emf/common/util/ResourceLocator.java 12 Nov 2007 18:36:23 -0000 >@@ -1,79 +1,7 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2004 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: ResourceLocator.java,v 1.3 2005/06/08 06:19:08 nickb Exp $ >- */ > package org.eclipse.emf.common.util; > >+public interface ResourceLocator { > >-import java.net.URL; >+ String getString(String string, Object[] objects); > >- >-/** >- * A locator of Java resources. >- */ >-public interface ResourceLocator >-{ >- /** >- * Returns the URL from which all resources are based. >- * @return the URL from which all resources are based. >- */ >- URL getBaseURL(); >- >- /** >- * Returns the description that can be used to create the image resource associated with the key. >- * The description will typically be in the form of a URL to the image data. >- * Creation of an actual image depends on the GUI environment; >- * within Eclipse, org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry can be used. >- * @param key the key of the image resource. >- * @return the description on the image resource. >- */ >- Object getImage(String key); >- >- /** >- * Returns the string resource associated with the key. >- * @param key the key of the string resource. >- * @return the string resource associated with the key. >- */ >- String getString(String key); >- >- /** >- * Returns the string resource associated with the key. >- * @param key the key of the string resource. >- * @param translate whether the result is to be translated to the current locale. >- * @return the string resource associated with the key. >- */ >- String getString(String key, boolean translate); >- >- /** >- * Returns a string resource associated with the key, and peforms substitutions. >- * @param key the key of the string. >- * @param substitutions the message substitutions. >- * @return a string resource associated with the key. >- * @see #getString(String) >- * @see java.text.MessageFormat#format(String, Object[]) >- */ >- String getString(String key, Object [] substitutions); >- >- /** >- * Returns a string resource associated with the key, and peforms substitutions. >- * @param key the key of the string. >- * @param substitutions the message substitutions. >- * @param translate whether the result is to be translated to the current locale. >- * @return a string resource associated with the key. >- * @see #getString(String) >- * @see java.text.MessageFormat#format(String, Object[]) >- */ >- String getString(String key, Object [] substitutions, boolean translate); > } >Index: src/org/eclipse/emf/common/util/BasicMonitor.java >=================================================================== >RCS file: src/org/eclipse/emf/common/util/BasicMonitor.java >diff -N src/org/eclipse/emf/common/util/BasicMonitor.java >--- src/org/eclipse/emf/common/util/BasicMonitor.java 18 Nov 2005 12:01:19 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,386 +0,0 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2005 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: BasicMonitor.java,v 1.1 2005/11/18 12:01:19 emerks Exp $ >- */ >-package org.eclipse.emf.common.util; >- >-import java.io.PrintStream; >- >-import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.core.runtime.IProgressMonitorWithBlocking; >-import org.eclipse.core.runtime.IStatus; >-import org.eclipse.core.runtime.SubProgressMonitor; >- >- >-/** >- * The most basic implementation of a task monitor. >- */ >-public class BasicMonitor implements Monitor >-{ >- private boolean isCanceled; >- >- private Diagnostic blockedReason; >- >- public BasicMonitor() >- { >- } >- >- public boolean isCanceled() >- { >- return isCanceled; >- } >- >- public void setCanceled(boolean isCanceled) >- { >- this.isCanceled = isCanceled; >- } >- >- /** >- * Returns the current reason for task being blocked, or <code>null</code>. >- */ >- public Diagnostic getBlockedReason() >- { >- return blockedReason; >- } >- >- public void setBlocked(Diagnostic reason) >- { >- this.blockedReason = reason; >- } >- >- public void clearBlocked() >- { >- this.blockedReason = null; >- } >- >- public void beginTask(String name, int totalWork) >- { >- } >- >- public void setTaskName(String name) >- { >- } >- >- public void subTask(String name) >- { >- } >- >- public void worked(int work) >- { >- } >- >- public void internalWorked(double work) >- { >- } >- >- public void done() >- { >- } >- >- /** >- * A simple monitor that delegates to another monitor. >- */ >- public static class Delegating >- { >- protected Monitor monitor; >- >- public Delegating(Monitor monitor) >- { >- this.monitor = monitor; >- } >- >- public boolean isCanceled() >- { >- return monitor.isCanceled(); >- } >- >- public void setCanceled(boolean value) >- { >- monitor.setCanceled(value); >- } >- >- public void setBlocked(Diagnostic reason) >- { >- monitor.setBlocked(reason); >- } >- >- public void clearBlocked() >- { >- monitor.clearBlocked(); >- } >- >- public void beginTask(String name, int totalWork) >- { >- monitor.beginTask(name, totalWork); >- } >- >- public void setTaskName(String name) >- { >- monitor.setTaskName(name); >- } >- >- public void subTask(String name) >- { >- monitor.subTask(name); >- } >- >- public void worked(int work) >- { >- monitor.worked(work); >- } >- >- public void internalWorked(double work) >- { >- monitor.internalWorked(work); >- } >- >- public void done() >- { >- monitor.done(); >- } >- >- /** >- * A simple monitor that delegates to another monitor, and implements the Eclipse API >- */ >- private static class Eclipse extends Delegating implements IProgressMonitorWithBlocking >- { >- public Eclipse(Monitor monitor) >- { >- super(monitor); >- } >- >- public void setBlocked(IStatus reason) >- { >- setBlocked >- (new BasicDiagnostic >- (reason.getSeverity(), >- reason.getPlugin(), >- reason.getCode(), >- reason.getMessage(), >- null)); >- } >- >- public static IProgressMonitorWithBlocking createIProgressMonitorWithBlocking(Monitor monitor) >- { >- if (monitor instanceof IProgressMonitorWithBlocking) >- { >- return (IProgressMonitorWithBlocking)monitor; >- } >- else >- { >- return new Eclipse(monitor); >- } >- } >- >- public static IProgressMonitor createIProgressMonitor(Monitor monitor) >- { >- if (monitor instanceof IProgressMonitor) >- { >- return (IProgressMonitor)monitor; >- } >- else >- { >- return new Eclipse(monitor); >- } >- } >- } >- } >- >- /** >- * Creates a delegating wrapper that allows the monitor to be used >- * in a context requiring an instance implementing the Eclipse API. >- */ >- public static IProgressMonitor toIProgressMonitor(Monitor monitor) >- { >- return Delegating.Eclipse.createIProgressMonitor(monitor); >- } >- >- /** >- * Creates a delegating wrapper that allows the monitor to be used >- * in a context requiring an instance implementing the Eclipse API. >- */ >- public static IProgressMonitorWithBlocking toIProgressMonitorWithBlocking(Monitor monitor) >- { >- return Delegating.Eclipse.createIProgressMonitorWithBlocking(monitor); >- } >- >- /** >- * A simple monitor that delegates to another Eclipse monitor. >- */ >- private static class EclipseDelegating implements Monitor >- { >- protected IProgressMonitor progressMonitor; >- protected IProgressMonitorWithBlocking progressMonitorWithBlocking; >- >- public EclipseDelegating(IProgressMonitor progressMonitor) >- { >- this.progressMonitor = progressMonitor; >- if (progressMonitor instanceof IProgressMonitorWithBlocking) >- { >- this.progressMonitorWithBlocking = (IProgressMonitorWithBlocking)progressMonitor; >- } >- } >- >- public EclipseDelegating(IProgressMonitorWithBlocking progressMonitorWithBlocking) >- { >- this.progressMonitor = progressMonitorWithBlocking; >- this.progressMonitorWithBlocking = progressMonitorWithBlocking; >- } >- >- public boolean isCanceled() >- { >- return progressMonitor.isCanceled(); >- } >- >- public void setCanceled(boolean value) >- { >- progressMonitor.setCanceled(value); >- } >- >- public void setBlocked(Diagnostic reason) >- { >- if (progressMonitorWithBlocking != null) >- { >- progressMonitorWithBlocking.setBlocked(BasicDiagnostic.toIStatus(reason)); >- } >- } >- >- public void clearBlocked() >- { >- if (progressMonitorWithBlocking != null) >- { >- progressMonitorWithBlocking.clearBlocked(); >- } >- } >- >- public void beginTask(String name, int totalWork) >- { >- progressMonitor.beginTask(name, totalWork); >- } >- >- public void setTaskName(String name) >- { >- progressMonitor.setTaskName(name); >- } >- >- public void subTask(String name) >- { >- progressMonitor.subTask(name); >- } >- >- public void worked(int work) >- { >- progressMonitor.worked(work); >- } >- >- public void internalWorked(double work) >- { >- progressMonitor.internalWorked(work); >- } >- >- public void done() >- { >- progressMonitor.done(); >- } >- } >- >- /** >- * Creates a delegating wrapper that allows the Eclipse progress monitor to be used >- * in a context requiring an instance implementing the monitor API. >- */ >- public static Monitor toMonitor(IProgressMonitorWithBlocking progressMonitor) >- { >- return new EclipseDelegating(progressMonitor); >- } >- >- /** >- * Creates a delegating wrapper that allows the Eclipse progress monitor to be used >- * in a context requiring an instance implementing the monitor API. >- */ >- public static Monitor toMonitor(IProgressMonitor progressMonitor) >- { >- return new EclipseDelegating(progressMonitor); >- } >- >- /** >- * An Eclipse subprogress monitor that directly implements the monitor API. >- */ >- public static class EclipseSubProgress extends SubProgressMonitor implements Monitor >- { >- public EclipseSubProgress(IProgressMonitor monitor, int ticks) >- { >- super(monitor, ticks); >- } >- >- public EclipseSubProgress(IProgressMonitor monitor, int ticks, int style) >- { >- super(monitor, ticks, style); >- } >- >- public void setBlocked(Diagnostic reason) >- { >- super.setBlocked(BasicDiagnostic.toIStatus(reason)); >- } >- } >- >- /** >- * A simple monitor that prints progress to a print stream. >- */ >- public static class Printing extends BasicMonitor >- { >- protected PrintStream printStream; >- >- public Printing(PrintStream printStream) >- { >- this.printStream = printStream; >- } >- >- public void beginTask(String name, int totalWork) >- { >- if (name != null && name.length() != 0) >- { >- printStream.println(">>> " + name); >- } >- } >- >- public void setTaskName(String name) >- { >- if (name != null && name.length() != 0) >- { >- printStream.println("<>> " + name); >- } >- } >- >- public void subTask(String name) >- { >- if (name != null && name.length() != 0) >- { >- printStream.println(">> " + name); >- } >- } >- >- public void setBlocked(Diagnostic reason) >- { >- super.setBlocked(reason); >- printStream.println("#> " + reason.getMessage()); >- } >- >- public void clearBlocked() >- { >- printStream.println("=> " + getBlockedReason().getMessage()); >- super.clearBlocked(); >- } >- } >-} >Index: src/org/eclipse/emf/common/util/URI.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/util/URI.java,v >retrieving revision 1.23 >diff -u -r1.23 URI.java >--- src/org/eclipse/emf/common/util/URI.java 13 Sep 2006 19:15:30 -0000 1.23 >+++ src/org/eclipse/emf/common/util/URI.java 12 Nov 2007 18:36:27 -0000 >@@ -1,13 +1,13 @@ > /** >- * <copyright> >+ * <copyright> > * > * Copyright (c) 2002-2005 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >+ * >+ * Contributors: > * IBM - Initial API and implementation > * > * </copyright> >@@ -16,14 +16,14 @@ > */ > package org.eclipse.emf.common.util; > >-import java.io.File; >-import java.lang.ref.WeakReference; >+//import java.io.File; >+//import java.lang.ref.WeakReference; > import java.util.ArrayList; > import java.util.Arrays; > import java.util.Collections; > import java.util.HashMap; > import java.util.HashSet; >-import java.util.Iterator; >+//import java.util.Iterator; > import java.util.List; > import java.util.Map; > import java.util.Set; >@@ -75,7 +75,7 @@ > * can be used, in which a non-null <code>device</code> parameter can be > * specified. > * >- * <p><a name="archive_explanation"> >+ * <p><a name="archive_explanation"> > * The other enhancement provides support for the almost-hierarchical > * form used for files within archives, such as the JAR scheme, defined > * for the Java Platform in the documentation for {@link >@@ -103,7 +103,7 @@ > * createURI(String) createURI} to have parsed them correctly from a single > * URI string. If necessary in the future, these tests may be made more > * strict, to better coform to the RFC. >- * >+ * > * <p>Another group of static methods, whose names begin with "encode", use > * percent escaping to encode any characters that are not permitted in the > * various URI components. Another static method is provided to {@link >@@ -153,51 +153,53 @@ > private final boolean absolutePath; > private final String[] segments; // empty last segment -> trailing separator > private final String query; >+ private static final char File_separatorChar = '/'; > > // A cache of URIs, keyed by the strings from which they were created. > // The fragment of any URI is removed before caching it here, to minimize > // the size of the cache in the usual case where most URIs only differ by > // the fragment. >- private static final Map uriCache = >+ private static final Map uriCache = > new HashMap() >- { >- static final int MIN_LIMIT = 1000; >- int count; >- int limit = MIN_LIMIT; >- >- public synchronized Object get(Object key) >- { >- WeakReference reference = (WeakReference)super.get(key); >- return reference == null ? null : reference.get(); >- } >- >- public synchronized Object put(Object key, Object value) >- { >- super.put(key, new WeakReference(value)); >- if (++count > limit) >- { >- cleanGCedValues(); >- } >- >- // The return value is not used. >- return null; >- } >- >- private void cleanGCedValues() >- { >- for (Iterator i = entrySet().iterator(); i.hasNext(); ) >- { >- Map.Entry entry = (Map.Entry)i.next(); >- WeakReference reference = (WeakReference)entry.getValue(); >- if (reference.get() == null) >- { >- i.remove(); >- } >- } >- count = 0; >- limit = Math.max(MIN_LIMIT, size() / 2); >- } >- }; >+// { >+// static final int MIN_LIMIT = 1000; >+// int count; >+// int limit = MIN_LIMIT; >+// >+// public synchronized Object get(Object key) >+// { >+// WeakReference reference = (WeakReference)super.get(key); >+// return reference == null ? null : reference.get(); >+// } >+// >+// public synchronized Object put(Object key, Object value) >+// { >+// super.put(key, new WeakReference(value)); >+// if (++count > limit) >+// { >+// cleanGCedValues(); >+// } >+// >+// // The return value is not used. >+// return null; >+// } >+// >+// private void cleanGCedValues() >+// { >+// for (Iterator i = entrySet().iterator(); i.hasNext(); ) >+// { >+// Map.Entry entry = (Map.Entry)i.next(); >+// WeakReference reference = (WeakReference)entry.getValue(); >+// if (reference.get() == null) >+// { >+// i.remove(); >+// } >+// } >+// count = 0; >+// limit = Math.max(MIN_LIMIT, size() / 2); >+// } >+// } >+ ; > > // The lower-cased schemes that will be used to identify archive URIs. > private static final Set archiveSchemes; >@@ -246,7 +248,7 @@ > private static final long ALPHANUM_LO = ALPHA_LO | DIGIT_LO; > private static final long HEX_HI = DIGIT_HI | highBitmask('A', 'F') | highBitmask('a', 'f'); > private static final long HEX_LO = DIGIT_LO | lowBitmask('A', 'F') | lowBitmask('a', 'f'); >- private static final long UNRESERVED_HI = ALPHANUM_HI | highBitmask("-_.!~*'()"); >+ private static final long UNRESERVED_HI = ALPHANUM_HI | highBitmask("-_.!~*'()"); > private static final long UNRESERVED_LO = ALPHANUM_LO | lowBitmask("-_.!~*'()"); > private static final long RESERVED_HI = highBitmask(";/?:@&=+$,"); > private static final long RESERVED_LO = lowBitmask(";/?:@&=+$,"); >@@ -254,7 +256,7 @@ > private static final long URIC_LO = RESERVED_LO | UNRESERVED_LO; > > // Additional useful character classes, including characters valid in certain >- // URI components and separators used in parsing them out of a string. >+ // URI components and separators used in parsing them out of a string. > // > private static final long SEGMENT_CHAR_HI = UNRESERVED_HI | highBitmask(";:@&=+$,"); // | ucschar | escaped > private static final long SEGMENT_CHAR_LO = UNRESERVED_LO | lowBitmask(";:@&=+$,"); >@@ -267,18 +269,19 @@ > private static final long SEGMENT_END_HI = highBitmask("/?#"); > private static final long SEGMENT_END_LO = lowBitmask("/?#"); > >- // We can't want to do encoding of platform resource URIs by default yet. >+ // We can't want to do encoding of platform resource URIs by default yet. > // > private static final boolean ENCODE_PLATFORM_RESOURCE_URIS = >- System.getProperty("org.eclipse.emf.common.util.URI.encodePlatformResourceURIs") != null && >- !"false".equalsIgnoreCase(System.getProperty("org.eclipse.emf.common.util.URI.encodePlatformResourceURIs")); >+// System.getProperty("org.eclipse.emf.common.util.URI.encodePlatformResourceURIs") != null && >+// !"false".equalsIgnoreCase(System.getProperty("org.eclipse.emf.common.util.URI.encodePlatformResourceURIs")); >+ false; > > // Static initializer for archiveSchemes. > static > { > Set set = new HashSet(); >- String propertyValue = System.getProperty("org.eclipse.emf.common.util.URI.archiveSchemes"); >- >+// String propertyValue = System.getProperty("org.eclipse.emf.common.util.URI.archiveSchemes"); >+ String propertyValue = null; > if (propertyValue == null) > { > set.add(SCHEME_JAR); >@@ -286,13 +289,13 @@ > set.add(SCHEME_ARCHIVE); > } > else >- { >+ { > for (StringTokenizer t = new StringTokenizer(propertyValue); t.hasMoreTokens(); ) > { > set.add(t.nextToken().toLowerCase()); > } > } >- >+ > archiveSchemes = Collections.unmodifiableSet(set); > } > >@@ -449,16 +452,16 @@ > /** > * Static factory method for a hierarchical URI with absolute path. > * The URI will be relative if <code>scheme</code> is non-null, and >- * absolute otherwise. >+ * absolute otherwise. > * > * @param segments an array of non-null strings, each representing one > * segment of the path. As an absolute path, it is automatically > * preceeded by a <code>/</code> separator. If desired, a trailing > * separator should be represented by an empty-string segment as the last >- * element of the array. >+ * element of the array. > * > * @exception java.lang.IllegalArgumentException if <code>scheme</code> is >- * an <a href="#archive_explanation">archive URI</a> scheme and >+ * an <a href="#archive_explanation">archive URI</a> scheme and > * <code>device</code> is non-null, or if <code>scheme</code>, > * <code>authority</code>, <code>device</code>, <code>segments</code>, > * <code>query</code>, or <code>fragment</code> is not valid according to >@@ -491,7 +494,7 @@ > * empty-string segment at the end of the array. > * > * @exception java.lang.IllegalArgumentException if <code>segments</code>, >- * <code>query</code>, or <code>fragment</code> is not valid according to >+ * <code>query</code>, or <code>fragment</code> is not valid according to > * {@link #validSegments validSegments}, {@link #validQuery validQuery}, or > * {@link #validFragment validFragment}, respectively. > */ >@@ -507,11 +510,21 @@ > // immutability. > private static String[] fix(String[] segments) > { >- return segments == null ? NO_SEGMENTS : (String[])segments.clone(); >+// return segments == null ? NO_SEGMENTS : (String[])segments.clone(); >+ return segments == null ? NO_SEGMENTS : clone(segments); > } >- >+ >+ private static String[] clone(String[] s) { >+ String[] rv = new String[s.length]; >+ for( int i = 0; i < s.length; i++ ) { >+ rv[i] = s[i]; >+ } >+ >+ return rv; >+ } >+ > /** >- * Static factory method based on parsing a URI string, with >+ * Static factory method based on parsing a URI string, with > * <a href="#device_explanation">explicit device support</a> and handling > * for <a href="#archive_explanation">archive URIs</a> enabled. The > * specified string is parsed as described in <a >@@ -532,7 +545,7 @@ > */ > public static URI createURI(String uri) > { >- return createURIWithCache(uri); >+ return createURIWithCache(uri); > } > > /** >@@ -540,12 +553,12 @@ > * Appropriate encoding is performed for each component of the URI. > * If more than one <code>#</code> is in the string, the last one is > * assumed to be the fragment's separator, and any others are encoded. >- * >+ * > * @param ignoreEscaped <code>true</code> to leave <code>%</code> characters > * unescaped if they already begin a valid three-character escape sequence; > * <code>false</code> to encode all <code>%</code> characters. Note that > * if a <code>%</code> is not followed by 2 hex digits, it will always be >- * escaped. >+ * escaped. > * > * @exception java.lang.IllegalArgumentException if any component parsed > * from <code>uri</code> is not valid according to {@link #validScheme >@@ -582,20 +595,20 @@ > * the fragment separator, and any others should be encoded. > * @see #createURI(String, boolean, int) > */ >- public static final int FRAGMENT_LAST_SEPARATOR = 2; >+ public static final int FRAGMENT_LAST_SEPARATOR = 2; > > /** > * Static factory method that encodes and parses the given URI string. > * Appropriate encoding is performed for each component of the URI. >- * Control is provided over which, if any, <code>#</code> should be >+ * Control is provided over which, if any, <code>#</code> should be > * taken as the fragment separator and which should be encoded. >- * >+ * > * @param ignoreEscaped <code>true</code> to leave <code>%</code> characters > * unescaped if they already begin a valid three-character escape sequence; > * <code>false</code> to encode all <code>%</code> characters. Note that > * if a <code>%</code> is not followed by 2 hex digits, it will always be >- * escaped. >- * >+ * escaped. >+ * > * @param fragmentLocationStyle one of {@link #FRAGMENT_NONE}, > * {@link #FRAGMENT_FIRST_SEPARATOR}, or {@link #FRAGMENT_LAST_SEPARATOR}, > * indicating which, if any, of the <code>#</code> characters should be >@@ -615,8 +628,8 @@ > } > > /** >- * Static factory method based on parsing a URI string, with >- * <a href="#device_explanation">explicit device support</a> enabled. >+ * Static factory method based on parsing a URI string, with >+ * <a href="#device_explanation">explicit device support</a> enabled. > * Note that validity testing is not a strict as in the RFC; essentially, > * only separator characters are considered. So, for example, non-Latin > * alphabet characters appearing in the scheme would not be considered an >@@ -647,7 +660,7 @@ > // by string-parsing factory methods, instead of parseIntoURI() directly. > /** > * This method was included in the public API by mistake. >- * >+ * > * @deprecated Please use {@link #createURI createURI} instead. > */ > public static URI createURIWithCache(String uri) >@@ -725,7 +738,7 @@ > { > j = find(uri, i + 1, SEGMENT_END_HI, SEGMENT_END_LO); > String s = uri.substring(i + 1, j); >- >+ > if (s.length() > 0 && s.charAt(s.length() - 1) == DEVICE_IDENTIFIER) > { > device = s; >@@ -817,7 +830,7 @@ > * > * <p>A relative path with a specified device (something like > * <code>C:myfile.txt</code>) cannot be expressed as a valid URI. >- * >+ * > * @exception java.lang.IllegalArgumentException if <code>pathName</code> > * specifies a device and a relative path, or if any component of the path > * is not valid according to {@link #validAuthority validAuthority}, {@link >@@ -826,15 +839,15 @@ > */ > public static URI createFileURI(String pathName) > { >- File file = new File(pathName); >- String uri = File.separatorChar != '/' ? pathName.replace(File.separatorChar, SEGMENT_SEPARATOR) : pathName; >+// File file = new File(pathName); >+ String uri = File_separatorChar != '/' ? pathName.replace(File_separatorChar, SEGMENT_SEPARATOR) : pathName; > uri = encode(uri, PATH_CHAR_HI, PATH_CHAR_LO, false); >- if (file.isAbsolute()) >- { >- URI result = createURI((uri.charAt(0) == SEGMENT_SEPARATOR ? "file:" : "file:/") + uri); >- return result; >- } >- else >+// if (file.isAbsolute()) >+// { >+// URI result = createURI((uri.charAt(0) == SEGMENT_SEPARATOR ? "file:" : "file:/") + uri); >+// return result; >+// } >+// else > { > URI result = createURI(uri); > if (result.scheme() != null) >@@ -863,10 +876,10 @@ > * stand-alone EMF. > * > * <p>Path encoding is performed only if the >- * <code>org.eclipse.emf.common.util.URI.encodePlatformResourceURIs</code> >+ * <code>org.eclipse.emf.common.util.URI.encodePlatformResourceURIs</code> > * system property is set to "true". Decoding can be performed with the > * static {@link #decode(String) decode} method. >- * >+ * > * @exception java.lang.IllegalArgumentException if any component parsed > * from the path is not valid according to {@link #validDevice validDevice}, > * {@link #validSegments validSegments}, {@link #validQuery validQuery}, or >@@ -903,7 +916,7 @@ > * and other characters disallowed in URIs, as well as <code>?</code>, > * which would delimit a path from a query. Decoding can be performed with > * the static {@link #decode(String) decode} method. >- * >+ * > * @exception java.lang.IllegalArgumentException if any component parsed > * from the path is not valid according to {@link #validDevice validDevice}, > * {@link #validSegments validSegments}, {@link #validQuery validQuery}, or >@@ -913,9 +926,9 @@ > */ > public static URI createPlatformResourceURI(String pathName, boolean encode) > { >- if (File.separatorChar != SEGMENT_SEPARATOR) >+ if (File_separatorChar != SEGMENT_SEPARATOR) > { >- pathName = pathName.replace(File.separatorChar, SEGMENT_SEPARATOR); >+ pathName = pathName.replace(File_separatorChar, SEGMENT_SEPARATOR); > } > > if (encode) >@@ -925,7 +938,7 @@ > URI result = createURI((pathName.charAt(0) == SEGMENT_SEPARATOR ? "platform:/resource" : "platform:/resource/") + pathName); > return result; > } >- >+ > // Private constructor for use of static factory methods. > private URI(boolean hierarchical, String scheme, String authority, > String device, boolean absolutePath, String[] segments, >@@ -976,7 +989,7 @@ > this.hashCode = hashCode; > //this.iri = iri; > this.hierarchical = hierarchical; >- this.scheme = scheme == null ? null : scheme.intern(); >+ this.scheme = scheme == null ? null : new String(scheme); > this.authority = authority; > this.device = device; > this.absolutePath = absolutePath; >@@ -984,7 +997,7 @@ > this.query = query; > this.fragment = fragment; > } >- >+ > // Validates all of the URI components. Factory methods should call this > // before using the constructor, though they must ensure that the > // inter-component requirements described in their own Javadocs are all >@@ -1044,7 +1057,7 @@ > */ > public static boolean validScheme(String value) > { >- return value == null || !contains(value, MAJOR_SEPARATOR_HI, MAJOR_SEPARATOR_LO); >+ return value == null || !contains(value, MAJOR_SEPARATOR_HI, MAJOR_SEPARATOR_LO); > > // <p>A valid scheme may be null, or consist of a single letter followed > // by any number of letters, numbers, and the following characters: >@@ -1072,7 +1085,7 @@ > > // <p>A valid opaque part must be non-null and non-empty. It may contain > // any allowed URI characters, but its first character may not be >- // <code>/</code> >+ // <code>/</code> > > //return value != null && value.length() != 0 && > // value.charAt(0) != SEGMENT_SEPARATOR && >@@ -1128,7 +1141,7 @@ > * URI</a>. This method has been replaced by {@link #validArchiveAuthority > * validArchiveAuthority} since the same form of URI is now supported > * for schemes other than "jar". This now simply calls that method. >- * >+ * > * @deprecated As of EMF 2.0, replaced by {@link #validArchiveAuthority > * validArchiveAuthority}. > */ >@@ -1146,7 +1159,7 @@ > * character must be <code>:</code> > */ > public static boolean validDevice(String value) >- { >+ { > if (value == null) return true; > int len = value.length(); > return len > 0 && value.charAt(len - 1) == DEVICE_IDENTIFIER && >@@ -1174,7 +1187,7 @@ > return value != null && !contains(value, SEGMENT_END_HI, SEGMENT_END_LO); > > // <p>A valid path segment must be non-null and may contain any allowed URI >- // characters except for the following: <code>/ ?</code> >+ // characters except for the following: <code>/ ?</code> > > //return value != null && validate(value, SEGMENT_CHAR_HI, SEGMENT_CHAR_LO, true, true); > } >@@ -1198,7 +1211,7 @@ > > // Returns null if the specicied value is null or would be a valid path > // segment array of a URI; otherwise, the value of the first invalid >- // segment. >+ // segment. > private static String firstInvalidSegment(String[] value) > { > if (value == null) return null; >@@ -1262,7 +1275,7 @@ > boolean allowNonASCII, boolean allowEscaped) > { > for (int i = 0, len = value.length(); i < len; i++) >- { >+ { > char c = value.charAt(i); > > if (matches(c, highBitmask, lowBitmask)) continue; >@@ -1298,7 +1311,7 @@ > > /** > * Returns <code>true</code> if this is a hierarcical URI with an authority >- * component; <code>false</code> otherwise. >+ * component; <code>false</code> otherwise. > */ > public boolean hasAuthority() > { >@@ -1361,7 +1374,7 @@ > > /** > * Returns <code>true</code> if this is a hierarchical URI with an empty >- * relative path; <code>false</code> otherwise. >+ * relative path; <code>false</code> otherwise. > * > * <p>Note that <code>!hasEmpty()</code> does <em>not</em> imply that this > * URI has any path segments; however, <code>hasRelativePath && >@@ -1458,7 +1471,7 @@ > // By default, "jar", "zip", and "archive" are considered archives. > return value != null && archiveSchemes.contains(value.toLowerCase()); > } >- >+ > /** > * Returns the hash code. > */ >@@ -1487,7 +1500,7 @@ > equals(scheme, uri.scheme(), true) && > equals(authority, hierarchical ? uri.authority() : uri.opaquePart()) && > equals(device, uri.device()) && >- equals(query, uri.query()) && >+ equals(query, uri.query()) && > equals(fragment, uri.fragment()) && > segmentsEqual(uri); > } >@@ -1551,9 +1564,9 @@ > * user info portion, returns it; <code>null</code> otherwise. > */ > public String userInfo() >- { >+ { > if (!hasAuthority()) return null; >- >+ > int i = authority.indexOf(USER_INFO_SEPARATOR); > return i < 0 ? null : authority.substring(0, i); > } >@@ -1565,7 +1578,7 @@ > public String host() > { > if (!hasAuthority()) return null; >- >+ > int i = authority.indexOf(USER_INFO_SEPARATOR); > int j = authority.indexOf(PORT_SEPARATOR); > return j < 0 ? authority.substring(i + 1) : authority.substring(i + 1, j); >@@ -1601,7 +1614,7 @@ > */ > public String[] segments() > { >- return (String[])segments.clone(); >+ return clone(segments); > } > > /** >@@ -1669,9 +1682,9 @@ > > /** > * If this is a hierarchical URI with a path, returns a string >- * representation of the path, including the authority and the >- * <a href="#device_explanation">device component</a>; >- * <code>null</code> otherwise. >+ * representation of the path, including the authority and the >+ * <a href="#device_explanation">device component</a>; >+ * <code>null</code> otherwise. > * > * <p>If there is no authority, the format of this string is: > * <pre> >@@ -1734,7 +1747,7 @@ > throw new IllegalArgumentException( > "invalid query portion: " + query); > } >- return new URI(hierarchical, scheme, authority, device, absolutePath, segments, query, fragment); >+ return new URI(hierarchical, scheme, authority, device, absolutePath, segments, query, fragment); > } > > /** >@@ -1749,7 +1762,7 @@ > } > else > { >- return new URI(hierarchical, scheme, authority, device, absolutePath, segments, null, fragment); >+ return new URI(hierarchical, scheme, authority, device, absolutePath, segments, null, fragment); > } > } > >@@ -1776,7 +1789,7 @@ > throw new IllegalArgumentException( > "invalid fragment portion: " + fragment); > } >- URI result = new URI(hierarchical, scheme, authority, device, absolutePath, segments, query, fragment); >+ URI result = new URI(hierarchical, scheme, authority, device, absolutePath, segments, query, fragment); > > if (!hasFragment()) > { >@@ -1797,7 +1810,7 @@ > } > else if (cachedTrimFragment == null) > { >- cachedTrimFragment = new URI(hierarchical, scheme, authority, device, absolutePath, segments, query, null); >+ cachedTrimFragment = new URI(hierarchical, scheme, authority, device, absolutePath, segments, query, null); > } > > return cachedTrimFragment; >@@ -1866,7 +1879,7 @@ > String newQuery = query; > // note: it's okay for two URIs to share a segments array, since > // neither will ever modify it >- >+ > if (authority == null) > { > // no authority: use base's >@@ -1888,7 +1901,7 @@ > { > // relative path: merge with base and keep query (note: if the > // base has no path and this a non-empty relative path, there is >- // an implied root in the resulting path) >+ // an implied root in the resulting path) > newAbsolutePath = base.hasAbsolutePath() || !hasEmptyPath(); > newSegments = newAbsolutePath ? mergePath(base, preserveRootParents) > : NO_SEGMENTS; >@@ -1898,7 +1911,7 @@ > // else keep device, path, and query > } > // else keep authority, device, path, and query >- >+ > // always keep fragment, even if null, and use scheme from base; > // no validation needed since all components are from existing URIs > return new URI(true, base.scheme(), newAuthority, newDevice, >@@ -1937,7 +1950,7 @@ > sp = accumulate(stack, sp, segments[i], preserveRootParents); > } > >- // if the relative path is empty or ends in an empty segment, a parent >+ // if the relative path is empty or ends in an empty segment, a parent > // reference, or a self referenfce, add a trailing separator to a > // non-empty path > if (sp > 0 && (segmentCount == 0 || >@@ -1986,7 +1999,7 @@ > /** > * Finds the shortest relative or, if necessary, the absolute URI that, > * when resolved against the given <code>base</code> absolute hierarchical >- * URI using {@link #resolve(URI) resolve}, will yield this absolute URI. >+ * URI using {@link #resolve(URI) resolve}, will yield this absolute URI. > * > * @exception java.lang.IllegalArgumentException if <code>base</code> is > * non-hierarchical or is relative. >@@ -2034,7 +2047,7 @@ > > // note: these assertions imply that neither this nor the base URI has a > // relative path; thus, both have either an absolute path or no path >- >+ > // different scheme: need complete, absolute URI > if (!scheme.equalsIgnoreCase(base.scheme())) return this; > >@@ -2224,7 +2237,7 @@ > if (sp > 0 && (SEGMENT_EMPTY.equals(segments[segmentCount - 1]) || > SEGMENT_PARENT.equals(segments[segmentCount - 1]) || > SEGMENT_SELF.equals(segments[segmentCount - 1]))) >- { >+ { > stack[sp++] = SEGMENT_EMPTY; > } > >@@ -2239,7 +2252,7 @@ > * non-hierarchical URI, this looks like: > * <pre> > * scheme:opaquePart#fragment</pre> >- * >+ * > * <p>For a hierarchical URI, it looks like: > * <pre> > * scheme://authority/device/pathSegment1/pathSegment2...?query#fragment</pre> >@@ -2335,7 +2348,7 @@ > > /** > * If this URI may refer directly to a locally accessible file, as >- * determined by {@link #isFile isFile}, {@link decode decodes} and formats >+ * determined by {@link #isFile isFile}, {@link decode decodes} and formats > * the URI as a pathname to that file; returns null otherwise. > * > * <p>If there is no authority, the format of this string is: >@@ -2345,7 +2358,7 @@ > * <p>If there is an authority, it is: > * <pre> > * //authority/device/pathSegment1/pathSegment2...</pre> >- * >+ * > * <p>However, the character used as a separator is system-dependant and > * obtained from {@link java.io.File#separatorChar}. > */ >@@ -2354,7 +2367,7 @@ > if (!isFile()) return null; > > StringBuffer result = new StringBuffer(); >- char separator = File.separatorChar; >+ char separator = File_separatorChar; > > if (hasAuthority()) > { >@@ -2433,14 +2446,14 @@ > if (!isHierarchical()) return this; > > // absolute path or no path -> absolute path >- boolean newAbsolutePath = !hasRelativePath(); >+ boolean newAbsolutePath = !hasRelativePath(); > > int len = this.segments.length; > int segmentsCount = segments.length; > String[] newSegments = new String[len + segmentsCount]; > System.arraycopy(this.segments, 0, newSegments, 0, len); > System.arraycopy(segments, 0, newSegments, len, segmentsCount); >- >+ > return new URI(true, scheme, authority, device, newAbsolutePath, > newSegments, query, fragment); > } >@@ -2453,11 +2466,11 @@ > * > * <p>Note that if all segments are trimmed from an absolute path, the > * root absolute path remains. >- * >+ * > * @param i the number of segments to be trimmed in the returned URI. If > * less than 1, this URI is returned unchanged; if equal to or greater > * than the number of segments in this URI's path, all segments are >- * trimmed. >+ * trimmed. > */ > public URI trimSegments(int i) > { >@@ -2484,7 +2497,7 @@ > */ > public boolean hasTrailingPathSeparator() > { >- return segments.length > 0 && >+ return segments.length > 0 && > SEGMENT_EMPTY.equals(segments[segments.length - 1]); > } > >@@ -2540,10 +2553,10 @@ > String[] newSegments = new String[len]; > System.arraycopy(segments, 0, newSegments, 0, len - 1); > newSegments[len - 1] = newLastSegment.toString(); >- >+ > // note: segments.length > 0 -> hierarchical > return new URI(true, scheme, authority, device, absolutePath, >- newSegments, query, fragment); >+ newSegments, query, fragment); > } > > /** >@@ -2566,7 +2579,7 @@ > > // note: segments.length > 0 -> hierarchical > return new URI(true, scheme, authority, device, absolutePath, >- newSegments, query, fragment); >+ newSegments, query, fragment); > } > > /** >@@ -2674,7 +2687,7 @@ > { > return NO_SEGMENTS; > } >- >+ > // Otherwise, the path needs only the remaining segments. > String[] newSegments = new String[segments.length - i]; > System.arraycopy(segments, i, newSegments, 0, newSegments.length); >@@ -2685,12 +2698,12 @@ > * Encodes a string so as to produce a valid opaque part value, as defined > * by the RFC. All excluded characters, such as space and <code>#</code>, > * are escaped, as is <code>/</code> if it is the first character. >- * >+ * > * @param ignoreEscaped <code>true</code> to leave <code>%</code> characters > * unescaped if they already begin a valid three-character escape sequence; > * <code>false</code> to encode all <code>%</code> characters. Note that > * if a <code>%</code> is not followed by 2 hex digits, it will always be >- * escaped. >+ * escaped. > */ > public static String encodeOpaquePart(String value, boolean ignoreEscaped) > { >@@ -2704,12 +2717,12 @@ > * Encodes a string so as to produce a valid authority, as defined by the > * RFC. All excluded characters, such as space and <code>#</code>, > * are escaped, as are <code>/</code> and <code>?</code> >- * >+ * > * @param ignoreEscaped <code>true</code> to leave <code>%</code> characters > * unescaped if they already begin a valid three-character escape sequence; > * <code>false</code> to encode all <code>%</code> characters. Note that > * if a <code>%</code> is not followed by 2 hex digits, it will always be >- * escaped. >+ * escaped. > */ > public static String encodeAuthority(String value, boolean ignoreEscaped) > { >@@ -2720,12 +2733,12 @@ > * Encodes a string so as to produce a valid segment, as defined by the > * RFC. All excluded characters, such as space and <code>#</code>, > * are escaped, as are <code>/</code> and <code>?</code> >- * >+ * > * @param ignoreEscaped <code>true</code> to leave <code>%</code> characters > * unescaped if they already begin a valid three-character escape sequence; > * <code>false</code> to encode all <code>%</code> characters. Note that > * if a <code>%</code> is not followed by 2 hex digits, it will always be >- * escaped. >+ * escaped. > */ > public static String encodeSegment(String value, boolean ignoreEscaped) > { >@@ -2735,12 +2748,12 @@ > /** > * Encodes a string so as to produce a valid query, as defined by the RFC. > * Only excluded characters, such as space and <code>#</code>, are escaped. >- * >+ * > * @param ignoreEscaped <code>true</code> to leave <code>%</code> characters > * unescaped if they already begin a valid three-character escape sequence; > * <code>false</code> to encode all <code>%</code> characters. Note that > * if a <code>%</code> is not followed by 2 hex digits, it will always be >- * escaped. >+ * escaped. > */ > public static String encodeQuery(String value, boolean ignoreEscaped) > { >@@ -2751,12 +2764,12 @@ > * Encodes a string so as to produce a valid fragment, as defined by the > * RFC. Only excluded characters, such as space and <code>#</code>, are > * escaped. >- * >+ * > * @param ignoreEscaped <code>true</code> to leave <code>%</code> characters > * unescaped if they already begin a valid three-character escape sequence; > * <code>false</code> to encode all <code>%</code> characters. Note that > * if a <code>%</code> is not followed by 2 hex digits, it will always be >- * escaped. >+ * escaped. > */ > public static String encodeFragment(String value, boolean ignoreEscaped) > { >@@ -2779,7 +2792,7 @@ > result.append(scheme); > result.append(SCHEME_SEPARATOR); > } >- >+ > int j = > fragmentLocationStyle == FRAGMENT_FIRST_SEPARATOR ? uri.indexOf(FRAGMENT_SEPARATOR) : > fragmentLocationStyle == FRAGMENT_LAST_SEPARATOR ? uri.lastIndexOf(FRAGMENT_SEPARATOR) : -1; >@@ -2798,7 +2811,7 @@ > String sspart = uri.substring(++i); > result.append(encode(sspart, URIC_HI, URIC_LO, ignoreEscaped)); > } >- >+ > return result.toString(); > } > >@@ -2871,7 +2884,7 @@ > > for (int i = 0, len = value.length(); i < len; i++) > { >- if (isEscaped(value, i)) >+ if (isEscaped(value, i)) > { > if (result == null) > { >@@ -2918,12 +2931,12 @@ > * Returns <code>true</code> if this URI contains non-ASCII characters; > * <code>false</code> otherwise. > * >- * This unused code is included for possible future use... >+ * This unused code is included for possible future use... > */ > /* > public boolean isIRI() > { >- return iri; >+ return iri; > } > > // Returns true if the given string contains any non-ASCII characters; >@@ -2962,7 +2975,7 @@ > { > eSegments[i] = encodeAsASCII(segments[i]); > } >- cachedASCIIURI = new URI(hierarchical, scheme, eAuthority, eDevice, absolutePath, eSegments, eQuery, eFragment); >+ cachedASCIIURI = new URI(hierarchical, scheme, eAuthority, eDevice, absolutePath, eSegments, eQuery, eFragment); > > } > return cachedASCIIURI; >Index: src/org/eclipse/emf/common/util/DelegatingEList.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/util/DelegatingEList.java,v >retrieving revision 1.6 >diff -u -r1.6 DelegatingEList.java >--- src/org/eclipse/emf/common/util/DelegatingEList.java 6 Mar 2006 13:17:06 -0000 1.6 >+++ src/org/eclipse/emf/common/util/DelegatingEList.java 12 Nov 2007 18:36:23 -0000 >@@ -32,6 +32,9 @@ > */ > public abstract class DelegatingEList extends AbstractList implements EList, Cloneable, Serializable > { >+//FIXME GWT CHANGE modCount not available, file bug against GWT? >+ protected transient int modCount = 0; >+ > /** > * Creates an empty instance. > */ >Index: src/org/eclipse/emf/common/util/BasicEMap.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/util/BasicEMap.java,v >retrieving revision 1.6 >diff -u -r1.6 BasicEMap.java >--- src/org/eclipse/emf/common/util/BasicEMap.java 8 Jun 2005 06:19:08 -0000 1.6 >+++ src/org/eclipse/emf/common/util/BasicEMap.java 12 Nov 2007 18:36:22 -0000 >@@ -17,9 +17,9 @@ > package org.eclipse.emf.common.util; > > >-import java.io.IOException; >-import java.io.ObjectInputStream; >-import java.io.ObjectOutputStream; >+//import java.io.IOException; >+//import java.io.ObjectInputStream; >+//import java.io.ObjectOutputStream; > import java.io.Serializable; > import java.util.AbstractCollection; > import java.util.AbstractSet; >@@ -716,9 +716,13 @@ > */ > public Object clone() > { >- try >- { >- BasicEMap result = (BasicEMap)super.clone(); >+//FIXME GWT CHANGE .clone is not supported by GWT >+// but creating a new list is not 100% the same! >+// Should we raise a bug against GWT and ask for clone-support for lists? >+// try >+// { >+// BasicEMap result = (BasicEMap)super.clone(); >+ BasicEMap result = new BasicEMap(); > if (entryData != null) > { > result.entryData = newEntryData(entryData.length); >@@ -730,11 +734,11 @@ > result.view = null; > result.modCount = 0; > return result; >- } >- catch (CloneNotSupportedException exception) >- { >- throw new InternalError(); >- } >+// } >+// catch (CloneNotSupportedException exception) >+// { >+// throw new InternalError(); >+// } > } > > protected class DelegatingMap implements EMap.InternalMapView >@@ -1447,62 +1451,62 @@ > return false; > } > } >- >- private void writeObject(ObjectOutputStream objectOutputStream) throws IOException >- { >- objectOutputStream.defaultWriteObject(); >- >- if (entryData == null) >- { >- objectOutputStream.writeInt(0); >- } >- else >- { >- // Write the capacity. >- // >- objectOutputStream.writeInt(entryData.length); >- >- // Write all the entryData; there will be size of them. >- // >- for (int i = 0; i < entryData.length; ++i) >- { >- BasicEList eList = entryData[i]; >- if (eList != null) >- { >- Entry [] entries = (Entry [])eList.data; >- int size = eList.size; >- for (int j = 0; j < size; ++j) >- { >- Entry entry = entries[j]; >- objectOutputStream.writeObject(entry.getKey()); >- objectOutputStream.writeObject(entry.getValue()); >- } >- } >- } >- } >- } >- >- private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException >- { >- objectInputStream.defaultReadObject(); >- >- // Restore the capacity, if there was any. >- // >- int capacity = objectInputStream.readInt(); >- if (capacity > 0) >- { >- entryData = newEntryData(capacity); >- >- // Read all size number of entryData. >- // >- for (int i = 0; i < size; ++i) >- { >- Object key = objectInputStream.readObject(); >- Object value = objectInputStream.readObject(); >- put(key, value); >- } >- } >- } >+//XXX GWT CHANGE Serialization not available >+// private void writeObject(ObjectOutputStream objectOutputStream) throws IOException >+// { >+// objectOutputStream.defaultWriteObject(); >+// >+// if (entryData == null) >+// { >+// objectOutputStream.writeInt(0); >+// } >+// else >+// { >+// // Write the capacity. >+// // >+// objectOutputStream.writeInt(entryData.length); >+// >+// // Write all the entryData; there will be size of them. >+// // >+// for (int i = 0; i < entryData.length; ++i) >+// { >+// BasicEList eList = entryData[i]; >+// if (eList != null) >+// { >+// Entry [] entries = (Entry [])eList.data; >+// int size = eList.size; >+// for (int j = 0; j < size; ++j) >+// { >+// Entry entry = entries[j]; >+// objectOutputStream.writeObject(entry.getKey()); >+// objectOutputStream.writeObject(entry.getValue()); >+// } >+// } >+// } >+// } >+// } >+// >+// private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException >+// { >+// objectInputStream.defaultReadObject(); >+// >+// // Restore the capacity, if there was any. >+// // >+// int capacity = objectInputStream.readInt(); >+// if (capacity > 0) >+// { >+// entryData = newEntryData(capacity); >+// >+// // Read all size number of entryData. >+// // >+// for (int i = 0; i < size; ++i) >+// { >+// Object key = objectInputStream.readObject(); >+// Object value = objectInputStream.readObject(); >+// put(key, value); >+// } >+// } >+// } > > /** > * Delegates to {@link #delegateEList}. >Index: src/org/eclipse/emf/common/util/BasicDiagnostic.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/util/BasicDiagnostic.java,v >retrieving revision 1.10 >diff -u -r1.10 BasicDiagnostic.java >--- src/org/eclipse/emf/common/util/BasicDiagnostic.java 1 May 2006 21:09:48 -0000 1.10 >+++ src/org/eclipse/emf/common/util/BasicDiagnostic.java 12 Nov 2007 18:36:19 -0000 >@@ -22,6 +22,8 @@ > > import org.eclipse.core.runtime.IStatus; > >+//XXX GWT CHANGE >+import org.eclipse.core.internal.runtime.Util; > > /** > * A basic implementation of a diagostic that that also acts as a chain. >@@ -362,8 +364,8 @@ > { > return toDiagnostic(throwable.getCause()); > } >- >- String message = throwable.getClass().getName(); >+//XXX GWT CHANGE >+ String message = Util.getClassNameAsString(throwable); > int index = message.lastIndexOf('.'); > if (index >= 0) > { >Index: src/org/eclipse/emf/common/CommonPlugin.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/CommonPlugin.java,v >retrieving revision 1.11 >diff -u -r1.11 CommonPlugin.java >--- src/org/eclipse/emf/common/CommonPlugin.java 14 Feb 2006 18:14:43 -0000 1.11 >+++ src/org/eclipse/emf/common/CommonPlugin.java 12 Nov 2007 18:36:19 -0000 >@@ -1,201 +1,23 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2004 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: CommonPlugin.java,v 1.11 2006/02/14 18:14:43 marcelop Exp $ >- */ > package org.eclipse.emf.common; > >+public class CommonPlugin { > >-import java.io.IOException; >-import java.net.URL; >+ public static final CommonPlugin INSTANCE = new CommonPlugin(); >+ >+ public static Class loadClass(String string, String string2) { >+ throw new UnsupportedOperationException(); >+ } >+ >+ public String getString(String string, String[] strings) { >+ return string; >+ } >+ >+ public String getString(String string) { >+ return string; >+ } >+ >+ public void log(Throwable fillInStackTrace) { >+ System.err.println(fillInStackTrace.toString()); >+ } > >-import org.eclipse.core.runtime.Platform; >-import org.eclipse.emf.common.util.ResourceLocator; >-import org.eclipse.emf.common.util.URI; >- >- >-/** >- * The <b>Plugin</b> for the model EMF.Common library. >- * EMF must run >- * within an Eclipse workbench, >- * within a headless Eclipse workspace, >- * or just stand-alone as part of some other application. >- * To support this, all resource access should be directed to the resource locator, >- * which can redirect the service as appopriate to the runtime. >- * During stand-alone invocation no plugin initialization takes place. >- * In this case, common.resources.jar must be on the CLASSPATH. >- * @see #INSTANCE >- */ >-public final class CommonPlugin extends EMFPlugin >-{ >- /** >- * The singleton instance of the plugin. >- */ >- public static final CommonPlugin INSTANCE = new CommonPlugin(); >- >- /** >- * The one instance of this class. >- */ >- private static Implementation plugin; >- >- /** >- * Creates the singleton instance. >- */ >- private CommonPlugin() >- { >- super(new ResourceLocator[] {}); >- } >- >- /* >- * Javadoc copied from base class. >- */ >- public ResourceLocator getPluginResourceLocator() >- { >- return plugin; >- } >- >- /** >- * Returns the singleton instance of the Eclipse plugin. >- * @return the singleton instance. >- */ >- public static Implementation getPlugin() >- { >- return plugin; >- } >- >- /** >- * Use the platform, if available, to convert to a local URI. >- */ >- public static URI asLocalURI(URI uri) >- { >- return plugin == null ? uri : Implementation.asLocalURI(uri); >- } >- >- /** >- * Use the platform, if available, to resolve the URI. >- */ >- public static URI resolve(URI uri) >- { >- return plugin == null ? uri : Implementation.resolve(uri); >- } >- >- /** >- * Use the platform, if available, to load the named class using the right class loader. >- */ >- public static Class loadClass(String pluginID, String className) throws ClassNotFoundException >- { >- return plugin == null ? Class.forName(className) : Implementation.loadClass(pluginID, className); >- } >- >- /** >- * The actual implementation of the Eclipse <b>Plugin</b>. >- */ >- public static class Implementation extends EclipsePlugin >- { >- /** >- * Creates an instance. >- */ >- public Implementation() >- { >- super(); >- >- // Remember the static instance. >- // >- plugin = this; >- } >- >- /** >- * Use the platform to convert to a local URI. >- */ >- protected static URI asLocalURI(URI uri) >- { >- try >- { >- String fragment = uri.fragment(); >- URL url = Platform.asLocalURL(new URL(uri.trimFragment().toString())); >- return fix(url, fragment); >- } >- catch (IOException exception) >- { >- } >- return uri; >- } >- >- /** >- * Use the platform to convert to a local URI. >- */ >- protected static URI resolve(URI uri) >- { >- String fragment = uri.fragment(); >- URI uriWithoutFragment = uri.trimFragment(); >- String uriWithoutFragmentToString = uriWithoutFragment.toString(); >- >- URL url = null; >- try >- { >- url = Platform.resolve(new URL(uriWithoutFragmentToString)); >- } >- catch (IOException exception1) >- { >- // Platform.resolve() doesn't work if the project is encoded. >- // >- try >- { >- uriWithoutFragmentToString = URI.decode(uriWithoutFragmentToString); >- url = Platform.resolve(new URL(uriWithoutFragmentToString)); >- } >- catch (IOException exception2) >- { >- } >- } >- if (url != null) >- { >- try >- { >- return fix(url, fragment); >- } >- catch (IOException exception) >- { >- } >- } >- >- return uri; >- } >- >- protected static URI fix(URL url, String fragment) throws IOException >- { >- // Only file-scheme URIs will be re-encoded. If a URI was decoded in the workaround >- // above, and Platform.resolve() didn't return a file-scheme URI, then this will return >- // an decoded URI. >- // >- URI result = >- "file".equalsIgnoreCase(url.getProtocol()) ? >- URI.createFileURI(URI.decode(url.getFile())) : >- URI.createURI(url.toString()); >- if (fragment != null) >- { >- result = result.appendFragment(fragment); >- } >- return result; >- } >- >- /** >- * Use the platform to load the named class using the right class loader. >- */ >- public static Class loadClass(String pluginID, String className) throws ClassNotFoundException >- { >- return Platform.getBundle(pluginID).loadClass(className); >- } >- } > } >Index: src/org/eclipse/emf/common/EMFPlugin.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/EMFPlugin.java,v >retrieving revision 1.15 >diff -u -r1.15 EMFPlugin.java >--- src/org/eclipse/emf/common/EMFPlugin.java 13 Sep 2006 18:58:14 -0000 1.15 >+++ src/org/eclipse/emf/common/EMFPlugin.java 12 Nov 2007 18:36:19 -0000 >@@ -1,832 +1,7 @@ >-/** >- * <copyright> >- * >- * Copyright (c) 2002-2006 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM - Initial API and implementation >- * >- * </copyright> >- * >- * $Id: EMFPlugin.java,v 1.15 2006/09/13 18:58:14 emerks Exp $ >- */ > package org.eclipse.emf.common; > >+public class EMFPlugin { > >-import java.io.IOException; >-import java.io.InputStream; >-import java.net.MalformedURLException; >-import java.net.URL; >-import java.text.MessageFormat; >-import java.util.HashMap; >-import java.util.Map; >-import java.util.MissingResourceException; >-import java.util.PropertyResourceBundle; >-import java.util.ResourceBundle; >-import java.util.jar.Manifest; >+ public static boolean IS_ECLIPSE_RUNNING = false; > >-import org.osgi.framework.Bundle; >- >-import org.eclipse.core.runtime.ILog; >-import org.eclipse.core.runtime.IStatus; >-import org.eclipse.core.runtime.Platform; >-import org.eclipse.core.runtime.Plugin; >-import org.eclipse.core.runtime.Status; >- >-import org.eclipse.emf.common.util.Logger; >-import org.eclipse.emf.common.util.ResourceLocator; >-import org.eclipse.emf.common.util.URI; >-import org.eclipse.emf.common.util.WrappedException; >- >- >-/** >- * EMF must run >- * within an Eclipse workbench, >- * within a headless Eclipse workspace, >- * or just stand-alone as part of some other application. >- * To support this, all resource access (e.g., NL strings, images, and so on) is directed to the resource locator methods, >- * which can redirect the service as appopriate to the runtime. >- * During Eclipse invocation, the implementation delegates to a plugin implementation. >- * During stand-alone invocation, no plugin initialization takes place, >- * so the implementation delegates to a resource JAR on the CLASSPATH. >- * The resource jar will typically <b>not</b> be on the CLASSPATH during Eclipse invocation. >- * It will contain things like the icons and the .properties, >- * which are available in a different way during Eclipse invocation. >- * @see ResourceLocator >- * @see Logger >- */ >-public abstract class EMFPlugin implements ResourceLocator, Logger >-{ >- public static final boolean IS_ECLIPSE_RUNNING; >- static >- { >- boolean result = false; >- try >- { >- result = Platform.isRunning(); >- } >- catch (Throwable exception) >- { >- } >- IS_ECLIPSE_RUNNING = result; >- } >- >- protected ResourceLocator [] delegateResourceLocators; >- protected URL baseURL; >- protected ResourceBundle untranslatedResourceBundle; >- protected ResourceBundle resourceBundle; >- protected Map strings = new HashMap(); >- protected Map untranslatedStrings = new HashMap(); >- protected boolean shouldTranslate = true; >- protected Map images = new HashMap(); >- >- public EMFPlugin(ResourceLocator [] delegateResourceLocators) >- { >- this.delegateResourceLocators = delegateResourceLocators; >- } >- >- /** >- * Returns an Eclipse plugin implementation of a resource locator. >- * @return an Eclipse plugin implementation of a resource locator. >- */ >- public abstract ResourceLocator getPluginResourceLocator(); >- >- /** >- * Returns an Eclipse plugin implementation of a logger. >- * @return an Eclipse plugin implementation of a logger. >- */ >- public Logger getPluginLogger() >- { >- return (Logger)getPluginResourceLocator(); >- } >- >- public String getSymbolicName() >- { >- ResourceLocator resourceLocator = getPluginResourceLocator(); >- if (resourceLocator instanceof InternalEclipsePlugin) >- { >- return ((InternalEclipsePlugin)resourceLocator).getSymbolicName(); >- } >- else >- { >- String result = getClass().getName(); >- return result.substring(0, result.lastIndexOf('.')); >- } >- } >- >- private static final URI DOT = URI.createURI("."); >- /* >- * Javadoc copied from interface. >- */ >- public URL getBaseURL() >- { >- if (baseURL == null) >- { >- if (getPluginResourceLocator() == null) >- { >- try >- { >- // Determine the base URL by looking for the plugin.properties file in the standard way. >- // >- Class theClass = getClass(); >- URL pluginPropertiesURL = theClass.getResource("plugin.properties"); >- if (pluginPropertiesURL == null) >- { >- // If that fails, determine the URL for the class itself. >- // The URL will be of one of the following forms, >- // so there are a few good places to consider looking for the plugin.properties. >- // >- // For a plugin.xml with runtime="common.jar": >- // jar:file:/D:/sandbox/unpackage1-3.1M7/eclipse/plugins/org.eclipse.emf.common/common.jar!/org/eclipse/common/CommonPlugin.class >- // >- // For a plugin.xml with runtime="runtime/common.jar": >- // jar:file:/D:/sandbox/unpackage1-3.1M7/eclipse/plugins/org.eclipse.emf.common/runtime/common.jar!/org/eclipse/common/CommonPlugin.class >- // >- // For a plugin.xml with runtime="." where the plugin is jarred: >- // jar:file:/D:/sandbox/unpackage1-3.1M7/eclipse/plugins/org.eclipse.emf.common.jar!/org/eclipse/common/CommonPlugin.class >- // >- // For a plugin.xml with runtime="." where the plugin is not jarred. >- // file:/D:/sandbox/unpackage1-3.1M7/eclipse/plugins/org.eclipse.emf.common/org/eclipse/emf/common/CommonPlugin.class >- // >- // Running in PDE with bin on classpath: >- // file:/D:/sandbox/unpackage1-3.1M7/eclipse/plugins/org.eclipse.emf.common/bin/org/eclipse/emf/common/CommonPlugin.class >- // >- String className = theClass.getName(); >- int index = className.lastIndexOf("."); >- URL classURL = theClass.getResource((index == -1 ? className : className.substring(index + 1)) + ".class"); >- URI uri = URI.createURI(classURL.toString()); >- >- // Trim off the segments corresponding to the package nesting. >- // >- int count = 1; >- for (int i = 0; (i = className.indexOf('.', i)) != -1; ++i) >- { >- ++count; >- } >- uri = uri.trimSegments(count); >- >- // For an archive URI, check for the plugin.properties in the archive. >- // >- if (URI.isArchiveScheme(uri.scheme())) >- { >- try >- { >- // If we can open an input stream, then the plugin.properties is there, and we have a good base URL. >- // >- InputStream inputStream = new URL(uri.appendSegment("plugin.properties").toString()).openStream(); >- inputStream.close(); >- baseURL = new URL(uri.toString()); >- } >- catch (IOException exception) >- { >- // If the plugin.properties isn't within the root of the archive, >- // create a new URI for the folder location of the archive, >- // so we can look in the folder that contains it. >- // >- uri = URI.createURI(uri.authority()).trimSegments(1); >- } >- } >- >- // If we didn't find the plugin.properties in the usual place nor in the archive... >- // >- if (baseURL == null) >- { >- // Trim off the "bin" or "runtime" segment. >- // >- String lastSegment = uri.lastSegment(); >- if ("bin".equals(lastSegment) || "runtime".equals(lastSegment)) >- { >- uri = uri.trimSegments(1); >- } >- uri = uri.appendSegment("plugin.properties"); >- try >- { >- // If we can open an input stream, then the plugin.properties is in the folder, and we have a good base URL. >- // >- InputStream inputStream = new URL(uri.toString()).openStream(); >- inputStream.close(); >- baseURL = new URL(DOT.resolve(uri).toString()); >- } >- catch (IOException exception) >- { >- } >- } >- >- // If we still don't have a good base URL, complain about it. >- // >- if (baseURL == null) >- { >- String resourceName = >- index == -1 ? >- "plugin.properties" : >- className.substring(0, index + 1).replace('.','/') + "plugin.properties"; >- throw new MissingResourceException("Missing properties: " + resourceName, theClass.getName(), "plugin.properties"); >- } >- } >- else >- { >- baseURL = new URL(DOT.resolve(URI.createURI(pluginPropertiesURL.toString())).toString()); >- } >- } >- catch (IOException exception) >- { >- throw new WrappedException(exception); >- } >- } >- else >- { >- baseURL = getPluginResourceLocator().getBaseURL(); >- } >- } >- >- return baseURL; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public Object getImage(String key) >- { >- Object result = (URL)images.get(key); >- if (result == null) >- { >- if (getPluginResourceLocator() == null) >- { >- try >- { >- result = doGetImage(key); >- } >- catch (MalformedURLException exception) >- { >- throw new WrappedException(exception); >- } >- catch (IOException exception) >- { >- result = delegatedGetImage(key); >- } >- } >- else >- { >- try >- { >- result = getPluginResourceLocator().getImage(key); >- } >- catch (MissingResourceException exception) >- { >- result = delegatedGetImage(key); >- } >- } >- >- images.put(key, result); >- } >- >- return result; >- } >- >- /** >- * Does the work of fetching the image associated with the key. >- * It ensures that the image exists. >- * @param key the key of the image to fetch. >- * @exception IOException if an image doesn't exist. >- * @return the description of the image associated with the key. >- */ >- protected Object doGetImage(String key) throws IOException >- { >- URL url = new URL(getBaseURL() + "icons/" + key + ".gif"); >- InputStream inputStream = url.openStream(); >- inputStream.close(); >- return url; >- } >- >- /** >- * Does the work of fetching the image associated with the key, >- * when the image resource is not available locally. >- * @param key the key of the image to fetch. >- * @exception MissingResourceException if the image resource doesn't exist anywhere. >- * @see #delegateResourceLocators >- */ >- protected Object delegatedGetImage(String key) throws MissingResourceException >- { >- for (int i = 0; i < delegateResourceLocators.length; ++i) >- { >- try >- { >- return delegateResourceLocators[i].getImage(key); >- } >- catch (MissingResourceException exception) >- { >- } >- } >- >- throw >- new MissingResourceException >- (CommonPlugin.INSTANCE.getString("_UI_ImageResourceNotFound_exception", new Object [] { key }), >- getClass().getName(), >- key); >- } >- >- /** >- * Indicates whether strings should be translated by default. >- * >- * @return <code>true</code> if strings should be translated by default; <code>false</code> otherwise. >- */ >- public boolean shouldTranslate() >- { >- return shouldTranslate; >- } >- >- /** >- * Sets whether strings should be translated by default. >- * >- * @param shouldTranslate whether strings should be translated by default. >- */ >- public void setShouldTranslate(boolean shouldTranslate) >- { >- this.shouldTranslate = shouldTranslate; >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public String getString(String key) >- { >- return getString(key, shouldTranslate()); >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public String getString(String key, boolean translate) >- { >- Map stringMap = translate ? strings : untranslatedStrings; >- String result = (String)stringMap.get(key); >- if (result == null) >- { >- try >- { >- if (getPluginResourceLocator() == null) >- { >- ResourceBundle bundle = translate ? resourceBundle : untranslatedResourceBundle; >- if (bundle == null) >- { >- String packageName = getClass().getName(); >- int index = packageName.lastIndexOf("."); >- if (index != -1) >- { >- packageName = packageName.substring(0, index); >- } >- if (translate) >- { >- try >- { >- bundle = resourceBundle = ResourceBundle.getBundle(packageName + ".plugin"); >- } >- catch (MissingResourceException exception) >- { >- // If the bundle can't be found the normal way, try to find it as the base URL. >- // If that also doesn't work, rethrow the original exception. >- // >- try >- { >- InputStream inputStream = new URL(getBaseURL().toString() + "plugin.properties").openStream(); >- bundle = untranslatedResourceBundle = resourceBundle = new PropertyResourceBundle(inputStream); >- inputStream.close(); >- } >- catch (IOException ioException) >- { >- } >- if (resourceBundle == null) >- { >- throw exception; >- } >- } >- } >- else >- { >- String resourceName = getBaseURL().toString() + "plugin.properties"; >- try >- { >- InputStream inputStream = new URL(resourceName).openStream(); >- bundle = untranslatedResourceBundle = new PropertyResourceBundle(inputStream); >- inputStream.close(); >- } >- catch (IOException ioException) >- { >- throw new MissingResourceException("Missing properties: " + resourceName, getClass().getName(), "plugin.properties"); >- } >- } >- } >- result = bundle.getString(key); >- } >- else >- { >- result = getPluginResourceLocator().getString(key, translate); >- } >- } >- catch (MissingResourceException exception) >- { >- result = delegatedGetString(key, translate); >- } >- >- stringMap.put(key, result); >- } >- >- return result; >- } >- >- /** >- * Does the work of fetching the string associated with the key, >- * when the string resource is not available locally. >- * @param key the key of the string to fetch. >- * @exception MissingResourceException if the string resource doesn't exist anywhere. >- * @see #delegateResourceLocators >- */ >- protected String delegatedGetString(String key, boolean translate) >- { >- for (int i = 0; i < delegateResourceLocators.length; ++i) >- { >- try >- { >- return delegateResourceLocators[i].getString(key, translate); >- } >- catch (MissingResourceException exception) >- { >- } >- } >- >- throw >- new MissingResourceException >- (MessageFormat.format("The string resource ''{0}'' could not be located", new Object [] { key }), >- getClass().getName(), >- key); >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public String getString(String key, Object [] substitutions) >- { >- return getString(key, substitutions, shouldTranslate()); >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public String getString(String key, Object [] substitutions, boolean translate) >- { >- return MessageFormat.format(getString(key, translate), substitutions); >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public void log(Object logEntry) >- { >- Logger logger = getPluginLogger(); >- if (logger == null) >- { >- if (logEntry instanceof Throwable) >- { >- ((Throwable)logEntry).printStackTrace(System.err); >- } >- else >- { >- System.err.println(logEntry); >- } >- } >- else >- { >- logger.log(logEntry); >- } >- } >- >- /** >- * The actual implementation of an Eclipse <b>Plugin</b>. >- */ >- public static abstract class EclipsePlugin extends Plugin implements ResourceLocator, Logger, InternalEclipsePlugin >- { >- /** >- * The EMF plug-in APIs are all delegated to this helper, so that code can be shared by plug-in >- * implementations with a different platform base class (e.g. AbstractUIPlugin). >- */ >- protected InternalHelper helper; >- >- /** >- * Creates an instance. >- */ >- public EclipsePlugin() >- { >- super(); >- helper = new InternalHelper(this); >- } >- >- /** >- * Creates an instance. >- * @param descriptor the description of the plugin. >- * @deprecated >- */ >- public EclipsePlugin(org.eclipse.core.runtime.IPluginDescriptor descriptor) >- { >- super(descriptor); >- helper = new InternalHelper(this); >- } >- >- /** >- * Return the plugin ID. >- */ >- public String getSymbolicName() >- { >- return helper.getSymbolicName(); >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public URL getBaseURL() >- { >- return helper.getBaseURL(); >- } >- >- /* >- * Javadoc copied from interface. >- */ >- public Object getImage(String key) >- { >- try >- { >- return doGetImage(key); >- } >- catch (MalformedURLException exception) >- { >- throw new WrappedException(exception); >- } >- catch (IOException exception) >- { >- throw >- new MissingResourceException >- (CommonPlugin.INSTANCE.getString("_UI_StringResourceNotFound_exception", new Object [] { key }), >- getClass().getName(), >- key); >- } >- } >- >- /** >- * Does the work of fetching the image associated with the key. >- * It ensures that the image exists. >- * @param key the key of the image to fetch. >- * @exception IOException if an image doesn't exist. >- * @return the description of the image associated with the key. >- */ >- protected Object doGetImage(String key) throws IOException >- { >- return helper.getImage(key); >- } >- >- public String getString(String key) >- { >- return helper.getString(key, true); >- } >- >- public String getString(String key, boolean translate) >- { >- return helper.getString(key, translate); >- } >- >- public String getString(String key, Object [] substitutions) >- { >- return helper.getString(key, substitutions, true); >- } >- >- public String getString(String key, Object [] substitutions, boolean translate) >- { >- return helper.getString(key, substitutions, translate); >- } >- >- public void log(Object logEntry) >- { >- helper.log(logEntry); >- } >- } >- >- /** >- * This just provides a common interface for the Eclipse plugins supported by EMF. >- * It is not considered API and should not be used by clients. >- */ >- public static interface InternalEclipsePlugin >- { >- String getSymbolicName(); >- } >- >- /** >- * This just provides a common delegate for non-UI and UI plug-in classes. >- * It is not considered API and should not be used by clients. >- */ >- public static class InternalHelper >- { >- protected Plugin plugin; >- protected ResourceBundle resourceBundle; >- protected ResourceBundle untranslatedResourceBundle; >- >- public InternalHelper(Plugin plugin) >- { >- this.plugin = plugin; >- } >- >- protected Bundle getBundle() >- { >- return plugin.getBundle(); >- } >- >- protected ILog getLog() >- { >- return plugin.getLog(); >- } >- >- /** >- * Return the plugin ID. >- */ >- public String getSymbolicName() >- { >- return getBundle().getSymbolicName(); >- } >- >- public URL getBaseURL() >- { >- return getBundle().getEntry("/"); >- } >- >- /** >- * Fetches the image associated with the given key. It ensures that the image exists. >- * @param key the key of the image to fetch. >- * @exception IOException if an image doesn't exist. >- * @return the description of the image associated with the key. >- */ >- public Object getImage(String key) throws IOException >- { >- URL url = new URL(getBaseURL() + "icons/" + key + ".gif"); >- InputStream inputStream = url.openStream(); >- inputStream.close(); >- return url; >- } >- >- public String getString(String key, boolean translate) >- { >- ResourceBundle bundle = translate ? resourceBundle : untranslatedResourceBundle; >- if (bundle == null) >- { >- if (translate) >- { >- bundle = resourceBundle = Platform.getResourceBundle(getBundle()); >- } >- else >- { >- String resourceName = getBaseURL().toString() + "plugin.properties"; >- try >- { >- InputStream inputStream = new URL(resourceName).openStream(); >- bundle = untranslatedResourceBundle = new PropertyResourceBundle(inputStream); >- inputStream.close(); >- } >- catch (IOException ioException) >- { >- throw new MissingResourceException("Missing properties: " + resourceName, getClass().getName(), "plugin.properties"); >- } >- } >- } >- return bundle.getString(key); >- } >- >- public String getString(String key, Object [] substitutions, boolean translate) >- { >- return MessageFormat.format(getString(key, translate), substitutions); >- } >- >- public void log(Object logEntry) >- { >- IStatus status; >- if (logEntry instanceof IStatus) >- { >- status = (IStatus)logEntry; >- getLog().log(status); >- } >- else >- { >- if (logEntry == null) >- { >- logEntry = new RuntimeException(getString("_UI_NullLogEntry_exception", true)).fillInStackTrace(); >- } >- >- if (logEntry instanceof Throwable) >- { >- Throwable throwable = (Throwable)logEntry; >- >- // System.err.println("Logged throwable: --------------------"); >- // throwable.printStackTrace(); >- >- String message = throwable.getLocalizedMessage(); >- if (message == null) >- { >- message = ""; >- } >- >- getLog().log(new Status(IStatus.WARNING, getBundle().getSymbolicName(), 0, message, throwable)); >- } >- else >- { >- // System.err.println("Logged throwable: --------------------"); >- // throwable.printStackTrace(); >- >- getLog().log (new Status (IStatus.WARNING, getBundle().getSymbolicName(), 0, logEntry.toString(), null)); >- } >- } >- } >- } >- >- public static void main(String[] args) >- { >- try >- { >- String [] relativePath = { "META-INF", "MANIFEST.MF" }; >- Class theClass = args.length > 0 ? Class.forName(args[0]) : EMFPlugin.class; >- >- String className = theClass.getName(); >- int index = className.lastIndexOf("."); >- URL classURL = theClass.getResource((index == -1 ? className : className.substring(index + 1)) + ".class"); >- URI uri = URI.createURI(classURL.toString()); >- >- // Trim off the segments corresponding to the package nesting. >- // >- int count = 1; >- for (int i = 0; (i = className.indexOf('.', i)) != -1; ++i) >- { >- ++count; >- } >- uri = uri.trimSegments(count); >- >- URL manifestURL = null; >- >- // For an archive URI, check for the path in the archive. >- // >- if (URI.isArchiveScheme(uri.scheme())) >- { >- try >- { >- // If we can open an input stream, then the path is there, and we have a good URL. >- // >- String manifestURI = uri.appendSegments(relativePath).toString(); >- InputStream inputStream = new URL(manifestURI).openStream(); >- inputStream.close(); >- manifestURL = new URL(manifestURI); >- } >- catch (IOException exception) >- { >- // If the path isn't within the root of the archive, >- // create a new URI for the folder location of the archive, >- // so we can look in the folder that contains it. >- // >- uri = URI.createURI(uri.authority()).trimSegments(1); >- } >- } >- >- // If we didn't find the path in the usual place nor in the archive... >- // >- if (manifestURL == null) >- { >- // Trim off the "bin" or "runtime" segment. >- // >- String lastSegment = uri.lastSegment(); >- if ("bin".equals(lastSegment) || "runtime".equals(lastSegment)) >- { >- uri = uri.trimSegments(1); >- } >- uri = uri.appendSegments(relativePath); >- manifestURL = new URL(uri.toString()); >- } >- >- if (manifestURL != null) >- { >- Manifest manifest = new Manifest(manifestURL.openStream()); >- String symbolicName = manifest.getMainAttributes().getValue("Bundle-SymbolicName"); >- if (symbolicName != null) >- { >- int end = symbolicName.indexOf(";"); >- if (end != -1) >- { >- symbolicName = symbolicName.substring(0, end); >- } >- System.out.println("Bundle-SymbolicName=" + symbolicName + " Bundle-Version=" + manifest.getMainAttributes().getValue("Bundle-Version")); >- return; >- } >- } >- } >- catch (Exception exception) >- { >- } >- >- System.err.println("No Bundle information found"); >- } > } >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.common/META-INF/MANIFEST.MF,v >retrieving revision 1.5.2.1 >diff -u -r1.5.2.1 MANIFEST.MF >--- META-INF/MANIFEST.MF 15 May 2007 20:29:08 -0000 1.5.2.1 >+++ META-INF/MANIFEST.MF 12 Nov 2007 18:36:19 -0000 >@@ -8,7 +8,6 @@ > Bundle-Vendor: %providerName > Bundle-Localization: plugin > Export-Package: org.eclipse.emf.common, >- org.eclipse.emf.common.archive, > org.eclipse.emf.common.command, > org.eclipse.emf.common.notify, > org.eclipse.emf.common.notify.impl, >Index: src/org/eclipse/emf/common/EMFCommonLib.gwt.xml >=================================================================== >RCS file: src/org/eclipse/emf/common/EMFCommonLib.gwt.xml >diff -N src/org/eclipse/emf/common/EMFCommonLib.gwt.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/common/EMFCommonLib.gwt.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+<module> >+ <!-- Inherit the core Web Toolkit stuff. --> >+ <inherits name='com.google.gwt.user.User'/> >+ <inherits name='org.eclipse.core.RuntimeCoreLib' /> >+ >+ <source path="common" /> >+</module>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 209434
:
82685
|
82689
|
83040
|
83041
|
83202
|
83205
|
92952
|
92954