Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjphillips2009-03-12 19:15:32 +0000
committerjphillips2009-03-12 19:15:32 +0000
commit484fcbf3cb68780adeaddc1c2fd79ca12106b6d3 (patch)
tree0fd545f957bf624c2d51ee031f5b1813ed8ba94a
parent5320a6383e8565d73fa2f129d2db01cfe8c3c02d (diff)
downloadorg.eclipse.osee-484fcbf3cb68780adeaddc1c2fd79ca12106b6d3.tar.gz
org.eclipse.osee-484fcbf3cb68780adeaddc1c2fd79ca12106b6d3.tar.xz
org.eclipse.osee-484fcbf3cb68780adeaddc1c2fd79ca12106b6d3.zip
-rw-r--r--org.eclipse.osee.framework.ui.skynet/plugin.xml24
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/FlatPresentationHandler.java33
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/HierarchicalPresentationHandler.java33
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptions.java12
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java136
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewImageHandler.java94
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewPresentationPreferences.java142
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewerFactory.java22
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchContentProvider.java69
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchLabelProvider.java130
-rw-r--r--org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java78
11 files changed, 606 insertions, 167 deletions
diff --git a/org.eclipse.osee.framework.ui.skynet/plugin.xml b/org.eclipse.osee.framework.ui.skynet/plugin.xml
index 812bf011359..4bf38118bb3 100644
--- a/org.eclipse.osee.framework.ui.skynet/plugin.xml
+++ b/org.eclipse.osee.framework.ui.skynet/plugin.xml
@@ -32,6 +32,30 @@
</objectContribution>
</extension>
+<extension
+ name="Menus for the new branch view"
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView">
+ <menu
+ label="Branch Presentation">
+ <command
+ commandId="org.eclipse.osee.framework.ui.skynet.branch.branchView.flatPresentation.command"
+ icon="images/flat_layout.gif"
+ id="org.eclipse.osee.framework.ui.skynet.branch.BranchView.flatCommand"
+ style="radio"
+ tooltip="Show branches as a flat listing">
+ </command>
+ <command
+ commandId="org.eclipse.osee.framework.ui.skynet.branch.branchView.hierarchicalPresentation.command"
+ icon="images/tree_layout.gif"
+ id="org.eclipse.osee.framework.ui.skynet.branch.BranchView.hierarchicalCommand"
+ style="radio"
+ tooltip="Show branches as a hierarchical listing">
+ </command>
+ </menu>
+ </menuContribution>
+</extension>
<extension
name="The merge view"
point="org.eclipse.ui.menus">
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/FlatPresentationHandler.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/FlatPresentationHandler.java
index 53bce7301df..95ef6b4a685 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/FlatPresentationHandler.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/FlatPresentationHandler.java
@@ -10,20 +10,49 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.branch;
+import java.util.Map;
import org.eclipse.core.commands.AbstractHandler;
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.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;
import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.menus.UIElement;
/**
+ * @author Jeff C. Phillips
* @author Robert A. Fisher
*/
-public class FlatPresentationHandler extends AbstractHandler {
+public class FlatPresentationHandler extends AbstractHandler implements IElementUpdater {
+ public static String COMMAND_ID = "org.eclipse.osee.framework.ui.skynet.branch.BranchView.flatCommand";
+ private ICommandService service;
+ public FlatPresentationHandler(){
+ this.service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ }
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- ((BranchView) HandlerUtil.getActivePartChecked(event)).presentAsFlat();
+ ((BranchView) HandlerUtil.getActivePartChecked(event)).changeBranchPresentation(true);
return null;
}
+ @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));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ service.refreshElements(COMMAND_ID, null);
+
+ return true;
+ }
}
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/HierarchicalPresentationHandler.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/HierarchicalPresentationHandler.java
index 0d805bd8871..9ed4e0cc570 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/HierarchicalPresentationHandler.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/HierarchicalPresentationHandler.java
@@ -10,20 +10,49 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.branch;
+import java.util.Map;
import org.eclipse.core.commands.AbstractHandler;
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.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;
import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.menus.UIElement;
/**
+ * @author Jeff C. Phillips
* @author Robert A. Fisher
*/
-public class HierarchicalPresentationHandler extends AbstractHandler {
+public class HierarchicalPresentationHandler extends AbstractHandler implements IElementUpdater {
+ public static String COMMAND_ID = "org.eclipse.osee.framework.ui.skynet.branch.branchView.hierarchicalPresentation.command";
+ private ICommandService service;
+ public HierarchicalPresentationHandler(){
+ this.service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ }
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- ((BranchView) HandlerUtil.getActivePartChecked(event)).presentAsHierarchy();
+ ((BranchView) HandlerUtil.getActivePartChecked(event)).changeBranchPresentation(false);
return null;
}
+ @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));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ service.refreshElements(COMMAND_ID, null);
+
+ return true;
+ }
}
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptions.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptions.java
new file mode 100644
index 00000000000..431935dd387
--- /dev/null
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptions.java
@@ -0,0 +1,12 @@
+/**
+ *
+ */
+package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
+
+/**
+ * @author Jeff C. Phillips
+ *
+ */
+public enum BranchOptions {
+ FLAT, FAVORITES_FIRST, SHOW_MERGE_BRANCHES, SHOW_TRANSACTIONS
+}
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java
index 4293dbc3447..15b12bc7209 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java
@@ -12,11 +12,6 @@
package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
@@ -26,20 +21,14 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.event.BranchEventType;
import org.eclipse.osee.framework.skynet.core.event.IBranchEventListener;
import org.eclipse.osee.framework.skynet.core.event.Sender;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
import org.eclipse.osee.framework.ui.plugin.util.Displays;
-import org.eclipse.osee.framework.ui.plugin.util.Jobs;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.ats.IActionable;
import org.eclipse.osee.framework.ui.skynet.util.SkynetViews;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.ViewPart;
/**
@@ -50,42 +39,34 @@ import org.eclipse.ui.part.ViewPart;
public class BranchView extends ViewPart implements IActionable, IBranchEventListener{
public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView";
+ private BranchViewPresentationPreferences branchViewPresentationPreferences;
private static String HELP_CONTEXT_ID = "BranchView";
private XBranchWidget xBranchWidget;
+ private BranchOptions[] branchOptions;
- public BranchView() {
- open();
- }
-
- private static void open() {
- Job job = new Job("Open Branch Manager") {
-
- @Override
- protected IStatus run(final IProgressMonitor monitor) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- try {
- IWorkbenchPage page = AWorkbench.getActivePage();
- BranchView branchView =
- (BranchView) page.showView(VIEW_ID, VIEW_ID, IWorkbenchPage.VIEW_VISIBLE);
-
- branchView.explore();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
- monitor.done();
- return Status.OK_STATUS;
+ private void setBranchOptions(BranchOptions[] options){
+ if(options == null){
+ return;
+ }
+
+ for(BranchOptions option : options){
+ if(option == BranchOptions.FAVORITES_FIRST){
+ setFavoritesFirst(true);
+ } else if (option == BranchOptions.FLAT){
+ setPresentation(true);
+ } else if (option == BranchOptions.SHOW_MERGE_BRANCHES){
+ setShowMergeBranches(true);
+ }else if(option == BranchOptions.SHOW_TRANSACTIONS){
+ setShowTransactions(true);
}
- };
-
- Jobs.startJob(job);
+ }
}
-
+
@Override
public void dispose() {
super.dispose();
+
+ branchViewPresentationPreferences.setDisposed(true);
}
@Override
@@ -97,9 +78,8 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis
*/
@Override
public void createPartControl(Composite parent) {
- /*
- * Create a grid layout object so the text and treeviewer are layed out the way I want.
- */
+ setPartName("Branch Manager");
+
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.verticalSpacing = 0;
@@ -111,6 +91,11 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis
xBranchWidget = new XBranchWidget();
xBranchWidget.setDisplayLabel(false);
xBranchWidget.createWidgets(parent, 1);
+
+ setBranchOptions(branchOptions);
+ branchViewPresentationPreferences = new BranchViewPresentationPreferences(this);
+
+ xBranchWidget.loadData();
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
@@ -130,53 +115,10 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis
SkynetGuiPlugin.getInstance().setHelp(parent, HELP_CONTEXT_ID);
}
- private void explore() {
- setPartName("Branch Manager");
- xBranchWidget.loadData();
- }
-
public String getActionDescription() {
return "";
}
- private static final String INPUT = "input";
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.ViewPart#saveState(org.eclipse.ui.IMemento)
- */
- @Override
- public void saveState(IMemento memento) {
- super.saveState(memento);
- memento = memento.createChild(INPUT);
- }
-
- @Override
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- try {
- if (memento != null) {
- memento = memento.getChild(INPUT);
- if (memento != null) {
- if (SkynetViews.isSourceValid(memento)) {
-// String guid = memento.getString(ART_GUID);
-// Integer branchId = memento.getInteger(BRANCH_ID);
-// Artifact artifact = ArtifactQuery.getArtifactFromId(guid, BranchManager.getBranch(branchId));
- open();
- } else {
- closeView();
- }
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "History View error on init", ex);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.osee.framework.skynet.core.eventx.IBranchEventListener#handleBranchEvent(org.eclipse.osee.framework.ui.plugin.event.Sender, org.eclipse.osee.framework.skynet.core.artifact.BranchModType, int)
- */
@Override
public void handleBranchEvent(Sender sender, BranchEventType branchModType, final int branchId) {
if (branchModType == BranchEventType.Deleted) {
@@ -190,7 +132,7 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis
Displays.ensureInDisplayThread(new Runnable() {
public void run() {
try {
- explore();
+ xBranchWidget.refresh();
} catch (Exception ex) {
OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
}
@@ -209,4 +151,26 @@ public class BranchView extends ViewPart implements IActionable, IBranchEventLis
private void closeView() {
SkynetViews.closeView(VIEW_ID, getViewSite().getSecondaryId());
}
+
+ public void changeBranchPresentation(boolean flat){
+ if(branchViewPresentationPreferences != null){
+ branchViewPresentationPreferences.getViewPreference().putBoolean(BranchViewPresentationPreferences.FLAT_KEY, flat);
+ }
+ }
+
+ 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);
+ }
} \ No newline at end of file
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewImageHandler.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewImageHandler.java
new file mode 100644
index 00000000000..fd3ede020c8
--- /dev/null
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewImageHandler.java
@@ -0,0 +1,94 @@
+/**
+ *
+ */
+package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
+
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.db.connection.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Branch;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.transaction.TransactionId;
+import org.eclipse.osee.framework.ui.plugin.util.OverlayImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Jeff C. Phillips
+ *
+ */
+public class BranchViewImageHandler {
+ private static Image branchImage = SkynetGuiPlugin.getInstance().getImage("branch.gif");
+ private static Image changeManagedBranchImage = SkynetGuiPlugin.getInstance().getImage("change_managed_branch.gif");
+ private static Image favoriteBranchImage = null;
+ private static Image defaultBranchImage = null;
+ private static Image favoriteDefaultBranchImage = null;
+ private static Image favoriteDefaultChangedManagedBranchImage = null;
+ private static Image defaultChangeManagedBranchImage = null;
+ private static Image favoriteChangeManagedBranchImage = null;
+
+ public static Image getImage(Object element, int columnIndex){
+ Image returnImage = null;
+
+ //lazy loading of images
+ checkImages();
+ // Seek down through aggregation lists to the lowest level to get an actual element
+ while (element instanceof List && !((List<?>) element).isEmpty()) {
+ element = ((List<?>) element).get(0);
+ }
+
+ if (element instanceof Branch && columnIndex == 0) {
+ try {
+ checkImages();
+ Branch branch = (Branch) element;
+ boolean favorite = UserManager.getUser().isFavoriteBranch(branch);
+ boolean action = branch.isChangeManaged();
+ boolean isDefault = element.equals(BranchManager.getDefaultBranch());
+
+ if (favorite && action) {
+ returnImage = isDefault ? favoriteDefaultChangedManagedBranchImage : favoriteChangeManagedBranchImage;
+ } else if (favorite) {
+ returnImage = isDefault ? favoriteDefaultBranchImage : favoriteBranchImage;
+ } else if (action) {
+ returnImage = isDefault ? defaultChangeManagedBranchImage : changeManagedBranchImage;
+ } else {
+ returnImage = isDefault ? defaultBranchImage : branchImage;
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+
+ } else if (element instanceof TransactionId && columnIndex == 0) {
+ returnImage= SkynetGuiPlugin.getInstance().getImage("DBiconBlue.GIF");
+
+ }
+ return returnImage;
+ }
+
+
+ private static synchronized void checkImages() {
+ if (defaultBranchImage == null) {
+ favoriteBranchImage =
+ new OverlayImage(branchImage, SkynetGuiPlugin.getInstance().getImageDescriptor("star_9_9.gif"), 0, 7).createImage();
+ defaultBranchImage =
+ new OverlayImage(branchImage, SkynetGuiPlugin.getInstance().getImageDescriptor("black_check.gif"), 8, 0).createImage();
+ favoriteDefaultBranchImage =
+ new OverlayImage(defaultBranchImage, SkynetGuiPlugin.getInstance().getImageDescriptor("star_9_9.gif"),
+ 0, 7).createImage();
+
+ defaultChangeManagedBranchImage =
+ new OverlayImage(changeManagedBranchImage, SkynetGuiPlugin.getInstance().getImageDescriptor(
+ "black_check.gif"), 8, 0).createImage();
+ favoriteChangeManagedBranchImage =
+ new OverlayImage(changeManagedBranchImage, SkynetGuiPlugin.getInstance().getImageDescriptor(
+ "star_9_9.gif"), 0, 7).createImage();
+ favoriteDefaultChangedManagedBranchImage =
+ new OverlayImage(defaultChangeManagedBranchImage, SkynetGuiPlugin.getInstance().getImageDescriptor(
+ "star_9_9.gif"), 0, 7).createImage();
+
+ }
+ }
+
+}
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewPresentationPreferences.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewPresentationPreferences.java
new file mode 100644
index 00000000000..b239ec72f84
--- /dev/null
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewPresentationPreferences.java
@@ -0,0 +1,142 @@
+/**
+ *
+ */
+package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.branch.FlatPresentationHandler;
+import org.eclipse.osee.framework.ui.skynet.branch.HierarchicalPresentationHandler;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.osgi.service.prefs.BackingStoreException;
+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 FLAT_KEY = "flat";
+ static final String BRANCH_ID = "branchId";
+
+ private final IPreferencesService preferencesService;
+ private IPreferenceChangeListener preferenceChangeListener;
+ private BranchView branchView;
+ private boolean disposed;
+
+ public BranchViewPresentationPreferences(BranchView branchView) {
+ this.preferencesService = Platform.getPreferencesService();
+ this.preferenceChangeListener = null;
+ this.branchView = branchView;
+ this.disposed = false;
+
+ IEclipsePreferences instanceNode =
+ (IEclipsePreferences) preferencesService.getRootNode().node(InstanceScope.SCOPE);
+
+ try {
+ if (instanceNode.nodeExists(BranchView.VIEW_ID)) {
+ ((IEclipsePreferences) instanceNode.node(BranchView.VIEW_ID)).addPreferenceChangeListener(getSingleton());
+ }
+ } catch (BackingStoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ instanceNode.addNodeChangeListener(new IEclipsePreferences.INodeChangeListener() {
+
+ public void added(NodeChangeEvent event) {
+ if (event.getChild().name().equals(BranchView.VIEW_ID)) {
+ ((IEclipsePreferences) event.getChild()).addPreferenceChangeListener(getSingleton());
+ }
+ }
+
+ public void removed(NodeChangeEvent event) {
+ if (event.getChild().name().equals(BranchView.VIEW_ID)) {
+ ((IEclipsePreferences) event.getChild()).removePreferenceChangeListener(getSingleton());
+ }
+ }
+ });
+
+ loadPreferences();
+ }
+
+ private synchronized IPreferenceChangeListener getSingleton() {
+ if (preferenceChangeListener == null) {
+ preferenceChangeListener = new IPreferenceChangeListener() {
+
+ public void preferenceChange(PreferenceChangeEvent event) {
+ if (disposed) {
+ ((IEclipsePreferences) event.getNode()).removePreferenceChangeListener(this);
+ } else {
+ String propertyName = event.getKey();
+ ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(HierarchicalPresentationHandler.COMMAND_ID, null);
+ ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(FlatPresentationHandler.COMMAND_ID, null);
+
+ 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(FAVORITE_KEY)) {
+ setFavoritesFirst(getViewPreference().getBoolean(FAVORITE_KEY, false));
+ }
+ }
+ }
+ };
+ }
+
+ return preferenceChangeListener;
+ }
+
+ private void loadPreferences() {
+ setPresentation(getViewPreference().getBoolean(FLAT_KEY, true));
+ setShowTransactions(getViewPreference().getBoolean(SHOW_TRANSACTIONS, true));
+ }
+
+ 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);
+ }
+
+ /**
+ * @param disposed the disposed to set
+ */
+ public void setDisposed(boolean disposed) {
+ this.disposed = disposed;
+
+ try {
+ getViewPreference().flush();
+ } catch (BackingStoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public Preferences getViewPreference() {
+ return preferencesService.getRootNode().node(InstanceScope.SCOPE).node(BranchView.VIEW_ID);
+ }
+}
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewerFactory.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewerFactory.java
index 102b49496ee..9ab99e296fd 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewerFactory.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewerFactory.java
@@ -21,31 +21,21 @@ import org.eclipse.swt.SWT;
* @author Jeff C. Phillips
*/
public class BranchXViewerFactory extends SkynetXViewerFactory {
- public static XViewerColumn transaction =
- new XViewerColumn("framework.branch.transaction", "Transaction", 100, SWT.LEFT, true, SortDataType.String,
- false, null);
- public static XViewerColumn gamma =
- new XViewerColumn("framework.branch.gamma", "Gamma", 70, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn itemType =
- new XViewerColumn("framework.branch.itemType", "Item Type", 150, SWT.LEFT, true, SortDataType.String, false,
- null);
- public static XViewerColumn was =
- new XViewerColumn("framework.branch.was", "Was", 250, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn is =
- new XViewerColumn("framework.branch.is", "Is", 250, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn timeStamp =
- new XViewerColumn("framework.branch.timeStamp", "Time Stamp", 110, SWT.LEFT, true, SortDataType.String, false,
+ public static XViewerColumn branch_name =
+ new XViewerColumn("framework.branch.branchName", "Branch Name", 250, SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn time_stamp =
+ new XViewerColumn("framework.branch.itemType", "Time Stamp", 150, SWT.LEFT, true, SortDataType.String, false,
null);
public static XViewerColumn author =
new XViewerColumn("framework.branch.author", "Author", 100, SWT.LEFT, true, SortDataType.String, false, null);
public static XViewerColumn comment =
- new XViewerColumn("framework.branch.comment", "Comment", 70, SWT.LEFT, true, SortDataType.String, false, null);
+ new XViewerColumn("framework.branch.comment", "Comment", 250, SWT.LEFT, true, SortDataType.String, false, null);
public static String NAMESPACE = "osee.skynet.gui.BranchXViewer";
public BranchXViewerFactory() {
super(NAMESPACE);
- registerColumn(transaction, gamma, itemType, was, is, timeStamp, author, comment);
+ registerColumn(branch_name, time_stamp, author, comment);
}
@Override
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchContentProvider.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchContentProvider.java
index 7244e5a956e..4de4cad9a65 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchContentProvider.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchContentProvider.java
@@ -12,6 +12,9 @@ package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import org.eclipse.jface.viewers.ITreeContentProvider;
@@ -24,6 +27,8 @@ import org.eclipse.osee.framework.skynet.core.artifact.Branch;
import org.eclipse.osee.framework.skynet.core.artifact.BranchControlled;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.artifact.BranchState;
+import org.eclipse.osee.framework.skynet.core.transaction.TransactionId;
+import org.eclipse.osee.framework.skynet.core.transaction.TransactionIdManager;
/**
* @author Jeff C. Phillips
@@ -33,6 +38,8 @@ public class XBranchContentProvider implements ITreeContentProvider {
private final BranchXViewer changeXViewer;
private boolean showChildBranchesAtMainLevel;
private boolean showMergeBranches;
+ private boolean showTransactions;
+ private boolean showChildBranchesUnderParents;
private static Object[] EMPTY_ARRAY = new Object[0];
public XBranchContentProvider(BranchXViewer commitXViewer) {
@@ -49,17 +56,28 @@ public class XBranchContentProvider implements ITreeContentProvider {
if (AccessControlManager.isOseeAdmin() && showMergeBranches) {
branchTypes.add(BranchType.MERGE);
}
-
if (showChildBranchesAtMainLevel) {
branchTypes.add(BranchType.BASELINE);
branchTypes.add(BranchType.WORKING);
}
-
List<Branch> branches =
BranchManager.getBranches(BranchState.ACTIVE, BranchControlled.ALL,
branchTypes.toArray(new BranchType[branchTypes.size()]));
return branches.toArray();
-
+ } catch (OseeCoreException ex) {
+ OseeLog.log(this.getClass(), Level.WARNING, ex);
+ }
+ } else if (parentElement instanceof Branch) {
+ try {
+ Branch branch = (Branch) parentElement;
+ if (showChildBranchesUnderParents) {
+ List<Object> items = new LinkedList<Object>();
+ items.addAll(branch.getChildBranches());
+ items.addAll(getTransactions(branch));
+ return items.toArray();
+ } else {
+ return getTransactions(branch).toArray();
+ }
} catch (OseeCoreException ex) {
OseeLog.log(this.getClass(), Level.WARNING, ex);
}
@@ -74,8 +92,25 @@ public class XBranchContentProvider implements ITreeContentProvider {
return null;
}
+ private Collection<Object> getTransactions(Branch branch) throws OseeCoreException {
+ if (!showTransactions) return Collections.emptyList();
+ List<TransactionId> transactions = TransactionIdManager.getTransactionsForBranch(branch);
+ Collections.sort(transactions, new Comparator<TransactionId>() {
+ public int compare(TransactionId o1, TransactionId o2) {
+ return o1.getTransactionNumber() - o2.getTransactionNumber();
+ }
+ });
+ if (transactions != null) {
+ return org.eclipse.osee.framework.jdk.core.util.Collections.getAggregateTree(new ArrayList<Object>(
+ transactions), 100);
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
public boolean hasChildren(Object element) {
if (element instanceof BranchManager) return true;
+ if (element instanceof Branch) return true;
if (element instanceof Collection) return true;
return false;
}
@@ -97,4 +132,32 @@ public class XBranchContentProvider implements ITreeContentProvider {
return changeXViewer;
}
+ /**
+ * @param favoritesFirst
+ */
+ public void setFavoritesFirst(boolean favoritesFirst) {
+ }
+
+ /**
+ * @param flat
+ */
+ public void setPresentation(boolean flat) {
+ showChildBranchesAtMainLevel = flat;
+ showChildBranchesUnderParents = !flat;
+ }
+
+ /**
+ * @param showMergeBranches2
+ */
+ public void setShowMergeBranches(boolean showMergeBranches) {
+ this.showMergeBranches = showMergeBranches;
+ }
+
+ /**
+ * @param showTransactions2
+ */
+ public void setShowTransactions(boolean showTransactions) {
+ this.showTransactions = showTransactions;
+ }
+
}
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchLabelProvider.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchLabelProvider.java
index 569ea1a7b0d..f2456e9b56f 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchLabelProvider.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchLabelProvider.java
@@ -10,12 +10,20 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
+import java.util.Collection;
+import java.util.List;
+import java.util.logging.Level;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.nebula.widgets.xviewer.XViewerCells;
import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
import org.eclipse.nebula.widgets.xviewer.XViewerLabelProvider;
import org.eclipse.osee.framework.db.connection.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.access.AccessControlManager;
import org.eclipse.osee.framework.skynet.core.artifact.Branch;
+import org.eclipse.osee.framework.skynet.core.transaction.TransactionId;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
@@ -34,31 +42,90 @@ public class XBranchLabelProvider extends XViewerLabelProvider {
@Override
public String getColumnText(Object element, XViewerColumn cCol, int columnIndex) throws OseeCoreException {
- try {
- if (!(element instanceof Branch)) return "";
- Branch data = (Branch) element;
-
- if (cCol.equals(BranchXViewerFactory.transaction)) {
- return String.valueOf(data.getBranchName());
- } else if (cCol.equals(BranchXViewerFactory.gamma)) {
- return String.valueOf(data.getBranchName());
- } else if (cCol.equals(BranchXViewerFactory.itemType)) {
- return String.valueOf(data.getBranchName());
- } else if (cCol.equals(BranchXViewerFactory.was)) {
- return String.valueOf(data.getBranchName());
- } else if (cCol.equals(BranchXViewerFactory.is)) {
- return String.valueOf(data.getBranchName());
- } else if (cCol.equals(BranchXViewerFactory.timeStamp)) {
- return String.valueOf(data.getBranchName());
- } else if (cCol.equals(BranchXViewerFactory.author)) {
- return String.valueOf(data.getBranchName());
- }else if (cCol.equals(BranchXViewerFactory.comment)) {
- return String.valueOf(data.getBranchName());
+ String columnText = "";
+ try {
+ if (element instanceof Branch) {
+ columnText = getBranchText((Branch) element, cCol, columnIndex);
+ } else if (element instanceof TransactionId) {
+ columnText = getTransactionText((TransactionId) element, cCol, columnIndex);
+ } else if (element instanceof Collection<?>) {
+ columnText = getAggrTransactionList((Collection<?>) element, columnIndex);
}
} catch (Exception ex) {
return XViewerCells.getCellExceptionString(ex);
}
- return "unhandled column";
+ return columnText;
+ }
+
+ private String getAggrTransactionList(Collection<?> collection, int columnIndex) {
+ Object headCursor = collection;
+ Object tailCursor = collection;
+ String columnText = "";
+
+ while (headCursor instanceof List && !((List<?>) headCursor).isEmpty()) {
+ headCursor = ((List<?>) headCursor).get(0);
+ }
+ while (tailCursor instanceof List && !((List<?>) tailCursor).isEmpty()) {
+ List<?> list = (List<?>) tailCursor;
+ tailCursor = list.get(list.size() - 1);
+ }
+
+ if (headCursor instanceof TransactionId && tailCursor instanceof TransactionId) {
+ TransactionId headTransaction = (TransactionId) headCursor;
+ TransactionId tailTransaction = (TransactionId) tailCursor;
+
+ if (columnIndex == 0) {
+ columnText =
+ String.valueOf(headTransaction.getTransactionNumber() + "..." + tailTransaction.getTransactionNumber());
+ } else if (columnIndex == 1) {
+ columnText = String.valueOf(headTransaction.getTime());
+ }
+ } else {
+ columnText =
+ "Unexpected aggregation of " + headCursor.getClass().getSimpleName() + " and " + tailCursor.getClass().getSimpleName();
+ }
+ return columnText;
+ }
+
+ private String getBranchText(Branch branch, XViewerColumn cCol, int columnIndex) {
+ String columnText = "";
+ String branchName = "";
+
+ try {
+ if (AccessControlManager.isOseeAdmin()) {
+ branchName = "(" + branch.getBranchId() + ") " + branch.getBranchName();
+ } else {
+ branchName = branch.getBranchName();
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+
+ if (cCol.equals(BranchXViewerFactory.branch_name)) {
+ columnText = branchName;
+ } else if (cCol.equals(BranchXViewerFactory.time_stamp)) {
+ columnText = String.valueOf(branch.getCreationDate());
+ } else if (cCol.equals(BranchXViewerFactory.author)) {
+ columnText = UserManager.getUserNameById(branch.getAuthorId());
+ } else if (cCol.equals(BranchXViewerFactory.comment)) {
+ columnText = branch.getCreationComment();
+ }
+ return columnText;
+ }
+
+ private String getTransactionText(TransactionId transaction, XViewerColumn cCol, int columnIndex) {
+ String columnText = "";
+
+ if (cCol.equals(BranchXViewerFactory.branch_name)) {
+ columnText = String.valueOf(transaction.getTransactionNumber());
+ } else if (cCol.equals(BranchXViewerFactory.time_stamp)) {
+ columnText = String.valueOf(transaction.getTime());
+ } else if (cCol.equals(BranchXViewerFactory.author)) {
+ columnText = UserManager.getUserNameById(transaction.getAuthorArtId());
+ } else if (cCol.equals(BranchXViewerFactory.comment)) {
+ columnText = transaction.getComment();
+ }
+ return columnText;
}
public void dispose() {
@@ -82,24 +149,7 @@ public class XBranchLabelProvider extends XViewerLabelProvider {
@Override
public Image getColumnImage(Object element, XViewerColumn xCol, int columnIndex) throws OseeCoreException {
-// try {
-// if (!(element instanceof Branch)) return null;
-// Branch change = (Branch) element;
-// if (xCol.equals(BranchXViewerFactory.transaction)) {
-// try {
-// return SkynetGuiPlugin.getInstance().getImage("DBiconBlue.GIF");
-// } catch (IllegalArgumentException ex) {
-// OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
-// } catch (Exception ex) {
-// OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
-// }
-// } else if (xCol.equals(BranchXViewerFactory.itemType)) {
-// return change.getChangeImage();
-// }
-//
-// } catch (Exception ex) {
-// // do nothing
-// }
- return null;
+ Image returnImage = BranchViewImageHandler.getImage(element, columnIndex);
+ return returnImage;
}
}
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java
index 45e5279f248..c32d73a90a1 100644
--- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java
+++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java
@@ -49,10 +49,11 @@ import org.eclipse.swt.widgets.Tree;
*/
public class XBranchWidget extends XWidget implements IActionable {
- private BranchXViewer xBranchViewer;
+ private BranchXViewer branchXViewer;
public final static String normalColor = "#EEEEEE";
private static final String LOADING = "Loading ...";
protected Label extraInfoLabel;
+ private XBranchContentProvider branchContentProvider;
/**
* @param label
@@ -88,15 +89,16 @@ public class XBranchWidget extends XWidget implements IActionable {
OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
}
- xBranchViewer = new BranchXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
- xBranchViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+ branchXViewer = new BranchXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
+ branchXViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
- xBranchViewer.setContentProvider(new XBranchContentProvider(xBranchViewer));
- xBranchViewer.setLabelProvider(new XBranchLabelProvider(xBranchViewer));
+ branchContentProvider = new XBranchContentProvider(branchXViewer);
+ branchXViewer.setContentProvider(branchContentProvider);
+ branchXViewer.setLabelProvider(new XBranchLabelProvider(branchXViewer));
- if (toolkit != null) toolkit.adapt(xBranchViewer.getStatusLabel(), false, false);
+ if (toolkit != null) toolkit.adapt(branchXViewer.getStatusLabel(), false, false);
- Tree tree = xBranchViewer.getTree();
+ Tree tree = branchXViewer.getTree();
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.heightHint = 100;
tree.setLayout(ALayout.getZeroMarginLayout());
@@ -146,7 +148,7 @@ public class XBranchWidget extends XWidget implements IActionable {
item.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- xBranchViewer.getCustomizeMgr().handleTableCustomization();
+ branchXViewer.getCustomizeMgr().handleTableCustomization();
}
});
@@ -160,9 +162,9 @@ public class XBranchWidget extends XWidget implements IActionable {
@SuppressWarnings("unchecked")
public ArrayList<Branch> getSelectedBranches() {
ArrayList<Branch> items = new ArrayList<Branch>();
- if (xBranchViewer == null) return items;
- if (xBranchViewer.getSelection().isEmpty()) return items;
- Iterator i = ((IStructuredSelection) xBranchViewer.getSelection()).iterator();
+ if (branchXViewer == null) return items;
+ if (branchXViewer.getSelection().isEmpty()) return items;
+ Iterator i = ((IStructuredSelection) branchXViewer.getSelection()).iterator();
while (i.hasNext()) {
Object obj = i.next();
items.add((Branch) obj);
@@ -172,22 +174,22 @@ public class XBranchWidget extends XWidget implements IActionable {
@Override
public Control getControl() {
- return xBranchViewer.getTree();
+ return branchXViewer.getTree();
}
@Override
public void dispose() {
- xBranchViewer.dispose();
+ branchXViewer.dispose();
}
@Override
public void setFocus() {
- xBranchViewer.getTree().setFocus();
+ branchXViewer.getTree().setFocus();
}
@Override
public void refresh() {
- xBranchViewer.refresh();
+ branchXViewer.refresh();
setLabelError();
}
@@ -205,7 +207,7 @@ public class XBranchWidget extends XWidget implements IActionable {
* @return Returns the xViewer.
*/
public BranchXViewer getXViewer() {
- return xBranchViewer;
+ return branchXViewer;
}
/*
@@ -215,7 +217,7 @@ public class XBranchWidget extends XWidget implements IActionable {
*/
@Override
public Object getData() {
- return xBranchViewer.getInput();
+ return branchXViewer.getInput();
}
public void loadData() {
@@ -229,7 +231,7 @@ public class XBranchWidget extends XWidget implements IActionable {
Displays.ensureInDisplayThread(new Runnable() {
public void run() {
extraInfoLabel.setText("");
- xBranchViewer.setInput(BranchManager.getInstance());
+ branchXViewer.setInput(BranchManager.getInstance());
}
});
return Status.OK_STATUS;
@@ -268,4 +270,44 @@ public class XBranchWidget extends XWidget implements IActionable {
public String getActionDescription() {
return null;
}
+
+ /**
+ * @param favoritesFirst
+ */
+ public void setFavoritesFirst(boolean favoritesFirst) {
+ if (branchContentProvider != null) {
+ branchContentProvider.setFavoritesFirst(favoritesFirst);
+ refresh();
+ }
+ }
+
+ /**
+ * @param flat
+ */
+ public void setPresentation(boolean flat) {
+ if (branchContentProvider != null) {
+ branchContentProvider.setPresentation(flat);
+ refresh();
+ }
+ }
+
+ /**
+ * @param showMergeBranches
+ */
+ public void setShowMergeBranches(boolean showMergeBranches) {
+ if (branchContentProvider != null) {
+ branchContentProvider.setShowMergeBranches(showMergeBranches);
+ refresh();
+ }
+ }
+
+ /**
+ * @param showTransactions
+ */
+ public void setShowTransactions(boolean showTransactions) {
+ if (branchContentProvider != null) {
+ branchContentProvider.setShowTransactions(showTransactions);
+ refresh();
+ }
+ }
}

Back to the top