Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-08-11 17:55:06 +0000
committerspingel2009-08-11 17:55:06 +0000
commit9cd59744a56b4b20550ce7e551da6ff358bcd9ad (patch)
treeb220b17b02893cc2cc6313d3307fc06359fc663b /org.eclipse.mylyn.tasks.bugs
parentcc6eae8c3c8a30d09a32771ae89803c26f81657f (diff)
downloadorg.eclipse.mylyn.tasks-9cd59744a56b4b20550ce7e551da6ff358bcd9ad.tar.gz
org.eclipse.mylyn.tasks-9cd59744a56b4b20550ce7e551da6ff358bcd9ad.tar.xz
org.eclipse.mylyn.tasks-9cd59744a56b4b20550ce7e551da6ff358bcd9ad.zip
NEW - bug 280961: supported products should be validated before being displayed in wizard
https://bugs.eclipse.org/bugs/show_bug.cgi?id=280961
Diffstat (limited to 'org.eclipse.mylyn.tasks.bugs')
-rw-r--r--org.eclipse.mylyn.tasks.bugs/src/org/eclipse/mylyn/internal/tasks/bugs/wizards/ReportBugOrEnhancementWizard.java35
1 files changed, 30 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.tasks.bugs/src/org/eclipse/mylyn/internal/tasks/bugs/wizards/ReportBugOrEnhancementWizard.java b/org.eclipse.mylyn.tasks.bugs/src/org/eclipse/mylyn/internal/tasks/bugs/wizards/ReportBugOrEnhancementWizard.java
index df216b7d3..cb3565932 100644
--- a/org.eclipse.mylyn.tasks.bugs/src/org/eclipse/mylyn/internal/tasks/bugs/wizards/ReportBugOrEnhancementWizard.java
+++ b/org.eclipse.mylyn.tasks.bugs/src/org/eclipse/mylyn/internal/tasks/bugs/wizards/ReportBugOrEnhancementWizard.java
@@ -16,6 +16,7 @@ import java.util.Collection;
import java.util.List;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.IWizardPage;
@@ -23,6 +24,7 @@ import org.eclipse.jface.wizard.Wizard;
import org.eclipse.mylyn.internal.provisional.tasks.bugs.IProduct;
import org.eclipse.mylyn.internal.provisional.tasks.bugs.IProvider;
import org.eclipse.mylyn.internal.tasks.bugs.AbstractSupportElement;
+import org.eclipse.mylyn.internal.tasks.bugs.AttributeTaskMapper;
import org.eclipse.mylyn.internal.tasks.bugs.SupportCategory;
import org.eclipse.mylyn.internal.tasks.bugs.SupportProduct;
import org.eclipse.mylyn.internal.tasks.bugs.SupportProvider;
@@ -30,6 +32,7 @@ import org.eclipse.mylyn.internal.tasks.bugs.SupportProviderManager;
import org.eclipse.mylyn.internal.tasks.bugs.SupportRequest;
import org.eclipse.mylyn.internal.tasks.bugs.TaskErrorReporter;
import org.eclipse.mylyn.internal.tasks.bugs.TasksBugsPlugin;
+import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
/**
@@ -45,16 +48,23 @@ public class ReportBugOrEnhancementWizard extends Wizard {
public Object[] getElements(Object inputElement) {
if (inputElement instanceof SupportProvider) {
- List<SupportProduct> providerProducts = getProdcuts(inputElement);
+ List<SupportProduct> providerProducts = getProducts((SupportProvider) inputElement);
return providerProducts.toArray();
} else if (input == inputElement) {
List<AbstractSupportElement> elements = new ArrayList<AbstractSupportElement>();
Collection<SupportCategory> categories = providerManager.getCategories();
for (SupportCategory category : categories) {
List<IProvider> providers = category.getProviders();
- if (!providers.isEmpty()) {
+ // filter valid providers
+ List<IProvider> validProviders = new ArrayList<IProvider>();
+ for (IProvider provider : providers) {
+ if (isValid((SupportProvider) provider)) {
+ validProviders.add(provider);
+ }
+ }
+ if (!validProviders.isEmpty()) {
elements.add(category);
- for (IProvider provider : providers) {
+ for (IProvider provider : validProviders) {
elements.add((AbstractSupportElement) provider);
}
}
@@ -65,9 +75,18 @@ public class ReportBugOrEnhancementWizard extends Wizard {
}
}
- private List<SupportProduct> getProdcuts(Object inputElement) {
+ private boolean isValid(SupportProvider provider) {
+ Collection<SupportProduct> products = providerManager.getProducts();
+ for (SupportProduct product : products) {
+ if (provider.equals(product.getProvider()) && product.isInstalled()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private List<SupportProduct> getProducts(SupportProvider provider) {
Collection<SupportProduct> products = providerManager.getProducts();
- SupportProvider provider = (SupportProvider) inputElement;
List<SupportProduct> providerProducts = new ArrayList<SupportProduct>();
for (SupportProduct product : products) {
if (provider.equals(product.getProvider()) && product.isInstalled()) {
@@ -135,6 +154,12 @@ public class ReportBugOrEnhancementWizard extends Wizard {
TaskErrorReporter reporter = TasksBugsPlugin.getTaskErrorReporter();
IStatus status = new ProductStatus((IProduct) product);
SupportRequest request = reporter.preProcess(status, ((ProductStatus) status).getProduct());
+ if (!((AttributeTaskMapper) request.getDefaultContribution()).isMappingComplete()) {
+ TasksUiInternal.displayStatus(Messages.ReportBugOrEnhancementWizard_Report_Bug_or_Enhancement, new Status(
+ IStatus.ERROR, TasksBugsPlugin.ID_PLUGIN,
+ "Creation of a support request failed. The information for the selected product is incomplete."));
+ return false;
+ }
return reporter.process(request.getDefaultContribution(), getContainer());
}

Back to the top