Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Bricon2014-04-23 10:11:40 -0400
committerFred Bricon2014-04-25 09:36:23 -0400
commit4f6f5eb95cfaa08f6ab6d3934992927273f47944 (patch)
treee7e4207021eeafbe438b3da8e06a88d4d4886493
parent21bde2de0ec260e928d66802b0e0bd9f5834ff1e (diff)
downloadm2e-core-4f6f5eb95cfaa08f6ab6d3934992927273f47944.tar.gz
m2e-core-4f6f5eb95cfaa08f6ab6d3934992927273f47944.tar.xz
m2e-core-4f6f5eb95cfaa08f6ab6d3934992927273f47944.zip
432402 : Show warning if remote indexes unavailable
Change-Id: Ide94d1555c35856b2314a93570f54a6d594d5be7 Bug-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=432402 Signed-off-by: Fred Bricon <fbricon@gmail.com>
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java4
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties1
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenPomSelectionComponent.java28
3 files changed, 30 insertions, 3 deletions
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java
index 8e406bf1..93fe1841 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2010 Sonatype, Inc.
+ * Copyright (c) 2008-2014 Sonatype, Inc. 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
@@ -345,6 +345,8 @@ public class Messages extends NLS {
public static String MavenPomSelectionComponent_toomany;
+ public static String MavenPomSelectionComponent_UnavailableRemoteRepositoriesIndexes;
+
public static String MavenPomWizard_error_exists;
public static String MavenPomWizard_error_title;
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties
index 25acf46e..33a6a82d 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties
@@ -203,6 +203,7 @@ MavenPomSelectionComponent_search_title=&Enter groupId, artifactId or sha1 prefi
MavenPomSelectionComponent_searching=Searching ''{0}''...
MavenPomSelectionComponent_selected=Selected {0}
MavenPomSelectionComponent_toomany=Too many results to display. Enter a more specific search term.
+MavenPomSelectionComponent_UnavailableRemoteRepositoriesIndexes=Index downloads are disabled, search results may be incomplete.
MavenPomWizardPage_desc=This wizard creates a new POM (pom.xml) descriptor for Maven.
MavenPomWizardPage_dialog_title=Select project
MavenPomWizardPage_error_artid=Artifact Id must be specified
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenPomSelectionComponent.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenPomSelectionComponent.java
index 3efbb74e..767aa15a 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenPomSelectionComponent.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenPomSelectionComponent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2010 Sonatype, Inc.
+ * Copyright (c) 2008-2014 Sonatype, Inc. 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
@@ -26,6 +26,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider;
import org.eclipse.jface.viewers.DecorationContext;
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
@@ -171,6 +174,10 @@ public class MavenPomSelectionComponent extends Composite {
}
});
+ if(!MavenPlugin.getMavenConfiguration().isUpdateIndexesOnStartup()) {
+ createWarningArea(this);
+ }
+
Label searchResultsLabel = new Label(this, SWT.NONE);
searchResultsLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
searchResultsLabel.setText(Messages.MavenPomSelectionComponent_lblResults);
@@ -192,6 +199,23 @@ public class MavenPomSelectionComponent extends Composite {
searchResultViewer = new TreeViewer(tree);
}
+ private void createWarningArea(Composite composite) {
+
+ Composite warningArea = new Composite(composite, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).span(2, 1).hint(100, SWT.DEFAULT)
+ .applyTo(warningArea);
+ warningArea.setLayout(new GridLayout(2, false));
+
+ Label warningImg = new Label(warningArea, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(warningImg);
+ warningImg.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
+
+ Text warningLabel = new Text(warningArea, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY);
+ warningLabel.setBackground(composite.getBackground());
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.FILL).grab(true, false).applyTo(warningLabel);
+ warningLabel.setText(Messages.MavenPomSelectionComponent_UnavailableRemoteRepositoriesIndexes);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.swt.widgets.Composite#setFocus()
*/
@@ -372,7 +396,7 @@ public class MavenPomSelectionComponent extends Composite {
searchJob = new SearchJob(queryType, indexManager);
} else {
if(!searchJob.cancel()) {
- //for already running ones, just create new instance so that the previous one can piecefully die
+ //for already running ones, just create new instance so that the previous one can peacefully die
//without preventing the new one from completing first
IndexManager indexManager = MavenPlugin.getIndexManager();
searchJob = new SearchJob(queryType, indexManager);

Back to the top