Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilos Kleint2010-12-23 11:51:02 -0500
committerMilos Kleint2010-12-23 11:51:02 -0500
commit17897ec65e21b000520d812d1216889a998c7dd5 (patch)
treed22edb8974249e6c81faa734869e888198c2ba65
parentb57d1935bc615ba9045ad6d06c0ac0e54470a922 (diff)
downloadm2e-core-17897ec65e21b000520d812d1216889a998c7dd5.tar.gz
m2e-core-17897ec65e21b000520d812d1216889a998c7dd5.tar.xz
m2e-core-17897ec65e21b000520d812d1216889a998c7dd5.zip
MNGECLIPSE-2677 in clickable description popup dialog, list texts from all the markers. improve labels and icons
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/ui/dialogs/MavenMessageDialog.java24
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/Messages.java6
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/messages.properties7
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java6
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java17
5 files changed, 51 insertions, 9 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/ui/dialogs/MavenMessageDialog.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/ui/dialogs/MavenMessageDialog.java
index ea439f57..6da9f585 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/ui/dialogs/MavenMessageDialog.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/ui/dialogs/MavenMessageDialog.java
@@ -11,8 +11,8 @@
package org.eclipse.m2e.core.ui.dialogs;
-import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
@@ -21,6 +21,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
/**
@@ -68,7 +69,7 @@ public class MavenMessageDialog extends MessageDialog {
* @param message The actual message to show in the text area.
*/
public static void openInfo(Shell parent, String title, String label, String message) {
- MavenMessageDialog dialog = new MavenMessageDialog(parent, title, Dialog.getImage(Dialog.DLG_IMG_INFO), // accept
+ MavenMessageDialog dialog = new MavenMessageDialog(parent, title, Display.getDefault().getSystemImage(SWT.ICON_INFORMATION), // accept
label, INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); // ok
dialog.create();
dialog.getMessageArea().setText(message);
@@ -77,7 +78,24 @@ public class MavenMessageDialog extends MessageDialog {
return;
}
-
+ /**
+ *
+ * @param parent
+ * @param title
+ * @param label
+ * @param message
+ * @param severity constants from MessageDialog
+ */
+ public static void openWithSeverity(Shell parent, String title, String label, String message, int severity) {
+ Image icon = severity == IMessageProvider.ERROR ? Display.getDefault().getSystemImage(SWT.ICON_ERROR) : Display.getDefault().getSystemImage(SWT.ICON_INFORMATION);
+ MavenMessageDialog dialog = new MavenMessageDialog(parent, title, icon, // accept
+ label, severity, new String[] { IDialogConstants.OK_LABEL }, 0); // ok
+ dialog.create();
+ dialog.getMessageArea().setText(message);
+ dialog.getDialogArea().pack(true);
+ dialog.open();
+ return;
+ }
/**
* @return Returns the messageArea.
*/
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/Messages.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/Messages.java
index bef6ce02..7fe40fed 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/Messages.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/Messages.java
@@ -257,10 +257,16 @@ public class Messages extends NLS {
public static String MavenPomEditorPage_action_open;
+ public static String MavenPomEditorPage_add_desc;
+
+ public static String MavenPomEditorPage_error_add;
+
public static String MavenPomEditorPage_error_unknown;
public static String MavenPomEditorPage_job_opening;
+ public static String MavenPomEditorPage_warning_add;
+
public static String OverviewPage_action_new_module_project;
public static String OverviewPage_action_newModuleElement;
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/messages.properties b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/messages.properties
index 4b2f988b..56b944e8 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/messages.properties
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/messages.properties
@@ -88,8 +88,8 @@ DependencyTreePage_section_hierarchy=Dependency Hierarchy
DependencyTreePage_section_resolvedDeps=Resolved Dependencies
DependencyTreePage_title=Dependency Hierarchy
FormUtils_click_for_details={0} (Click for more details)
-FormUtils_error_info=Error info:
-FormUtils_pom_error=The POM has the following error:
+FormUtils_error_info=Problems in the POM
+FormUtils_pom_error=The POM has the following problems:
LifecyclePage_btnAdd=Add
LifecyclePage_btnDisable=Disable
LifecyclePage_btnEdit=Edit...
@@ -118,8 +118,11 @@ MavenPomEditor_loading=Loading Effective POM...
MavenPomEditor_task_reading=Reading project
MavenPomEditorPage_actio_refresh=Refresh
MavenPomEditorPage_action_open=Open Parent POM
+MavenPomEditorPage_add_desc={0}\n\nAdditional problems:\n{1}
+MavenPomEditorPage_error_add=* Error: {0}\n
MavenPomEditorPage_error_unknown=Unknown error
MavenPomEditorPage_job_opening=Opening POM
+MavenPomEditorPage_warning_add=\n* Warning: {0}
OverviewPage_action_new_module_project=New module project
OverviewPage_action_newModuleElement=New module element
OverviewPage_action_selectParent=Select Parent
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java
index a6f129a7..6c76bfb0 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java
@@ -15,6 +15,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.m2e.core.core.MavenLogger;
import org.eclipse.m2e.core.ui.dialogs.MavenMessageDialog;
import org.eclipse.m2e.core.util.Util;
@@ -212,7 +213,7 @@ public abstract class FormUtils {
private static void addFormTitleListeners(final ScrolledForm form, final String message, final String ttip,
final int severity) {
- if(ttip != null && ttip.length() > 0 && message != null && severity == IMessageProvider.ERROR) {
+ if(ttip != null && ttip.length() > 0 && message != null) {
final Composite head = form.getForm().getHead();
Control[] kids = head.getChildren();
for(Control kid : kids) {
@@ -226,7 +227,8 @@ public abstract class FormUtils {
cleanupMouseListeners(kid, SWT.MouseExit);
kid.addMouseListener(new MouseAdapter() {
public void mouseUp(MouseEvent e) {
- MavenMessageDialog.openInfo(form.getShell(), Messages.FormUtils_error_info, Messages.FormUtils_pom_error, ttip);
+ int dialogSev = IMessageProvider.ERROR == severity ? MessageDialog.ERROR : MessageDialog.WARNING;
+ MavenMessageDialog.openWithSeverity(form.getShell(), Messages.FormUtils_error_info, Messages.FormUtils_pom_error, ttip, dialogSev);
}
});
kid.addMouseTrackListener(new MouseTrackAdapter() {
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java
index 7cacb19c..823c6639 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java
@@ -58,6 +58,7 @@ import org.eclipse.m2e.editor.internal.Messages;
import org.eclipse.m2e.model.edit.pom.Model;
import org.eclipse.m2e.model.edit.pom.Parent;
import org.eclipse.m2e.model.edit.pom.PomPackage;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -203,19 +204,31 @@ public abstract class MavenPomEditorPage extends FormPage implements Adapter {
//error markers have to be always updated..
IFile pomFile = pomEditor.getPomFile();
if(pomFile != null) {
+ String text = ""; //$NON-NLS-1$
IMarker[] markers = pomFile.findMarkers(IMavenConstants.MARKER_ID, true, IResource.DEPTH_ZERO);
IMarker max = null;
int maxSev = -1;
if(markers != null) {
for(IMarker mark : markers) {
+ IMarker toAdd = max;
int sev = mark.getAttribute(IMarker.SEVERITY, -1);
if(sev > maxSev) {
max = mark;
maxSev = sev;
+ } else {
+ toAdd = mark;
+ }
+ if (toAdd != null) {
+ if (toAdd.getAttribute(IMarker.SEVERITY, -1) == IMarker.SEVERITY_ERROR) {
+ text = NLS.bind(Messages.MavenPomEditorPage_error_add, toAdd.getAttribute(IMarker.MESSAGE, "")) + text; //$NON-NLS-2$
+ } else {
+ text = text + NLS.bind(Messages.MavenPomEditorPage_warning_add, toAdd.getAttribute(IMarker.MESSAGE, "")); //$NON-NLS-2$
+ }
}
}
}
if(max != null) {
+ text = NLS.bind(Messages.MavenPomEditorPage_add_desc, max.getAttribute(IMarker.MESSAGE, Messages.MavenPomEditorPage_error_unknown), text);
int severity;
switch(max.getAttribute(IMarker.SEVERITY, -1)) {
case IMarker.SEVERITY_ERROR: {
@@ -234,7 +247,7 @@ public abstract class MavenPomEditorPage extends FormPage implements Adapter {
severity = IMessageProvider.NONE;
}
}
- setErrorMessage(max.getAttribute(IMarker.MESSAGE, Messages.MavenPomEditorPage_error_unknown), severity);
+ setErrorMessage(text, severity);
} else {
setErrorMessage(null, IMessageProvider.NONE);
}
@@ -518,7 +531,7 @@ public abstract class MavenPomEditorPage extends FormPage implements Adapter {
owner = provider.getValue();
}
- String value = control.getSelection() ? "true" : "false";
+ String value = control.getSelection() ? "true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$
Command command = SetCommand.create(getEditingDomain(), owner, feature, //
defaultValue.equals(value) ? null : value);
getEditingDomain().getCommandStack().execute(command);

Back to the top