Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2011-03-08 23:38:31 -0500
committerRyan D. Brooks2011-03-08 23:38:31 -0500
commitdfb43944208e9eba550bd80a89c15b989065ca1c (patch)
tree490cde157e61d0239a4527c67a1e3e25d95178ff /plugins/org.eclipse.osee.coverage
parent04f0803b14e6d19a601fd97c7e3115484fd6f9c6 (diff)
downloadorg.eclipse.osee-dfb43944208e9eba550bd80a89c15b989065ca1c.tar.gz
org.eclipse.osee-dfb43944208e9eba550bd80a89c15b989065ca1c.tar.xz
org.eclipse.osee-dfb43944208e9eba550bd80a89c15b989065ca1c.zip
feature: Coverage - Coverage Method dialog needs to force a single coverage method
Diffstat (limited to 'plugins/org.eclipse.osee.coverage')
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageMethodAction.java8
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/dialog/CoverageMethodLabelProvider.java44
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/dialog/CoverageMethodSingleSelectListDialog.java54
3 files changed, 102 insertions, 4 deletions
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageMethodAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageMethodAction.java
index e95ba06ac5..7a15502adc 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageMethodAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/EditCoverageMethodAction.java
@@ -21,7 +21,7 @@ import org.eclipse.osee.coverage.model.CoverageOption;
import org.eclipse.osee.coverage.model.CoverageOptionManager.EnabledOption;
import org.eclipse.osee.coverage.model.ICoverage;
import org.eclipse.osee.coverage.util.ISaveable;
-import org.eclipse.osee.coverage.util.dialog.CoverageMethodListDialog;
+import org.eclipse.osee.coverage.util.dialog.CoverageMethodSingleSelectListDialog;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -78,13 +78,13 @@ public class EditCoverageMethodAction extends Action {
return;
}
- CoverageMethodListDialog dialog =
- new CoverageMethodListDialog(coverageXViewer.getCoverageOptionManager().getEnabled(EnabledOption.Write));
+ CoverageMethodSingleSelectListDialog dialog =
+ new CoverageMethodSingleSelectListDialog(coverageXViewer.getCoverageOptionManager(), EnabledOption.Write);
if (dialog.open() == 0) {
Set<ICoverage> coveragesToSave = new HashSet<ICoverage>();
for (ICoverage coverageItem : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
if (coverageItem instanceof CoverageItem) {
- ((CoverageItem) coverageItem).setCoverageMethod((CoverageOption) dialog.getFirstResult());
+ ((CoverageItem) coverageItem).setCoverageMethod((CoverageOption) dialog.getResult()[0]);
refreshable.update(coverageItem);
coveragesToSave.add(coverageItem);
}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/dialog/CoverageMethodLabelProvider.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/dialog/CoverageMethodLabelProvider.java
new file mode 100644
index 0000000000..cb3564bfba
--- /dev/null
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/dialog/CoverageMethodLabelProvider.java
@@ -0,0 +1,44 @@
+package org.eclipse.osee.coverage.util.dialog;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.osee.coverage.model.CoverageOption;
+import org.eclipse.swt.graphics.Image;
+
+public class CoverageMethodLabelProvider implements ILabelProvider {
+
+ @Override
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof CoverageOption) {
+ CoverageOption option = (CoverageOption) element;
+ return option.getName();
+ }
+ return "Unknown";
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ // do nothing
+ }
+
+ @Override
+ public void dispose() {
+ // do nothing
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ // do nothing
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/dialog/CoverageMethodSingleSelectListDialog.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/dialog/CoverageMethodSingleSelectListDialog.java
new file mode 100644
index 0000000000..dc5a7ce64d
--- /dev/null
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/dialog/CoverageMethodSingleSelectListDialog.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.coverage.util.dialog;
+
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.osee.coverage.model.CoverageOptionManager;
+import org.eclipse.osee.coverage.model.CoverageOptionManager.EnabledOption;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.ToStringViewerSorter;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.dialogs.ListDialog;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageMethodSingleSelectListDialog extends ListDialog {
+
+ public CoverageMethodSingleSelectListDialog(CoverageOptionManager optionManager, EnabledOption enabledOption) {
+ super(Displays.getActiveShell());
+ setTitle("Select Coverage Method");
+ setMessage("Select Coverage Method");
+ setContentProvider(new ArrayContentProvider());
+ setLabelProvider(new CoverageMethodLabelProvider());
+ setInput(optionManager.getEnabled(enabledOption));
+ }
+
+ @Override
+ protected Control createDialogArea(Composite container) {
+ Control c = super.createDialogArea(container);
+ getTableViewer().setSorter(new ToStringViewerSorter());
+ return c;
+ }
+
+ @Override
+ protected void okPressed() {
+ if (getTableViewer().getSelection().isEmpty()) {
+ AWorkbench.popup("ERROR", "Must make selection.");
+ return;
+ }
+ super.okPressed();
+ }
+
+}

Back to the top