Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache')
-rw-r--r--plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/Cache.java521
-rw-r--r--plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheEntry.java114
-rw-r--r--plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheJob.java92
-rw-r--r--plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CachePlugin.java241
-rw-r--r--plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CachePluginResources.properties41
-rw-r--r--plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheURIResolverExtension.java50
-rw-r--r--plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/LicenseAcceptanceDialog.java258
-rw-r--r--plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/LicenseRegistry.java252
-rw-r--r--plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/ToCacheRegistryReader.java117
-rw-r--r--plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/ToCacheResource.java53
-rw-r--r--plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/CachePreferencePage.java323
-rw-r--r--plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/ContextIds.java21
-rw-r--r--plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/PreferenceConstants.java23
-rw-r--r--plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/PreferenceInitializer.java33
14 files changed, 0 insertions, 2139 deletions
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/Cache.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/Cache.java
deleted file mode 100644
index 795e8bb92..000000000
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/Cache.java
+++ /dev/null
@@ -1,521 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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 Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.internet.cache.internal;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Random;
-import java.util.Set;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * The cache holds references to remote resources. The cache can store resources,
- * retrieve resources, and delete resources.
- *
- */
-public class Cache
-{
- /**
- * String instances.
- */
- private static final String URI = "uri";
- private static final String LOCATION ="location";
- private static final String ENTRY = "entry";
- private static final String CACHE = "cache";
- private static final String LAST_MODIFIED = "lastModified";
- private static final String EXPIRATION_TIME = "expirationTime";
- private static final String FILE_PROTOCOL = "file:///";
- private static final String CACHE_FILE = "cache.xml";
- private static final String CACHE_EXTENSION = ".cache";
- private static final String CACHE_PREFIX = "wtpcache";
- private static final String CACHE_SUFFIX = null;
- /**
- * The default timeout for a cache entry is 1 day.
- */
- private static final long TIMEOUT = 86400000;
-
- /**
- * The one and only instance of the cache.
- */
- private static Cache cacheInstance = null;
-
- /**
- * The cache is stored in a hashtable.
- */
- private Hashtable cache;
-
- /**
- * A set of uncached resources. The cache was not able to cache resources
- * in this list. This list allows quickly skipping over these resources in
- * future requests.
- */
- private Set uncached;
-
- /**
- * The location of the cache
- */
- private File cacheLocation = null;
-
- /**
- * Private constructor.
- */
- protected Cache(IPath cacheLocation)
- {
- this.cacheLocation = cacheLocation.toFile();//Platform.getPluginStateLocation(CachePlugin.getDefault()).toFile();
- cache = new Hashtable();
- uncached = new HashSet();
- }
-
- /**
- * Get the one and only instance of the cache.
- *
- * @return The one and only instance of the cache.
- */
- public static Cache getInstance()
- {
-// if(cacheInstance == null)
-// {
-// cacheInstance = new Cache(cacheLocation);
-// cacheInstance.open(cacheLocation);
-// }
- return cacheInstance;
- }
-
- /**
- * Return the local resource for the specified uri. If there is no resource
- * the cache will attempt to download and cache the resource before returning.
- * If a remote resource cannot be cached this method will return null.
- *
- * @param uri The URI for which a resource is requested.
- * @return The local resource for the specified URI or null if a remote resource cannot be cached.
- */
- public String getResource(String uri)
- {
- if(uri == null) return null;
- CacheEntry result = (CacheEntry)cache.get(uri);
-
- // If no result is in the cache and the URI is of an allowed type
- // retrieve it and store it in the cache.
- if(result == null)
- {
-
- if(!uncached.contains(uri))
- {
- result = cacheResource(uri);
- }
- }
- // Retreive a fresh copy of the result if it has timed out.
- else if(result.hasExpired())
- {
- result = refreshCacheEntry(result);
- }
- if(result == null || result.getLocalFile() == null)
- {
- return null;
- }
- return FILE_PROTOCOL + cacheLocation.toString() + "/" + result.getLocalFile();
- }
-
- /**
- * Get the list of uncached resources.
- *
- * @return The list of uncached resources.
- */
- protected String[] getUncachedURIs()
- {
- return (String[])uncached.toArray(new String[uncached.size()]);
- }
-
- /**
- * Clear the list of uncached resources.
- */
- protected void clearUncachedURIs()
- {
- uncached.clear();
- }
-
- /**
- * Add an uncached resource to the list.
- */
- protected void addUncachedURI(String uri)
- {
- uncached.add(uri);
- }
-
- /**
- * Cache the specified resource. This method creates a local version of the
- * remote resource and adds the resource reference to the cache. If the resource
- * cannot be accessed it is not added and null is returned.
- *
- * @param uri The remote URI to cache.
- * @return A new CacheEntry representing the cached resource or null if the remote
- * resource could not be retrieved.
- */
- protected CacheEntry cacheResource(String uri)
- {
- CacheEntry cacheEntry = null;
- URLConnection conn = null;
- InputStream is = null;
- OutputStream os = null;
- try
- {
- URL url = new URL(uri);
- conn = url.openConnection();
- conn.connect();
- // Determine if this resource can be cached.
- if(conn.getUseCaches())
- {
- is = conn.getInputStream();//url.openStream();
-
- Random rand = new Random();
- String fileName = rand.nextInt() + CACHE_EXTENSION;
- File file = new File(cacheLocation, fileName);
- // If the file already exists we need to change the file name.
- while(!file.createNewFile())
- {
- fileName = rand.nextInt() + CACHE_EXTENSION;
- file = new File(cacheLocation,fileName);
- }
- os = new FileOutputStream(file);
- byte[] bytes = new byte[1024];
- int bytelength;
- while((bytelength = is.read(bytes)) != -1)
- {
- os.write(bytes, 0, bytelength);
- }
- long lastModified = conn.getLastModified();
- long expiration = conn.getExpiration();
- if(expiration == 0)
- {
- expiration = System.currentTimeMillis() + TIMEOUT;
- }
- cacheEntry = new CacheEntry(uri, fileName, lastModified, expiration);
- cache.put(uri,cacheEntry);
- }
-
- }
- catch(Throwable t)
- {
- // Put the entry in the uncached list so the resolution work will not be performed again.
- // TODO: Add in a timeout for the non-located uris.
- uncached.add(uri);
- }
- finally
- {
- if(is != null)
- {
- try
- {
- is.close();
- }
- catch(IOException e)
- {
- // Do nothing if the stream cannot be closed.
- }
- }
- if(os != null)
- {
- try
- {
- os.close();
- }
- catch(IOException e)
- {
- // Do nothing if the stream cannot be closed.
- }
- }
- }
- return cacheEntry;
- }
-
- /**
- * Refresh the cache entry if necessary. The cache entry will be refreshed
- * if the remote resource is accessible and the last modified time of the
- * remote resource is greater than the last modified time of the cached
- * resource.
- *
- * @param cacheEntry The cache entry to refresh.
- * @return The refreshed cache entry.
- */
- protected CacheEntry refreshCacheEntry(CacheEntry cacheEntry)
- {
- URLConnection conn = null;
- InputStream is = null;
- OutputStream os = null;
- try
- {
- URL url = new URL(cacheEntry.getURI());
- conn = url.openConnection();
- conn.connect();
-
- long lastModified = conn.getLastModified();
- if(lastModified > cacheEntry.getLastModified())
- {
- long expiration = conn.getExpiration();
- if(expiration == 0)
- {
- expiration = System.currentTimeMillis() + TIMEOUT;
- }
-
- is = conn.getInputStream();
-
- String localFile = cacheEntry.getLocalFile();
-
- File tempFile = File.createTempFile(CACHE_PREFIX, CACHE_SUFFIX);
- tempFile.deleteOnExit();
-
- os = new FileOutputStream(tempFile);
- byte[] bytes = new byte[1024];
- int bytelength;
- while((bytelength = is.read(bytes)) != -1)
- {
- os.write(bytes, 0, bytelength);
- }
- is.close();
- os.close();
- deleteFile(cacheEntry.getURI());
- File f = new File(cacheLocation, localFile);
- tempFile.renameTo(f);
- cacheEntry.setExpiration(expiration);
- cacheEntry.setLastModified(lastModified);
- }
- // The cache entry hasn't changed. Just update the expiration time.
- else
- {
- long expiration = conn.getExpiration();
- if(expiration == 0)
- {
- expiration = System.currentTimeMillis() + TIMEOUT;
- }
- cacheEntry.setExpiration(expiration);
- }
-
- }
- catch(Exception e)
- {
- // Do nothing.
- }
- finally
- {
- if(is != null)
- {
- try
- {
- is.close();
- }
- catch(IOException e)
- {
- // Do nothing if the stream cannot be closed.
- }
- }
- if(os != null)
- {
- try
- {
- os.close();
- }
- catch(IOException e)
- {
- // Do nothing if the stream cannot be closed.
- }
- }
- }
- return cacheEntry;
- }
-
- /**
- * Get an array of the cached URIs.
- *
- * @return An array of the cached URIs.
- */
- public String[] getCachedURIs()
- {
- Set keyset = cache.keySet();
- return (String[])keyset.toArray(new String[keyset.size()]);
- }
-
- /**
- * Close the cache. Closing the cache involves serializing the data to an XML file
- * in the plugin state location.
- */
- protected void close()
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- try {
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document cachedoc = builder.newDocument();
- Element rootelem = cachedoc.createElement(CACHE);
- cachedoc.appendChild(rootelem);
-
- Enumeration uris = cache.keys();
- while(uris.hasMoreElements())
- {
- String key = (String)uris.nextElement();
- CacheEntry cacheEntry = (CacheEntry)cache.get(key);
- if(cacheEntry != null)
- {
- Element entry = cachedoc.createElement(ENTRY);
- entry.setAttribute(URI, key);
- entry.setAttribute(LOCATION, cacheEntry.getLocalFile());
- entry.setAttribute(EXPIRATION_TIME, String.valueOf(cacheEntry.getExpirationTime()));
- entry.setAttribute(LAST_MODIFIED, String.valueOf(cacheEntry.getLastModified()));
- rootelem.appendChild(entry);
- }
- }
-
- // Write the cache entry.
- TransformerFactory tFactory = TransformerFactory.newInstance();
- Transformer transformer = tFactory.newTransformer();
- Source input = new DOMSource(cachedoc);
- IPath stateLocation = Platform.getStateLocation(CachePlugin.getDefault().getBundle());
- Result output = new StreamResult(stateLocation.toString() + "/" + CACHE_FILE);
- transformer.transform(input, output);
-
- }catch(Exception e)
- {
- System.out.println("Unable to store internet cache.");
- }
- cacheInstance = null;
- }
-
- /**
- * Open the cache. Opening the cache involves parsing the cache XML file in
- * the plugin state location if it can be read.
- */
- protected static void open(IPath cacheLocation)
- {
- cacheInstance = new Cache(cacheLocation);
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- try {
-
- IPath stateLocation = cacheLocation;
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document cachedoc = builder.parse(stateLocation.toString() + "/" + CACHE_FILE);
- Element rootelem = cachedoc.getDocumentElement();
- NodeList entries = rootelem.getChildNodes();
- int numEntries = entries.getLength();
- for(int i = 0; i < numEntries; i++)
- {
- Node entry = entries.item(i);
- if(entry instanceof Element)
- {
- Element e = (Element)entry;
- if(e.getNodeName().equals(ENTRY))
- {
- String uri = e.getAttribute(URI);
- String location = e.getAttribute(LOCATION);
- String lm = e.getAttribute(LAST_MODIFIED);
- String et = e.getAttribute(EXPIRATION_TIME);
- long lastModified = -1;
- long expirationTime = -1;
- try
- {
- lastModified = Long.parseLong(lm);
- }
- catch(NumberFormatException nfe)
- {
- }
- try
- {
- expirationTime = Long.parseLong(et);
- }
- catch(NumberFormatException nfe)
- {
- }
- if(uri != null && location != null)
- {
- cacheInstance.cache.put(uri, new CacheEntry(uri, location, lastModified, expirationTime));
- }
- }
- }
- }
- }
- catch(FileNotFoundException e)
- {
- // If the file doesn't exist in the correct location there is nothing to load. Do nothing.
- }
- catch(Exception e)
- {
- System.out.println("Unable to load cache.");
- }
- }
-
- /**
- * Clear all of the entries from the cache. This method also deletes the cache files.
- */
- public void clear()
- {
- Enumeration keys = cache.keys();
- while(keys.hasMoreElements())
- {
- String key = (String)keys.nextElement();
-
- deleteFile(key);
- }
- cache.clear();
- }
-
- /**
- * Delete the cache entry specified by the given URI.
- * @param uri The URI entry to remove from the catalog.
- */
- public void deleteEntry(String uri)
- {
- if(uri == null) return;
-
- deleteFile(uri);
- cache.remove(uri);
- }
-
- /**
- * Delete the file specified by the URI.
- *
- * @param uri The URI of the file to delete.
- */
- protected void deleteFile(String uri)
- {
- CacheEntry cacheEntry = (CacheEntry)cache.get(uri);
- if(cacheEntry != null)
- {
- String location = cacheLocation.toString() + "/" + cacheEntry.getLocalFile();
- File file = new File(location);
- if(!file.delete())
- {
- System.out.println("Unable to delete file " + location + " from cache.");
- }
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheEntry.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheEntry.java
deleted file mode 100644
index 817ec069b..000000000
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheEntry.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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 Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.internet.cache.internal;
-
-/**
- * A cache entry contains a URI, a local file, and a timeout.
- */
-public class CacheEntry
-{
- private String uri;
- private String localFile;
- private long lastModified;
- private long expirationTime;
-
- /**
- * Create a new cache entry.
- *
- * @param uri The remote URI of the cache entry.
- * @param localFile The local file that contains the cached entry.
- * @param lastModifie The time this resource was last modified.
- * @param expirationTime The time in miliseconds that this cache entry will
- * expire.
- */
- public CacheEntry(String uri, String localFile, long lastModified, long expirationTime)
- {
- this.uri = uri;
- this.localFile = localFile;
- this.lastModified = lastModified;
- this.expirationTime = expirationTime;
- }
-
- /**
- * The cache entry is expired if its expiration time is less then the
- * current system time and not equal to -1.
- *
- * @return True if this cached entry has expired, false otherwise.
- */
- public boolean hasExpired()
- {
- if(expirationTime != -1 && System.currentTimeMillis() > expirationTime)
- {
- return true;
- }
- return false;
- }
-
- /**
- * Set the time in miliseconds that this cache entry will expire.
- *
- * @param timeout The time in miliseconds that this cache entry will expire.
- * -1 indicates that this entry will not expire.
- */
- public void setExpiration(long expirationTime)
- {
- this.expirationTime = expirationTime;
- }
-
- /**
- * Get the time at which this cache entry will expire.
- *
- * @return The time at which this cache entry will expire.
- */
- public long getExpirationTime()
- {
- return expirationTime;
- }
-
- /**
- * Get the remote URI for this cache entry.
- *
- * @return The remote URI for this cache entry.
- */
- public String getURI()
- {
- return uri;
- }
-
- /**
- * Get the local file for this cache entry.
- *
- * @return The local file for this cache entry.
- */
- public String getLocalFile()
- {
- return localFile;
- }
-
- /**
- * Get the last time this cache entry was modified.
- *
- * @return The last time this cache entry was modified.
- */
- public long getLastModified()
- {
- return lastModified;
- }
-
- /**
- * Set the last time this cache entry was modified.
- */
- public void setLastModified(long lastModified)
- {
- this.lastModified = lastModified;
- }
-}
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheJob.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheJob.java
deleted file mode 100644
index 8108abc99..000000000
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheJob.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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 Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.internet.cache.internal;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * A cache job runs once an hour to cache any prespecified resources which
- * should be cached and any resources for which an attempt was previously
- * made to cache them but they were unable to be cached.
- */
-public class CacheJob extends Job
-{
- private static final String _UI_CACHE_MONITOR_NAME = "_UI_CACHE_MONITOR_NAME";
- private static final String _UI_CACHE_MONITOR_CACHING = "_UI_CACHE_MONITOR_CACHING";
- private String[] specifiedURIsToCache = null;
- private static final long SCHEDULE_TIME = 3600000;
-
- /**
- * Constructor.
- */
- public CacheJob()
- {
- super(CachePlugin.getResourceString(_UI_CACHE_MONITOR_NAME));
- //specifiedURIsToCache = ToCacheRegistryReader.getInstance().getURIsToCache();
- }
-
- /**
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor)
- {
- Cache cache = Cache.getInstance();
- String[] uncachedURIs = cache.getUncachedURIs();
- int numUncachedURIs = uncachedURIs.length;
- // Special case for the first time the job is run which will attemp to
- // cache specified resources.
- if(specifiedURIsToCache != null)
- {
- int numSpecifiedURIs = specifiedURIsToCache.length;
- String[] temp = new String[numUncachedURIs + numSpecifiedURIs];
- System.arraycopy(specifiedURIsToCache, 0, temp, 0, numSpecifiedURIs);
- System.arraycopy(uncachedURIs, 0, temp, numSpecifiedURIs, numUncachedURIs);
- uncachedURIs = temp;
- numUncachedURIs = uncachedURIs.length;
- specifiedURIsToCache = null;
- }
-
- cache.clearUncachedURIs();
- monitor.beginTask(CachePlugin.getResourceString(_UI_CACHE_MONITOR_NAME), numUncachedURIs);
- try
- {
- for(int i = 0; i < numUncachedURIs; i++)
- {
- if (monitor.isCanceled())
- {
- for(int j = i; j < numUncachedURIs; j++)
- {
- cache.addUncachedURI(uncachedURIs[j]);
- }
- return Status.CANCEL_STATUS;
- }
- String uri = uncachedURIs[i];
- monitor.subTask(CachePlugin.getResourceString(_UI_CACHE_MONITOR_CACHING, uri));
- cache.getResource(uri);
- monitor.worked(1);
- monitor.subTask("");
- }
- monitor.done();
- return Status.OK_STATUS;
- }
- finally
- {
- schedule(SCHEDULE_TIME); // schedule the next time the job should run
- }
- }
-
-}
-
-
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CachePlugin.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CachePlugin.java
deleted file mode 100644
index 11adf85f0..000000000
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CachePlugin.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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 Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.internet.cache.internal;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.wst.internet.cache.internal.preferences.PreferenceConstants;
-import org.osgi.framework.BundleContext;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class CachePlugin extends AbstractUIPlugin
-{
- /**
- * The ID of this plugin.
- */
- public static final String PLUGIN_ID = "org.eclipse.wst.internet.cache";
-
- /**
- * The shared instance.
- */
- private static CachePlugin plugin;
-
- /**
- * The cache job caches resources that were not able to be downloaded when requested.
- */
- private CacheJob job = null;
-
- /**
- * The constructor.
- */
- public CachePlugin()
- {
- super();
- plugin = this;
- }
-
- /**
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception
- {
- super.start(context);
- ToCacheRegistryReader.getInstance().readRegistry();
- Cache.open(Platform.getStateLocation(getBundle()));
- if (getPluginPreferences().contains(PreferenceConstants.CACHE_ENABLED))
- {
- setCacheEnabled(getPluginPreferences().getBoolean(PreferenceConstants.CACHE_ENABLED));
- }
- else
- {
- // The cache is disabled by default.
- setCacheEnabled(false);
- }
-
- // Restore license preferences
- Preferences prefs = getPluginPreferences();
- LicenseRegistry registry = LicenseRegistry.getInstance();
- String[] licenses = registry.getLicenses();
- int numLicenses = licenses.length;
- for(int i = 0; i < numLicenses; i++)
- {
- int state = prefs.getInt(licenses[i]);
- if(state == LicenseRegistry.LICENSE_AGREE.intValue())
- {
- registry.agreeLicense(licenses[i]);
- }
- else if(state == LicenseRegistry.LICENSE_DISAGREE.intValue())
- {
- registry.disagreeLicense(licenses[i]);
- }
- }
- }
-
- /**
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception
- {
- // Save the license state information.
- Preferences prefs = getPluginPreferences();
- LicenseRegistry registry = LicenseRegistry.getInstance();
- String[] licenses = registry.getLicenses();
- int numLicenses = licenses.length;
- for(int i = 0; i < numLicenses; i++)
- {
- Integer state = registry.getLicenseState(licenses[i]);
- // For states that have been disagreed to this session store
- // them as disagree.
- if(state == LicenseRegistry.LICENSE_DISAGREE_THIS_SESSION)
- {
- state = LicenseRegistry.LICENSE_DISAGREE;
- }
- prefs.setValue(licenses[i], state.intValue());
- }
-
- Cache.getInstance().close();
- stopJob();
- super.stop(context);
- plugin = null;
- }
-
- /**
- * Returns the shared instance.
- *
- * @return The shared instance.
- */
- public static CachePlugin getDefault()
- {
- return plugin;
- }
-
- /**
- * Returns the string from the plugin's resource bundle, or 'key' if not found.
- *
- * @param key The key for which the string is requested.
- * @return The string from the plugin's resource bundle, or 'key' if not found.
- */
- public static String getResourceString(String key)
- {
- ResourceBundle bundle = ResourceBundle
- .getBundle("org.eclipse.wst.internet.cache.internal.CachePluginResources");
- try
- {
- return (bundle != null) ? bundle.getString(key) : key;
- }
- catch (MissingResourceException e)
- {
- return key;
- }
- }
-
- /**
- * Returns the string from the plugin's resource bundle using the specified
- * object, or 'key' if not found.
- *
- * @param key The key for which the string is requested.
- * @param s1 The object to insert into the string.
- * @return The formatted string.
- */
- public static String getResourceString(String key, Object s1)
- {
- return MessageFormat.format(getResourceString(key), new Object[] { s1 });
- }
-
- /**
- * Set whether or not the cache is enabled.
- *
- * @param enabled If true the cache is enabled, if false it is not enabled.
- */
- public void setCacheEnabled(boolean enabled)
- {
- getPluginPreferences().setValue(PreferenceConstants.CACHE_ENABLED, enabled);
- if (enabled)
- {
- startJob();
- }
- else
- {
- stopJob();
- }
- }
-
- /**
- * Returns true if the cache is enabled, false otherwise.
- *
- * @return True if the cache is enabled, false otherwise.
- */
- public boolean isCacheEnabled()
- {
- if (getPluginPreferences().contains(PreferenceConstants.CACHE_ENABLED))
- return getPluginPreferences().getBoolean(PreferenceConstants.CACHE_ENABLED);
- return true;
- }
-
- /**
- * Set whether or not the user should be prompted for licenses to which they
- * have previously disagreed.
- *
- * @param prompt If true the the user should be prompted, if false the user should not be prompted.
- */
- public void setPromptDisagreedLicenses(boolean prompt)
- {
- getPluginPreferences().setValue(PreferenceConstants.PROMPT_DISAGREED_LICENSES, prompt);
- }
-
- /**
- * Returns true if the the user should be prompted for licenses to which they
- * have previously disagreed, false otherwise.
- *
- * @return True if the user should be prompted, false otherwise.
- */
- public boolean shouldPrompt()
- {
- if (getPluginPreferences().contains(PreferenceConstants.PROMPT_DISAGREED_LICENSES))
- return getPluginPreferences().getBoolean(PreferenceConstants.PROMPT_DISAGREED_LICENSES);
- return true;
- }
-
- /**
- * Start the cache job. The cache job caches resources that were not able to be previously
- * downloaded.
- */
- private void startJob()
- {
- if (job == null)
- {
- job = new CacheJob();
- job.setPriority(CacheJob.DECORATE);
- job.schedule(); // start as soon as possible
- }
- }
-
- /**
- * Stop the cache job. The cache job caches resources that were not able to be previously
- * downloaded.
- */
- private void stopJob()
- {
- if (job != null)
- {
- job.cancel();
- }
- job = null;
- }
-}
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CachePluginResources.properties b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CachePluginResources.properties
deleted file mode 100644
index 05729d27e..000000000
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CachePluginResources.properties
+++ /dev/null
@@ -1,41 +0,0 @@
-###############################################################################
-# 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 Corporation - initial API and implementation
-###############################################################################
-
-# Cache preference page strings.
-_UI_CONFIRM_CLEAR_CACHE_DIALOG_TITLE = Remove All?
-_UI_CONFIRM_CLEAR_CACHE_DIALOG_MESSAGE = Remove all cache entries?
-_UI_CONFIRM_DELETE_CACHE_ENTRY_DIALOG_TITLE = Remove Entries?
-_UI_CONFIRM_DELETE_CACHE_ENTRY_DIALOG_MESSAGE = Remove all selected cache entries?
-_UI_BUTTON_CLEAR_CACHE = Remove &All
-_UI_BUTTON_DELETE_ENTRY = &Remove
-_UI_PREF_CACHE_ENTRIES_TITLE = &Cache entries:
-_UI_PREF_CACHE_CACHE_OPTION = &Disable caching
-_UI_PREF_CACHE_ABOUT = Manage the cache of remote resources, such as those downloaded from the internet.
-_UI_PREF_PROMPT_FOR_DISAGREED_LICENSES = &Prompt me for agreement for licenses for whose terms I have already disagreed.
-
-# Cache monitor strings.
-_UI_CACHE_MONITOR_NAME = Caching Remote Resources
-_UI_CACHE_MONITOR_CACHING = Caching {0}
-
-# Cache license dialog
-_UI_CACHE_DIALOG_LICENSE_STATEMENT1 = A request has been made to cache the resource:
-_UI_CACHE_DIALOG_LICENSE_STATEMENT2 = In order to cache the resource you must agree to the license below:
-_UI_CACHE_DIALOG_LICENSE_STATEMENT2_NO_INTERNAL = In order to cache the resource you must agree to the license which has been opened in your browser.
-_UI_CACHE_DIALOG_LICENSE_STATEMENT2_NO_BROWSER = The license cannot be displayed in this dialog. In order to cache the resource you must agree to the license located at {0}.
-_UI_CACHE_DIALOG_AGREE_BUTTON = I Agree
-_UI_CACHE_DIALOG_DISAGREE_BUTTON = I Disagree
-_UI_CACHE_DIALOG_TITLE = License Agreement
-
-# Cache logging messages
-_LOG_INFO_WTP_NO_USER_INTERACTION = {0} is set. Licenses dialogs will not be displayed.
-
-# WTP test no user interaction system property
-WTP_NO_USER_INTERACTION_SYSTEM_PROP = wtp.autotest.noninteractive \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheURIResolverExtension.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheURIResolverExtension.java
deleted file mode 100644
index f6518f2f6..000000000
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheURIResolverExtension.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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 Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.internet.cache.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverExtension;
-import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
-
-/**
- * A cache URI resolver. This resolver will cache remote resources and return
- * the local copy if they can be cached. If a resource cannot be cached the
- * resource returns null.
- */
-public class CacheURIResolverExtension implements URIResolverExtension
-{
- /**
- * @see org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverExtension#resolve(org.eclipse.core.resources.IProject, java.lang.String, java.lang.String, java.lang.String)
- */
- public String resolve(IFile file, String baseLocation, String publicId, String systemId)
- {
- if(CachePlugin.getDefault().isCacheEnabled())
- {
- String resource = null;
- if(systemId != null)
- {
- resource = URIHelper.normalize(systemId, baseLocation, null);
- }
-
- if(resource != null && (resource.startsWith("http:") || resource.startsWith("ftp:")))
- {
- // Handle resources prespecified to cache.
- ToCacheResource toCacheResource = ToCacheRegistryReader.getInstance().getResourceToCache(resource);
- if(toCacheResource == null || LicenseRegistry.getInstance().hasLicenseBeenAccepted(resource, toCacheResource.getLicense()))
- {
- return Cache.getInstance().getResource(resource);
- }
- }
- }
- return null;
- }
-}
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/LicenseAcceptanceDialog.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/LicenseAcceptanceDialog.java
deleted file mode 100644
index a26a25404..000000000
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/LicenseAcceptanceDialog.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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 Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.internet.cache.internal;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Hashtable;
-
-import org.eclipse.jface.dialogs.IconAndMessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * A dialog that prompts the user to accept a license agreement.
- */
-public class LicenseAcceptanceDialog extends IconAndMessageDialog
-{
- /**
- * Externalized string keys.
- */
- private static final String _UI_CACHE_DIALOG_LICENSE_STATEMENT1 = "_UI_CACHE_DIALOG_LICENSE_STATEMENT1";
- private static final String _UI_CACHE_DIALOG_LICENSE_STATEMENT2 = "_UI_CACHE_DIALOG_LICENSE_STATEMENT2";
- private static final String _UI_CACHE_DIALOG_LICENSE_STATEMENT2_NO_INTERNAL = "_UI_CACHE_DIALOG_LICENSE_STATEMENT2_NO_INTERNAL";
- private static final String _UI_CACHE_DIALOG_LICENSE_STATEMENT2_NO_BROWSER = "_UI_CACHE_DIALOG_LICENSE_STATEMENT2_NO_BROWSER";
- private static final String _UI_CACHE_DIALOG_AGREE_BUTTON = "_UI_CACHE_DIALOG_AGREE_BUTTON";
- private static final String _UI_CACHE_DIALOG_DISAGREE_BUTTON = "_UI_CACHE_DIALOG_DISAGREE_BUTTON";
- private static final String _UI_CACHE_DIALOG_TITLE = "_UI_CACHE_DIALOG_TITLE";
-
- /**
- * Holds all the dialogs that are currently displayed keyed by the license URL.
- */
- private static Hashtable dialogsInUse = new Hashtable();
-
- /**
- * The URL of the resource.
- */
- private String url;
-
- /**
- * The URL of the license.
- */
- private String licenseURL;
-
- /**
- * Constructor.
- *
- * @param parent The parent of this dialog.
- * @param url The license URL.
- */
- protected LicenseAcceptanceDialog(Shell parent, String url, String licenseURL)
- {
- super(parent);
- this.url = url;
- this.licenseURL = licenseURL;
- }
-
- /**
- * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
- */
- protected void configureShell(Shell shell)
- {
- super.configureShell(shell);
- shell.setText(CachePlugin.getResourceString(_UI_CACHE_DIALOG_TITLE));
- shell.setImage(null);
- }
-
- /**
- * @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite)
- */
- protected Control createButtonBar(Composite parent)
- {
- Composite buttonBar = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 0;
- layout.makeColumnsEqualWidth = true;
- buttonBar.setLayout(layout);
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- buttonBar.setLayoutData(gd);
-
- // Create the agree button.
- createButton(buttonBar, LicenseAcceptanceDialog.OK,
- CachePlugin.getResourceString(_UI_CACHE_DIALOG_AGREE_BUTTON), false);
-
- // Create the disagree button.
- createButton(buttonBar, LicenseAcceptanceDialog.CANCEL,
- CachePlugin.getResourceString(_UI_CACHE_DIALOG_DISAGREE_BUTTON), false);
-
- return buttonBar;
- }
-
- /**
- * @see org.eclipse.jface.window.Window#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent)
- {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
- GridData gd = new GridData(SWT.FILL);
- gd.widthHint = 500;
- composite.setLayoutData(gd);
-
- // Display a statement about the license.
- Label licenseText1 = new Label(composite, SWT.NONE);
- licenseText1.setText(CachePlugin.getResourceString(_UI_CACHE_DIALOG_LICENSE_STATEMENT1));
- Label urlText = new Label(composite, SWT.WRAP);
- gd = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1);
- urlText.setLayoutData(gd);
- urlText.setText(url);
- new Label(composite, SWT.NONE); // Spacing label.
- Label licenseText2 = new Label(composite, SWT.WRAP);
- gd = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1);
- licenseText2.setLayoutData(gd);
-
- // Display the license in a browser.
- try
- {
- Browser browser = new Browser(composite, SWT.BORDER);
- gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 400;
- browser.setUrl(licenseURL);
- browser.setLayoutData(gd);
- licenseText2.setText(CachePlugin.getResourceString(_UI_CACHE_DIALOG_LICENSE_STATEMENT2));
- }
- catch(Throwable e)
- {
- // The browser throws an exception on platforms that do not support it.
- // In this case we need to create an external browser.
- try
- {
- CachePlugin.getDefault().getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(licenseURL));
- licenseText2.setText(CachePlugin.getResourceString(_UI_CACHE_DIALOG_LICENSE_STATEMENT2_NO_INTERNAL));
- }
- catch(Exception ex)
- {
- // In this case the license cannot be display. Inform the user of this and give them the license location.
- licenseText2.setText(CachePlugin.getResourceString(_UI_CACHE_DIALOG_LICENSE_STATEMENT2_NO_BROWSER, licenseURL));
- }
- }
-
- createButtonBar(composite);
-
- return composite;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IconAndMessageDialog#getImage()
- */
- protected Image getImage()
- {
- return getInfoImage();
- }
-
- /**
- * Prompt the user to accept the specified license. This method creates the
- * dialog and returns the result.
- *
- * @param parent The parent of this dialog.
- * @param url The URL of the resource for which the license must be accepted.
- * @param licenseURL The license URL.
- * @return True if the license is accepted, false otherwise.
- */
- public static boolean promptForLicense(Shell parent, String url, String licenseURL) throws IOException
- {
- boolean agreedToLicense = false;
- boolean newDialog = true;
- LicenseAcceptanceDialog dialog = null;
- // If the dialog is already displayed for this license use it instead of
- // displaying another dialog.
- if(dialogsInUse.containsKey(licenseURL))
- {
- newDialog = false;
- dialog = (LicenseAcceptanceDialog)dialogsInUse.get(licenseURL);
- }
- else
- {
- //BufferedReader bufreader = null;
- InputStream is = null;
-// StringBuffer source = new StringBuffer();
- try
- {
- URL urlObj = new URL(licenseURL);
- is = urlObj.openStream();
-// if (urlObj != null)
-// {
-// bufreader = new BufferedReader(new InputStreamReader(urlObj.openStream()));
-//
-// if (bufreader != null)
-// {
-// while (bufreader.ready())
-// {
-// source.append(bufreader.readLine());
-// }
-// }
-// }
- dialog = new LicenseAcceptanceDialog(parent, url, licenseURL);
- dialogsInUse.put(licenseURL, dialog);
- dialog.setBlockOnOpen(true);
- }
- catch(Exception e)
- {
- throw new IOException("The license cannot be opened.");
- }
- finally
- {
-// if(bufreader != null)
-// {
-// bufreader.close();
-// }
- if(is != null)
- {
- try
- {
- is.close();
- }
- catch(IOException e)
- {
- // Do nothing.
- }
- }
- }
- }
- if(dialog != null)
- {
- dialog.open();
-
- if (dialog.getReturnCode() == LicenseAcceptanceDialog.OK)
- {
- agreedToLicense = true;
- }
-
- if(newDialog)
- {
- dialogsInUse.remove(licenseURL);
- }
- }
-
-
-
- return agreedToLicense;
- }
-}
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/LicenseRegistry.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/LicenseRegistry.java
deleted file mode 100644
index 6a66bc5c2..000000000
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/LicenseRegistry.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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 Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.internet.cache.internal;
-
-import java.util.Hashtable;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * The license registry holds all of the registered licenses and whether or not they
- * have been accepted.
- */
-public class LicenseRegistry
-{
- protected static Integer LICENSE_UNSPECIFIED = new Integer(0); // This needs to be 0 for the plugin prefs.
- protected static Integer LICENSE_AGREE = new Integer(1);
- protected static Integer LICENSE_DISAGREE = new Integer(2);
- // Signifies a license that has been disagreed to this session.
- protected static Integer LICENSE_DISAGREE_THIS_SESSION = new Integer(3);
-
- protected final static String _LOG_INFO_WTP_NO_USER_INTERACTION = "_LOG_INFO_WTP_NO_USER_INTERACTION";
-
- protected final static String WTP_NO_USER_INTERACTION_SYSTEM_PROP = CachePlugin.getResourceString("WTP_NO_USER_INTERACTION_SYSTEM_PROP");
-
- /**
- * There is only one instance of the license registry.
- */
- protected static LicenseRegistry instance = null;
-
- /**
- * If set to true, the do not prompt flag will prevent user prompting. Used for automated testing.
- */
- private boolean DO_NOT_PROMPT = false;
-
- /**
- * The licenses hashtable contains licenses and whether or not they've been accepted.
- */
- protected Hashtable licenses;
-
- protected LicenseRegistry()
- {
- licenses = new Hashtable();
-
- // If the wtp quiet system property is set the DO_NOT_PROMPT flag is set to true.
- // This is used for automated testing.
- if(System.getProperty(WTP_NO_USER_INTERACTION_SYSTEM_PROP, "false").equals("true"))
- {
- CachePlugin.getDefault().getLog().log(new Status(IStatus.INFO, CachePlugin.PLUGIN_ID, IStatus.OK, CachePlugin.getResourceString(_LOG_INFO_WTP_NO_USER_INTERACTION, WTP_NO_USER_INTERACTION_SYSTEM_PROP), null));
- DO_NOT_PROMPT = true;
- }
- }
-
- /**
- * Get the one and only instance of the license registry.
- *
- * @return The one and only instance of the license registry.
- */
- public static LicenseRegistry getInstance()
- {
- if(instance == null)
- {
- instance = new LicenseRegistry();
- }
- return instance;
- }
-
- /**
- * Add the specified license to the license registry. A license can only be added to the
- * registry once.
- *
- * @param url The URL of the license to add to the registry.
- */
- public void addLicense(String url)
- {
- if(url != null && !licenses.containsKey(url))
- {
- licenses.put(url, LICENSE_UNSPECIFIED);
- }
- }
-
- /**
- * Agree to the specified license. The license is agreed to only if it has already
- * been registered with the registry.
- *
- * @param url The URL of the license to accept.
- */
- protected void agreeLicense(String url)
- {
- if(licenses.containsKey(url))
- {
- licenses.put(url, LICENSE_AGREE);
- }
- }
-
- /**
- * Disagree to the specified license. The license is disagreed to only if it has already
- * been registered with the registry.
- *
- * @param url The URL of the license to accept.
- */
- protected void disagreeLicense(String url)
- {
- if(licenses.containsKey(url))
- {
- licenses.put(url, LICENSE_DISAGREE);
- }
- }
-
- /**
- * Disagree to the specified license for this session. The license is disagreed to only if it has already
- * been registered with the registry.
- *
- * @param url The URL of the license to accept.
- */
- private void disagreeLicenseThisSession(String url)
- {
- if(licenses.containsKey(url))
- {
- licenses.put(url, LICENSE_DISAGREE_THIS_SESSION);
- }
- }
-
- /**
- * Determine if the license has been accepted. This method will return true if the license
- * has been accepted or is not registered with the registry and false if it has not been accepted.
- *
- * @param url The URL of the resource for which we are checking the license.
- * @param licenseURL The URL of the license that should be checked to see if it has been accepted.
- * @return True if the license has been accepted or is not registered with the registry, false otherwise.
- */
- public boolean hasLicenseBeenAccepted(String url, String licenseURL)
- {
- if(DO_NOT_PROMPT)
- {
- return true;
- }
-
- if(licenses.containsKey(licenseURL))
- {
- Integer agreed = (Integer)licenses.get(licenseURL);
- if(agreed == LICENSE_AGREE)
- {
- return true;
- }
- else if(agreed == LICENSE_DISAGREE)
- {
- if(!CachePlugin.getDefault().shouldPrompt())
- return false;
- licenses.put(licenseURL, LICENSE_DISAGREE_THIS_SESSION);
- }
- // The license has already been disagreed to this session. Do not prompt.
- else if(agreed == LICENSE_DISAGREE_THIS_SESSION)
- {
- return false;
- }
-
-
- // Prompt the user to accept the license.
- int licenseAcceptance = promptToAcceptLicense(url, licenseURL);
- if(licenseAcceptance == Accepted.ACCEPTED)
- {
- agreeLicense(licenseURL);
- return true;
- }
- else if(licenseAcceptance == Accepted.NOT_ACCEPTED)
- {
- disagreeLicenseThisSession(licenseURL);
- return false;
- }
- return false;
- }
-
- // The license is not registred with the registry.
- return true;
- }
-
- /**
- * Prompt the user to accept the license. This method creates a LicenseAcceptanceDialog.
- *
- * @param url The URL of the resource for which the license needs to be accepted.
- * @param licenseURL The URL of the license to be accepted.
- * @return 0 if accepted, 1 if not accepted, 2 if not able to accept.
- */
- protected int promptToAcceptLicense(final String url, final String licenseURL)
- {
- final Accepted accepted = new Accepted();
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- try
- {
- if(LicenseAcceptanceDialog.promptForLicense(null, url, licenseURL))
- {
- accepted.accepted = Accepted.ACCEPTED;
- }
- else
- {
- accepted.accepted = Accepted.NOT_ACCEPTED;
- }
- }
- catch(Exception e)
- {
- accepted.accepted = Accepted.NOT_DETERMINED;
- }
- }
- });
- return accepted.accepted;
- }
-
- /**
- * Get an array containing all the licenses in the registry.
- *
- * @return As array containing all the licenses in the registry.
- */
- protected String[] getLicenses()
- {
- return (String[])licenses.keySet().toArray(new String[licenses.keySet().size()]);
- }
-
- /**
- * Get the state of the license.
- *
- * @param url The URL of the license.
- * @return The state of the license.
- */
- protected Integer getLicenseState(String url)
- {
- return (Integer)licenses.get(url);
- }
-
-
- /**
- * A class to hold acceptance information for the prompt method.
- */
- private class Accepted
- {
- public static final int ACCEPTED = 0;
- public static final int NOT_ACCEPTED = 1;
- public static final int NOT_DETERMINED = 2;
- public int accepted = NOT_ACCEPTED;
- }
-
-}
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/ToCacheRegistryReader.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/ToCacheRegistryReader.java
deleted file mode 100644
index 96733769a..000000000
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/ToCacheRegistryReader.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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 Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.internet.cache.internal;
-
-import java.util.Hashtable;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-
-/**
- * The ToCacheRegistryReaders reads Eclipse extensions which specify
- * resources to cache. An extension point looks like the following.
- *
- * <extension point="org.eclipse.wst.internet.cache.cacheresource">
- * <cacheresource uri="URI_TO_CACHE" license="URI_OF_LICENSE"/>
- * </extension>
- *
- */
-public class ToCacheRegistryReader
-{
- protected static final String PLUGIN_ID = "org.eclipse.wst.internet.cache";
- protected static final String EXTENSION_POINT_ID = "cacheresource";
- protected static final String ATT_URL = "url";
- protected static final String ATT_LICENSE = "license";
-
- private static ToCacheRegistryReader registryReader = null;
-
- private Hashtable resourcesToCache = new Hashtable();
-
- /**
- * Get the one and only instance of this registry reader.
- *
- * @return The one and only instance of this registry reader.
- */
- public static ToCacheRegistryReader getInstance()
- {
- if(registryReader == null)
- {
- registryReader = new ToCacheRegistryReader();
- }
- return registryReader;
- }
- /**
- * Read from plugin registry and handle the configuration elements that match
- * the spedified elements.
- */
- public void readRegistry()
- {
- IExtensionRegistry pluginRegistry = Platform.getExtensionRegistry();
- IExtensionPoint point = pluginRegistry.getExtensionPoint(PLUGIN_ID, EXTENSION_POINT_ID);
- if (point != null)
- {
- IConfigurationElement[] elements = point.getConfigurationElements();
- for (int i = 0; i < elements.length; i++)
- {
- ToCacheResource toCacheResource = readElement(elements[i]);
- if(toCacheResource != null)
- {
- resourcesToCache.put(toCacheResource.getURL(), toCacheResource);
- LicenseRegistry.getInstance().addLicense(toCacheResource.getLicense());
- }
- }
- }
- }
-
- /**
- * Parse and deal with the extension points.
- *
- * @param element The extension point element.
- */
- protected ToCacheResource readElement(IConfigurationElement element)
- {
-
- if(element.getName().equals(EXTENSION_POINT_ID))
- {
- String url = element.getAttribute(ATT_URL);
- if(url != null)
- {
- String license = element.getAttribute(ATT_LICENSE);
- return new ToCacheResource(url, license);
- }
- }
- return null;
- }
-
- /**
- * Get the list of URIs that have been specified for caching.
- *
- * @return The list of URIs that have been specified for caching.
- */
- public String[] getURIsToCache()
- {
- return (String[])resourcesToCache.keySet().toArray(new String[resourcesToCache.size()]);
- }
-
- /**
- * Get the resource to cache if one has been specified.
- *
- * @param url The URL of the resource to cache.
- * @return A ToCacheResource object representing the URL or null if none has been specified.
- */
- public ToCacheResource getResourceToCache(String url)
- {
- return (ToCacheResource)resourcesToCache.get(url);
- }
-}
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/ToCacheResource.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/ToCacheResource.java
deleted file mode 100644
index 3f6778bad..000000000
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/ToCacheResource.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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 Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.internet.cache.internal;
-
-/**
- * A resource that is specified to be cached. The resource has a URL and an optional
- * license.
- */
-public class ToCacheResource
-{
- private String url;
- private String license;
-
- /**
- * Constructor.
- *
- * @param url The URL of the resource to be cached.
- * @param license The URL of the optional license for this resource.
- */
- public ToCacheResource(String url, String license)
- {
- this.url = url;
- this.license = license;
- }
-
- /**
- * Get the URL of the resource to be cached.
- *
- * @return The URL of the resource to be cached.
- */
- public String getURL()
- {
- return url;
- }
-
- /**
- * Get the license URL of the resource to be cached.
- *
- * @return The license URL of the resource to be cached.
- */
- public String getLicense()
- {
- return license;
- }
-}
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/CachePreferencePage.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/CachePreferencePage.java
deleted file mode 100644
index 5b8bd6cf9..000000000
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/CachePreferencePage.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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 Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.internet.cache.internal.preferences;
-
-import java.util.Arrays;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.internet.cache.internal.Cache;
-import org.eclipse.wst.internet.cache.internal.CachePlugin;
-
-/**
- * This class represents a preference page that is contributed to the
- * Preferences dialog. This page contains options for the cache. The cache can
- * be disabled, the list of entries in the cache can be viewed, and individual
- * entries or the entire cache can be deleted.
- */
-
-public class CachePreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage
-{
- private static final String _UI_CONFIRM_CLEAR_CACHE_DIALOG_TITLE = "_UI_CONFIRM_CLEAR_CACHE_DIALOG_TITLE";
-
- private static final String _UI_CONFIRM_CLEAR_CACHE_DIALOG_MESSAGE = "_UI_CONFIRM_CLEAR_CACHE_DIALOG_MESSAGE";
-
- private static final String _UI_BUTTON_CLEAR_CACHE = "_UI_BUTTON_CLEAR_CACHE";
-
- private static final String _UI_BUTTON_DELETE_ENTRY = "_UI_BUTTON_DELETE_ENTRY";
-
- private static final String _UI_PREF_CACHE_ENTRIES_TITLE = "_UI_PREF_CACHE_ENTRIES_TITLE";
-
- private static final String _UI_PREF_CACHE_CACHE_OPTION = "_UI_PREF_CACHE_CACHE_OPTION";
-
- private static final String _UI_CONFIRM_DELETE_CACHE_ENTRY_DIALOG_TITLE = "_UI_CONFIRM_DELETE_CACHE_ENTRY_DIALOG_TITLE";
-
- private static final String _UI_CONFIRM_DELETE_CACHE_ENTRY_DIALOG_MESSAGE = "_UI_CONFIRM_DELETE_CACHE_ENTRY_DIALOG_MESSAGE";
-
- private static final String _UI_PREF_CACHE_ABOUT = "_UI_PREF_CACHE_ABOUT";
-
- private static final String _UI_PREF_PROMPT_FOR_DISAGREED_LICENSES = "_UI_PREF_PROMPT_FOR_DISAGREED_LICENSES";
-
- protected Button clearButton;
-
- protected Button deleteButton;
-
- protected Button enabledButton;
-
- protected Button disagreedLicensesButton;
-
- protected List entries;
-
- protected Composite composite = null;
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
- */
- public void dispose()
- {
- if (composite != null)
- {
- composite.dispose();
- }
- super.dispose();
- }
-
- /**
- * Constructor.
- */
- public CachePreferencePage()
- {
- setPreferenceStore(CachePlugin.getDefault().getPreferenceStore());
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench)
- {
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent)
- {
- noDefaultAndApplyButton();
-
- composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
- layout.verticalSpacing = convertVerticalDLUsToPixels(3);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- composite.setLayoutData(gd);
-
- Label aboutLabel = new Label(composite, SWT.WRAP);
- aboutLabel.setText(CachePlugin.getResourceString(_UI_PREF_CACHE_ABOUT));
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gridData.horizontalSpan = 2;
- aboutLabel.setLayoutData(gridData);
- new Label(composite, SWT.None);
- try
- {
- // Created the disable cache option.
- enabledButton = new Button(composite, SWT.CHECK | SWT.LEFT);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gridData.horizontalSpan = 2;
- enabledButton.setLayoutData(gridData);
- enabledButton.setText(CachePlugin
- .getResourceString(_UI_PREF_CACHE_CACHE_OPTION));
- enabledButton.setSelection(!CachePlugin.getDefault().getPreferenceStore()
- .getBoolean(PreferenceConstants.CACHE_ENABLED));
- enabledButton.addSelectionListener(new SelectionListener()
- {
-
- public void widgetDefaultSelected(SelectionEvent e)
- {
- widgetSelected(e);
-
- }
-
- public void widgetSelected(SelectionEvent e)
- {
- boolean disabled = enabledButton.getSelection();
- CachePlugin.getDefault().setCacheEnabled(!disabled);
- }
-
- });
-
- disagreedLicensesButton = new Button(composite, SWT.CHECK | SWT.LEFT);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gridData.horizontalSpan = 2;
- disagreedLicensesButton.setLayoutData(gridData);
- disagreedLicensesButton.setText(CachePlugin
- .getResourceString(_UI_PREF_PROMPT_FOR_DISAGREED_LICENSES));
- disagreedLicensesButton.setSelection(CachePlugin.getDefault().getPreferenceStore()
- .getBoolean(PreferenceConstants.PROMPT_DISAGREED_LICENSES));
- disagreedLicensesButton.addSelectionListener(new SelectionListener()
- {
-
- public void widgetDefaultSelected(SelectionEvent e)
- {
- widgetSelected(e);
-
- }
-
- public void widgetSelected(SelectionEvent e)
- {
- boolean prompt = disagreedLicensesButton.getSelection();
- CachePlugin.getDefault().setPromptDisagreedLicenses(prompt);
- }
-
- });
-
- // Create the entities group.
- Label entriesLabel = new Label(composite, SWT.WRAP);
- entriesLabel.setText(CachePlugin.getResourceString(_UI_PREF_CACHE_ENTRIES_TITLE));
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gridData.horizontalSpan = 2;
- entriesLabel.setLayoutData(gridData);
-
- entries = new List(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(entries,
- ContextIds.PREF_ENTRIES);
- String[] cacheEntries = Cache.getInstance().getCachedURIs();
- Arrays.sort(cacheEntries);
- entries.setItems(cacheEntries);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_FILL);
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- entries.setLayoutData(gridData);
- entries.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- setPreferenceWidgets();
- }
- });
-
- Composite buttonComposite = new Composite(composite, SWT.NULL);
- GridLayout gridLayout = new GridLayout();
- gridLayout.horizontalSpacing = 0;
- gridLayout.verticalSpacing = convertVerticalDLUsToPixels(3);
- gridLayout.marginWidth = 0;
- gridLayout.marginHeight = 0;
- gridLayout.numColumns = 1;
- buttonComposite.setLayout(gridLayout);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_FILL | SWT.TOP);
- buttonComposite.setLayoutData(gridData);
- // Create the Delete button
- deleteButton = new Button(buttonComposite, SWT.PUSH);
- deleteButton.setText(CachePlugin
- .getResourceString(_UI_BUTTON_DELETE_ENTRY));
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
- gridData.grabExcessHorizontalSpace = true;
- deleteButton.setLayoutData(gridData);
- deleteButton.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- if (MessageDialog
- .openConfirm(
- Display.getDefault().getActiveShell(),
- CachePlugin.getResourceString(_UI_CONFIRM_DELETE_CACHE_ENTRY_DIALOG_TITLE),
- CachePlugin.getResourceString(_UI_CONFIRM_DELETE_CACHE_ENTRY_DIALOG_MESSAGE)))
- {
- String[] selectedEntries = entries.getSelection();
- int numSelectedEntries = selectedEntries.length;
-
- Cache cache = Cache.getInstance();
- for (int i = 0; i < numSelectedEntries; i++)
- {
- cache.deleteEntry(selectedEntries[i]);
- }
- String[] cacheEntries = cache.getCachedURIs();
- Arrays.sort(cacheEntries);
- entries.setItems(cacheEntries);
- setPreferenceWidgets();
- }
- }
- });
-
- // Create the Clear Cache button
- clearButton = new Button(buttonComposite, SWT.PUSH);
- clearButton.setText(CachePlugin.getResourceString(_UI_BUTTON_CLEAR_CACHE));
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
- gridData.grabExcessHorizontalSpace = true;
- clearButton.setLayoutData(gridData);
- clearButton.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- if (MessageDialog.openConfirm(Display.getDefault().getActiveShell(),
- CachePlugin.getResourceString(_UI_CONFIRM_CLEAR_CACHE_DIALOG_TITLE),
- CachePlugin.getResourceString(_UI_CONFIRM_CLEAR_CACHE_DIALOG_MESSAGE)))
- {
- Cache cache = Cache.getInstance();
- cache.clear();
- String[] cacheEntries = cache.getCachedURIs();
- Arrays.sort(cacheEntries);
- entries.setItems(cacheEntries);
- setPreferenceWidgets();
- }
- }
- });
-
- } catch (Throwable e)
- {
- //TODO: Log error
- }
- setPreferenceWidgets();
-
- return composite;
- }
-
- /**
- * Set the preference page widgets. There are a few rules. 1. If disabled, all
- * of the widgets are diabled except for the disabled check box. 2. If
- * enabled, all widgets are enabled except a. The delete button is enabled
- * only if there is a selection in the list. b. The clear button is enabled
- * only if there are items in the list.
- */
- public void setPreferenceWidgets()
- {
- if (composite != null && composite.getEnabled())
- {
- if (entries.getSelectionCount() > 0)
- {
- deleteButton.setEnabled(true);
- }
- else
- {
- deleteButton.setEnabled(false);
- }
- if (entries.getItemCount() > 0)
- {
- clearButton.setEnabled(true);
- }
- else
- {
- clearButton.setEnabled(false);
- }
-
- }
- }
-
- /*
- * @see PreferencePage#createControl(Composite)
- */
- public void createControl(Composite parent)
- {
- super.createControl(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ContextIds.PREF); //$NON-NLS-1$
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/ContextIds.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/ContextIds.java
deleted file mode 100644
index 259cafb03..000000000
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/ContextIds.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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 Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.internet.cache.internal.preferences;
-
-import org.eclipse.wst.internet.cache.internal.CachePlugin;
-
-/**
- * Constant ids for context help.
- */
-public interface ContextIds {
- public static final String PREF = CachePlugin.PLUGIN_ID + ".cpr0000";
- public static final String PREF_ENTRIES = CachePlugin.PLUGIN_ID + ".cpr0002";
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/PreferenceConstants.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/PreferenceConstants.java
deleted file mode 100644
index a51c4ae84..000000000
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/PreferenceConstants.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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 Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.internet.cache.internal.preferences;
-
-/**
- * Constant definitions for plug-in preferences
- */
-public class PreferenceConstants
-{
- public static final String CACHE_ENABLED = "cacheEnabled";
-
- public static final String PROMPT_DISAGREED_LICENSES = "promptDisagreedLicenses";
-
-}
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/PreferenceInitializer.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/PreferenceInitializer.java
deleted file mode 100644
index a7b4af9bf..000000000
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/preferences/PreferenceInitializer.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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 Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.internet.cache.internal.preferences;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-import org.eclipse.wst.internet.cache.internal.CachePlugin;
-
-/**
- * Class used to initialize default preference values.
- */
-public class PreferenceInitializer extends AbstractPreferenceInitializer
-{
- /**
- * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
- */
- public void initializeDefaultPreferences()
- {
- IPreferenceStore store = CachePlugin.getDefault().getPreferenceStore();
- store.setDefault(PreferenceConstants.CACHE_ENABLED, true);
- store.setDefault(PreferenceConstants.PROMPT_DISAGREED_LICENSES, false);
- }
-}

Back to the top