Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Piggott2011-03-10 16:41:58 -0500
committerMatthew Piggott2011-03-10 16:42:18 -0500
commitb62ad77add75cd82020b14995f57d8b45fbbd38d (patch)
tree9f99b512a3ab8518a980622a08fe2dd2027b7b57 /org.eclipse.m2e.discovery/src
parentfa600ec16f34b8c723140f8916150b994dd6e773 (diff)
downloadm2e-core-b62ad77add75cd82020b14995f57d8b45fbbd38d.tar.gz
m2e-core-b62ad77add75cd82020b14995f57d8b45fbbd38d.tar.xz
m2e-core-b62ad77add75cd82020b14995f57d8b45fbbd38d.zip
Add message in m2e marketplace header when no items are applicable
Diffstat (limited to 'org.eclipse.m2e.discovery/src')
-rw-r--r--org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/Messages.java7
-rw-r--r--org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/messages.properties1
-rw-r--r--org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenCatalogViewer.java89
3 files changed, 52 insertions, 45 deletions
diff --git a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/Messages.java b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/Messages.java
index e14bf95a..6da26aa6 100644
--- a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/Messages.java
+++ b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/Messages.java
@@ -17,7 +17,6 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.m2e.internal.discovery.messages"; //$NON-NLS-1$
-
public static String BundleDiscoveryStrategy_3;
public static String BundleDiscoveryStrategy_categoryDisallowed;
@@ -44,13 +43,12 @@ public class Messages extends NLS {
public static String MavenCatalogViewer_allInstalled;
-
public static String MavenCatalogViewer_Error_loading_lifecycle;
+ public static String MavenCatalogViewer_noApplicableMarketplaceItems;
public static String MavenCatalogViewer_noEntries;
-
public static String MavenCatalogViewer_unexpectedException;
public static String MavenDiscoveryWizard_Title;
@@ -65,15 +63,12 @@ public class Messages extends NLS {
public static String MavenDiscoveryInstallOperation_Configuring;
-
public static String MavenDiscoveryInstallOperation_ErrorMessage;
public static String MavenDiscoveryInstallOperation_missingIU;
-
public static String MavenDiscoveryInstallOperation_missingRepository;
-
public static String UpdateConfigurationStartup_MarkerError;
static {
diff --git a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/messages.properties b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/messages.properties
index 07ce4185..d6da4c6b 100644
--- a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/messages.properties
+++ b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/messages.properties
@@ -19,6 +19,7 @@ MavenCatalogPage_Descripton=Select updates and extensions to install. Press Fini
MavenCatalogPage_Title=Install m2e connectors
MavenCatalogViewer_allInstalled=All available entries are installed.
MavenCatalogViewer_Error_loading_lifecycle=An error occurred loading lifecycle data for catalog item: {0}
+MavenCatalogViewer_noApplicableMarketplaceItems=No marketplace items are applicable.
MavenCatalogViewer_noEntries=No entries available.
MavenCatalogViewer_unexpectedException=Unexpected exception
MavenDiscoveryWizard_Title=m2e Marketplace
diff --git a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenCatalogViewer.java b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenCatalogViewer.java
index f517f5b6..6a96f8ba 100644
--- a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenCatalogViewer.java
+++ b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenCatalogViewer.java
@@ -51,6 +51,8 @@ public class MavenCatalogViewer extends CatalogViewer {
private Set<String> installedFeatures;
+ private boolean noneApplicable;
+
/*
* Outside of tests the shellProvider should generally be a WizardPage which allows setting the header.
*/
@@ -77,27 +79,44 @@ public class MavenCatalogViewer extends CatalogViewer {
final Collection<String> selectedLifecycleIds = config.getSelectedLifecycleIds();
final Collection<String> selectedConfiguratorIds = config.getSelectedConfiguratorIds();
- shellProvider.getShell().getDisplay().syncExec(new Runnable() {
- @SuppressWarnings("synthetic-access")
- public void run() {
- for(CatalogItem ci : getCatalog().getItems()) {
- boolean selected = false;
- subMon.worked(2);
-
- LifecycleMappingMetadataSource src = MavenDiscovery.getLifecycleMappingMetadataSource(ci);
- if(src != null) {
- for(String packagingType : selectedPackagingTypes) {
- if(hasPackaging(src, packagingType)) {
- selected = true;
- select(ci);
- break;
+ if(!selectedConfiguratorIds.isEmpty() || !selectedLifecycleIds.isEmpty() || !selectedMojos.isEmpty()
+ || !selectedPackagingTypes.isEmpty()) {
+ noneApplicable = true;
+ shellProvider.getShell().getDisplay().syncExec(new Runnable() {
+ @SuppressWarnings("synthetic-access")
+ public void run() {
+ for(CatalogItem ci : getCatalog().getItems()) {
+ boolean selected = false;
+ subMon.worked(2);
+
+ LifecycleMappingMetadataSource src = MavenDiscovery.getLifecycleMappingMetadataSource(ci);
+ if(src != null) {
+ for(String packagingType : selectedPackagingTypes) {
+ if(hasPackaging(src, packagingType)) {
+ selected = true;
+ select(ci);
+ break;
+ }
+ }
+ if(selected) {
+ continue;
+ }
+ for(MojoExecutionKey mojoExecution : selectedMojos) {
+ if(matchesFilter(src, mojoExecution)) {
+ selected = true;
+ select(ci);
+ break;
+ }
+ }
+ if(selected) {
+ continue;
}
}
- if(selected) {
- continue;
- }
- for(MojoExecutionKey mojoExecution : selectedMojos) {
- if(matchesFilter(src, mojoExecution)) {
+
+ for(String configuratorId : selectedConfiguratorIds) {
+ Tag configuratorIdTag = new Tag(CONFIGURATOR_PREFIX + configuratorId, CONFIGURATOR_PREFIX
+ + configuratorId);
+ if(ci.hasTag(configuratorIdTag)) {
selected = true;
select(ci);
break;
@@ -106,31 +125,22 @@ public class MavenCatalogViewer extends CatalogViewer {
if(selected) {
continue;
}
- }
- for(String configuratorId : selectedConfiguratorIds) {
- Tag configuratorIdTag = new Tag(CONFIGURATOR_PREFIX + configuratorId, CONFIGURATOR_PREFIX
- + configuratorId);
- if(ci.hasTag(configuratorIdTag)) {
- selected = true;
- select(ci);
- break;
+ for(String lifecycleId : selectedLifecycleIds) {
+ Tag lifecycleIdTag = new Tag(LIFECYCLE_PREFIX + lifecycleId, LIFECYCLE_PREFIX + lifecycleId);
+ if(ci.hasTag(lifecycleIdTag)) {
+ select(ci);
+ break;
+ }
}
}
- if(selected) {
- continue;
- }
-
- for(String lifecycleId : selectedLifecycleIds) {
- Tag lifecycleIdTag = new Tag(LIFECYCLE_PREFIX + lifecycleId, LIFECYCLE_PREFIX + lifecycleId);
- if(ci.hasTag(lifecycleIdTag)) {
- select(ci);
- break;
- }
+ if(noneApplicable) {
+ handleStatus(new Status(IStatus.ERROR, DiscoveryActivator.PLUGIN_ID,
+ Messages.MavenCatalogViewer_noApplicableMarketplaceItems));
}
}
- }
- });
+ });
+ }
}
} finally {
subMon.done();
@@ -184,6 +194,7 @@ public class MavenCatalogViewer extends CatalogViewer {
private void select(CatalogItem ci) {
modifySelection(ci, true);
ci.addTag(MavenDiscovery.APPLICABLE_TAG);
+ noneApplicable = false;
}
private void handleStatus(final IStatus status) {

Back to the top