本文整理汇总了Java中org.openide.nodes.NodeOp.findActions方法的典型用法代码示例。如果您正苦于以下问题:Java NodeOp.findActions方法的具体用法?Java NodeOp.findActions怎么用?Java NodeOp.findActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.nodes.NodeOp
的用法示例。
在下文中一共展示了NodeOp.findActions方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPopup
import org.openide.nodes.NodeOp; //导入方法依赖的package包/类
void createPopup(int xpos, int ypos) {
// bugfix #23932, don't create if it's disabled
if (isPopupAllowed()) {
Node[] selNodes = manager.getSelectedNodes();
if (selNodes.length > 0) {
Action[] actions = NodeOp.findActions(selNodes);
if (actions.length > 0) {
createPopup(xpos, ypos, Utilities.actionsToPopup(actions, this));
}
} else if (manager.getRootContext() != null) {
JPopupMenu popup = manager.getRootContext().getContextMenu();
if (popup != null) {
createPopup(xpos, ypos, popup);
}
}
}
}
示例2: createExtendedPopup
import org.openide.nodes.NodeOp; //导入方法依赖的package包/类
void createExtendedPopup(int xpos, int ypos, JMenu newMenu) {
Node[] ns = manager.getSelectedNodes();
JPopupMenu popup = null;
if (ns.length > 0) {
// if any nodes are selected --> find theirs actions
Action[] actions = NodeOp.findActions(ns);
popup = Utilities.actionsToPopup(actions, this);
} else {
// if none node is selected --> get context actions from view's root
if (manager.getRootContext() != null) {
popup = manager.getRootContext().getContextMenu();
}
}
int cnt = 0;
if (popup == null) {
popup = SystemAction.createPopupMenu(new SystemAction[] { });
}
popup.add(newMenu);
createPopup(xpos, ypos, popup);
}
示例3: createPopupMenu
import org.openide.nodes.NodeOp; //导入方法依赖的package包/类
/**
* Creates a popup menu with entries from the selected nodes
* related to the given component (usually a ETable subclass). The popup
* is created for the table element in given column and row (column
* and row are in the view's coordinates (not the model's)).
*/
public JPopupMenu createPopupMenu(int row, int column, Node[] selectedNodes,
Component component) {
Action[] actions = NodeOp.findActions (selectedNodes);
JPopupMenu res = Utilities.actionsToPopup(actions, component);
if (showQuickFilter) {
if ((component instanceof ETable) && (column >= 0)) {
ETable et = (ETable)component;
if (row >= 0) {
Object val = et.getValueAt(row, column);
val = et.transformValue(val);
String s = NbBundle.getMessage(NodePopupFactory.class, "LBL_QuickFilter");
res.add(et.getQuickFilterPopup(column, val, s));
} else if (et.getQuickFilterColumn() == column) {
addNoFilterItem(et, res);
}
}
}
return res;
}
示例4: getPopupMenu
import org.openide.nodes.NodeOp; //导入方法依赖的package包/类
public JPopupMenu getPopupMenu(Widget widget, Point localLocation) {
Node[] nodes = null;
try {
nodes = OutlineTopComponent.getDefault().getExplorerManager().getSelectedNodes();
} catch (Exception ex) { }
if (nodes != null && nodes.length > 0)
{
//return NodeOp.findContextMenu(nodes);
Action[] actions = NodeOp.findActions(nodes);
if (actions != null && actions.length > 0)
{
ActionMap actionsMap = new ActionMap();
for (int i=0; i<actions.length; ++i)
{
if (actions[i] != null && actions[i].getValue( Action.ACTION_COMMAND_KEY) != null)
actionsMap.put( actions[i].getValue( Action.ACTION_COMMAND_KEY), actions[i]);
}
List<Lookup> allLookups = new ArrayList<Lookup>();
for (int i=0; i<nodes.length; ++i)
{
allLookups.add(nodes[i].getLookup());
}
allLookups.add(Utilities.actionsGlobalContext());
allLookups.add(Lookups.singleton(actionsMap));
Lookup lookup = new ProxyLookup(allLookups.toArray(new Lookup[allLookups.size()]));
return Utilities.actionsToPopup(actions, lookup);
}
}
return null;
}
示例5: createPopup
import org.openide.nodes.NodeOp; //导入方法依赖的package包/类
void createPopup(int xpos, int ypos) {
// bugfix #23932, don't create if it's disabled
if (isPopupAllowed ()) {
Node[] arr = manager.getSelectedNodes ();
Action[] actions = NodeOp.findActions (arr);
if (actions.length > 0) {
createPopup ( xpos, ypos, Utilities.actionsToPopup(actions, this) );
}
}
}
示例6: createExtendedPopup
import org.openide.nodes.NodeOp; //导入方法依赖的package包/类
void createExtendedPopup(int xpos, int ypos, JMenu newMenu) {
Node[] ns = manager.getSelectedNodes ();
JPopupMenu popup = null;
if (ns.length > 0) {
// if any nodes are selected --> find theirs actions
Action[] actions = NodeOp.findActions (ns);
popup = Utilities.actionsToPopup (actions, this);
} else {
// if none node is selected --> get context actions from view's root
if (manager.getRootContext () != null) {
popup = manager.getRootContext ().getContextMenu ();
}
}
int cnt = 0;
if ( popup != null && ( cnt = popup.getComponentCount() ) > 1 ) {
popup.insert( newMenu, cnt - 1 );
popup.insert( new JPopupMenu.Separator(), cnt );
}
else {
if ( popup == null )
popup = SystemAction.createPopupMenu( new SystemAction[] {} );
popup.add( newMenu );
}
createPopup ( xpos, ypos, popup );
}
示例7: createPopup
import org.openide.nodes.NodeOp; //导入方法依赖的package包/类
void createPopup(int xpos, int ypos, boolean contextMenu) {
if (manager == null) {
return;
}
if (!popupAllowed) {
return;
}
if (!isShowing()) {
return;
}
JPopupMenu popup;
if (contextMenu) {
popup = Utilities.actionsToPopup(manager.getExploredContext().getActions(true), this);
} else {
Action[] actions = NodeOp.findActions(manager.getSelectedNodes());
popup = Utilities.actionsToPopup(actions, this);
}
if ((popup != null) && (popup.getSubElements().length > 0)) {
Point p = getViewport().getViewPosition();
p.x = xpos - p.x;
p.y = ypos - p.y;
SwingUtilities.convertPointToScreen(p, ListView.this);
Dimension popupSize = popup.getPreferredSize();
Rectangle screenBounds = Utilities.getUsableScreenBounds(getGraphicsConfiguration());
if ((p.x + popupSize.width) > (screenBounds.x + screenBounds.width)) {
p.x = (screenBounds.x + screenBounds.width) - popupSize.width;
}
if ((p.y + popupSize.height) > (screenBounds.y + screenBounds.height)) {
p.y = (screenBounds.y + screenBounds.height) - popupSize.height;
}
SwingUtilities.convertPointFromScreen(p, ListView.this);
popup.show(this, p.x, p.y);
}
}
示例8: getPopupMenu
import org.openide.nodes.NodeOp; //导入方法依赖的package包/类
public JPopupMenu getPopupMenu(Widget widget, Point localLocation) {
JRDesignElement element = getElement(widget);
if (element == null) {
return null;
}
if ( !((AbstractReportObjectScene)widget.getScene()).getSelectedObjects().contains(element) )
{
return null;
}
Node node = null;
// We can assume that the node is selected in this explorer window...
Node[] selectedNodes = IReportManager.getInstance().getActiveVisualView().getExplorerManager().getSelectedNodes();
if (selectedNodes != null && selectedNodes.length > 0)
{
node = selectedNodes[0];
}
//node = IReportManager.getInstance().findNodeOf(element, IReportManager.getInstance().getActiveVisualView().getExplorerManager().getRootContext());
if (selectedNodes != null && selectedNodes.length > 0)
{
Action[] actions = NodeOp.findActions(selectedNodes);
List<Action> actionsList = new ArrayList<Action>(Arrays.asList(actions));
int index = actionsList.indexOf(SystemAction.get(CopyAction.class));
if (index < 0) index = 0;
if (index == 0 && actionsList.size() > 2) index = 2;
actionsList.add(index, SubMenuAction.getAction("ireport/tablecomponent"));
actionsList.add(index+1, null);
actions = actionsList.toArray(new Action[actionsList.size()]);
if (actions != null && actions.length > 0)
{
ActionMap actionsMap = new ActionMap();
for (int i=0; i<actions.length; ++i)
{
if (actions[i] != null && actions[i].getValue( Action.ACTION_COMMAND_KEY) != null)
actionsMap.put( actions[i].getValue( Action.ACTION_COMMAND_KEY), actions[i]);
}
List<Lookup> allLookups = new ArrayList<Lookup>();
allLookups.add(node.getLookup());
allLookups.add(Utilities.actionsGlobalContext());
allLookups.add(Lookups.singleton(actionsMap));
Lookup lookup = new ProxyLookup(allLookups.toArray(new Lookup[allLookups.size()]));
return Utilities.actionsToPopup(actions, lookup);
}
}
return null;
}
示例9: getPopupMenu
import org.openide.nodes.NodeOp; //导入方法依赖的package包/类
public JPopupMenu getPopupMenu(Widget widget, Point localLocation) {
JRDesignElement element = getElement(widget);
if (element == null) {
return null;
}
if ( !((AbstractReportObjectScene)widget.getScene()).getSelectedObjects().contains(element) )
{
return null;
}
Node node = null;
// We can assume that the node is selected in this explorer window...
Node[] selectedNodes = IReportManager.getInstance().getActiveVisualView().getExplorerManager().getSelectedNodes();
if (selectedNodes != null && selectedNodes.length > 0)
{
node = selectedNodes[0];
}
//node = IReportManager.getInstance().findNodeOf(element, IReportManager.getInstance().getActiveVisualView().getExplorerManager().getRootContext());
if (selectedNodes != null && selectedNodes.length > 0)
{
Action[] actions = NodeOp.findActions(selectedNodes);
if (actions != null && actions.length > 0)
{
ActionMap actionsMap = new ActionMap();
for (int i=0; i<actions.length; ++i)
{
if (actions[i] != null && actions[i].getValue( Action.ACTION_COMMAND_KEY) != null)
actionsMap.put( actions[i].getValue( Action.ACTION_COMMAND_KEY), actions[i]);
}
List<Lookup> allLookups = new ArrayList<Lookup>();
allLookups.add(node.getLookup());
allLookups.add(Utilities.actionsGlobalContext());
allLookups.add(Lookups.singleton(actionsMap));
Lookup lookup = new ProxyLookup(allLookups.toArray(new Lookup[allLookups.size()]));
return Utilities.actionsToPopup(actions, lookup);
}
}
return null;
}