Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2011-03-09 10:29:21 -0500
committerRyan D. Brooks2011-03-09 10:29:21 -0500
commitc8808082e673367facc223c0c1486e2097d38ffb (patch)
tree3b3545ef9c808d5a3139576f9af02728d6f234ad /plugins/org.eclipse.osee.coverage
parentcc52318fafb495b9ec01c0a105a371e57e753f59 (diff)
downloadorg.eclipse.osee-c8808082e673367facc223c0c1486e2097d38ffb.tar.gz
org.eclipse.osee-c8808082e673367facc223c0c1486e2097d38ffb.tar.xz
org.eclipse.osee-c8808082e673367facc223c0c1486e2097d38ffb.zip
feature: Coverage - Ensure that coverage can't be changed on read-only branch
Diffstat (limited to 'plugins/org.eclipse.osee.coverage')
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java26
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorOverviewTab.java6
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParametersComposite.java24
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackageBase.java11
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoveragePackageStore.java13
5 files changed, 64 insertions, 16 deletions
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java
index 29873b56ed..e51ec51b25 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java
@@ -53,6 +53,7 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
@@ -132,12 +133,35 @@ public class CoverageEditorCoverageTab extends FormPage implements ISaveable, IR
coverageEditor.getToolkit().adapt(branchComp);
GridData gd = new GridData(SWT.NONE, SWT.NONE, false, false);
gd.horizontalSpan = 2;
+ gd.verticalIndent = 0;
branchComp.setLayoutData(gd);
- branchComp.setLayout(ALayout.getZeroMarginLayout(2, false));
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginHeight = 5;
+ branchComp.setLayout(layout);
+
+ // branch label
Label label = new Label(branchComp, SWT.NONE);
label.setText("Branch: ");
label.setFont(FontManager.getDefaultLabelFont());
coverageEditor.getToolkit().adapt(label, false, false);
+
+ // read-only label
+ try {
+ if (coverageEditor.getCoveragePackageBase().isEditable().isFalse()) {
+ label = new Label(branchComp, SWT.NONE);
+ label.setText(" -- READ-ONLY -- ");
+ if (Strings.isValid(coverageEditor.getCoveragePackageBase().getEditableReason())) {
+ label.setToolTipText(coverageEditor.getCoveragePackageBase().getEditableReason());
+ }
+ label.setFont(FontManager.getDefaultLabelFont());
+ coverageEditor.getToolkit().adapt(label, false, false);
+ label.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
+ }
+ } catch (OseeCoreException ex1) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex1);
+ }
+
+ // show branch name
try {
label = new Label(branchComp, SWT.NONE);
label.setText(Strings.truncate(coverageEditor.getBranch().getName(), 200, true));
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorOverviewTab.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorOverviewTab.java
index 477c6a0124..4830f88ba6 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorOverviewTab.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorOverviewTab.java
@@ -31,12 +31,12 @@ import org.eclipse.osee.framework.ui.skynet.action.browser.BrowserPrintAction;
import org.eclipse.osee.framework.ui.skynet.action.browser.IBrowserActionHandler;
import org.eclipse.osee.framework.ui.skynet.results.XResultData;
import org.eclipse.osee.framework.ui.skynet.results.html.XResultsComposite;
-import org.eclipse.osee.framework.ui.swt.ALayout;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
@@ -69,10 +69,12 @@ public class CoverageEditorOverviewTab extends FormPage implements IRefreshActio
scrolledForm.setText(coveragePackageBase.getName());
scrolledForm.setImage(ImageManager.getImage(CoverageUtil.getCoveragePackageBaseImage(coveragePackageBase)));
- scrolledForm.getBody().setLayout(ALayout.getZeroMarginLayout());
createToolBar();
Composite composite = scrolledForm.getBody();
composite.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+ composite.setLayout(new GridLayout(1, true));
+
+ CoverageEditorCoverageTab.createBranchLabel(coverageEditor, composite);
xResultsComp = new XResultsComposite(composite, SWT.NONE);
xResultsComp.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParametersComposite.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParametersComposite.java
index 80340aca13..92148ba56f 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParametersComposite.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/params/CoverageParametersComposite.java
@@ -77,7 +77,9 @@ public class CoverageParametersComposite extends Composite {
@Override
public void widgetSelected(SelectionEvent e) {
try {
- getAssigeeCombo().clear();
+ if (getAssigeeCombo() != null) {
+ getAssigeeCombo().clear();
+ }
getNotesXText().set("");
getNameXText().set("");
getWorkProductTasksXText().set("");
@@ -100,17 +102,19 @@ public class CoverageParametersComposite extends Composite {
page = new WorkPage(getWidgetXml(), new DefaultXWidgetOptionResolver());
page.createBody(managedForm, paramComp, null, null, true);
- getAssigeeCombo().addXModifiedListener(new XModifiedListener() {
+ if (getAssigeeCombo() != null) {
+ getAssigeeCombo().addXModifiedListener(new XModifiedListener() {
- @Override
- public void widgetModified(XWidget widget) {
- try {
- coverageParameters.setAssignee(getAssignee());
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ @Override
+ public void widgetModified(XWidget widget) {
+ try {
+ coverageParameters.setAssignee(getAssignee());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
}
- }
- });
+ });
+ }
getNotesXText().addXModifiedListener(new XModifiedListener() {
@Override
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackageBase.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackageBase.java
index 9a9034cf8a..00b7cd6995 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackageBase.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackageBase.java
@@ -34,6 +34,7 @@ public abstract class CoveragePackageBase extends NamedIdentity implements ICove
boolean editable = true;
protected final CoverageOptionManager coverageOptionManager;
protected ICoverageUnitFileContentsProvider coverageUnitFileContentsProvider;
+ private String editableReason;
public CoveragePackageBase(String guid, String name, CoverageOptionManager coverageOptionManager) {
super(guid, name);
@@ -215,13 +216,14 @@ public abstract class CoveragePackageBase extends NamedIdentity implements ICove
@Override
public Result isEditable() {
if (!editable) {
- return new Result("CoveragePackage locked for edits.");
+ return new Result(editableReason);
}
return Result.TrueResult;
}
- public void setEditable(boolean editable) {
+ public void setEditable(boolean editable, String editableReason) {
this.editable = editable;
+ this.editableReason = editableReason;
}
@Override
@@ -293,4 +295,9 @@ public abstract class CoveragePackageBase extends NamedIdentity implements ICove
public CoverageUnit createCoverageUnit(ICoverage parent, String name, String location) {
return new CoverageUnit(parent, name, location, coverageUnitFileContentsProvider);
}
+
+ public String getEditableReason() {
+ return editableReason;
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoveragePackageStore.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoveragePackageStore.java
index cd36419caf..78633ba439 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoveragePackageStore.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoveragePackageStore.java
@@ -30,8 +30,10 @@ import org.eclipse.osee.coverage.model.ICoverageItemProvider;
import org.eclipse.osee.coverage.model.ICoverageUnitProvider;
import org.eclipse.osee.coverage.model.IWorkProductRelatable;
import org.eclipse.osee.coverage.util.ISaveable;
+import org.eclipse.osee.framework.access.AccessControlManager;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
@@ -85,7 +87,16 @@ public class OseeCoveragePackageStore extends OseeCoverageStore implements ISave
private void load(CoverageOptionManager coverageOptionManager) throws OseeCoreException {
coveragePackage.clearCoverageUnits();
if (artifact != null) {
- coveragePackage.setEditable(artifact.getSoleAttributeValue(CoreAttributeTypes.Active, true));
+ boolean editable = true;
+ String editableReason = "";
+ if (artifact.getSoleAttributeValue(CoreAttributeTypes.Active, true) == false) {
+ editable = false;
+ editableReason = "Coverage Package has been locked for edit.";
+ } else if (!AccessControlManager.hasPermission(artifact, PermissionEnum.WRITE)) {
+ editable = false;
+ editableReason = "Coverage Package artifact permissions do not allow write.";
+ }
+ coveragePackage.setEditable(editable, editableReason);
for (Artifact childArt : artifact.getChildren()) {
if (childArt.isOfType(CoverageArtifactTypes.CoverageUnit, CoverageArtifactTypes.CoverageFolder)) {
coveragePackage.addCoverageUnit(OseeCoverageUnitStore.get(coveragePackage, childArt,

Back to the top