From 6405b3a3689d9b086d1bcb5eb3361a2d5a71ee1e Mon Sep 17 00:00:00 2001 From: Chris Recoskie Date: Wed, 25 Apr 2007 14:00:22 +0000 Subject: [PATCH] RESOLVED - bug 170615: Need access to ProgressMonitor in MBS Custom Pages https://bugs.eclipse.org/bugs/show_bug.cgi?id=170615 --- .../schema/newWizardPages.exsd | 2 +- .../ui/wizards/MBSCustomPageManager.java | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.ui/schema/newWizardPages.exsd b/build/org.eclipse.cdt.managedbuilder.ui/schema/newWizardPages.exsd index 25e65a76bd4..be2fbc8e23b 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/schema/newWizardPages.exsd +++ b/build/org.eclipse.cdt.managedbuilder.ui/schema/newWizardPages.exsd @@ -87,7 +87,7 @@ For convenience, there is an org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustom - Specifies the Java class which implements the operations associated with this page. The class must implement the java.lang.Runnable interface. + Specifies the Java class which implements the operations associated with this page. The class must implement either the java.lang.Runnable interface, or the org.eclipse.jface.operation.IRunnableWithProgress interface if progress reporting is desired. diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSCustomPageManager.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSCustomPageManager.java index 62349b889b8..be123e22a13 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSCustomPageManager.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSCustomPageManager.java @@ -191,7 +191,7 @@ public final class MBSCustomPageManager // String operationClassName = element.getAttribute(OPERATION_CLASS); // optional element so may be null IWizardPage wizardPage = null; - Runnable operation = null; + Object operation = null; // instantiate the classes specified in the manifest // first try to create the page class, which is required @@ -201,7 +201,7 @@ public final class MBSCustomPageManager // the operation is an optional element so it might not be present if (element.getAttribute(OPERATION_CLASS) != null) - operation = (Runnable) element.createExecutableExtension(OPERATION_CLASS); + operation = element.createExecutableExtension(OPERATION_CLASS); } catch (CoreException e) { @@ -210,8 +210,18 @@ public final class MBSCustomPageManager } // create the page data and add it to ourselves - MBSCustomPageData currentPageData = new MBSCustomPageData(id, - wizardPage, operation, false); + MBSCustomPageData currentPageData; + + // Custom pages prior to CDT 4.0 were required to provide Runnables as operations. + // Post 4.0, IRunnableWithProgress are accepted as well. + if (operation instanceof Runnable) { + currentPageData = new MBSCustomPageData(id, wizardPage, (Runnable) operation, false); + } else if (operation instanceof IRunnableWithProgress) { + currentPageData = new MBSCustomPageData(id, wizardPage, (IRunnableWithProgress) operation, false); + } else { + throw new BuildException(element.getName()); + } + idToPageDataMap.put(id, currentPageData); pageSet.add(currentPageData);