[117492] Added progress stack layout to license dialog while license is loading.
Added ability to define a license stored in a plug-in.
Updated messages to use OSGI NLS support.
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
index 8108abc..45d7df8 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * Copyright (c) 2001, 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
@@ -11,6 +11,8 @@
package org.eclipse.wst.internet.cache.internal;
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -23,8 +25,6 @@
*/
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;
@@ -33,7 +33,7 @@
*/
public CacheJob()
{
- super(CachePlugin.getResourceString(_UI_CACHE_MONITOR_NAME));
+ super(CacheMessages._UI_CACHE_MONITOR_NAME);
//specifiedURIsToCache = ToCacheRegistryReader.getInstance().getURIsToCache();
}
@@ -59,7 +59,7 @@
}
cache.clearUncachedURIs();
- monitor.beginTask(CachePlugin.getResourceString(_UI_CACHE_MONITOR_NAME), numUncachedURIs);
+ monitor.beginTask(CacheMessages._UI_CACHE_MONITOR_NAME, numUncachedURIs);
try
{
for(int i = 0; i < numUncachedURIs; i++)
@@ -73,7 +73,7 @@
return Status.CANCEL_STATUS;
}
String uri = uncachedURIs[i];
- monitor.subTask(CachePlugin.getResourceString(_UI_CACHE_MONITOR_CACHING, uri));
+ monitor.subTask(MessageFormat.format(CacheMessages._UI_CACHE_MONITOR_CACHING, new Object[]{uri}));
cache.getResource(uri);
monitor.worked(1);
monitor.subTask("");
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheMessages.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheMessages.java
new file mode 100644
index 0000000..f8fee2f
--- /dev/null
+++ b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/CacheMessages.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ */
+package org.eclipse.wst.internet.cache.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Strings used by the cache.
+ */
+public class CacheMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.wst.internet.cache.internal.CachePluginResources";//$NON-NLS-1$
+
+ public static String _UI_CONFIRM_CLEAR_CACHE_DIALOG_TITLE;
+ public static String _UI_CONFIRM_CLEAR_CACHE_DIALOG_MESSAGE;
+ public static String _UI_CONFIRM_DELETE_CACHE_ENTRY_DIALOG_TITLE;
+ public static String _UI_CONFIRM_DELETE_CACHE_ENTRY_DIALOG_MESSAGE;
+ public static String _UI_BUTTON_CLEAR_CACHE;
+ public static String _UI_BUTTON_DELETE_ENTRY;
+ public static String _UI_PREF_CACHE_ENTRIES_TITLE;
+ public static String _UI_PREF_CACHE_CACHE_OPTION;
+ public static String _UI_PREF_CACHE_ABOUT;
+ public static String _UI_PREF_PROMPT_FOR_DISAGREED_LICENSES;
+ public static String _UI_CACHE_MONITOR_NAME;
+ public static String _UI_CACHE_MONITOR_CACHING;
+
+ // Cache license dialog
+ public static String _UI_CACHE_DIALOG_LICENSE_STATEMENT1;
+ public static String _UI_CACHE_DIALOG_LICENSE_STATEMENT2;
+ public static String _UI_CACHE_DIALOG_LICENSE_STATEMENT2_NO_INTERNAL;
+ public static String _UI_CACHE_DIALOG_LICENSE_STATEMENT2_NO_BROWSER;
+ public static String _UI_CACHE_DIALOG_AGREE_BUTTON;
+ public static String _UI_CACHE_DIALOG_DISAGREE_BUTTON;
+ public static String _UI_CACHE_DIALOG_TITLE;
+ public static String _UI_LOADING_LICENSE;
+
+ // Cache logging messages
+ public static String _LOG_INFO_WTP_NO_USER_INTERACTION;
+
+ // WTP test no user interaction system property
+ public static String WTP_NO_USER_INTERACTION_SYSTEM_PROP;
+
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, CacheMessages.class);
+ }
+
+ private CacheMessages() {
+ // cannot create new instance
+ }
+}
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
index 11adf85..01a65e8 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * Copyright (c) 2001, 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
@@ -11,10 +11,6 @@
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;
@@ -126,39 +122,6 @@
}
/**
- * 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.
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
index 05729d2..fe850d6 100644
--- 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
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2005 IBM Corporation and others.
+# Copyright (c) 2005, 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
@@ -33,9 +33,11 @@
_UI_CACHE_DIALOG_AGREE_BUTTON = I Agree
_UI_CACHE_DIALOG_DISAGREE_BUTTON = I Disagree
_UI_CACHE_DIALOG_TITLE = License Agreement
+_UI_LOADING_LICENSE = Loading license
# 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
+# This property is checked by the cache. This sting is not shown to the user.
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/LicenseAcceptanceDialog.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/LicenseAcceptanceDialog.java
index a26a254..53d6da3 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * Copyright (c) 2001, 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
@@ -13,14 +13,20 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.text.MessageFormat;
import java.util.Hashtable;
import org.eclipse.jface.dialogs.IconAndMessageDialog;
+import org.eclipse.jface.wizard.ProgressMonitorPart;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.ProgressEvent;
+import org.eclipse.swt.browser.ProgressListener;
+import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.graphics.Image;
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.Label;
@@ -32,17 +38,6 @@
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();
@@ -58,6 +53,11 @@
private String licenseURL;
/**
+ * The agree button for the dialog.
+ */
+ private Button agreeButton = null;
+
+ /**
* Constructor.
*
* @param parent The parent of this dialog.
@@ -76,7 +76,7 @@
protected void configureShell(Shell shell)
{
super.configureShell(shell);
- shell.setText(CachePlugin.getResourceString(_UI_CACHE_DIALOG_TITLE));
+ shell.setText(CacheMessages._UI_CACHE_DIALOG_TITLE);
shell.setImage(null);
}
@@ -94,12 +94,13 @@
buttonBar.setLayoutData(gd);
// Create the agree button.
- createButton(buttonBar, LicenseAcceptanceDialog.OK,
- CachePlugin.getResourceString(_UI_CACHE_DIALOG_AGREE_BUTTON), false);
-
+ agreeButton = createButton(buttonBar, LicenseAcceptanceDialog.OK,
+ CacheMessages._UI_CACHE_DIALOG_AGREE_BUTTON, false);
+ agreeButton.setEnabled(false);
+
// Create the disagree button.
createButton(buttonBar, LicenseAcceptanceDialog.CANCEL,
- CachePlugin.getResourceString(_UI_CACHE_DIALOG_DISAGREE_BUTTON), false);
+ CacheMessages._UI_CACHE_DIALOG_DISAGREE_BUTTON, false);
return buttonBar;
}
@@ -118,7 +119,7 @@
// Display a statement about the license.
Label licenseText1 = new Label(composite, SWT.NONE);
- licenseText1.setText(CachePlugin.getResourceString(_UI_CACHE_DIALOG_LICENSE_STATEMENT1));
+ licenseText1.setText(CacheMessages._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);
@@ -131,12 +132,56 @@
// Display the license in a browser.
try
{
- Browser browser = new Browser(composite, SWT.BORDER);
- gd = new GridData(GridData.FILL_BOTH);
+ final Composite licenseTextComposite = new Composite(composite, SWT.NONE);
+ final StackLayout stackLayout = new StackLayout();
+ licenseTextComposite.setLayout(stackLayout);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = 400;
+ licenseTextComposite.setLayoutData(gd);
+ // Create the loading progress monitor composite and part.
+ Composite monitorComposite = new Composite(licenseTextComposite, SWT.NONE);
+ monitorComposite.setLayout(new GridLayout());
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.heightHint = 400;
+ monitorComposite.setLayoutData(gd);
+ final ProgressMonitorPart monitor = new ProgressMonitorPart(monitorComposite, new GridLayout());
+ gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
+ monitor.setLayoutData(gd);
+ monitor.beginTask(CacheMessages._UI_LOADING_LICENSE, 100);
+ stackLayout.topControl = monitorComposite;
+ // Create the browser.
+ final Browser browser = new Browser(licenseTextComposite, SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ //gd.heightHint = 400;
browser.setUrl(licenseURL);
browser.setLayoutData(gd);
- licenseText2.setText(CachePlugin.getResourceString(_UI_CACHE_DIALOG_LICENSE_STATEMENT2));
+ browser.addProgressListener(new ProgressListener(){
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.browser.ProgressListener#changed(org.eclipse.swt.browser.ProgressEvent)
+ */
+ public void changed(ProgressEvent event)
+ {
+ if (event.total != 0)
+ {
+ monitor.internalWorked(event.current * 100 / event.total);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.browser.ProgressListener#completed(org.eclipse.swt.browser.ProgressEvent)
+ */
+ public void completed(ProgressEvent event)
+ {
+ monitor.done();
+
+ stackLayout.topControl = browser;
+ agreeButton.setEnabled(true);
+ licenseTextComposite.layout();
+ }
+ });
+
+ licenseText2.setText(CacheMessages._UI_CACHE_DIALOG_LICENSE_STATEMENT2);
}
catch(Throwable e)
{
@@ -145,12 +190,12 @@
try
{
CachePlugin.getDefault().getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(licenseURL));
- licenseText2.setText(CachePlugin.getResourceString(_UI_CACHE_DIALOG_LICENSE_STATEMENT2_NO_INTERNAL));
+ licenseText2.setText(CacheMessages._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));
+ licenseText2.setText(MessageFormat.format(CacheMessages._UI_CACHE_DIALOG_LICENSE_STATEMENT2_NO_BROWSER, new Object[]{licenseURL}));
}
}
@@ -190,25 +235,13 @@
}
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);
@@ -219,10 +252,6 @@
}
finally
{
-// if(bufreader != null)
-// {
-// bufreader.close();
-// }
if(is != null)
{
try
@@ -250,9 +279,21 @@
dialogsInUse.remove(licenseURL);
}
}
-
-
return agreedToLicense;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#close()
+ */
+ public boolean close()
+ {
+ if(agreeButton != null)
+ {
+ agreeButton.dispose();
+ agreeButton = null;
+ }
+ return super.close();
+ }
+
}
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
index 6a66bc5..2ffb248 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * Copyright (c) 2001, 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.wst.internet.cache.internal;
+import java.text.MessageFormat;
import java.util.Hashtable;
import org.eclipse.core.runtime.IStatus;
@@ -28,10 +29,6 @@
// 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.
*/
@@ -53,9 +50,9 @@
// 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"))
+ if(System.getProperty(CacheMessages.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));
+ CachePlugin.getDefault().getLog().log(new Status(IStatus.INFO, CachePlugin.PLUGIN_ID, IStatus.OK, MessageFormat.format(CacheMessages._LOG_INFO_WTP_NO_USER_INTERACTION, new Object[]{CacheMessages.WTP_NO_USER_INTERACTION_SYSTEM_PROP}), null));
DO_NOT_PROMPT = true;
}
}
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
index 9673376..73165b2 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * Copyright (c) 2001, 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
@@ -11,12 +11,18 @@
package org.eclipse.wst.internet.cache.internal;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
import java.util.Hashtable;
+import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
+import org.osgi.framework.Bundle;
/**
* The ToCacheRegistryReaders reads Eclipse extensions which specify
@@ -88,6 +94,30 @@
if(url != null)
{
String license = element.getAttribute(ATT_LICENSE);
+
+ // If the license is relative resolve relative to the
+ // plug-in that declares it.
+ try
+ {
+ URI licenseURI = new URI(license);
+ if(!licenseURI.isAbsolute())
+ {
+ Bundle pluginBundle = Platform.getBundle(element.getDeclaringExtension().getContributor().getName());
+ URL licenseURL = pluginBundle.getEntry(license);
+ if(licenseURL != null)
+ {
+ license = FileLocator.resolve(licenseURL).toExternalForm();
+ }
+ }
+ }
+ catch(URISyntaxException e)
+ {
+ // Use the license as specified.
+ }
+ catch(IOException e)
+ {
+ // Use the license as specified.
+ }
return new ToCacheResource(url, 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
index 5b8bd6c..a72fdf2 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * Copyright (c) 2001, 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
@@ -31,6 +31,7 @@
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.CacheMessages;
import org.eclipse.wst.internet.cache.internal.CachePlugin;
/**
@@ -43,26 +44,6 @@
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;
@@ -121,7 +102,7 @@
composite.setLayoutData(gd);
Label aboutLabel = new Label(composite, SWT.WRAP);
- aboutLabel.setText(CachePlugin.getResourceString(_UI_PREF_CACHE_ABOUT));
+ aboutLabel.setText(CacheMessages._UI_PREF_CACHE_ABOUT);
GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gridData.horizontalSpan = 2;
aboutLabel.setLayoutData(gridData);
@@ -133,8 +114,7 @@
gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gridData.horizontalSpan = 2;
enabledButton.setLayoutData(gridData);
- enabledButton.setText(CachePlugin
- .getResourceString(_UI_PREF_CACHE_CACHE_OPTION));
+ enabledButton.setText(CacheMessages._UI_PREF_CACHE_CACHE_OPTION);
enabledButton.setSelection(!CachePlugin.getDefault().getPreferenceStore()
.getBoolean(PreferenceConstants.CACHE_ENABLED));
enabledButton.addSelectionListener(new SelectionListener()
@@ -158,8 +138,7 @@
gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gridData.horizontalSpan = 2;
disagreedLicensesButton.setLayoutData(gridData);
- disagreedLicensesButton.setText(CachePlugin
- .getResourceString(_UI_PREF_PROMPT_FOR_DISAGREED_LICENSES));
+ disagreedLicensesButton.setText(CacheMessages._UI_PREF_PROMPT_FOR_DISAGREED_LICENSES);
disagreedLicensesButton.setSelection(CachePlugin.getDefault().getPreferenceStore()
.getBoolean(PreferenceConstants.PROMPT_DISAGREED_LICENSES));
disagreedLicensesButton.addSelectionListener(new SelectionListener()
@@ -181,7 +160,7 @@
// Create the entities group.
Label entriesLabel = new Label(composite, SWT.WRAP);
- entriesLabel.setText(CachePlugin.getResourceString(_UI_PREF_CACHE_ENTRIES_TITLE));
+ entriesLabel.setText(CacheMessages._UI_PREF_CACHE_ENTRIES_TITLE);
gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gridData.horizontalSpan = 2;
entriesLabel.setLayoutData(gridData);
@@ -217,8 +196,7 @@
buttonComposite.setLayoutData(gridData);
// Create the Delete button
deleteButton = new Button(buttonComposite, SWT.PUSH);
- deleteButton.setText(CachePlugin
- .getResourceString(_UI_BUTTON_DELETE_ENTRY));
+ deleteButton.setText(CacheMessages._UI_BUTTON_DELETE_ENTRY);
gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
gridData.grabExcessHorizontalSpace = true;
deleteButton.setLayoutData(gridData);
@@ -229,8 +207,8 @@
if (MessageDialog
.openConfirm(
Display.getDefault().getActiveShell(),
- CachePlugin.getResourceString(_UI_CONFIRM_DELETE_CACHE_ENTRY_DIALOG_TITLE),
- CachePlugin.getResourceString(_UI_CONFIRM_DELETE_CACHE_ENTRY_DIALOG_MESSAGE)))
+ CacheMessages._UI_CONFIRM_DELETE_CACHE_ENTRY_DIALOG_TITLE,
+ CacheMessages._UI_CONFIRM_DELETE_CACHE_ENTRY_DIALOG_MESSAGE))
{
String[] selectedEntries = entries.getSelection();
int numSelectedEntries = selectedEntries.length;
@@ -250,7 +228,7 @@
// Create the Clear Cache button
clearButton = new Button(buttonComposite, SWT.PUSH);
- clearButton.setText(CachePlugin.getResourceString(_UI_BUTTON_CLEAR_CACHE));
+ clearButton.setText(CacheMessages._UI_BUTTON_CLEAR_CACHE);
gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
gridData.grabExcessHorizontalSpace = true;
clearButton.setLayoutData(gridData);
@@ -259,8 +237,8 @@
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)))
+ CacheMessages._UI_CONFIRM_CLEAR_CACHE_DIALOG_TITLE,
+ CacheMessages._UI_CONFIRM_CLEAR_CACHE_DIALOG_MESSAGE))
{
Cache cache = Cache.getInstance();
cache.clear();