Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Davis2015-12-11 16:39:38 -0500
committerSam Davis2015-12-11 16:39:38 -0500
commit13d36c118142563651d0893f2c6d6c087e1438ef (patch)
treee23fe7ea5eb35c08876dbcd1957a43021e435866 /org.eclipse.mylyn.reviews.ui/src
parentf597b1af01f670654b151b1bbc5c22f65cc2fb46 (diff)
downloadorg.eclipse.mylyn.reviews-13d36c118142563651d0893f2c6d6c087e1438ef.tar.gz
org.eclipse.mylyn.reviews-13d36c118142563651d0893f2c6d6c087e1438ef.tar.xz
org.eclipse.mylyn.reviews-13d36c118142563651d0893f2c6d6c087e1438ef.zip
484260: add build toolbar to review editor
Change-Id: Ic655181397f0fe97f466180de314b44b39ae7a70 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=484260
Diffstat (limited to 'org.eclipse.mylyn.reviews.ui/src')
-rw-r--r--org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/spi/editor/BuildStatusAttributeEditor.java28
1 files changed, 24 insertions, 4 deletions
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/spi/editor/BuildStatusAttributeEditor.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/spi/editor/BuildStatusAttributeEditor.java
index 56f77792..3017a7e9 100644
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/spi/editor/BuildStatusAttributeEditor.java
+++ b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/spi/editor/BuildStatusAttributeEditor.java
@@ -13,6 +13,7 @@
package org.eclipse.mylyn.reviews.ui.spi.editor;
import org.eclipse.jface.action.LegacyActionTools;
+import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.layout.LayoutConstants;
@@ -31,14 +32,21 @@ import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.menus.IMenuService;
+import org.eclipse.ui.services.IServiceLocator;
public class BuildStatusAttributeEditor extends AbstractAttributeEditor {
- public BuildStatusAttributeEditor(TaskDataModel dataModel, TaskAttribute taskAttribute) {
+ private final IServiceLocator locator;
+
+ public BuildStatusAttributeEditor(TaskDataModel dataModel, IServiceLocator locator, TaskAttribute taskAttribute) {
super(dataModel, taskAttribute);
+ this.locator = locator;
}
@Override
@@ -47,7 +55,7 @@ public class BuildStatusAttributeEditor extends AbstractAttributeEditor {
Composite layoutComposite = toolkit.createComposite(parent);
GridLayoutFactory.fillDefaults()
.spacing(LayoutConstants.getSpacing().x, 0)
- .numColumns(2)
+ .numColumns(3)
.applyTo(layoutComposite);
GridDataFactory.fillDefaults().indent(28, 0).applyTo(layoutComposite);
@@ -87,6 +95,18 @@ public class BuildStatusAttributeEditor extends AbstractAttributeEditor {
buildText.setText(statusValue);
buildText.setImage(getImageForBuildStatus(statusValue));
+
+ final ToolBarManager toolBarManager = new ToolBarManager();
+ IMenuService menuService = (IMenuService) locator.getService(IMenuService.class);
+ if (menuService != null) {
+ menuService.populateContributionManager(toolBarManager, "toolbar:org.eclipse.mylyn.build.toolbar"); //$NON-NLS-1$
+ toolBarManager.createControl(layoutComposite);
+ for (ToolItem item : toolBarManager.getControl().getItems()) {
+ item.setData(urlValue);
+ }
+ } else {
+ new Label(layoutComposite, SWT.NONE);
+ }
}
}
@@ -104,8 +124,8 @@ public class BuildStatusAttributeEditor extends AbstractAttributeEditor {
Composite layoutComposite = (Composite) getControl();
if (this.getModel().hasIncomingChanges(currentBuildAttribute)) {
- layoutComposite.getChildren()[2 * i].setBackground(color);
- layoutComposite.getChildren()[2 * i + 1].setBackground(color);
+ layoutComposite.getChildren()[3 * i].setBackground(color);
+ layoutComposite.getChildren()[3 * i + 1].setBackground(color);
}
}
}

Back to the top