summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwilk2011-01-10 13:33:38 (EST)
committer Ryan D. Brooks2011-01-10 13:33:38 (EST)
commit65da98278455193b5f4dfd5664371015e3e48c44 (patch)
treef36d80c7f4c920806f15a5cfb0a9d17a54fd47c2
parentcdb97a11fbe5f61b6ff75c154b64cb630088804c (diff)
downloadorg.eclipse.osee-65da98278455193b5f4dfd5664371015e3e48c44.zip
org.eclipse.osee-65da98278455193b5f4dfd5664371015e3e48c44.tar.gz
org.eclipse.osee-65da98278455193b5f4dfd5664371015e3e48c44.tar.bz2
feature[bgz_332807]: Support multiple delete and purge options for branches in Branch Manager view
-rw-r--r--plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java2
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Strings.java24
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/SystemGroup.java8
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java25
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectionDialog.java37
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/DeleteBranchHandler.java42
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/FlatPresentationHandler.java7
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/GeneralBranchHandler.java90
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/HierarchicalPresentationHandler.java6
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/PurgeBranchHandler.java43
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/PurgeTransactionHandler.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowArchivedBranchHandler.java7
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowFavoriteBranchesFirstHandler.java7
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowMergeBranchPresentationHandler.java7
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowTransactionPresentationHandler.java7
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitHandler.java6
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptions.java23
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptionsEnum.java40
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java82
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewPresentationPreferences.java105
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/NullBranchViewPresentationPreferences.java174
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchContentProvider.java15
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java107
23 files changed, 509 insertions, 357 deletions
diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java
index eab16a6..a2079e5 100644
--- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java
+++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/purge/PurgeBranchOperation.java
@@ -120,4 +120,4 @@ public class PurgeBranchOperation extends AbstractDbTxOperation {
monitor.worked(calculateWork(percentage));
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Strings.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Strings.java
index d55e2db..1486cae 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Strings.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Strings.java
@@ -11,6 +11,8 @@
package org.eclipse.osee.framework.jdk.core.util;
+import java.util.List;
+
/**
* @author Jeff C. Phillips
* @author Don Dunne
@@ -94,4 +96,26 @@ public class Strings {
return toReturn;
}
+ /**
+ * @return string of form "apple, banana and orange" or "apple and banana" depending on size of list
+ */
+ public static String buildItemizedStatment(List<?> items) {
+ StringBuilder niceList = new StringBuilder();
+ if (items.size() >= 2) {
+ int andIndex = items.size() - 2;
+ for (int branchIndex = 0; branchIndex < items.size(); branchIndex++) {
+ niceList.append(items.get(branchIndex));
+ if (branchIndex == andIndex) {
+ niceList.append(" and ");
+ } else if (branchIndex < andIndex) {
+ niceList.append(", ");
+ }
+ }
+ } else {
+ if (!items.isEmpty()) {
+ niceList.append(items.get(0));
+ }
+ }
+ return niceList.toString();
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/SystemGroup.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/SystemGroup.java
index a7d3129..5a206ca 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/SystemGroup.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/SystemGroup.java
@@ -24,7 +24,7 @@ public enum SystemGroup {
private final OseeGroup group;
SystemGroup() {
- this.group = new OseeGroup(this.name());
+ group = new OseeGroup(name());
}
public Artifact getArtifact() throws OseeCoreException {
@@ -32,14 +32,14 @@ public enum SystemGroup {
}
public void addMember(User user) throws OseeCoreException {
- this.group.addMember(user);
+ group.addMember(user);
}
public boolean isMember(User user) throws OseeCoreException {
- return this.group.isMember(user);
+ return group.isMember(user);
}
public boolean isCurrentUserMember() throws OseeCoreException {
- return this.group.isCurrentUserMember();
+ return group.isCurrentUserMember();
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
index 824f058..ce51cfc 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
@@ -37,6 +37,7 @@ import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.cache.BranchFilter;
import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact;
+import org.eclipse.osee.framework.core.operation.CompositeOperation;
import org.eclipse.osee.framework.core.operation.IOperation;
import org.eclipse.osee.framework.core.operation.Operations;
import org.eclipse.osee.framework.core.util.Conditions;
@@ -225,6 +226,18 @@ public class BranchManager {
Operations.executeWorkAndCheckStatus(new PurgeBranchHttpRequestOperation(branch));
}
+ /**
+ * Purges branches from the system. (sets branch state to purged. operation is undo-able)
+ */
+ public static Job purgeBranch(final List<Branch> branches) {
+ List<IOperation> ops = new ArrayList<IOperation>();
+ for (Branch branch : branches) {
+ ops.add(new PurgeBranchHttpRequestOperation(branch)); //can this be done in one http request?
+ }
+ return Operations.executeAsJob(new CompositeOperation("Purging multiple branches...", Activator.PLUGIN_ID, ops),
+ true);
+ }
+
public static void updateBranchType(IProgressMonitor monitor, final int branchId, String branchGuid, final BranchType type) throws OseeCoreException {
IOperation operation = new UpdateBranchTypeHttpRequestOperation(branchId, branchGuid, type);
Operations.executeWorkAndCheckStatus(operation, monitor);
@@ -249,6 +262,18 @@ public class BranchManager {
}
/**
+ * Delete branches from the system. (sets branch state to deleted. operation is undo-able)
+ */
+ public static Job deleteBranch(final List<Branch> branches) {
+ List<IOperation> ops = new ArrayList<IOperation>();
+ for (Branch branch : branches) {
+ ops.add(new DeleteBranchOperation(branch));
+ }
+ return Operations.executeAsJob(new CompositeOperation("Deleting multiple branches...", Activator.PLUGIN_ID, ops),
+ true);
+ }
+
+ /**
* Commit the net changes from the source branch into the destination branch. If there are conflicts between the two
* branches, the source branch changes will override those on the destination branch.
*/
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectionDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectionDialog.java
index 78aa288..2706f10 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectionDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectionDialog.java
@@ -16,9 +16,10 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchOptions;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchOptionsEnum;
import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.XBranchWidget;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.swt.SWT;
@@ -32,6 +33,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
/**
@@ -44,19 +46,19 @@ public class BranchSelectionDialog extends MessageDialog {
private boolean allowOnlyWorkingBranches;
private final Collection<Branch> branches;
+ public BranchSelectionDialog(String title, boolean allowOnlyWorkingBranches) {
+ this(title, null);
+ this.allowOnlyWorkingBranches = allowOnlyWorkingBranches;
+ }
+
public BranchSelectionDialog(String title, Collection<Branch> branches) {
super(Displays.getActiveShell(), title, null, null, MessageDialog.NONE, new String[] {"Ok", "Cancel"}, 0);
- this.allowOnlyWorkingBranches = false;
- this.selected = null;
+ allowOnlyWorkingBranches = false;
+ selected = null;
this.branches = branches;
setShellStyle(getShellStyle() | SWT.RESIZE);
}
- public BranchSelectionDialog(String title, boolean allowOnlyWorkingBranches) {
- this(title, null);
- this.allowOnlyWorkingBranches = allowOnlyWorkingBranches;
- }
-
public Branch getSelection() {
return selected;
}
@@ -66,16 +68,16 @@ public class BranchSelectionDialog extends MessageDialog {
branchWidget = new XBranchWidget(true, true);
branchWidget.setDisplayLabel(false);
branchWidget.createWidgets(container, 1);
- branchWidget.setBranchOptions(BranchOptions.FAVORITES_FIRST, BranchOptions.FLAT);
- branchWidget.setShowWorkingBranchesOnly(allowOnlyWorkingBranches);
- branchWidget.getXViewer().getFilterDataUI().addFilterTextListener(new KeyListener() {
+ branchWidget.setBranchOptions(true, BranchOptionsEnum.FAVORITE_KEY, BranchOptionsEnum.FLAT_KEY);
+ branchWidget.setBranchOptions(allowOnlyWorkingBranches, BranchOptionsEnum.SHOW_WORKING_BRANCHES_ONLY);
+ final XViewer viewer = branchWidget.getXViewer();
+ viewer.getFilterDataUI().addFilterTextListener(new KeyListener() {
@Override
public void keyReleased(KeyEvent e) {
- Collection<TreeItem> visibleItems = branchWidget.getXViewer().getVisibleItems();
+ Collection<TreeItem> visibleItems = viewer.getVisibleItems();
if (visibleItems.size() == 1) {
- branchWidget.getXViewer().setSelection(
- new StructuredSelection(new Object[] {visibleItems.iterator().next().getData()}));
+ viewer.setSelection(new StructuredSelection(new Object[] {visibleItems.iterator().next().getData()}));
getButton(IDialogConstants.OK_ID).setEnabled(true);
storeSelectedBranch();
}
@@ -95,14 +97,15 @@ public class BranchSelectionDialog extends MessageDialog {
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = 500;
gd.widthHint = 800;
- branchWidget.getXViewer().getTree().setLayoutData(gd);
- branchWidget.getXViewer().getTree().addListener(SWT.MouseDoubleClick, new Listener() {
+ Tree viewersTree = viewer.getTree();
+ viewersTree.setLayoutData(gd);
+ viewersTree.addListener(SWT.MouseDoubleClick, new Listener() {
@Override
public void handleEvent(Event event) {
handleDoubleClick();
}
});
- branchWidget.getXViewer().getTree().addSelectionListener(new SelectionAdapter() {
+ viewersTree.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getButton(IDialogConstants.OK_ID).setEnabled(true);
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/DeleteBranchHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/DeleteBranchHandler.java
index 1bc3cb8..5ad21ef 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/DeleteBranchHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/DeleteBranchHandler.java
@@ -10,46 +10,14 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch;
-import java.util.List;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-import org.eclipse.osee.framework.ui.swt.Displays;
/**
+ * @author Karol M. Wilk
* @author Roberto E. Escobar
*/
-public class DeleteBranchHandler extends CommandHandler {
+public final class DeleteBranchHandler extends GeneralBranchHandler {
- @Override
- public Object executeWithException(ExecutionEvent event) {
- IStructuredSelection selection =
- (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
- Branch selectedBranch = Handlers.getBranchesFromStructuredSelection(selection).iterator().next();
-
- MessageDialog dialog =
- new MessageDialog(Displays.getActiveShell(), "Delete Branch", null,
- "Are you sure you want to delete the branch: " + selectedBranch.getName(), MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 1);
-
- if (dialog.open() == 0) {
- BranchManager.deleteBranch(selectedBranch);
- }
-
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
- return branches.size() == 1 && AccessControlManager.isOseeAdmin();
+ public DeleteBranchHandler() {
+ super(OpTypeEnum.DELETE);
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/FlatPresentationHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/FlatPresentationHandler.java
index b5fbda0..2552043 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/FlatPresentationHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/FlatPresentationHandler.java
@@ -16,8 +16,8 @@ import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchOptionsEnum;
import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchViewPresentationPreferences;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementUpdater;
@@ -38,7 +38,7 @@ public class FlatPresentationHandler extends AbstractHandler implements IElement
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- ((BranchView) HandlerUtil.getActivePartChecked(event)).changeBranchPresentation(true);
+ ((BranchView) HandlerUtil.getActivePartChecked(event)).changePresentation(BranchOptionsEnum.FLAT_KEY, true);
return null;
}
@@ -46,13 +46,12 @@ public class FlatPresentationHandler extends AbstractHandler implements IElement
@Override
public void updateElement(UIElement element, Map parameters) {
element.setChecked(Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(
- BranchView.VIEW_ID).getBoolean(BranchViewPresentationPreferences.FLAT_KEY, true));
+ BranchView.VIEW_ID).getBoolean(BranchOptionsEnum.FLAT_KEY.origKeyName, true));
}
@Override
public boolean isEnabled() {
service.refreshElements(COMMAND_ID, null);
-
return true;
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/GeneralBranchHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/GeneralBranchHandler.java
new file mode 100644
index 0000000..3ecacc7
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/GeneralBranchHandler.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.framework.ui.skynet.commandHandlers.branch;
+
+import java.util.List;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Karol M. Wilk
+ */
+public class GeneralBranchHandler extends CommandHandler {
+ public enum OpTypeEnum {
+ DELETE("delete", "Delete Branch"),
+ PURGE("purge", "Purge Branch");
+
+ private final String dialogType;
+ private final String dialogTitle;
+
+ private OpTypeEnum(String type, String title) {
+ dialogType = type;
+ dialogTitle = type;
+ }
+ };
+ private final OpTypeEnum type;
+
+ public GeneralBranchHandler(OpTypeEnum type) {
+ this.type = type;
+ }
+
+ @Override
+ public Object executeWithException(ExecutionEvent arg0) {
+ IStructuredSelection selections =
+ (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
+
+ List<Branch> selectedBranches = Handlers.getBranchesFromStructuredSelection(selections);
+
+ MessageDialog dialog =
+ new MessageDialog(Displays.getActiveShell(), type.dialogTitle, null, buildDialogMessage(selectedBranches,
+ type.dialogType), MessageDialog.QUESTION, new String[] {
+ IDialogConstants.YES_LABEL,
+ IDialogConstants.NO_LABEL}, 1);
+
+ if (dialog.open() == 0) {
+ switch (type) {
+ case DELETE:
+ BranchManager.deleteBranch(selectedBranches);
+ break;
+ case PURGE:
+ BranchManager.purgeBranch(selectedBranches);
+ break;
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
+ return branches.size() > 0 && AccessControlManager.isOseeAdmin();
+ }
+
+ private String buildDialogMessage(List<Branch> selectedBranches, String actionDesc) {
+ StringBuilder branchesStatement = new StringBuilder();
+ branchesStatement.append(String.format("Are you sure you want to %s branch(es): ", actionDesc));
+ branchesStatement.append(Strings.buildItemizedStatment(selectedBranches));
+ branchesStatement.append(" \u003F");
+ return branchesStatement.toString();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/HierarchicalPresentationHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/HierarchicalPresentationHandler.java
index bc18398..087a9eb 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/HierarchicalPresentationHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/HierarchicalPresentationHandler.java
@@ -16,8 +16,8 @@ import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchOptionsEnum;
import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchViewPresentationPreferences;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementUpdater;
@@ -39,7 +39,7 @@ public final class HierarchicalPresentationHandler extends AbstractHandler imple
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- ((BranchView) HandlerUtil.getActivePartChecked(event)).changeBranchPresentation(false);
+ ((BranchView) HandlerUtil.getActivePartChecked(event)).changePresentation(BranchOptionsEnum.FLAT_KEY, false);
return null;
}
@@ -47,7 +47,7 @@ public final class HierarchicalPresentationHandler extends AbstractHandler imple
@Override
public void updateElement(UIElement element, Map parameters) {
element.setChecked(!Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(
- BranchView.VIEW_ID).getBoolean(BranchViewPresentationPreferences.FLAT_KEY, true));
+ BranchView.VIEW_ID).getBoolean(BranchOptionsEnum.FLAT_KEY.origKeyName, true));
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/PurgeBranchHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/PurgeBranchHandler.java
index fe49bb4..64403ba 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/PurgeBranchHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/PurgeBranchHandler.java
@@ -10,47 +10,14 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch;
-import java.util.List;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.skynet.core.httpRequests.PurgeBranchHttpRequestOperation;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-import org.eclipse.osee.framework.ui.swt.Displays;
/**
+ * @author Karol M. Wilk
* @author Jeff C. Phillips
*/
-public class PurgeBranchHandler extends CommandHandler {
+public final class PurgeBranchHandler extends GeneralBranchHandler {
- @Override
- public Object executeWithException(ExecutionEvent event) {
- IStructuredSelection selection =
- (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
- Branch selectedBranch = Handlers.getBranchesFromStructuredSelection(selection).iterator().next();
-
- MessageDialog dialog =
- new MessageDialog(Displays.getActiveShell(), "Purge Branch", null,
- "Are you sure you want to purge the branch: " + selectedBranch.getName(), MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 1);
-
- if (dialog.open() == 0) {
- Operations.executeAsJob(new PurgeBranchHttpRequestOperation(selectedBranch), true);
- }
-
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
- return branches.size() == 1 && AccessControlManager.isOseeAdmin();
+ public PurgeBranchHandler() {
+ super(OpTypeEnum.PURGE);
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/PurgeTransactionHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/PurgeTransactionHandler.java
index 3a3b924..c98e9ef 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/PurgeTransactionHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/PurgeTransactionHandler.java
@@ -71,6 +71,6 @@ public class PurgeTransactionHandler extends CommandHandler {
@Override
public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
List<TransactionRecord> transactions = Handlers.getTransactionsFromStructuredSelection(structuredSelection);
- return transactions.size() == 1 && AccessControlManager.isOseeAdmin();
+ return transactions.size() > 0 && AccessControlManager.isOseeAdmin();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowArchivedBranchHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowArchivedBranchHandler.java
index a04383e..0b04d3c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowArchivedBranchHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowArchivedBranchHandler.java
@@ -22,8 +22,8 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.utility.DbUtil;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchOptionsEnum;
import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchViewPresentationPreferences;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementUpdater;
@@ -46,7 +46,8 @@ public class ShowArchivedBranchHandler extends AbstractHandler implements IEleme
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- ((BranchView) HandlerUtil.getActivePartChecked(event)).changeArchivedBranchPresentation(!itemChk);
+ ((BranchView) HandlerUtil.getActivePartChecked(event)).changePresentation(
+ BranchOptionsEnum.SHOW_ARCHIVED_BRANCHES, !itemChk);
return null;
}
@@ -55,7 +56,7 @@ public class ShowArchivedBranchHandler extends AbstractHandler implements IEleme
public void updateElement(UIElement element, Map parameters) {
itemChk =
Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(BranchView.VIEW_ID).getBoolean(
- BranchViewPresentationPreferences.SHOW_ARCHIVED_BRANCHES, false);
+ BranchOptionsEnum.SHOW_ARCHIVED_BRANCHES.origKeyName, false);
element.setChecked(itemChk);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowFavoriteBranchesFirstHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowFavoriteBranchesFirstHandler.java
index 99f49a3..cdf7520 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowFavoriteBranchesFirstHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowFavoriteBranchesFirstHandler.java
@@ -16,8 +16,8 @@ import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchOptionsEnum;
import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchViewPresentationPreferences;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementUpdater;
@@ -40,7 +40,8 @@ public class ShowFavoriteBranchesFirstHandler extends AbstractHandler implements
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- ((BranchView) HandlerUtil.getActivePartChecked(event)).changeFavoritesFirstPresentation(!itemChk);
+ ((BranchView) HandlerUtil.getActivePartChecked(event)).changePresentation(BranchOptionsEnum.FAVORITE_KEY,
+ !itemChk);
return null;
}
@@ -49,7 +50,7 @@ public class ShowFavoriteBranchesFirstHandler extends AbstractHandler implements
public void updateElement(UIElement element, Map parameters) {
itemChk =
Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(BranchView.VIEW_ID).getBoolean(
- BranchViewPresentationPreferences.FAVORITE_KEY, false);
+ BranchOptionsEnum.FAVORITE_KEY.origKeyName, false);
element.setChecked(itemChk);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowMergeBranchPresentationHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowMergeBranchPresentationHandler.java
index f264f40..7e0920f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowMergeBranchPresentationHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowMergeBranchPresentationHandler.java
@@ -22,8 +22,8 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.utility.DbUtil;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchOptionsEnum;
import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchViewPresentationPreferences;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementUpdater;
@@ -45,7 +45,8 @@ public final class ShowMergeBranchPresentationHandler extends AbstractHandler im
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- ((BranchView) HandlerUtil.getActivePartChecked(event)).changeMergeBranchPresentation(!itemChk);
+ ((BranchView) HandlerUtil.getActivePartChecked(event)).changePresentation(BranchOptionsEnum.SHOW_MERGE_BRANCHES,
+ !itemChk);
return null;
}
@@ -54,7 +55,7 @@ public final class ShowMergeBranchPresentationHandler extends AbstractHandler im
public void updateElement(UIElement element, Map parameters) {
itemChk =
Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(BranchView.VIEW_ID).getBoolean(
- BranchViewPresentationPreferences.SHOW_MERGE_BRANCHES, false);
+ BranchOptionsEnum.SHOW_MERGE_BRANCHES.origKeyName, false);
element.setChecked(itemChk);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowTransactionPresentationHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowTransactionPresentationHandler.java
index 4ed9c29..1b86aad 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowTransactionPresentationHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ShowTransactionPresentationHandler.java
@@ -16,8 +16,8 @@ import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchOptionsEnum;
import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchViewPresentationPreferences;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementUpdater;
@@ -39,7 +39,8 @@ public final class ShowTransactionPresentationHandler extends AbstractHandler im
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- ((BranchView) HandlerUtil.getActivePartChecked(event)).changeTransactionPresentation(!itemChk);
+ ((BranchView) HandlerUtil.getActivePartChecked(event)).changePresentation(BranchOptionsEnum.SHOW_TRANSACTIONS,
+ !itemChk);
return null;
}
@@ -48,7 +49,7 @@ public final class ShowTransactionPresentationHandler extends AbstractHandler im
public void updateElement(UIElement element, Map parameters) {
itemChk =
Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(BranchView.VIEW_ID).getBoolean(
- BranchViewPresentationPreferences.SHOW_TRANSACTIONS, true);
+ BranchOptionsEnum.SHOW_TRANSACTIONS.origKeyName, true);
element.setChecked(itemChk);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitHandler.java
index ef8c73c..d51c9d1 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitHandler.java
@@ -32,7 +32,7 @@ import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchViewPresentationPreferences;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchOptionsEnum;
import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeView;
import org.eclipse.osee.framework.ui.swt.Displays;
@@ -142,7 +142,7 @@ public abstract class CommitHandler extends CommandHandler {
destinationBranch = sourceBranch.getParentBranch();
} else {
destinationBranch =
- BranchManager.getBranch(Integer.parseInt(event.getParameter(BranchViewPresentationPreferences.BRANCH_ID)));
+ BranchManager.getBranch(Integer.parseInt(event.getParameter(BranchOptionsEnum.BRANCH_ID.origKeyName)));
}
Jobs.startJob(new CommitJob(sourceBranch, destinationBranch,
Boolean.parseBoolean(event.getParameter(CommitBranchParameter.ARCHIVE_PARENT_BRANCH))));
@@ -185,4 +185,4 @@ public abstract class CommitHandler extends CommandHandler {
return Status.OK_STATUS;
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptions.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptions.java
deleted file mode 100644
index fbb1524..0000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptions.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * 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.framework.ui.skynet.widgets.xBranch;
-
-/**
- * @author Jeff C. Phillips
- */
-public enum BranchOptions {
- FLAT,
- FAVORITES_FIRST,
- SHOW_MERGE_BRANCHES,
- SHOW_TRANSACTIONS,
- SHOW_ARCHIVED,
- SHOW_WORKING_BRANCHES_ONLY
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptionsEnum.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptionsEnum.java
new file mode 100644
index 0000000..4cc2a4d
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptionsEnum.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.framework.ui.skynet.widgets.xBranch;
+
+public enum BranchOptionsEnum {
+ //TODO: get rid of the cap constants and replace with their origKeyNames
+ // then there will be no need for fromInitValue
+ FLAT_KEY("flat"),
+ HIERARCHY_KEY("hierarchy"),
+ FAVORITE_KEY("favorites_first"),
+ SHOW_MERGE_BRANCHES("show_merge_branches"),
+ SHOW_TRANSACTIONS("show_transactions"),
+ SHOW_ARCHIVED_BRANCHES("show_archived_branches"),
+ BRANCH_ID("branchId"),
+ SHOW_WORKING_BRANCHES_ONLY("show_working_branches");
+
+ public String origKeyName;
+
+ private BranchOptionsEnum(String keyName) {
+ origKeyName = keyName;
+ }
+
+ public static BranchOptionsEnum fromInitValue(String initKey) {
+ //at worst O(n^2), but n will always remain small.
+ for (BranchOptionsEnum optEnum : values()) {
+ if (optEnum.origKeyName.equals(initKey)) {
+ return optEnum;
+ }
+ }
+ throw new IllegalArgumentException(String.format("Incorrect BranchOptionEnum value", initKey));
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java
index 566c1a6..7b5b465 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java
@@ -75,7 +75,6 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis
@Override
public void dispose() {
super.dispose();
-
branchViewPresentationPreferences.setDisposed(true);
OseeEventManager.removeListener(this);
clipboard.dispose();
@@ -106,23 +105,25 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis
xBranchWidget.loadData();
final BranchView fBranchView = this;
+ final XViewer branchWidget = xBranchWidget.getXViewer();
+
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
menuManager.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
MenuManager menuManager = (MenuManager) manager;
- xBranchWidget.getXViewer().setColumnMultiEditEnabled(true);
+ branchWidget.setColumnMultiEditEnabled(true);
menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menuManager.add(new EditTransactionComment(fBranchView));
menuManager.add(new Separator());
- menuManager.add(new TableCustomizationAction(xBranchWidget.getXViewer()));
- menuManager.add(new ViewTableReportAction(xBranchWidget.getXViewer()));
- menuManager.add(new ViewSelectedCellDataAction(xBranchWidget.getXViewer(), clipboard, Option.Copy));
- menuManager.add(new ViewSelectedCellDataAction(xBranchWidget.getXViewer(), null, Option.View));
+ menuManager.add(new TableCustomizationAction(branchWidget));
+ menuManager.add(new ViewTableReportAction(branchWidget));
+ menuManager.add(new ViewSelectedCellDataAction(branchWidget, clipboard, Option.Copy));
+ menuManager.add(new ViewSelectedCellDataAction(branchWidget, null, Option.View));
try {
if (AccessControlManager.isOseeAdmin()) {
- menuManager.add(new ColumnMultiEditAction(xBranchWidget.getXViewer()));
+ menuManager.add(new ColumnMultiEditAction(branchWidget));
}
} catch (OseeCoreException ex) {
OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
@@ -131,13 +132,10 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis
});
menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- xBranchWidget.getXViewer().getTree().setMenu(menuManager.createContextMenu(xBranchWidget.getXViewer().getTree()));
- getSite().registerContextMenu(VIEW_ID, menuManager, xBranchWidget.getXViewer());
-
- getSite().setSelectionProvider(xBranchWidget.getXViewer());
-
+ branchWidget.getTree().setMenu(menuManager.createContextMenu(branchWidget.getTree()));
+ getSite().registerContextMenu(VIEW_ID, menuManager, branchWidget);
+ getSite().setSelectionProvider(branchWidget);
HelpUtil.setHelp(parent, OseeHelpContext.BRANCH_MANAGER);
-
OseeStatusContributionItemFactory.addTo(this, true);
getViewSite().getActionBars().updateActionBars();
@@ -195,63 +193,15 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis
}
}
- public void changeBranchPresentation(boolean flat) {
+ public void changePresentation(BranchOptionsEnum branchViewPresKey, boolean state) {
if (branchViewPresentationPreferences != null) {
- branchViewPresentationPreferences.getViewPreference().putBoolean(BranchViewPresentationPreferences.FLAT_KEY,
- flat);
+ Preferences pref = branchViewPresentationPreferences.getViewPreference();
+ pref.putBoolean(branchViewPresKey.origKeyName, state);
}
}
- public void changeTransactionPresentation(boolean showTransactions) {
- if (branchViewPresentationPreferences != null) {
- branchViewPresentationPreferences.getViewPreference().putBoolean(
- BranchViewPresentationPreferences.SHOW_TRANSACTIONS, showTransactions);
- }
- }
-
- public void changeMergeBranchPresentation(boolean showMergeBranches) {
- if (branchViewPresentationPreferences != null) {
- branchViewPresentationPreferences.getViewPreference().putBoolean(
- BranchViewPresentationPreferences.SHOW_MERGE_BRANCHES, showMergeBranches);
- }
- }
-
- public void changeArchivedBranchPresentation(boolean showArchivedBranches) {
- if (branchViewPresentationPreferences != null) {
- branchViewPresentationPreferences.getViewPreference().putBoolean(
- BranchViewPresentationPreferences.SHOW_ARCHIVED_BRANCHES, showArchivedBranches);
- }
- }
-
- public void changeFavoritesFirstPresentation(boolean showArchivedBranches) {
- if (branchViewPresentationPreferences != null) {
- branchViewPresentationPreferences.getViewPreference().putBoolean(
- BranchViewPresentationPreferences.FAVORITE_KEY, showArchivedBranches);
- }
- }
-
- /**
- * These five methods is called by BranchViewPresentationPreferences to change the branch view data presentation. Not
- * part of the regular API.
- */
- protected void setPresentation(boolean flat) {
- xBranchWidget.setPresentation(flat);
- }
-
- protected void setFavoritesFirst(boolean favoritesFirst) {
- xBranchWidget.setFavoritesFirst(favoritesFirst);
- }
-
- protected void setShowMergeBranches(boolean showMergeBranches) {
- xBranchWidget.setShowMergeBranches(showMergeBranches);
- }
-
- protected void setShowTransactions(boolean showTransactions) {
- xBranchWidget.setShowTransactions(showTransactions);
- }
-
- protected void setShowArchivedBranches(boolean showArchivedBranches) {
- xBranchWidget.setShowArchivedBranches(showArchivedBranches);
+ public XBranchWidget getXBranchWidget() {
+ return xBranchWidget;
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewPresentationPreferences.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewPresentationPreferences.java
index 8a9cf1e..08869df 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewPresentationPreferences.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewPresentationPreferences.java
@@ -35,18 +35,19 @@ import org.osgi.service.prefs.Preferences;
* @author Jeff C. Phillips
*/
public class BranchViewPresentationPreferences {
- public static final String FAVORITE_KEY = "favorites_first";
- public static final String SHOW_TRANSACTIONS = "show_transactions";
- public static final String SHOW_MERGE_BRANCHES = "show_merge_branches";
- public static final String SHOW_ARCHIVED_BRANCHES = "show_archived_branches";
- public static final String FLAT_KEY = "flat";
- public static final String BRANCH_ID = "branchId";
-
private final IPreferencesService preferencesService;
private IPreferenceChangeListener preferenceChangeListener;
private final BranchView branchView;
private boolean disposed;
+ private static final String[] listOfCommandIds = {
+ HierarchicalPresentationHandler.COMMAND_ID,
+ FlatPresentationHandler.COMMAND_ID,
+ ShowTransactionPresentationHandler.COMMAND_ID,
+ ShowMergeBranchPresentationHandler.COMMAND_ID,
+ ShowArchivedBranchHandler.COMMAND_ID,
+ ShowFavoriteBranchesFirstHandler.COMMAND_ID};
+
public BranchViewPresentationPreferences(BranchView branchView) {
preferencesService = Platform.getPreferencesService();
preferenceChangeListener = null;
@@ -68,15 +69,17 @@ public class BranchViewPresentationPreferences {
@Override
public void added(NodeChangeEvent event) {
- if (event.getChild().name().equals(BranchView.VIEW_ID)) {
- ((IEclipsePreferences) event.getChild()).addPreferenceChangeListener(singletonPreferenceChangeListener());
+ Preferences child = event.getChild();
+ if (child.name().equals(BranchView.VIEW_ID)) {
+ ((IEclipsePreferences) child).addPreferenceChangeListener(singletonPreferenceChangeListener());
}
}
@Override
public void removed(NodeChangeEvent event) {
- if (event.getChild().name().equals(BranchView.VIEW_ID)) {
- ((IEclipsePreferences) event.getChild()).removePreferenceChangeListener(singletonPreferenceChangeListener());
+ Preferences child = event.getChild();
+ if (child.name().equals(BranchView.VIEW_ID)) {
+ ((IEclipsePreferences) child).removePreferenceChangeListener(singletonPreferenceChangeListener());
}
}
});
@@ -87,31 +90,18 @@ public class BranchViewPresentationPreferences {
private synchronized IPreferenceChangeListener singletonPreferenceChangeListener() {
if (preferenceChangeListener == null) {
preferenceChangeListener = new IPreferenceChangeListener() {
-
@Override
public void preferenceChange(PreferenceChangeEvent event) {
if (disposed) {
((IEclipsePreferences) event.getNode()).removePreferenceChangeListener(this);
} else {
- String propertyName = event.getKey();
+ BranchOptionsEnum presEnum = BranchOptionsEnum.fromInitValue(event.getKey());
refreshCommands();
- if (propertyName.equals(FLAT_KEY)) {
- setPresentation(getViewPreference().getBoolean(FLAT_KEY, true));
- }
- if (propertyName.equals(SHOW_TRANSACTIONS)) {
- setShowTransactions(getViewPreference().getBoolean(SHOW_TRANSACTIONS, true));
- }
- if (propertyName.equals(SHOW_MERGE_BRANCHES)) {
- setShowMergeBranches(getViewPreference().getBoolean(SHOW_MERGE_BRANCHES, true));
- }
- if (propertyName.equals(SHOW_ARCHIVED_BRANCHES)) {
- setShowArchivedBranches(getViewPreference().getBoolean(SHOW_ARCHIVED_BRANCHES, true));
- }
- if (propertyName.equals(FAVORITE_KEY)) {
- setFavoritesFirst(getViewPreference().getBoolean(FAVORITE_KEY, false));
- }
+ branchView.getXBranchWidget().setBranchOptions(
+ getViewPreference().getBoolean(presEnum.origKeyName,
+ (presEnum == BranchOptionsEnum.FAVORITE_KEY) ? false : true), presEnum);
}
}
};
@@ -121,46 +111,29 @@ public class BranchViewPresentationPreferences {
}
private void refreshCommands() {
- ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(
- HierarchicalPresentationHandler.COMMAND_ID, null);
- ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(
- FlatPresentationHandler.COMMAND_ID, null);
- ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(
- ShowTransactionPresentationHandler.COMMAND_ID, null);
- ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(
- ShowMergeBranchPresentationHandler.COMMAND_ID, null);
- ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(
- ShowArchivedBranchHandler.COMMAND_ID, null);
- ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(
- ShowFavoriteBranchesFirstHandler.COMMAND_ID, null);
- }
-
- private void loadPreferences() {
- setPresentation(getViewPreference().getBoolean(FLAT_KEY, true));
- setShowTransactions(getViewPreference().getBoolean(SHOW_TRANSACTIONS, true));
- setShowMergeBranches(getViewPreference().getBoolean(SHOW_MERGE_BRANCHES, false));
- setShowArchivedBranches(getViewPreference().getBoolean(SHOW_ARCHIVED_BRANCHES, false));
- setFavoritesFirst(getViewPreference().getBoolean(FAVORITE_KEY, false));
- }
-
- private void setFavoritesFirst(boolean favoritesFirst) {
- branchView.setFavoritesFirst(favoritesFirst);
- }
-
- private void setPresentation(boolean flat) {
- branchView.setPresentation(flat);
- }
-
- private void setShowMergeBranches(boolean showMergeBranches) {
- branchView.setShowMergeBranches(showMergeBranches);
- }
-
- private void setShowTransactions(boolean showTransactions) {
- branchView.setShowTransactions(showTransactions);
+ ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ for (String command : listOfCommandIds) {
+ service.refreshElements(command, null);
+ service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ }
}
- private void setShowArchivedBranches(boolean showArchivedBranches) {
- branchView.setShowArchivedBranches(showArchivedBranches);
+ public void loadPreferences() {
+ Preferences pref = getViewPreference();
+ for (BranchOptionsEnum keyEnum : BranchOptionsEnum.values()) {
+ XBranchWidget branchWidget = branchView.getXBranchWidget();
+ switch (keyEnum) {
+ case FLAT_KEY:
+ case SHOW_TRANSACTIONS:
+ branchWidget.setBranchOptions(pref.getBoolean(keyEnum.origKeyName, true), keyEnum);
+ break;
+ case SHOW_MERGE_BRANCHES:
+ case SHOW_ARCHIVED_BRANCHES:
+ case FAVORITE_KEY:
+ branchWidget.setBranchOptions(pref.getBoolean(keyEnum.origKeyName, false), keyEnum);
+ break;
+ }
+ }
}
/**
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/NullBranchViewPresentationPreferences.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/NullBranchViewPresentationPreferences.java
new file mode 100644
index 0000000..093b375
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/NullBranchViewPresentationPreferences.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * 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.framework.ui.skynet.widgets.xBranch;
+
+import java.util.logging.Level;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.osgi.service.prefs.Preferences;
+
+/**
+ * @author Karol M. Wilk
+ */
+public class NullBranchViewPresentationPreferences extends BranchViewPresentationPreferences {
+ public NullBranchViewPresentationPreferences() {
+ super(null);
+ }
+
+ /**
+ * @param disposed the disposed to set
+ */
+ @Override
+ public void setDisposed(boolean disposed) {
+ //
+ }
+
+ @Override
+ public Preferences getViewPreference() {
+ return new Preferences() {
+ @Override
+ public void put(String key, String value) {
+ //
+ }
+
+ @Override
+ public String get(String key, String def) {
+ return "";
+ }
+
+ @Override
+ public void remove(String key) {
+ //
+ }
+
+ @Override
+ public void clear() {
+ //
+ }
+
+ @Override
+ public void putInt(String key, int value) {
+ //
+ }
+
+ @Override
+ public int getInt(String key, int def) {
+ return 0;
+ }
+
+ @Override
+ public void putLong(String key, long value) {
+ //
+ }
+
+ @Override
+ public long getLong(String key, long def) {
+ return 0;
+ }
+
+ @Override
+ public void putBoolean(String key, boolean value) {
+ //
+ }
+
+ @Override
+ public boolean getBoolean(String key, boolean def) {
+ return false;
+ }
+
+ @Override
+ public void putFloat(String key, float value) {
+ //
+ }
+
+ @Override
+ public float getFloat(String key, float def) {
+ return 0;
+ }
+
+ @Override
+ public void putDouble(String key, double value) {
+ //
+ }
+
+ @Override
+ public double getDouble(String key, double def) {
+ return 0;
+ }
+
+ @Override
+ public void putByteArray(String key, byte[] value) {
+ //
+ }
+
+ @Override
+ public byte[] getByteArray(String key, byte[] def) {
+ return new byte[] {};
+ }
+
+ @Override
+ public String[] keys() {
+ return new String[] {};
+ }
+
+ @Override
+ public String[] childrenNames() {
+ return new String[] {};
+ }
+
+ @Override
+ public Preferences parent() {
+ showImproperStateMessage();
+ return null;
+ }
+
+ @Override
+ public Preferences node(String pathName) {
+ showImproperStateMessage();
+ return null;
+ }
+
+ @Override
+ public boolean nodeExists(String pathName) {
+ return false;
+ }
+
+ @Override
+ public void removeNode() {
+ //
+ }
+
+ @Override
+ public String name() {
+ return "";
+ }
+
+ @Override
+ public String absolutePath() {
+ return "";
+ }
+
+ @Override
+ public void flush() {
+ //
+ }
+
+ @Override
+ public void sync() {
+ //
+ }
+ };
+ }
+
+ private void showImproperStateMessage() {
+ OseeLog.format(NullBranchViewPresentationPreferences.class, Level.SEVERE,
+ "%s has not been properlly initialized.", BranchViewPresentationPreferences.class.getName());
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchContentProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchContentProvider.java
index 8f20b1e..01bfa09 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchContentProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchContentProvider.java
@@ -34,13 +34,6 @@ import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
*/
public class XBranchContentProvider implements ITreeContentProvider {
- /**
- * @param showOnlyWorkingBranches the showOnlyWorkingBranches to set
- */
- public void setShowOnlyWorkingBranches(boolean showOnlyWorkingBranches) {
- this.showOnlyWorkingBranches = showOnlyWorkingBranches;
- }
-
private final BranchXViewer changeXViewer;
private boolean showChildBranchesAtMainLevel;
private boolean showMergeBranches;
@@ -244,6 +237,14 @@ public class XBranchContentProvider implements ITreeContentProvider {
showChildBranchesUnderParents = !flat;
}
+ //TODO: get rid of this and replace with hashset<branchoptenum, bool>
+ /**
+ * @param showOnlyWorkingBranches the showOnlyWorkingBranches to set
+ */
+ public void setShowOnlyWorkingBranches(boolean showOnlyWorkingBranches) {
+ this.showOnlyWorkingBranches = showOnlyWorkingBranches;
+ }
+
public void setShowMergeBranches(boolean showMergeBranches) {
this.showMergeBranches = showMergeBranches;
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java
index 39d2b32..9e8ab48 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java
@@ -78,29 +78,40 @@ public class XBranchWidget extends XWidget implements IActionable {
this.searchRealTime = false;
}
- public void setBranchOptions(BranchOptions... options) {
- for (BranchOptions option : options) {
-
- switch (option) {
- case FAVORITES_FIRST:
- setFavoritesFirst(true);
- break;
- case FLAT:
- setPresentation(true);
- break;
- case SHOW_MERGE_BRANCHES:
- setShowMergeBranches(true);
- break;
- case SHOW_TRANSACTIONS:
- setShowMergeBranches(true);
- break;
- case SHOW_ARCHIVED:
- setShowMergeBranches(true);
- break;
+ public void setBranchOptions(boolean state, BranchOptionsEnum... options) {
+ for (BranchOptionsEnum option : options) {
+ if (branchContentProvider != null) {
+ switch (option) {
+ case FAVORITE_KEY:
+ sorter.setFavoritesFirst(state);
+ break;
+ case FLAT_KEY:
+ branchContentProvider.setPresentation(state);
+ break;
+ case SHOW_MERGE_BRANCHES:
+ branchContentProvider.setShowMergeBranches(state);
+ break;
+ case SHOW_TRANSACTIONS:
+ branchContentProvider.setShowTransactions(state);
+ break;
+ case SHOW_ARCHIVED_BRANCHES:
+ branchContentProvider.setShowArchivedBranches(state);
+ break;
+ case SHOW_WORKING_BRANCHES_ONLY:
+ branchContentProvider.setShowOnlyWorkingBranches(state);
+ break;
+ }
}
+ refresh();
}
}
+ public void reveal(Branch branch) {
+ branchXViewer.reveal(branch);
+ branchXViewer.setSelection(new StructuredSelection(branch), true);
+ refresh();
+ }
+
@Override
protected void createControls(Composite parent, int horizontalSpan) {
// Create Text Widgets
@@ -188,10 +199,7 @@ public class XBranchWidget extends XWidget implements IActionable {
public ArrayList<Branch> getSelectedBranches() {
ArrayList<Branch> items = new ArrayList<Branch>();
- if (branchXViewer == null) {
- return items;
- }
- if (branchXViewer.getSelection().isEmpty()) {
+ if (branchXViewer == null || branchXViewer.getSelection().isEmpty()) {
return items;
}
Iterator<?> i = ((IStructuredSelection) branchXViewer.getSelection()).iterator();
@@ -208,10 +216,7 @@ public class XBranchWidget extends XWidget implements IActionable {
@SuppressWarnings("rawtypes")
public ArrayList<TransactionRecord> getSelectedTransactionRecords() {
ArrayList<TransactionRecord> items = new ArrayList<TransactionRecord>();
- if (branchXViewer == null) {
- return items;
- }
- if (branchXViewer.getSelection().isEmpty()) {
+ if (branchXViewer == null || branchXViewer.getSelection().isEmpty()) {
return items;
}
Iterator i = ((IStructuredSelection) branchXViewer.getSelection()).iterator();
@@ -324,52 +329,4 @@ public class XBranchWidget extends XWidget implements IActionable {
public String getActionDescription() {
return null;
}
-
- public void setFavoritesFirst(boolean favoritesFirst) {
- if (branchContentProvider != null) {
- sorter.setFavoritesFirst(favoritesFirst);
- refresh();
- }
- }
-
- public void setPresentation(boolean flat) {
- if (branchContentProvider != null) {
- branchContentProvider.setPresentation(flat);
- refresh();
- }
- }
-
- public void setShowMergeBranches(boolean showMergeBranches) {
- if (branchContentProvider != null) {
- branchContentProvider.setShowMergeBranches(showMergeBranches);
- refresh();
- }
- }
-
- public void setShowArchivedBranches(boolean showArchivedBranches) {
- if (branchContentProvider != null) {
- branchContentProvider.setShowArchivedBranches(showArchivedBranches);
- refresh();
- }
- }
-
- public void setShowTransactions(boolean showTransactions) {
- if (branchContentProvider != null) {
- branchContentProvider.setShowTransactions(showTransactions);
- refresh();
- }
- }
-
- public void setShowWorkingBranchesOnly(boolean allowOnlyWorkingBranches) {
- if (branchContentProvider != null) {
- branchContentProvider.setShowOnlyWorkingBranches(allowOnlyWorkingBranches);
- refresh();
- }
- }
-
- public void reveal(Branch branch) {
- branchXViewer.reveal(branch);
- branchXViewer.setSelection(new StructuredSelection(branch), true);
- refresh();
- }
}