Issue #1215 Added runWithEvent override in PointToolAction.
Reviewer comments implemented. Change-Id: I60fbf26f8721750a11ada9ceaffe65a2d3c9dabf Former-commit-id:5d93bdd642
[formerly99378b0fe5
] [formerly5d93bdd642
[formerly99378b0fe5
] [formerly9df9bc7530
[formerly c22956889d2368d0ec4fe8f524c98745791737c6]]] Former-commit-id:9df9bc7530
Former-commit-id:9cb2d0abea
[formerly11a7956541
] Former-commit-id:1f3b361e0d
This commit is contained in:
parent
216e83f2cb
commit
2c508b7ca3
1 changed files with 27 additions and 6 deletions
|
@ -27,7 +27,9 @@ import org.eclipse.jface.action.ContributionItem;
|
||||||
import org.eclipse.jface.action.IMenuCreator;
|
import org.eclipse.jface.action.IMenuCreator;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Event;
|
||||||
import org.eclipse.swt.widgets.Menu;
|
import org.eclipse.swt.widgets.Menu;
|
||||||
|
import org.eclipse.swt.widgets.ToolItem;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.points.PointsDataManager;
|
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||||
import com.raytheon.uf.viz.points.data.IPointNode;
|
import com.raytheon.uf.viz.points.data.IPointNode;
|
||||||
|
@ -44,6 +46,8 @@ import com.raytheon.viz.volumebrowser.xml.MenuContribution;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jul 29, 2012 rferrel Initial creation
|
* Jul 29, 2012 rferrel Initial creation
|
||||||
|
* Sep 25, 2012 1215 rferrel Clicking anywhere on the Point button
|
||||||
|
* now opens the menu.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -58,16 +62,34 @@ public class PointToolAction extends Action implements IMenuCreator {
|
||||||
|
|
||||||
private IPointNode parentNode;
|
private IPointNode parentNode;
|
||||||
|
|
||||||
|
private PointsDataManager dataManager;
|
||||||
|
|
||||||
public PointToolAction(String text, String pointNames) {
|
public PointToolAction(String text, String pointNames) {
|
||||||
super(text, SWT.DROP_DOWN);
|
this(text, pointNames, null);
|
||||||
this.pointNames = pointNames;
|
|
||||||
this.parentNode = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PointToolAction(String text, String pointNames, IPointNode parentNode) {
|
public PointToolAction(String text, String pointNames, IPointNode parentNode) {
|
||||||
super(text, SWT.DROP_DOWN);
|
super(text, SWT.DROP_DOWN);
|
||||||
this.pointNames = pointNames;
|
this.pointNames = pointNames;
|
||||||
this.parentNode = parentNode;
|
this.parentNode = parentNode;
|
||||||
|
this.dataManager = PointsDataManager.getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.
|
||||||
|
* Event)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void runWithEvent(Event event) {
|
||||||
|
if (menu == null) {
|
||||||
|
ToolItem item = (ToolItem) event.widget;
|
||||||
|
getMenu(item.getParent());
|
||||||
|
}
|
||||||
|
menu.setVisible(true);
|
||||||
|
super.runWithEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -116,13 +138,12 @@ public class PointToolAction extends Action implements IMenuCreator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillMenu(final Menu menu) {
|
private void fillMenu(final Menu menu) {
|
||||||
List<IPointNode> nodes = PointsDataManager.getInstance().getChildren(
|
List<IPointNode> nodes = dataManager.getChildren(parentNode);
|
||||||
parentNode);
|
|
||||||
|
|
||||||
// Create the menu items
|
// Create the menu items
|
||||||
for (IPointNode node : nodes) {
|
for (IPointNode node : nodes) {
|
||||||
if (node.isGroup()) {
|
if (node.isGroup()) {
|
||||||
if (PointsDataManager.getInstance().getChildren(node).size() > 0) {
|
if (dataManager.getChildren(node).size() > 0) {
|
||||||
PointToolAction submenu = new PointToolAction(""
|
PointToolAction submenu = new PointToolAction(""
|
||||||
+ node.getName(), pointNames, node);
|
+ node.getName(), pointNames, node);
|
||||||
submenu.menu = new Menu(menu);
|
submenu.menu = new Menu(menu);
|
||||||
|
|
Loading…
Add table
Reference in a new issue