Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fleck2016-06-30 05:22:13 -0400
committerLaurent Goubet2016-07-25 11:11:11 -0400
commit47f29d0f824b6fe77d3ededc55a0fc7a6ba13a21 (patch)
tree77d84c931ee227e7271c566d33b556c5474670b8
parent27695cda9e78979857936a05467614d36a084d88 (diff)
downloadorg.eclipse.emf.compare-47f29d0f824b6fe77d3ededc55a0fc7a6ba13a21.tar.gz
org.eclipse.emf.compare-47f29d0f824b6fe77d3ededc55a0fc7a6ba13a21.tar.xz
org.eclipse.emf.compare-47f29d0f824b6fe77d3ededc55a0fc7a6ba13a21.zip
[497066] 'Problems' tab should not be shown automatically for warnings
Add separate message for warning in ProblemIndicator composite. Avoid revealing the 'Problems' tab when there is a warning. Bug: 497066 Change-Id: Id11f69283afa2e9b6148e15504488d0fbb6281b6 Signed-off-by: Martin Fleck <mfleck@eclipsesource.com> Signed-off-by: Philip Langer <planger@eclipsesource.com>
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/ide_ui_messages.properties8
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java51
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/ProblemIndicationComposite.java20
3 files changed, 58 insertions, 21 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/ide_ui_messages.properties b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/ide_ui_messages.properties
index 196bb0ef5..8e204749b 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/ide_ui_messages.properties
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/ide_ui_messages.properties
@@ -82,9 +82,11 @@ ModelResolutionPreferencesPage.resolutionScope.invalid = Invalid resolution scop
MergePreferencesPage.preMergeOnConflict = Pre-merge models when a real conflict is detected
-_UI_NoProblems_message = There are no problems with the computation of the comparison
-_UI_DefaultProblem_message = Problems encountered. Click on each problem for further information. The computed comparison and the merge you will do on it may be inaccurate. We suggest you to fix the errors before doing any merge or to switch to text comparison (use 'Text Compare' below)
-_UI_Cancel_message = Operation has been canceled. The computed comparison and the merge you will do on it may be inaccurate. We suggest you to be very careful or to switch to text comparison (use 'Text Compare' below)
+_UI_NoProblems_message = There are no problems with the computation of the comparison.
+_UI_DefaultProblem_message = The comparison completed with problems. The computed comparison and the merge you will do on it may be inaccurate. Click on each problem for further information. We suggest you to fix the problems before doing any merge or to switch to text comparison (use 'Text Compare' below).
+_UI_Error_message = The comparison completed with errors. The computed comparison and the merge you will do on it may be inaccurate. Click on each error for further information. We suggest you to fix the errors before doing any merge or to switch to text comparison (use 'Text Compare' below).
+_UI_Warning_message = The comparison completed with warnings. The computed comparison and the merge you will do on it may be inaccurate. Click on each warning for further information. We suggest you consider the warnings before doing any merge or to switch to text comparison (use 'Text Compare' below).
+_UI_Cancel_message = Operation has been canceled. The computed comparison and the merge you will do on it may be inaccurate. We suggest you to be very careful or to switch to text comparison (use 'Text Compare' below).
EMFCompareStructureMergeViewer.title = Model differences
EMFCompareStructureMergeViewer.titleDesc = {0} of {1} differences are not merged \u2014 {2} differences filtered from view
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
index af46b2d8a..f07f26307 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
@@ -10,6 +10,7 @@
* Michael Borkowski - bug 467191
* Philip Langer - bug 462884
* Stefan Dirix - bugs 473985 and 474030
+ * Martin Fleck - bug 497066
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer;
@@ -1371,26 +1372,54 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
g.fillRectangle(areaBounds.x, itemBounds.y, areaBounds.width, itemBounds.height);
}
- private void updateProblemIndication(Diagnostic diagnostic) {
+ /**
+ * Returns a problem indication composite for the given diagnostic. If a problem indication composite
+ * already exists, the existing one is returned. If no composite exists, a new composite is created if the
+ * severity of the provided diagnostic is anything besides OK. If no composite exists and the severity
+ * does not warrant the creation of a new composite, this method returns null.
+ *
+ * @param diagnostic
+ * comparison diagnostic
+ * @return the existing or a newly created problem indication composite or null if no indication is
+ * necessary
+ */
+ private ProblemIndicationComposite getProblemIndication(Diagnostic diagnostic) {
Assert.isNotNull(diagnostic);
int lastEditorPage = getPageCount() - 1;
+ ProblemIndicationComposite problemIndicationComposite = null;
if (lastEditorPage >= 0 && getItemControl(lastEditorPage) instanceof ProblemIndicationComposite) {
- ((ProblemIndicationComposite)getItemControl(lastEditorPage)).setDiagnostic(diagnostic);
- if (diagnostic.getSeverity() != Diagnostic.OK) {
- setActivePage(lastEditorPage);
- updateLayout(false, true);
- }
+ problemIndicationComposite = ((ProblemIndicationComposite)getItemControl(lastEditorPage));
} else if (diagnostic.getSeverity() != Diagnostic.OK && !getControl().isDisposed()) {
- ProblemIndicationComposite problemIndicationComposite = new ProblemIndicationComposite(
- getControl(), SWT.NONE);
- problemIndicationComposite.setDiagnostic(diagnostic);
+ problemIndicationComposite = new ProblemIndicationComposite(getControl(), SWT.NONE);
createItem(++lastEditorPage, problemIndicationComposite);
getControl().getItem(lastEditorPage)
.setText(CommonUIPlugin.getPlugin().getString("_UI_Problems_label")); //$NON-NLS-1$
- setActivePage(lastEditorPage);
- updateLayout(false, true);
showTabs();
}
+ return problemIndicationComposite;
+ }
+
+ /**
+ * Updates the problem indication for the provided diagnostic. If everything is {@link Diagnostic#OK} and
+ * no problem indication is available, this method does nothing. In any other case, the existing or a
+ * newly created problem indication is updated and automatically revealed if the diagnostics
+ * {@link Diagnostic#getSeverity() severity} is anything besides {@link Diagnostic#OK} and
+ * {@link Diagnostic#WARNING}.
+ *
+ * @param diagnostic
+ * comparison diagnostic
+ */
+ private void updateProblemIndication(Diagnostic diagnostic) {
+ ProblemIndicationComposite problemIndicationComposite = getProblemIndication(diagnostic);
+ if (problemIndicationComposite != null) {
+ problemIndicationComposite.setDiagnostic(diagnostic);
+ if (diagnostic.getSeverity() != Diagnostic.OK && diagnostic.getSeverity() != Diagnostic.WARNING) {
+ // reveal problem indication composite (last editor page)
+ int lastEditorPage = getPageCount() - 1;
+ setActivePage(lastEditorPage);
+ updateLayout(false, true);
+ }
+ }
}
private void showTabs() {
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/ProblemIndicationComposite.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/ProblemIndicationComposite.java
index 823bff17c..8048ba16e 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/ProblemIndicationComposite.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/ProblemIndicationComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Obeo.
+ * Copyright (c) 2014, 2016 Obeo 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Martin Fleck - bug 497066
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer;
@@ -34,12 +35,17 @@ public class ProblemIndicationComposite extends Composite {
* @return a not null String
*/
public String getMessage(Diagnostic rootDiagnostic) {
- if (rootDiagnostic.getSeverity() == Diagnostic.OK) {
- return EMFCompareIDEUIMessages.getString("_UI_NoProblems_message"); //$NON-NLS-1$
- } else if (rootDiagnostic.getSeverity() == Diagnostic.CANCEL) {
- return EMFCompareIDEUIMessages.getString("_UI_Cancel_message"); //$NON-NLS-1$
- } else {
- return EMFCompareIDEUIMessages.getString("_UI_DefaultProblem_message"); //$NON-NLS-1$
+ switch (rootDiagnostic.getSeverity()) {
+ case Diagnostic.OK:
+ return EMFCompareIDEUIMessages.getString("_UI_NoProblems_message"); //$NON-NLS-1$
+ case Diagnostic.CANCEL:
+ return EMFCompareIDEUIMessages.getString("_UI_Cancel_message"); //$NON-NLS-1$
+ case Diagnostic.WARNING:
+ return EMFCompareIDEUIMessages.getString("_UI_Warning_message"); //$NON-NLS-1$
+ case Diagnostic.ERROR:
+ return EMFCompareIDEUIMessages.getString("_UI_Error_message"); //$NON-NLS-1$
+ default:
+ return EMFCompareIDEUIMessages.getString("_UI_DefaultProblem_message"); //$NON-NLS-1$
}
}
}

Back to the top