summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-07-18 19:36:11 (EDT)
committerSteffen Pingel2011-07-18 19:36:11 (EDT)
commit1f95734d1ccad89997d2ec195a43dd89d0b61875 (patch)
tree043bb171b16cb179707b293ef8c320b3308bd40e
parent1f883168b002a29591dc0dfd1287ee1b412d58ab (diff)
downloadorg.eclipse.mylyn.builds-1f95734d1ccad89997d2ec195a43dd89d0b61875.zip
org.eclipse.mylyn.builds-1f95734d1ccad89997d2ec195a43dd89d0b61875.tar.gz
org.eclipse.mylyn.builds-1f95734d1ccad89997d2ec195a43dd89d0b61875.tar.bz2
NEW - bug 350334: [patch] Add preference for showing test failures only
https://bugs.eclipse.org/bugs/show_bug.cgi?id=350334
-rw-r--r--org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/BuildsUiInternal.java2
-rw-r--r--org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/editor/TestResultPart.java42
2 files changed, 35 insertions, 9 deletions
diff --git a/org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/BuildsUiInternal.java b/org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/BuildsUiInternal.java
index d58ddf4..5d1d03d 100644
--- a/org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/BuildsUiInternal.java
+++ b/org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/BuildsUiInternal.java
@@ -174,6 +174,8 @@ public class BuildsUiInternal {
public static final String PREF_AUTO_REFRESH_INTERVAL = "refresh.interval"; //$NON-NLS-1$
+ public static final String PREF_SHOW_TEST_FAILURES_ONLY = "editor.testResults.failuresOnly"; //$NON-NLS-1$
+
public static IBuildServer createServer(String connectorKind, RepositoryLocation location) {
return getManager().createServer(connectorKind, location);
}
diff --git a/org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/editor/TestResultPart.java b/org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/editor/TestResultPart.java
index 7a0c4d0..499e193 100644
--- a/org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/editor/TestResultPart.java
+++ b/org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/editor/TestResultPart.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Tasktop Technologies - initial API and implementation
+ * GitHub, Inc. - fixes for bug 350334
*******************************************************************************/
package org.eclipse.mylyn.internal.builds.ui.editor;
@@ -36,6 +37,8 @@ import org.eclipse.mylyn.builds.core.TestCaseResult;
import org.eclipse.mylyn.builds.internal.core.BuildPackage.Literals;
import org.eclipse.mylyn.builds.internal.core.TestResult;
import org.eclipse.mylyn.internal.builds.ui.BuildImages;
+import org.eclipse.mylyn.internal.builds.ui.BuildsUiInternal;
+import org.eclipse.mylyn.internal.builds.ui.BuildsUiPlugin;
import org.eclipse.mylyn.internal.builds.ui.actions.ShowTestResultsAction;
import org.eclipse.mylyn.internal.builds.ui.util.TestResultManager;
import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil;
@@ -51,27 +54,51 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
/**
* @author Steffen Pingel
+ * @author Kevin Sawicki
*/
public class TestResultPart extends AbstractBuildEditorPart {
public class FilterTestFailuresAction extends Action {
+ private final TestFailureFilter filter;
+
public FilterTestFailuresAction() {
super("Show Failures Only", IAction.AS_CHECK_BOX);
+ filter = new TestFailureFilter();
setToolTipText("Show Failures Only");
setImageDescriptor(BuildImages.FILTER_FAILURES);
+ setChecked(BuildsUiPlugin.getDefault()
+ .getPreferenceStore()
+ .getBoolean(BuildsUiInternal.PREF_SHOW_TEST_FAILURES_ONLY));
+ }
+
+ public void initialize() {
+ if (isChecked()) {
+ addFilter();
+ }
+ }
+
+ private void addFilter() {
+ viewer.addFilter(filter);
+ viewer.expandAll();
+ }
+
+ private void removeFilter() {
+ viewer.removeFilter(filter);
}
@Override
public void run() {
- if (isChecked()) {
- viewer.addFilter(testFailureFilter);
- viewer.expandAll();
+ boolean checked = isChecked();
+ if (checked) {
+ addFilter();
} else {
- viewer.removeFilter(testFailureFilter);
+ removeFilter();
}
+ BuildsUiPlugin.getDefault()
+ .getPreferenceStore()
+ .setValue(BuildsUiInternal.PREF_SHOW_TEST_FAILURES_ONLY, checked);
}
-
}
private static final String ID_POPUP_MENU = "org.eclipse.mylyn.builds.ui.editor.menu.TestResult"; //$NON-NLS-1$
@@ -158,8 +185,6 @@ public class TestResultPart extends AbstractBuildEditorPart {
private TreeViewer viewer;
- private TestFailureFilter testFailureFilter;
-
public TestResultPart() {
super(ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED);
setPartName("Test Results");
@@ -214,8 +239,6 @@ public class TestResultPart extends AbstractBuildEditorPart {
}
});
- testFailureFilter = new TestFailureFilter();
-
menuManager = new MenuManager();
WorkbenchUtil.addDefaultGroups(menuManager);
getPage().getEditorSite().registerContextMenu(ID_POPUP_MENU, menuManager, viewer, true);
@@ -223,6 +246,7 @@ public class TestResultPart extends AbstractBuildEditorPart {
viewer.getControl().setMenu(menu);
refresh(testResult);
+ filterTestFailuresAction.initialize();
toolkit.paintBordersFor(composite);
return composite;