Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorndai2009-03-29 18:23:25 +0000
committerndai2009-03-29 18:23:25 +0000
commit1a83db76e55052d3ef6642d17d864bed36ef6004 (patch)
tree369ea771a493a6ce2c9233bbfd317210ae66ebf4 /plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery
parent4666eed7f259322e2c12d304d7d299e952e7739f (diff)
downloadwebtools.servertools-1a83db76e55052d3ef6642d17d864bed36ef6004.tar.gz
webtools.servertools-1a83db76e55052d3ef6642d17d864bed36ef6004.tar.xz
webtools.servertools-1a83db76e55052d3ef6642d17d864bed36ef6004.zip
This commit was manufactured by cvs2svn to create tag 'v200903292134'.v200903292134
Diffstat (limited to 'plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery')
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/Discovery.java25
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/ExtensionWizard.java164
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Activator.java60
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionInstallableUnitQuery.java33
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionUtility.java257
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/IMemento.java133
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ImageResource.java130
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.java36
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.properties27
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ProgressUtil.java69
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Trace.java89
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/XMLMemento.java390
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/Extension.java109
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/ExtensionUpdateSite.java104
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/BaseLabelProvider.java142
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ErrorWizardPage.java257
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionComposite.java495
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionContentProvider.java39
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionTableLabelProvider.java59
-rw-r--r--plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionWizardPage.java121
20 files changed, 0 insertions, 2739 deletions
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/Discovery.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/Discovery.java
deleted file mode 100644
index 125b74d80..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/Discovery.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.server.discovery;
-
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-
-public class Discovery {
- public static boolean launchExtensionWizard(Shell shell, String title, String message) {
- ExtensionWizard wizard = new ExtensionWizard();
- WizardDialog dialog = new WizardDialog(shell, wizard);
- if (dialog.open() != Window.CANCEL)
- return true;
- return false;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/ExtensionWizard.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/ExtensionWizard.java
deleted file mode 100644
index eda262e61..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/ExtensionWizard.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.server.discovery;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.AcceptLicensesWizardPage;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.server.discovery.internal.ImageResource;
-import org.eclipse.wst.server.discovery.internal.Messages;
-import org.eclipse.wst.server.discovery.internal.model.Extension;
-import org.eclipse.wst.server.discovery.internal.wizard.ErrorWizardPage;
-import org.eclipse.wst.server.discovery.internal.wizard.ExtensionWizardPage;
-
-public class ExtensionWizard extends Wizard {
- protected ExtensionWizardPage extensionPage;
- protected AcceptLicensesWizardPage licensePage;
- protected ErrorWizardPage errorPage;
- protected IWizardPage nextPage;
-
- public ExtensionWizard() {
- super();
- setWindowTitle(Messages.wizExtensionTitle);
- setDefaultPageImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_WIZARD));
- setNeedsProgressMonitor(true);
- setForcePreviousAndNextButtons(true);
- }
-
- public void addPages() {
- super.addPages();
- Policy policy = new Policy();
- licensePage = new AcceptLicensesWizardPage(policy, new IInstallableUnit[0], null);
- licensePage.setWizard(this);
- errorPage = new ErrorWizardPage();
- errorPage.setWizard(this);
- extensionPage = new ExtensionWizardPage(licensePage, errorPage);
- extensionPage.setWizard(this);
- }
-
- public int getPageCount() {
- if (nextPage != null)
- return 2;
- return 1;
- }
-
- public IWizardPage[] getPages() {
- if (nextPage != null)
- return new IWizardPage[] { extensionPage, nextPage };
- return new IWizardPage[] { extensionPage };
- }
-
- public boolean canFinish() {
- return licensePage.equals(nextPage) && licensePage.isPageComplete();
- }
-
- public IWizardPage getStartingPage() {
- return extensionPage;
- }
-
- public IWizardPage getNextPage(IWizardPage page) {
- if (extensionPage.equals(page))
- return nextPage;
- return null;
- }
-
- public IWizardPage getPreviousPage(IWizardPage page) {
- if (nextPage != null && nextPage.equals(page))
- return extensionPage;
- return null;
- }
-
- public void setSecondPage(IWizardPage page) {
- nextPage = page;
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- getContainer().updateButtons();
- }
- });
- }
-
- public boolean performFinish() {
- return install(extensionPage.getExtension());
- }
-
- /**
- * Install a new feature.
- * @param extension
- */
- protected static boolean install(final Extension extension) {
- if (extension == null)
- return false;
-
- final boolean[] b = new boolean[1];
- final Display display = Display.getDefault();
- display.syncExec(new Runnable() {
- public void run() {
- String msg = NLS.bind(Messages.installConfirm, extension.getName());
- b[0] = MessageDialog.openConfirm(display.getActiveShell(),
- Messages.dialogTitle, msg);
- }
- });
- if (!b[0])
- return true;
-
- String name = NLS.bind(Messages.installJobName, extension.getName());
- Job job = new Job(name) {
- public IStatus run(IProgressMonitor monitor) {
- IStatus status = extension.install(monitor);
- if (status.isOK() && !monitor.isCanceled())
- promptRestart();
- return status;
- }
- };
- job.setUser(true);
- job.schedule();
- return true;
- }
-
- /**
- * Prompt the user to restart.
- */
- protected static void promptRestart() {
- final Display display = Display.getDefault();
- display.asyncExec(new Runnable() {
- public void run() {
- if (MessageDialog.openQuestion(display.getActiveShell(),
- Messages.dialogTitle, Messages.installPromptRestart)) {
- Thread t = new Thread("Restart thread") {
- public void run() {
- try {
- sleep(1000);
- } catch (Exception e) {
- // ignore
- }
- display.asyncExec(new Runnable() {
- public void run() {
- PlatformUI.getWorkbench().restart();
- }
- });
- }
- };
- t.setDaemon(true);
- t.start();
- }
- }
- });
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Activator.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Activator.java
deleted file mode 100644
index 35fe3e85a..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Activator.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.server.discovery.internal;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.wst.server.discovery";
- public static final String JOB_FAMILY = PLUGIN_ID;
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- // do nothing
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionInstallableUnitQuery.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionInstallableUnitQuery.java
deleted file mode 100644
index 2e054f8a9..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionInstallableUnitQuery.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.server.discovery.internal;
-
-import java.util.List;
-
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.query.MatchQuery;
-
-public class ExtensionInstallableUnitQuery extends MatchQuery {
- private List<String> list;
-
- public ExtensionInstallableUnitQuery(List<String> list) {
- this.list = list;
- }
-
- public boolean isMatch(Object object) {
- if (!(object instanceof IInstallableUnit))
- return false;
- IInstallableUnit candidate = (IInstallableUnit) object;
- if (list.contains(candidate.getId()))
- return true;
- return false;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionUtility.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionUtility.java
deleted file mode 100644
index a361d8f5c..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ExtensionUtility.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.server.discovery.internal;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.equinox.internal.provisional.p2.core.Version;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfileRegistry;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
-import org.eclipse.equinox.internal.provisional.p2.query.Collector;
-import org.eclipse.equinox.internal.provisional.p2.query.Query;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.discovery.internal.model.Extension;
-import org.eclipse.wst.server.discovery.internal.model.ExtensionUpdateSite;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-
-public class ExtensionUtility {
- private static ExtensionUpdateSite[] getExtensionUpdateSites(URL url) throws CoreException {
- InputStream in = null;
- try {
- in = url.openStream();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not load URL " + url);
- }
-
- if (in == null)
- throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, "Could not load extensions", null));
-
- try {
- IMemento memento = XMLMemento.loadMemento(in);
- IMemento children[] = memento.getChildren("site");
- int size = children.length;
- List<ExtensionUpdateSite> list = new ArrayList<ExtensionUpdateSite>(size);
- for (int i = 0; i < size; i++) {
- String url2 = children[i].getString("url");
- ExtensionUpdateSite item = new ExtensionUpdateSite(url2, null, null);
- list.add(item);
- }
-
- ExtensionUpdateSite[] items = new ExtensionUpdateSite[list.size()];
- list.toArray(items);
- return items;
- } catch (Exception e) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, e.getMessage(), e));
- }
- }
-
- /**
- * Returns an array of all known extension update sites.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @return the array of extensions items {@link ExtensionUpdateSite}
- */
- private static ExtensionUpdateSite[] getExtensionUpdateSites() {
- URL url = Activator.getDefault().getBundle().getEntry("serverAdapterSites.xml");
-
- try {
- return getExtensionUpdateSites(url);
- } catch (CoreException ce) {
- Trace.trace(Trace.SEVERE, "Could not get extension items");
- return new ExtensionUpdateSite[0];
- }
- }
-
- /**
- * Return true if the new feature is already installed, or a newer one is.
- *
- * @param existing
- * @param newFeature
- * @return true if the new feature is already installed, or a newer one is.
- */
- private static boolean alreadyExists(List<Extension> existing, Extension newFeature) {
- if (existing.contains(newFeature))
- return true;
-
- Version newV = newFeature.getVersion();
-
- Iterator<Extension> iterator = existing.iterator();
- while (iterator.hasNext()) {
- Extension feature = iterator.next();
- if (feature.getId().equals(newFeature.getId())) {
- if (feature.getVersion().compareTo(newV) >= 0)
- return true;
- }
- }
-
- return false;
- }
-
- private static void addExtension(List<Extension> list, List<Extension> existing, Extension newFeature, ExtensionListener listener) {
- if (alreadyExists(existing, newFeature))
- return;
-
- synchronized (list) {
- Version newV = newFeature.getVersion();
- Extension remove = null;
-
- Iterator<Extension> iterator = list.iterator();
- while (iterator.hasNext()) {
- Extension feature = iterator.next();
- if (feature.getId().equals(newFeature.getId())) {
- if (feature.getVersion().compareTo(newV) < 0) {
- remove = feature;
- } else // new feature is older
- return;
- }
- }
- if (remove != null) {
- list.remove(remove);
- listener.extensionRemoved(remove);
- }
-
- list.add(newFeature);
- }
- listener.extensionFound(newFeature);
- }
-
- protected static void addExtensions(List<Extension> list, List<Extension> existing, List<Extension> newFeatures, ExtensionListener listener) {
- Iterator<Extension> iterator = newFeatures.iterator();
- while (iterator.hasNext())
- addExtension(list, existing, iterator.next(), listener);
- }
-
- public interface ExtensionListener {
- public void extensionFound(Extension extension);
- public void extensionRemoved(Extension feature);
- public void siteFailure(String host);
- }
-
- private static List<Extension> getExistingFeatures(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask(Messages.discoverLocalConfiguration, 100);
-
- IProfileRegistry profileRegistry = (IProfileRegistry) getService(Activator.getDefault().getBundle().getBundleContext(), IProfileRegistry.class.getName());
- IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
-
- Query query = new InstallableUnitQuery(null);
- //Query query = new InstallableUnitQuery("org.eclipse.wst.server.core.serverAdapter");
- //List<String> list2 = new ArrayList();
- //Query query = new ExtensionInstallableUnitQuery(list2);
- Collector collector = new Collector();
- profile.query(query, collector, monitor);
-
- List<Extension> list = new ArrayList<Extension>();
- Iterator iter = collector.iterator();
- while (iter.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) iter.next();
- if (!list.contains(iu))
- list.add(new Extension(iu));
- }
-
- monitor.done();
-
- return list;
- }
-
- public static Extension[] getAllExtensions(final String id, final ExtensionListener listener, IProgressMonitor monitor) throws CoreException {
- monitor = ProgressUtil.getMonitorFor(monitor);
- monitor.beginTask("", 1100);
-
- monitor.subTask(Messages.discoverLocalConfiguration);
- final List<Extension> existing = getExistingFeatures(ProgressUtil.getSubMonitorFor(monitor, 100));
-
- final ExtensionUpdateSite[] items = getExtensionUpdateSites();
- if (items == null || items.length == 0)
- return new Extension[0];
- final int x = 1000 / items.length;
-
- monitor.worked(50);
- final List<Extension> list = new ArrayList<Extension>();
- int size = items.length;
-
- Thread[] threads = new Thread[size];
- for (int i = 0; i < size; i++) {
- try {
- if (monitor.isCanceled())
- return null;
-
- monitor.subTask(NLS.bind(Messages.discoverSearching, items[i].getUrl()));
- final int ii = i;
- final IProgressMonitor monitor2 = monitor;
- threads[i] = new Thread("Extension Checker for " + items[i].getUrl()) {
- public void run() {
- try {
- List<Extension> list2 = items[ii].getExtensions(ProgressUtil.getSubMonitorFor(monitor2, x));
- addExtensions(list, existing, list2, listener);
- } catch (CoreException ce) {
- listener.siteFailure(ce.getLocalizedMessage());
- Trace.trace(Trace.WARNING, "Error downloading extension info", ce);
- }
- }
- };
- threads[i].setDaemon(true);
- threads[i].start();
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Error downloading extension info 2", e);
- }
- }
-
- for (int i = 0; i < size; i++) {
- try {
- if (monitor.isCanceled())
- return null;
-
- if (threads[i].isAlive())
- threads[i].join();
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Error downloading extension info 3", e);
- }
- }
-
- Extension[] ef = new Extension[list.size()];
- list.toArray(ef);
- monitor.done();
- return ef;
- }
-
- /**
- * Returns the service described by the given arguments. Note that this is a helper class
- * that <b>immediately</b> ungets the service reference. This results in a window where the
- * system thinks the service is not in use but indeed the caller is about to use the returned
- * service object.
- * @param context
- * @param name
- * @return The requested service
- */
- public static Object getService(BundleContext context, String name) {
- if (context == null)
- return null;
- ServiceReference reference = context.getServiceReference(name);
- if (reference == null)
- return null;
- Object result = context.getService(reference);
- context.ungetService(reference);
- return result;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/IMemento.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/IMemento.java
deleted file mode 100644
index 4a44c9d5a..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/IMemento.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 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.server.discovery.internal;
-
-import java.util.List;
-/**
- * Interface to a memento used for saving the important state of an object
- * in a form that can be persisted in the file system.
- * <p>
- * Mementos were designed with the following requirements in mind:
- * <ol>
- * <li>Certain objects need to be saved and restored across platform sessions.
- * </li>
- * <li>When an object is restored, an appropriate class for an object might not
- * be available. It must be possible to skip an object in this case.</li>
- * <li>When an object is restored, the appropriate class for the object may be
- * different from the one when the object was originally saved. If so, the
- * new class should still be able to read the old form of the data.</li>
- * </ol>
- * </p>
- * <p>
- * Mementos meet these requirements by providing support for storing a
- * mapping of arbitrary string keys to primitive values, and by allowing
- * mementos to have other mementos as children (arranged into a tree).
- * A robust external storage format based on XML is used.
- * </p><p>
- * The key for an attribute may be any alpha numeric value. However, the
- * value of <code>TAG_ID</code> is reserved for internal use.
- * </p><p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface IMemento {
- /**
- * Creates a new child of this memento with the given type.
- * <p>
- * The <code>getChild</code> and <code>getChildren</code> methods
- * are used to retrieve children of a given type.
- * </p>
- *
- * @param type the type
- * @return a new child memento
- * @see #getChild
- * @see #getChildren
- */
- public IMemento createChild(String type);
-
- /**
- * Returns the first child with the given type id.
- *
- * @param type the type id
- * @return the first child with the given type
- */
- public IMemento getChild(String type);
-
- /**
- * Returns all children with the given type id.
- *
- * @param type the type id
- * @return the list of children with the given type
- */
- public IMemento[] getChildren(String type);
-
- /**
- * Returns the floating point value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found or was found
- * but was not a floating point number
- */
- public Float getFloat(String key);
-
- /**
- * Returns the integer value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found or was found
- * but was not an integer
- */
- public Integer getInteger(String key);
-
- /**
- * Returns the string value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found or was found
- * but was not an integer
- */
- public String getString(String key);
-
- /**
- * Returns the boolean value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found or was found
- * but was not a boolean
- */
- public Boolean getBoolean(String key);
-
- public List<String> getNames();
-
- /**
- * Sets the value of the given key to the given integer.
- *
- * @param key the key
- * @param value the value
- */
- public void putInteger(String key, int value);
-
- /**
- * Sets the value of the given key to the given boolean value.
- *
- * @param key the key
- * @param value the value
- */
- public void putBoolean(String key, boolean value);
-
- /**
- * Sets the value of the given key to the given string.
- *
- * @param key the key
- * @param value the value
- */
- public void putString(String key, String value);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ImageResource.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ImageResource.java
deleted file mode 100644
index f93a652f2..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ImageResource.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.server.discovery.internal;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-/**
- * Utility class to handle image resources.
- */
-public class ImageResource {
- // the image registry
- private static ImageRegistry imageRegistry;
-
- // map of image descriptors since these
- // will be lost by the image registry
- private static Map<String, ImageDescriptor> imageDescriptors;
-
- // base urls for images
- private static URL ICON_BASE_URL;
-
- static {
- try {
- String pathSuffix = "icons/";
- ICON_BASE_URL = Activator.getDefault().getBundle().getEntry(pathSuffix);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not set icon base URL", e);
- }
- }
-
- private static final String URL_OBJ = "obj16/";
-
- private static final String URL_WIZBAN = "wizban/";
-
- // --- constants for images ---
-
- public static final String IMG_WIZARD = "wizard";
- public static final String IMG_EXTENSION = "extension";
-
- /**
- * Cannot construct an ImageResource. Use static methods only.
- */
- private ImageResource() {
- // do nothing
- }
-
- /**
- * Dispose of element images that were created.
- */
- protected static void dispose() {
- // do nothing
- }
-
- /**
- * Return the image with the given key.
- *
- * @param key a key
- * @return an image
- */
- public static Image getImage(String key) {
- if (imageRegistry == null)
- initializeImageRegistry();
- Image image = imageRegistry.get(key);
- if (image == null) {
- imageRegistry.put(key, ImageDescriptor.getMissingImageDescriptor());
- image = imageRegistry.get(key);
- }
- return image;
- }
-
- /**
- * Return the image descriptor with the given key.
- *
- * @param key a key
- * @return an image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String key) {
- if (imageRegistry == null)
- initializeImageRegistry();
- ImageDescriptor id = imageDescriptors.get(key);
- if (id != null)
- return id;
-
- return ImageDescriptor.getMissingImageDescriptor();
- }
-
- /**
- * Initialize the image resources.
- */
- protected static void initializeImageRegistry() {
- imageRegistry = new ImageRegistry();
- imageDescriptors = new HashMap<String, ImageDescriptor>();
-
- registerImage(IMG_WIZARD, URL_WIZBAN + "install_wiz.gif");
- registerImage(IMG_EXTENSION, URL_OBJ + "iu_obj.gif");
-
- PlatformUI.getWorkbench().getProgressService().registerIconForFamily(
- getImageDescriptor(IMG_EXTENSION), Activator.JOB_FAMILY);
- }
-
- /**
- * Register an image with the registry.
- *
- * @param key a key
- * @param partialURL a partial URL
- */
- private static void registerImage(String key, String partialURL) {
- try {
- ImageDescriptor id = ImageDescriptor.createFromURL(new URL(ICON_BASE_URL, partialURL));
- imageRegistry.put(key, id);
- imageDescriptors.put(key, id);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error registering image " + key + " from " + partialURL, e);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.java
deleted file mode 100644
index 8873ada58..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2008 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.server.discovery.internal;
-
-import org.eclipse.osgi.util.NLS;
-/**
- * Translated messages.
- */
-public class Messages extends NLS {
- public static String dialogTitle;
- public static String viewInitializing;
-
- public static String wizExtensionTitle;
- public static String wizExtensionDescription;
- public static String wizExtensionMessage;
-
- public static String discoverSearching;
- public static String discoverLocalConfiguration;
- public static String discoverSiteError;
-
- public static String installConfirm;
- public static String installJobName;
- public static String installPromptRestart;
-
- static {
- NLS.initializeMessages(Activator.PLUGIN_ID + ".internal.Messages", Messages.class);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.properties b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.properties
deleted file mode 100644
index 9d63a00e3..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Messages.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-###############################################################################
-# Copyright (c) 2008 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
-###############################################################################
-
-# Extension Wizard
-wizExtensionTitle=Install New Extension
-wizExtensionDescription=Download and install support for a new server
-wizExtensionMessage=The following server adapters have been found on remote sites. Select a server adapter to download and install.
-
-discoverLocalConfiguration=Examining local configuration
-discoverSearching=Searching {0}
-discoverSiteError=Could not connect to {0}
-
-installConfirm=Support for {0} will now be downloaded and installed. You will be prompted to restart once the installation is complete.
-installJobName=Installing {0}
-installPromptRestart=Installation complete. The new server will not be available until after the workbench is restarted. Do you want to restart now?
-
-dialogTitle=Install Extension
-
-viewInitializing=Initializing... \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ProgressUtil.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ProgressUtil.java
deleted file mode 100644
index 94b59f1cf..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/ProgressUtil.java
+++ /dev/null
@@ -1,69 +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.server.discovery.internal;
-
-import org.eclipse.core.runtime.*;
-/**
- * Progress Monitor utility.
- */
-public class ProgressUtil {
- /**
- * ProgressUtil constructor comment.
- */
- private ProgressUtil() {
- super();
- }
-
- /**
- * Return a valid progress monitor.
- *
- * @param monitor org.eclipse.core.runtime.IProgressMonitor
- * @return org.eclipse.core.runtime.IProgressMonitor
- */
- public static IProgressMonitor getMonitorFor(IProgressMonitor monitor) {
- if (monitor == null)
- return new NullProgressMonitor();
- return monitor;
- }
-
- /**
- * Return a sub-progress monitor with the given amount on the
- * current progress monitor.
- *
- * @param monitor org.eclipse.core.runtime.IProgressMonitor
- * @param ticks int
- * @return org.eclipse.core.runtime.IProgressMonitor
- */
- public static IProgressMonitor getSubMonitorFor(IProgressMonitor monitor, int ticks) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new SubProgressMonitor(monitor, ticks);
- }
-
- /**
- * Return a sub-progress monitor with the given amount on the
- * current progress monitor.
- *
- * @param monitor a progress monitor, or null
- * @param ticks a number of ticks
- * @param style a style
- * @return a progress monitor
- */
- public static IProgressMonitor getSubMonitorFor(IProgressMonitor monitor, int ticks, int style) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new SubProgressMonitor(monitor, ticks, style);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Trace.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Trace.java
deleted file mode 100644
index fe978dfa4..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/Trace.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.server.discovery.internal;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-/**
- * Helper class to route trace output.
- */
-public class Trace {
- public static final byte CONFIG = 0;
- public static final byte INFO = 1;
- public static final byte WARNING = 2;
- public static final byte SEVERE = 3;
- public static final byte FINEST = 4;
- public static final byte FINER = 5;
- public static final byte PERFORMANCE = 6;
- public static final byte EXTENSION_POINT = 7;
-
- private static final String[] levelNames = new String[] {
- "CONFIG ", "INFO ", "WARNING", "SEVERE ", "FINER ", "FINEST ", "PERF ", "EXTENSION"};
-
- private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy HH:mm.ss.SSS");
-
- private static Set<String> logged = new HashSet<String>();
-
- /**
- * Trace constructor comment.
- */
- private Trace() {
- super();
- }
-
- /**
- * Trace the given text.
- *
- * @param level a trace level
- * @param s a message
- */
- public static void trace(byte level, String s) {
- trace(level, s, null);
- }
-
- /**
- * Trace the given message and exception.
- *
- * @param level a trace level
- * @param s a message
- * @param t a throwable
- */
- public static void trace(byte level, String s, Throwable t) {
- if (s == null)
- return;
-
- if (level == SEVERE) {
- if (!logged.contains(s)) {
- Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, s, t));
- logged.add(s);
- }
- }
-
- if (!Activator.getDefault().isDebugging())
- return;
-
- StringBuffer sb = new StringBuffer(Activator.PLUGIN_ID);
- sb.append(" ");
- sb.append(levelNames[level]);
- sb.append(" ");
- sb.append(sdf.format(new Date()));
- sb.append(" ");
- sb.append(s);
- System.out.println(sb.toString());
- if (t != null)
- t.printStackTrace();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/XMLMemento.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/XMLMemento.java
deleted file mode 100644
index 31595b156..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/XMLMemento.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 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.server.discovery.internal;
-
-import java.io.*;
-import java.util.*;
-import org.w3c.dom.*;
-import org.xml.sax.*;
-
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-/**
- * A Memento is a class independent container for persistence
- * info. It is a reflection of 3 storage requirements.
- *
- * 1) We need the ability to persist an object and restore it.
- * 2) The class for an object may be absent. If so we would
- * like to skip the object and keep reading.
- * 3) The class for an object may change. If so the new class
- * should be able to read the old persistence info.
- *
- * We could ask the objects to serialize themselves into an
- * ObjectOutputStream, DataOutputStream, or Hashtable. However
- * all of these approaches fail to meet the second requirement.
- *
- * Memento supports binary persistance with a version ID.
- */
-public final class XMLMemento implements IMemento {
- private Document factory;
- private Element element;
-
- /**
- * Answer a memento for the document and element. For simplicity
- * you should use createReadRoot and createWriteRoot to create the initial
- * mementos on a document.
- */
- private XMLMemento(Document doc, Element el) {
- factory = doc;
- element = el;
- }
-
- /*
- * @see IMemento
- */
- public IMemento createChild(String type) {
- Element child = factory.createElement(type);
- element.appendChild(child);
- return new XMLMemento(factory, child);
- }
-
- /**
- * Create a Document from a Reader and answer a root memento for reading
- * a document.
- */
- protected static XMLMemento createReadRoot(InputStream in) {
- Document document = null;
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder parser = factory.newDocumentBuilder();
- document = parser.parse(new InputSource(in));
- Node node = document.getFirstChild();
- if (node instanceof Element)
- return new XMLMemento(document, (Element) node);
- } catch (Exception e) {
- // ignore
- } finally {
- try {
- in.close();
- } catch (Exception e) {
- // ignore
- }
- }
- return null;
- }
-
- /**
- * Answer a root memento for writing a document.
- *
- * @param type a type
- * @return a memento
- */
- public static XMLMemento createWriteRoot(String type) {
- Document document;
- try {
- document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
- Element element = document.createElement(type);
- document.appendChild(element);
- return new XMLMemento(document, element);
- } catch (ParserConfigurationException e) {
- throw new Error(e);
- }
- }
-
- /*
- * @see IMemento
- */
- public IMemento getChild(String type) {
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0)
- return null;
-
- // Find the first node which is a child of this node.
- for (int nX = 0; nX < size; nX ++) {
- Node node = nodes.item(nX);
- if (node instanceof Element) {
- Element element2 = (Element)node;
- if (element2.getNodeName().equals(type))
- return new XMLMemento(factory, element2);
- }
- }
-
- // A child was not found.
- return null;
- }
-
- /*
- * @see IMemento
- */
- public IMemento [] getChildren(String type) {
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0)
- return new IMemento[0];
-
- // Extract each node with given type.
- List<Element> list = new ArrayList<Element>(size);
- for (int nX = 0; nX < size; nX ++) {
- Node node = nodes.item(nX);
- if (node instanceof Element) {
- Element element2 = (Element)node;
- if (element2.getNodeName().equals(type))
- list.add(element2);
- }
- }
-
- // Create a memento for each node.
- size = list.size();
- IMemento [] results = new IMemento[size];
- for (int x = 0; x < size; x ++) {
- results[x] = new XMLMemento(factory, list.get(x));
- }
- return results;
- }
-
- /**
- * Return the contents of this memento as a byte array.
- *
- * @return byte[]
- * @throws IOException if anything goes wrong
- */
- public byte[] getContents() throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- save(out);
- return out.toByteArray();
- }
-
- /**
- * Returns an input stream for writing to the disk with a local locale.
- *
- * @return java.io.InputStream
- * @throws IOException if anything goes wrong
- */
- public InputStream getInputStream() throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- save(out);
- return new ByteArrayInputStream(out.toByteArray());
- }
-
- /*
- * @see IMemento
- */
- public Float getFloat(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- String strValue = attr.getValue();
- try {
- return new Float(strValue);
- } catch (NumberFormatException e) {
- return null;
- }
- }
-
- /*
- * @see IMemento
- */
- public Integer getInteger(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- String strValue = attr.getValue();
- try {
- return new Integer(strValue);
- } catch (NumberFormatException e) {
- return null;
- }
- }
-
- /*
- * @see IMemento
- */
- public String getString(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- return attr.getValue();
- }
-
- public List<String> getNames() {
- NamedNodeMap map = element.getAttributes();
- int size = map.getLength();
- List<String> list = new ArrayList<String>();
- for (int i = 0; i < size; i++) {
- Node node = map.item(i);
- String name = node.getNodeName();
- list.add(name);
- }
- return list;
- }
-
- /**
- * Loads a memento from the given filename.
- *
- * @param in java.io.InputStream
- * @return org.eclipse.ui.IMemento
- */
- public static IMemento loadMemento(InputStream in) {
- return createReadRoot(in);
- }
-
- /**
- * Loads a memento from the given filename.
- *
- * @param filename java.lang.String
- * @return org.eclipse.ui.IMemento
- * @exception java.io.IOException
- */
- public static IMemento loadMemento(String filename) throws IOException {
- InputStream in = null;
- try {
- in = new BufferedInputStream(new FileInputStream(filename));
- return XMLMemento.createReadRoot(in);
- } finally {
- try {
- if (in != null)
- in.close();
- } catch (Exception e) {
- // ignore
- }
- }
- }
-
- /*
- * @see IMemento
- */
- public void putInteger(String key, int n) {
- element.setAttribute(key, String.valueOf(n));
- }
-
- /*
- * @see IMemento
- */
- public void putString(String key, String value) {
- if (value == null)
- return;
- element.setAttribute(key, value);
- }
-
- /**
- * Save this Memento to a Writer.
- *
- * @throws IOException if there is a problem saving
- */
- public void save(OutputStream os) throws IOException {
- Result result = new StreamResult(os);
- Source source = new DOMSource(factory);
- try {
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
- transformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "2");
- transformer.transform(source, result);
- } catch (Exception e) {
- throw (IOException) (new IOException().initCause(e));
- }
- }
-
- /**
- * Saves the memento to the given file.
- *
- * @param filename java.lang.String
- * @exception java.io.IOException
- */
- public void saveToFile(String filename) throws IOException {
- BufferedOutputStream w = null;
- try {
- w = new BufferedOutputStream(new FileOutputStream(filename));
- save(w);
- } catch (IOException e) {
- throw e;
- } catch (Exception e) {
- throw new IOException(e.getLocalizedMessage());
- } finally {
- if (w != null) {
- try {
- w.close();
- } catch (Exception e) {
- // ignore
- }
- }
- }
- }
-
- public String saveToString() throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- save(out);
- return out.toString("UTF-8");
- }
-
- /*
- * @see IMemento#getBoolean(String)
- */
- public Boolean getBoolean(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- String strValue = attr.getValue();
- if ("true".equalsIgnoreCase(strValue))
- return new Boolean(true);
- return new Boolean(false);
- }
-
- /*
- * @see IMemento#putBoolean(String, boolean)
- */
- public void putBoolean(String key, boolean value) {
- element.setAttribute(key, value ? "true" : "false");
- }
-
- /**
- * Returns the Text node of the memento. Each memento is allowed only
- * one Text node.
- *
- * @return the Text node of the memento, or <code>null</code> if
- * the memento has no Text node.
- */
- private Text getTextNode() {
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0) {
- return null;
- }
- for (int nX = 0; nX < size; nX++) {
- Node node = nodes.item(nX);
- if (node instanceof Text) {
- return (Text) node;
- }
- }
- // a Text node was not found
- return null;
- }
-
- /* (non-Javadoc)
- */
- public void putTextData(String data) {
- Text textNode = getTextNode();
- if (textNode == null) {
- textNode = factory.createTextNode(data);
- // Always add the text node as the first child (fixes bug 93718)
- element.insertBefore(textNode, element.getFirstChild());
- } else {
- textNode.setData(data);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/Extension.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/Extension.java
deleted file mode 100644
index 0e944f027..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/Extension.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.server.discovery.internal.model;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.equinox.internal.provisional.p2.core.Version;
-import org.eclipse.equinox.internal.provisional.p2.director.IPlanner;
-import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
-import org.eclipse.equinox.internal.provisional.p2.engine.DefaultPhaseSet;
-import org.eclipse.equinox.internal.provisional.p2.engine.IEngine;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfileRegistry;
-import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.IUPropertyUtils;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.server.discovery.internal.Activator;
-import org.eclipse.wst.server.discovery.internal.ExtensionUtility;
-import org.osgi.framework.BundleContext;
-
-public class Extension {
- private ImageDescriptor imageDescriptor;
- private IInstallableUnit iu;
-
- private ProvisioningContext provContext;
- private ProvisioningPlan plan;
-
- public Extension() {
- // do nothing
- }
-
- public Extension(IInstallableUnit iu) {
- this.iu = iu;
- }
-
- public String getName() {
- return IUPropertyUtils.getIUProperty(iu, IInstallableUnit.PROP_NAME);
- }
-
- public String getDescription() {
- return IUPropertyUtils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION);
- }
-
- public Image getImage() {
- // TODO no image support in p2 yet
- return null;
- }
-
- public String getLicense() {
- return iu.getLicense().getBody();
- }
-
- public String getProvider() {
- return IUPropertyUtils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER);
- }
-
- public String getId() {
- return iu.getId();
- }
-
- public Version getVersion() {
- return iu.getVersion();
- }
-
- public IStatus install(IProgressMonitor monitor) {
- BundleContext bundleContext = Activator.getDefault().getBundle().getBundleContext();
-
- ProvisioningPlan plan = getProvisioningPlan(monitor);
- if (!plan.getStatus().isOK())
- return plan.getStatus();
-
- IProfileRegistry profileRegistry = (IProfileRegistry) ExtensionUtility.getService(bundleContext, IProfileRegistry.class.getName());
- IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
-
- IEngine engine = (IEngine) ExtensionUtility.getService(bundleContext, IEngine.SERVICE_NAME);
- return engine.perform(profile, new DefaultPhaseSet(), plan.getOperands(), provContext, monitor);
- }
-
- public IInstallableUnit[] getIUs() {
- return new IInstallableUnit[] { iu };
- }
-
- public ProvisioningPlan getProvisioningPlan(IProgressMonitor monitor) {
- if (plan != null)
- return plan;
-
- BundleContext bundleContext = Activator.getDefault().getBundle().getBundleContext();
- IPlanner planner = (IPlanner) ExtensionUtility.getService(bundleContext, IPlanner.class.getName());
-
- IProfileRegistry profileRegistry = (IProfileRegistry) ExtensionUtility.getService(bundleContext, IProfileRegistry.class.getName());
- IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
- ProfileChangeRequest pcr = new ProfileChangeRequest(profile);
- pcr.addInstallableUnits(new IInstallableUnit[] { iu } );
- provContext = new ProvisioningContext();
- plan = planner.getProvisioningPlan(pcr, provContext, monitor);
- return plan;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/ExtensionUpdateSite.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/ExtensionUpdateSite.java
deleted file mode 100644
index ba31d43fb..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/model/ExtensionUpdateSite.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.server.discovery.internal.model;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.equinox.internal.p2.updatesite.metadata.UpdateSiteMetadataRepositoryFactory;
-import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IRequiredCapability;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
-import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
-import org.eclipse.equinox.internal.provisional.p2.query.Collector;
-import org.eclipse.equinox.internal.provisional.p2.query.Query;
-import org.eclipse.wst.server.discovery.internal.Trace;
-/*
-* From Kosta:
-* feature version (optional)
-* alternate name (optional) - defaults to feature name
-*/
-public class ExtensionUpdateSite {
- private static final List<String> EMPTY_LIST = new ArrayList<String>(0);
-
- private String url;
- private String featureId;
- private String homepage;
- private String supportUrl;
- private List<String> categories;
-
- public ExtensionUpdateSite() {
- // do nothing
- }
-
- public ExtensionUpdateSite(String url, String featureId, List<String> categories) {
- this.url = url;
- this.featureId = featureId;
- this.categories = categories;
- }
-
- public String getUrl() {
- return url;
- }
-
- public String getFeatureId() {
- return featureId;
- }
-
- public List<String> getCategories() {
- if (categories == null)
- return EMPTY_LIST;
- return categories;
- }
-
- public List<Extension> getExtensions(IProgressMonitor monitor) throws CoreException {
- try {
- UpdateSiteMetadataRepositoryFactory mrf = new UpdateSiteMetadataRepositoryFactory();
- URI url2 = new URI(url);
- IMetadataRepository repo = mrf.load(url2, IRepositoryManager.REPOSITORIES_ALL, monitor);
- Query query = new InstallableUnitQuery("org.eclipse.wst.server.core.serverAdapter");
- Collector collector = new Collector();
- repo.query(query, collector, monitor);
-
- List<Extension> list = new ArrayList<Extension>();
- Iterator iter = collector.iterator();
- while (iter.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) iter.next();
- IRequiredCapability[] req = iu.getRequiredCapabilities();
- if (req != null) {
- for (IRequiredCapability rc : req) {
- query = new InstallableUnitQuery(rc.getName(), rc.getRange());
- Collector collector2 = new Collector();
- repo.query(query, collector2, monitor);
-
- Iterator iter2 = collector2.iterator();
- while (iter2.hasNext()) {
- IInstallableUnit iu2 = (IInstallableUnit) iter2.next();
- if (!list.contains(iu2)) {
- Extension ext = new Extension(iu2);
- list.add(ext);
- }
- }
- }
- }
- }
- return list;
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Error getting update info", e);
- return new ArrayList<Extension>(0);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/BaseLabelProvider.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/BaseLabelProvider.java
deleted file mode 100644
index 2bf1fdb7e..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/BaseLabelProvider.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 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.server.discovery.internal.wizard;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.server.discovery.internal.Trace;
-/**
- * A basic label provider.
- */
-public abstract class BaseLabelProvider implements ILabelProvider {
- protected ILabelDecorator decorator;
- private transient List<ILabelProviderListener> listeners;
- private ILabelProviderListener providerListener;
-
- /**
- * A basic ILabelProvider with no decorator.
- */
- public BaseLabelProvider() {
- this(null);
- }
-
- /**
- * A basic ILabelProvider with support for a decorator.
- *
- * @param decorator a label decorator, or null if no decorator is required
- */
- public BaseLabelProvider(ILabelDecorator decorator) {
- super();
- if (decorator == null)
- decorator = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
-
- this.decorator = decorator;
- if (decorator != null) {
- providerListener = new ILabelProviderListener() {
- public void labelProviderChanged(LabelProviderChangedEvent event) {
- fireListener(event);
- }
- };
- decorator.addListener(providerListener);
- }
- }
-
- /**
- * Use this method to avoid having a label decorator. This method is NOT API.
- *
- * @param noDecorator
- */
- public BaseLabelProvider(boolean noDecorator) {
- super();
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- if (listener == null)
- throw new IllegalArgumentException("Listener cannot be null");
-
- if (listeners == null)
- listeners = new ArrayList<ILabelProviderListener>();
- listeners.add(listener);
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
- if (listener == null)
- throw new IllegalArgumentException("Listener cannot be null");
-
- if (listeners != null)
- listeners.remove(listener);
- }
-
- protected void fireListener(LabelProviderChangedEvent event) {
- if (listeners == null || listeners.isEmpty())
- return;
-
- int size = listeners.size();
- ILabelProviderListener[] srl = new ILabelProviderListener[size];
- listeners.toArray(srl);
-
- for (int i = 0; i < size; i++) {
- try {
- srl[i].labelProviderChanged(event);
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, " Error firing label change event to " + srl[i], e);
- }
- }
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- if (decorator != null)
- decorator.removeListener(providerListener);
- }
-
- /**
- * @see ILabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- return null;
- }
-
- /**
- * @see ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- return "";
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- protected String notNull(String s) {
- if (s == null)
- return "";
- return s;
- }
-}
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ErrorWizardPage.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ErrorWizardPage.java
deleted file mode 100644
index bf433349f..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ErrorWizardPage.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.server.discovery.internal.wizard;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.wst.server.discovery.internal.Messages;
-
-public class ErrorWizardPage extends WizardPage {
- /**
- * The nesting indent.
- */
- private static final String NESTING_INDENT = " "; //$NON-NLS-1$
-
- /**
- * The SWT list control that displays the error details.
- */
- private List list;
-
- /**
- * Message (a localized string).
- */
- protected String message;
-
- /**
- * The main status object.
- */
- private IStatus status;
-
- /**
- * The current clipboard. To be disposed when closing the dialog.
- */
- private Clipboard clipboard;
-
- public ErrorWizardPage() {
- super("error-page");
- setTitle(Messages.wizExtensionTitle);
- setDescription(Messages.wizExtensionDescription);
- }
-
- public void createControl(Composite parent) {
- Control control = createDropDownList(parent);
- setControl(control);
- }
-
- /**
- * Set the status displayed by this error dialog to the given status. This
- * only affects the status displayed by the Details list. The message, image
- * and title should be updated by the subclass, if desired.
- *
- * @param status
- * the status to be displayed in the details list
- */
- public void setStatus(IStatus status) {
- if (this.status != status)
- this.status = status;
-
- setDescription(status.getMessage());
- if (list != null && !list.isDisposed()) {
- list.removeAll();
- populateList(list);
- }
- }
-
- /**
- * Create this dialog's drop-down list component.
- *
- * @param parent
- * the parent composite
- * @return the drop-down list component
- */
- protected List createDropDownList(Composite parent) {
- list = new List(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
- populateList(list);
- GridData data = new GridData(SWT.FILL, SWT.FILL, false, false);
- data.widthHint = 225;
- list.setLayoutData(data);
- list.setFont(parent.getFont());
- Menu copyMenu = new Menu(list);
- MenuItem copyItem = new MenuItem(copyMenu, SWT.NONE);
- copyItem.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- copyToClipboard();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- copyToClipboard();
- }
- });
- copyItem.setText(JFaceResources.getString("copy")); //$NON-NLS-1$
- list.setMenu(copyMenu);
- //listCreated = true;
- return list;
- }
-
- /**
- * Copy the contents of the statuses to the clipboard.
- */
- protected void copyToClipboard() {
- if (clipboard != null)
- clipboard.dispose();
-
- StringBuffer statusBuffer = new StringBuffer();
- populateCopyBuffer(status, statusBuffer, 0);
- clipboard = new Clipboard(list.getDisplay());
- clipboard.setContents(new Object[] { statusBuffer.toString() },
- new Transfer[] { TextTransfer.getInstance() });
- }
-
- public void dispose() {
- if (clipboard != null)
- clipboard.dispose();
-
- super.dispose();
- }
-
- /**
- * Put the details of the status of the error onto the stream.
- *
- * @param buildingStatus
- * @param buffer
- * @param nesting
- */
- private void populateCopyBuffer(IStatus buildingStatus, StringBuffer buffer, int nesting) {
- for (int i = 0; i < nesting; i++)
- buffer.append(NESTING_INDENT);
-
- buffer.append(buildingStatus.getMessage());
- buffer.append("\n"); //$NON-NLS-1$
-
- // Look for a nested core exception
- Throwable t = buildingStatus.getException();
- if (t instanceof CoreException) {
- CoreException ce = (CoreException) t;
- populateCopyBuffer(ce.getStatus(), buffer, nesting + 1);
- } else if (t != null) {
- // Include low-level exception message
- for (int i = 0; i < nesting; i++)
- buffer.append(NESTING_INDENT);
-
- String message = t.getLocalizedMessage();
- if (message == null)
- message = t.toString();
-
- buffer.append(message);
- buffer.append("\n"); //$NON-NLS-1$
- }
-
- IStatus[] children = buildingStatus.getChildren();
- for (int i = 0; i < children.length; i++)
- populateCopyBuffer(children[i], buffer, nesting + 1);
- }
-
- /**
- * Populates the list using this error dialog's status object. This walks
- * the child static of the status object and displays them in a list. The
- * format for each entry is status_path : status_message If the status's
- * path was null then it (and the colon) are omitted.
- *
- * @param listToPopulate
- * The list to fill.
- */
- private void populateList(List listToPopulate) {
- populateList(listToPopulate, status, 0, true);
- }
-
- /**
- * Populate the list with the messages from the given status. Traverse the
- * children of the status deeply and also traverse CoreExceptions that
- * appear in the status.
- *
- * @param listToPopulate
- * the list to populate
- * @param buildingStatus
- * the status being displayed
- * @param nesting
- * the nesting level (increases one level for each level of
- * children)
- * @param includeStatus
- * whether to include the buildingStatus in the display or just
- * its children
- */
- private void populateList(List listToPopulate, IStatus buildingStatus,
- int nesting, boolean includeStatus) {
-
- Throwable t = buildingStatus.getException();
- boolean isCoreException = t instanceof CoreException;
- boolean incrementNesting = false;
-
- if (includeStatus) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < nesting; i++)
- sb.append(NESTING_INDENT);
-
- String message = buildingStatus.getMessage();
- sb.append(message);
- listToPopulate.add(sb.toString());
- incrementNesting = true;
- }
-
- if (!isCoreException && t != null) {
- // Include low-level exception message
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < nesting; i++)
- sb.append(NESTING_INDENT);
-
- String message = t.getLocalizedMessage();
- if (message == null)
- message = t.toString();
-
- sb.append(message);
- listToPopulate.add(sb.toString());
- incrementNesting = true;
- }
-
- if (incrementNesting)
- nesting++;
-
- // Look for a nested core exception
- if (isCoreException) {
- CoreException ce = (CoreException) t;
- IStatus eStatus = ce.getStatus();
- // Only print the exception message if it is not contained in the
- // parent message
- if (message == null || message.indexOf(eStatus.getMessage()) == -1) {
- populateList(listToPopulate, eStatus, nesting, true);
- }
- }
-
- // Look for child status
- IStatus[] children = buildingStatus.getChildren();
- for (int i = 0; i < children.length; i++)
- populateList(listToPopulate, children[i], nesting, true);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionComposite.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionComposite.java
deleted file mode 100644
index 2dca1b158..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionComposite.java
+++ /dev/null
@@ -1,495 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.server.discovery.internal.wizard;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.wst.server.discovery.internal.ExtensionUtility;
-import org.eclipse.wst.server.discovery.internal.ImageResource;
-import org.eclipse.wst.server.discovery.internal.Messages;
-import org.eclipse.wst.server.discovery.internal.Trace;
-import org.eclipse.wst.server.discovery.internal.model.Extension;
-/**
- *
- */
-public class ExtensionComposite extends Composite {
- private static final String ROOT = "root";
-
- public interface ExtensionSelectionListener {
- public void extensionSelected(Extension extension);
- }
-
- protected Table table;
- protected TableViewer tableViewer;
-
- protected Font font;
-
- protected HashMap<String, Image> images;
-
- protected String progress;
- protected int totalWork;
- protected double currentWork;
- protected int count;
-
- public ExtensionSelectionListener listener;
-
- public ExtensionComposite(Composite parent, int style, ExtensionSelectionListener listener) {
- super(parent, style);
- this.listener = listener;
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.verticalSpacing = 5;
- layout.horizontalSpacing = 5;
- //layout.numColumns = 2;
- setLayout(layout);
-
- Font currentFont = getFont();
- FontData[] fd = currentFont.getFontData();
- int size2 = fd.length;
- for (int i = 0; i < size2; i++) {
- fd[i].setHeight(fd[i].getHeight() + 2);
- fd[i].setStyle(SWT.BOLD);
- }
-
- font = new Font(getDisplay(), fd);
-
- table = new Table(this, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- //data.horizontalSpan = 2;
- //data.heightHint = 250;
- data.widthHint = 350;
- table.setLayoutData(data);
- //table.setLinesVisible(true);
- table.setHeaderVisible(false);
- tableViewer = new TableViewer(table);
- table.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- disposeResources();
- }
- });
-
- TableLayout tableLayout = new TableLayout();
- table.setLayout(tableLayout);
-
- /*tableLayout.addColumnData(new ColumnPixelData(90, false));
- //tableLayout.addColumnData(new ColumnWeightData(8, 80, true));
- TableColumn col2 = new TableColumn(table, SWT.NONE);
- col2.setText("null");
- */
- tableLayout.addColumnData(new ColumnWeightData(10, 250, false));
- final TableColumn col = new TableColumn(table, SWT.NONE);
- col.setText("null");
- /*col.setWidth(300);
- col.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- col.pack();
- }
- });*/
-
- //tableLayout.addColumnData(new ColumnWeightData(30, 250, false));
- //TableColumn col2 = new TableColumn(table, SWT.NONE);
- //col2.setText("null2");
-
- final int TEXT_MARGIN = 3;
- table.addListener(SWT.MeasureItem, new Listener() {
- public void handleEvent(Event event) {
- //System.out.println(event.width);
- /*TableItem item = (TableItem) event.item;
- Object obj = item.getData();
- //System.out.println("measure " + obj);
- if (obj instanceof CoreException) {
- event.gc.setFont(font);
- Point size = event.gc.textExtent("A");
- event.gc.setFont(null);
- //event.height = Math.max(event.height, TEXT_MARGIN * 2 + size.y);
- event.height = TEXT_MARGIN * 2 + size.y;
- System.out.println(event.height);
- return;
- }*/
- event.gc.setFont(font);
- Point size = event.gc.textExtent("A");
- int h = TEXT_MARGIN * 3 + size.y;
- size = event.gc.textExtent("A");
- event.gc.setFont(null);
- h += size.y;
- h = Math.max(h, 40 + TEXT_MARGIN * 2);
- //event.width = 400;
- event.height = Math.max(event.height, h);
- //System.out.println(event.height);
- //event.width = 300;
- }
- });
- table.addListener(SWT.EraseItem, new Listener() {
- public void handleEvent(Event event) {
- //if (event.index == 0)
- // return;
- event.detail &= ~SWT.FOREGROUND;
- //event.detail &= ~SWT.BACKGROUND;
- }
- });
- table.addListener(SWT.PaintItem, new Listener() {
- public void handleEvent(Event event) {
- //if (event.index == 0)
- // return;
- TableItem item = (TableItem) event.item;
- Object obj = item.getData();
-
- int width = table.getColumn(0).getWidth();
- GC gc = event.gc;
-
- if (obj instanceof String) {
- String s = (String) obj;
- if (progress != null)
- s = progress;
- int h = event.y + event.height / 2;
- Point size = event.gc.textExtent(s);
- gc.drawText(s, event.x + TEXT_MARGIN, h - size.y/2, true);
-
- int hh = event.y + event.height - 5 - TEXT_MARGIN - 1;
-
- gc.setLineWidth(2);
- Color color = getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION);
- gc.setBackground(color);
-
- int width2 = 0;
- int step = 9;
- if (totalWork > 0)
- width2 = (int) ((width - step * 2 - 15 - TEXT_MARGIN * 2) * currentWork / totalWork);
-
- for (int i = 0; i < width2; i+= step) {
- gc.fillRectangle(event.x + TEXT_MARGIN + i, hh, step - 2, 5);
- }
-
- return;
- } else if (obj instanceof List) {
- List<String> list = (List<String>) obj;
-
- int size = list.size();
- String[] hosts = new String[size];
- list.toArray(hosts);
-
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < size; i++) {
- if (i > 0)
- sb.append(", ");
- sb.append(hosts[i]);
- }
- String s = NLS.bind(Messages.discoverSiteError, sb.toString());
- gc.drawText(s, event.x + TEXT_MARGIN, event.y + TEXT_MARGIN, true);
- return;
- }
- Extension ei = (Extension) obj;
- if (ei == null)
- return;
-
-
- //if ((event.detail & SWT.SELECTED) == 0) {
- // //event.gc.setForeground();
- // //event.gc.fillRectangle(0, 0, width, 5);
- // event.gc.setBackground(getBackground());
- // event.gc.setForeground(getForeground());
- // event.gc.fillRectangle(event.x, event.y, width, event.height);
- //}
- //System.out.println(width + " " + event.width + " " + event.x);
-
- String name = ei.getName();
- String provider = "" + ei.getProvider();
- //String provider = "" + ei.getImage();
- //String provider = "" + ExtensionUtility.getDescription(ei);
- String version = ei.getVersion().toString();
- /*int ind = ver.indexOf("_");
- if (ind >= 0)
- ver = ver.substring(ind+1);
- String version = "v" + ver;*/
-
- //Image image = getImage(ei.getImage());
- Image image = ei.getImage();
- if (image == null)
- image = ImageResource.getImage(ImageResource.IMG_WIZARD); // TODO
- int iw = image.getBounds().width;
- int ih = image.getBounds().height;
- gc.drawImage(image, 0, 0, iw, ih, event.x + TEXT_MARGIN, event.y + TEXT_MARGIN, 40, 40);
- iw = 40 + TEXT_MARGIN * 2;
-
- int yOffset = TEXT_MARGIN;
- gc.setFont(font);
- Point size = new Point(0, 0);
- if (name != null) {
- gc.drawText(name, event.x + iw, event.y + yOffset, true);
- size = event.gc.textExtent(name);
- }
- gc.setFont(null);
-
- yOffset += size.y + TEXT_MARGIN;
- gc.drawText(provider, event.x + iw, event.y + yOffset, true);
-
- size = event.gc.textExtent(version);
- gc.drawText(version, event.x + width - TEXT_MARGIN * 3 - size.x, event.y + yOffset, true);
- }
- });
-
- tableViewer.setSorter(new ViewerSorter() {
- public int compare(Viewer viewer, Object e1, Object e2) {
- if ((e1 instanceof Extension) && !(e2 instanceof Extension))
- return -1;
- if (!(e1 instanceof Extension) && (e2 instanceof Extension))
- return 1;
- try {
- Extension f1 = (Extension) e1;
- Extension f2 = (Extension) e2;
- return (f1.getName().compareToIgnoreCase(f2.getName()));
- } catch (Exception e) {
- return 0;
- }
- }
- });
-
- /*Composite buttonComp = new Composite(this, SWT.NONE);
- buttonComp.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING));
- layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- buttonComp.setLayout(layout);
-
- Button install = SWTUtil.createButton(buttonComp, "Find Updates");
- install.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- //
- }
- });*/
-
- final Label description = new Label(this, SWT.WRAP);
- description.setText("Multi\nLine\nMessage");
- Dialog.applyDialogFont(this);
- Point p = description.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- description.setText("");
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
- data.horizontalSpan = 2;
- if (p.y > 10)
- data.heightHint = p.y;
- else
- data.heightHint = 42;
- description.setLayoutData(data);
-
- /*final Label download = new Label(this, SWT.NONE);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
- data.horizontalSpan = 2;
- download.setLayoutData(data);
- download.setText("Download size: ");*/
-
- tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- StructuredSelection sel = (StructuredSelection) tableViewer.getSelection();
- Object obj = sel.getFirstElement();
- Extension extension = null;
- if (obj instanceof Extension)
- extension = (Extension) obj;
-
- handleSelection(extension);
- if (extension != null)
- description.setText(extension.getDescription());
- else
- description.setText("");
- /*long size = feature.getDownloadSize();
- String s = "<unknown>";
- if (size > 0)
- s = size + " Kb";
- download.setText("Download size: " + s);*/
- }
- });
-
- deferInitialization();
- }
-
- protected Image getImage(URL url) {
- if (url == null)
- return null;
-
- try {
- Image image = images.get(url.toString());
- if (image != null)
- return image;
- } catch (Exception e) {
- // ignore
- }
- try {
- ImageDescriptor id = ImageDescriptor.createFromURL(url);
- Image image = id.createImage();
- if (images == null)
- images = new HashMap<String, Image>();
- images.put(url.toString(), image);
- return image;
- } catch (Exception e) {
- Trace.trace(Trace.INFO, "Could not create image", e);
- }
- return null;
- }
-
- protected void disposeResources() {
- try {
- font.dispose();
-
- if (images != null) {
- Iterator iterator = images.values().iterator();
- while (iterator.hasNext()) {
- Image image = (Image) iterator.next();
- image.dispose();
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not dispose - possible resource leak", e);
- }
- }
-
- protected void handleSelection(Extension extension) {
- listener.extensionSelected(extension);
- }
-
- protected void deferInitialization() {
- final List<Object> list = Collections.synchronizedList(new ArrayList<Object>());
- list.add(Messages.viewInitializing);
-
- tableViewer.setContentProvider(new ExtensionContentProvider(list));
- tableViewer.setLabelProvider(new ExtensionTableLabelProvider());
- tableViewer.setInput(ROOT);
-
- final Thread t = new Thread("Deferred Initialization") {
- public void run() {
- deferredInitialize(list, new IProgressMonitor() {
- public void beginTask(String name, int totalWork2) {
- totalWork = totalWork2;
- progress = name;
- }
-
- public void setTaskName(String name) {
- progress = name;
- }
-
- public void subTask(String name) {
- progress = name;
- }
-
- public void done() {
- //
- }
-
- public void internalWorked(double work) {
- currentWork += work;
- }
-
- public boolean isCanceled() {
- return false;
- }
-
- public void setCanceled(boolean value) {
- //
- }
-
- public void worked(int work) {
- currentWork += work;
- }
- });
- }
- };
- t.setDaemon(true);
- t.start();
-
- final Display display = getDisplay();
- final int SLEEP = 100;
- final Runnable[] animator = new Runnable[1];
- animator[0] = new Runnable() {
- public void run() {
- if (t.isAlive()) {
- count++;
- if (!table.isDisposed())
- tableViewer.refresh(ROOT);
- display.timerExec(SLEEP, animator[0]);
- }
- }
- };
- display.timerExec(SLEEP, animator[0]);
- }
-
- public void deferredInitialize(final List<Object> list, IProgressMonitor monitor) {
- final List<String> failedSites = new ArrayList<String>();
- ExtensionUtility.ExtensionListener listener2 = new ExtensionUtility.ExtensionListener() {
- public void extensionFound(Extension feature) {
- list.add(feature);
- if (progress != null)
- list.set(0, progress);
- }
-
- public void extensionRemoved(Extension feature) {
- list.remove(feature);
- }
-
- public void siteFailure(String host) {
- synchronized (failedSites) {
- if (!list.contains(failedSites))
- list.add(failedSites);
- failedSites.add(host);
- }
- }
- };
-
- String id = "org.eclipse.wst.server.core.serverAdapter"; // TODO
- try {
- ExtensionUtility.getAllExtensions(id, listener2, monitor);
- } catch (CoreException ce) {
- Trace.trace(Trace.WARNING, "Error downloading server adapter info", ce);
- }
-
- list.remove(0);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (!table.isDisposed())
- tableViewer.refresh(ROOT);
- }
- });
- }
-
- protected Object getSelection(ISelection sel2) {
- IStructuredSelection sel = (IStructuredSelection) sel2;
- return sel.getFirstElement();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionContentProvider.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionContentProvider.java
deleted file mode 100644
index f33831fb1..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionContentProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.server.discovery.internal.wizard;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-/**
- * Extension content provider.
- */
-public class ExtensionContentProvider implements IStructuredContentProvider {
- protected List list;
-
- public ExtensionContentProvider(List list) {
- super();
- this.list = list;
- }
-
- public void dispose() {
- // do nothing
- }
-
- public Object[] getElements(Object inputElement) {
- return list.toArray();
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionTableLabelProvider.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionTableLabelProvider.java
deleted file mode 100644
index ee237fdb2..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionTableLabelProvider.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.server.discovery.internal.wizard;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.server.discovery.internal.model.Extension;
-/**
- * Extension item table label provider.
- */
-public class ExtensionTableLabelProvider extends BaseLabelProvider implements ITableLabelProvider {
- /**
- * ExtensionTableLabelProvider constructor comment.
- */
- public ExtensionTableLabelProvider() {
- super();
- }
-
- /**
- * ExtensionTableLabelProvider constructor comment.
- *
- * @param decorator a label decorator, or null if no decorator is required
- */
- public ExtensionTableLabelProvider(ILabelDecorator decorator) {
- super(decorator);
- }
-
- /**
- * @see ITableLabelProvider#getColumnImage(Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- /**
- * @see ITableLabelProvider#getColumnText(Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- if (element instanceof List)
- return "Some update sites failed";
-
- if (element instanceof String)
- return ((String) element) + Math.random();
-
- Extension item = (Extension) element;
- return item.getName() + "\n" + item.getProvider();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionWizardPage.java b/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionWizardPage.java
deleted file mode 100644
index e15479bb7..000000000
--- a/plugins/org.eclipse.wst.server.discovery/src/org/eclipse/wst/server/discovery/internal/wizard/ExtensionWizardPage.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.server.discovery.internal.wizard;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.AcceptLicensesWizardPage;
-import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.wst.server.discovery.ExtensionWizard;
-import org.eclipse.wst.server.discovery.internal.Messages;
-import org.eclipse.wst.server.discovery.internal.Trace;
-import org.eclipse.wst.server.discovery.internal.model.Extension;
-
-public class ExtensionWizardPage extends WizardPage {
- private ExtensionComposite comp;
- protected AcceptLicensesWizardPage licensePage;
- protected ErrorWizardPage errorPage;
- protected IWizardPage nextPage;
- private Extension extension;
-
- public ExtensionWizardPage(AcceptLicensesWizardPage licenseWizardPage, ErrorWizardPage errorWizardPage) {
- super("extension");
- this.licensePage = licenseWizardPage;
- this.errorPage = errorWizardPage;
- setTitle(Messages.wizExtensionTitle);
- setDescription(Messages.wizExtensionDescription);
- setPageComplete(false);
- }
-
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
-
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
- layout.verticalSpacing = convertVerticalDLUsToPixels(4);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 3;
- composite.setLayout(layout);
- //WorkbenchHelp.setHelp(this, ContextIds.SELECT_CLIENT_WIZARD);
-
- Label label = new Label(composite, SWT.WRAP);
- GridData data = new GridData(SWT.FILL, SWT.BEGINNING, false, false);
- data.horizontalSpan = 3;
- label.setLayoutData(data);
- label.setText(Messages.wizExtensionMessage);
-
- comp = new ExtensionComposite(composite, SWT.NONE, new ExtensionComposite.ExtensionSelectionListener() {
- public void extensionSelected(Extension sel) {
- handleSelection(sel);
- }
- });
- data = new GridData(SWT.FILL, SWT.FILL, true, false);
- data.widthHint = 200;
- data.heightHint = 400;
- comp.setLayoutData(data);
-
- Dialog.applyDialogFont(composite);
- setControl(composite);
- }
-
- protected void handleSelection(Extension sel) {
- extension = sel;
- if (extension == null)
- licensePage.update(new IInstallableUnit[0], null);
- else {
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- final ProvisioningPlan plan = extension.getProvisioningPlan(monitor);
- if (plan != null && plan.getStatus().isOK()) {
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- licensePage.update(extension.getIUs(), plan);
- nextPage = licensePage;
- ((ExtensionWizard)getWizard()).setSecondPage(nextPage);
- }
- });
- } else {
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- errorPage.setStatus(plan.getStatus());
- }
- });
- nextPage = errorPage;
- ((ExtensionWizard)getWizard()).setSecondPage(nextPage);
- }
- }
- });
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error verifying license", e);
- }
- }
- setPageComplete(extension != null);
- }
-
- public Extension getExtension() {
- return extension;
- }
-} \ No newline at end of file

Back to the top