Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2018-09-27 19:06:39 +0000
committerDonald Dunne2018-10-15 23:10:34 +0000
commit38807b632178a64d57b465e430d3f5ece59868a4 (patch)
tree4e333449a171d9f19f3ab23f7a6585dad5a703e6
parenta02be67f14551848e4c1fd471fd0d5a74754cbc3 (diff)
downloadorg.eclipse.osee-38807b632178a64d57b465e430d3f5ece59868a4.tar.gz
org.eclipse.osee-38807b632178a64d57b465e430d3f5ece59868a4.tar.xz
org.eclipse.osee-38807b632178a64d57b465e430d3f5ece59868a4.zip
bug: Reload user artifact before saving settings
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonFavorites.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java6
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeUiEarlyStartup.java58
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ToggleFavoriteBranchHandler.java9
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/actions/SetAsFavoriteAction.java2
6 files changed, 45 insertions, 34 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
index ed494e4b9b4..be8020a4eee 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
@@ -289,6 +289,8 @@ public class XWorkingBranch extends GenericXWidget implements IArtifactWidget, I
try {
User user = AtsClientService.get().getUserServiceClient().getOseeUser(
AtsClientService.get().getUserService().getCurrentUser());
+ // Make sure we have latest artifact
+ user.reloadAttributesAndRelations();
if (user.isSystemUser()) {
AWorkbench.popup("Can't set preference as System User = " + user);
return;
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonFavorites.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonFavorites.java
index f3c7cb323b9..ca128c46303 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonFavorites.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonFavorites.java
@@ -58,6 +58,8 @@ public class XWorkingBranchButtonFavorites extends XWorkingBranchButtonAbstract
try {
User user = AtsClientService.get().getUserServiceClient().getOseeUser(
AtsClientService.get().getUserService().getCurrentUser());
+ // Make sure we have latest artifact
+ user.reloadAttributesAndRelations();
if (user.isSystemUser()) {
AWorkbench.popup("Can't set preference as System User = " + user);
return;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
index 1044ea18bef..913bbf1576d 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
@@ -659,7 +659,7 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, A
if (soleAttributes.isEmpty()) {
if (!isAttributeTypeValid(attributeType)) {
throw new OseeArgumentException(
- "The attribute type %s is not valid for artifacts of type [%s] on artifact [%s] on branch [%s]",
+ "The attribute type %s is not valid for artifacts of type [%s] on artifact %s on branch [%s]",
attributeType, getArtifactTypeName(), toStringWithId(), getBranch());
}
throw new AttributeDoesNotExist("Attribute of type [%s] could not be found on artifact [%s] on branch [%s]",
@@ -709,7 +709,7 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, A
return value;
} else if (soleAttributes.size() > 1) {
throw new MultipleAttributesExist(
- "Attribute [%s] must have exactly one instance. It currently has %d for artifact [%s] on branch [%s]",
+ "Attribute [%s] must have exactly one instance. It currently has %d for artifact %s on branch [%s]",
attributeType, soleAttributes.size(), toStringWithId(), getBranch());
} else {
return defaultReturnValue;
@@ -764,7 +764,7 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, A
return value;
} else if (soleAttributes.size() > 1) {
throw new MultipleAttributesExist(
- "Attribute [%s] must have exactly one instance. It currently has %d for artifact [%s] on branch [%s]",
+ "Attribute [%s] must have exactly one instance. It currently has %d for artifact %s on branch [%s]",
attributeType, soleAttributes.size(), toStringWithId(), getBranch());
} else {
return defaultReturnValue;
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeUiEarlyStartup.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeUiEarlyStartup.java
index b55660bea35..fec8ec6361c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeUiEarlyStartup.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeUiEarlyStartup.java
@@ -62,6 +62,8 @@ public class OseeUiEarlyStartup implements IStartup {
public boolean preShutdown(IWorkbench workbench, boolean forced) {
if (!DbUtil.isDbInit()) {
try {
+ // Make sure we have latest artifact
+ UserManager.getUser().reloadAttributesAndRelations();
UserManager.getUser().saveSettings();
} catch (Throwable th) {
th.printStackTrace();
@@ -77,44 +79,44 @@ public class OseeUiEarlyStartup implements IStartup {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().addPartListener(
new IPartListener() {
- @Override
- public void partActivated(IWorkbenchPart part) {
- // WorkspaceContributionItem.addToAllViews();
- if (part instanceof ViewPart) {
- WorkspaceContributionItem.addToViewpart((ViewPart) part);
+ @Override
+ public void partActivated(IWorkbenchPart part) {
+ // WorkspaceContributionItem.addToAllViews();
+ if (part instanceof ViewPart) {
+ WorkspaceContributionItem.addToViewpart((ViewPart) part);
+ }
+
}
- }
+ @Override
+ public void partBroughtToTop(IWorkbenchPart part) {
+ // WorkspaceContributionItem.addToAllViews();
+ if (part instanceof ViewPart) {
+ WorkspaceContributionItem.addToViewpart((ViewPart) part);
+ }
- @Override
- public void partBroughtToTop(IWorkbenchPart part) {
- // WorkspaceContributionItem.addToAllViews();
- if (part instanceof ViewPart) {
- WorkspaceContributionItem.addToViewpart((ViewPart) part);
}
- }
+ @Override
+ public void partClosed(IWorkbenchPart part) {
+ // do nothing
+ }
- @Override
- public void partClosed(IWorkbenchPart part) {
- // do nothing
- }
+ @Override
+ public void partDeactivated(IWorkbenchPart part) {
+ // do nothing
+ }
- @Override
- public void partDeactivated(IWorkbenchPart part) {
- // do nothing
- }
+ @Override
+ public void partOpened(IWorkbenchPart part) {
+ // WorkspaceContributionItem.addToAllViews();
+ if (part instanceof ViewPart) {
+ WorkspaceContributionItem.addToViewpart((ViewPart) part);
+ }
- @Override
- public void partOpened(IWorkbenchPart part) {
- // WorkspaceContributionItem.addToAllViews();
- if (part instanceof ViewPart) {
- WorkspaceContributionItem.addToViewpart((ViewPart) part);
}
- }
-
- });
+ });
PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(new IPerspectiveListener() {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ToggleFavoriteBranchHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ToggleFavoriteBranchHandler.java
index d1d96ea9fa4..5603d0f8369 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ToggleFavoriteBranchHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ToggleFavoriteBranchHandler.java
@@ -15,6 +15,7 @@ import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.User;
import org.eclipse.osee.framework.skynet.core.UserManager;
import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.framework.skynet.core.event.model.BranchEvent;
@@ -33,9 +34,11 @@ public class ToggleFavoriteBranchHandler extends CommandHandler {
public Object executeWithException(ExecutionEvent event, IStructuredSelection selection) throws OseeCoreException {
BranchId selectedBranch = Handlers.getBranchesFromStructuredSelection(selection).iterator().next();
- UserManager.getUser().toggleFavoriteBranch(selectedBranch);
- OseeEventManager.kickBranchEvent(this,
- new BranchEvent(BranchEventType.FavoritesUpdated, selectedBranch));
+ User user = UserManager.getUser();
+ // Make sure we have latest artifact
+ user.reloadAttributesAndRelations();
+ user.toggleFavoriteBranch(selectedBranch);
+ OseeEventManager.kickBranchEvent(this, new BranchEvent(BranchEventType.FavoritesUpdated, selectedBranch));
return null;
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/actions/SetAsFavoriteAction.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/actions/SetAsFavoriteAction.java
index 651bcf0a7a0..110f4f3c288 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/actions/SetAsFavoriteAction.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/actions/SetAsFavoriteAction.java
@@ -60,6 +60,8 @@ public class SetAsFavoriteAction extends Action {
}
if (MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Toggle Branch Favorites",
"Toggle Branch Favorites for " + branches.size() + " branch(s)")) {
+ // Make sure we have latest artifact
+ user.reloadAttributesAndRelations();
for (BranchId branch : branches) {
user.toggleFavoriteBranch(branch);
}

Back to the top