Skip to content

Commit

Permalink
Merge pull request #285 from JieD/master
Browse files Browse the repository at this point in the history
[Platform] No login dialog window shown if only one user ID exists in DB & [Menu] Change “Revert to Committed” to “Revert to Saved"
  • Loading branch information
VWoeltjen committed Apr 22, 2014
2 parents d0c040d + aa8df05 commit 287a458
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public CenterPaneRevertToCommitted() {
super(TEXT);
}

private static String TEXT = "Revert to Committed";
private static String TEXT = "Revert to Saved";
private ActionContext actionContext;
private MCTHousingViewManifestation housingManifestation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

@SuppressWarnings("serial")
public class InspectorPaneRevertToCommitted extends ContextAwareAction {
private static final String TEXT = "Revert to Committed";
private static final String TEXT = "Revert to Saved";

public InspectorPaneRevertToCommitted() {
super(TEXT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ private void ensureInitialized() {

if (username == null && persistence != null && windowing != null) {
Object[] users = persistence.getAllUsers().toArray();
if (users.length > 0) {
if (users.length > 1) {
Arrays.sort(users);
username = (String) windowing.showInputDialog(bundle.getString("TITLE"), bundle.getString("QUESTION"), users, users[0], null); //NOI18N
} else if (users.length == 1) {
username = users[0].toString();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ view.modified.alert.abort=Discard
view.modified.alert.discard=Discard
view.modified.alert.cancel=Cancel
view.modified.status.bar.text=*MODIFIED*
view.modified.status.bar.tooltip.text=To see the modified object, use the Revert to Committed menu item
view.modified.status.bar.tooltip.text=To see the modified object, use the Revert to Saved menu item



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ public void testNoDialogForNoUsers() {
Mockito.verify(mockWindowing, Mockito.never()).showInputDialog(Mockito.anyString(), Mockito.anyString(), Mockito.<Object[]>any(), Mockito.any(), Mockito.<Map<String,Object>>any());
}

@Test
public void testNoDialogForOneUsers() {
// No input dialog should be shown if there are 1 user in the DB
Set<String> oneElementSet = new HashSet<String>();
oneElementSet.add("testUser1");
Mockito.when(mockPersistence.getAllUsers()).thenReturn(oneElementSet);
new DefaultIdentityManager(mockProperties).getCurrentUser();
Mockito.verify(mockWindowing, Mockito.never()).showInputDialog(Mockito.anyString(), Mockito.anyString(), Mockito.<Object[]>any(), Mockito.any(), Mockito.<Map<String,Object>>any());
}

@Test
public void testDialogForUsers() {
// If multiple users are present, input dialog should be shown
Expand Down

0 comments on commit 287a458

Please sign in to comment.