本文整理汇总了Java中org.netbeans.jemmy.operators.JPopupMenuOperator类的典型用法代码示例。如果您正苦于以下问题:Java JPopupMenuOperator类的具体用法?Java JPopupMenuOperator怎么用?Java JPopupMenuOperator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JPopupMenuOperator类属于org.netbeans.jemmy.operators包,在下文中一共展示了JPopupMenuOperator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testNewSizeOfGap
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
public void testNewSizeOfGap() {
opDesigner = new FormDesignerOperator(FILE_NAME);
ComponentInspectorOperator cio = new ComponentInspectorOperator();
Node inspectorRootNode = new Node(cio.treeComponents(), FRAME_ROOT);
inspectorRootNode.select();
inspectorRootNode.expand();
Node buttonNode = new Node(inspectorRootNode, "jButton1 [JButton]");
buttonNode.callPopup();
JPopupMenuOperator jpmo= new JPopupMenuOperator();
waitNoEvent(500);
jpmo.pushMenuNoBlock("Edit Layout Space...");
waitNoEvent(500);
EditLayoutSpaceOperator elso = new EditLayoutSpaceOperator();
elso.setSizeOfGapTop("800");
waitNoEvent(500);
findInCode(".addContainerGap(800, Short.MAX_VALUE)", opDesigner);
}
示例2: runToCursor
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
/**
* Sets line 280 breakpoint, disables it and then continues to run to cursor
* at line 283.
*/
public void runToCursor() {
EditorOperator eo = new EditorOperator("MemoryView.java");
eo.setCaretPositionToLine(280);
new ToggleBreakpointAction().perform();
JTableOperator jTableOperator = new JTableOperator(new TopComponentOperator(BREAKPOINTS_VIEW));
jTableOperator.waitCell("Line MemoryView.java:280", 1, 0);
new JPopupMenuOperator(jTableOperator.callPopupOnCell(1, 0)).pushMenu("Disable");
MainWindowOperator.StatusTextTracer stt = MainWindowOperator.getDefault().getStatusTextTracer();
stt.start();
eo.makeComponentVisible();
eo.setCaretPositionToLine(283);
new RunToCursorAction().perform();
stt.waitText("Thread main stopped at MemoryView.java:283.");
stt.stop();
assertEquals(new EditorOperator("MemoryView.java").getLineNumber(), 283);
}
示例3: newWatch
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
/**
* Tests that it is possible to add watches.
*/
public void newWatch() throws IllegalAccessException, InvocationTargetException, InvalidExpressionException {
Node projectNode = new ProjectsTabOperator().getProjectRootNode(DEBUG_TEST_PROJECT_ANT);
Node testFile = new Node(new SourcePackagesNode(projectNode), "advanced|VariablesTest.java");
new OpenAction().perform(testFile);
EditorOperator eo = new EditorOperator("VariablesTest.java");
eo.setCaretPositionToLine(49);
new ToggleBreakpointAction().perform();
MainWindowOperator.StatusTextTracer stt = MainWindowOperator.getDefault().getStatusTextTracer();
stt.start();
new DebugJavaFileAction().perform(testFile);
stt.waitText("Thread main stopped at VariablesTest.java:49");
stt.stop();
new ActionNoBlock("Debug|New Watch...", null).perform();
NbDialogOperator newWatchDialog = new NbDialogOperator("New Watch");
new JEditorPaneOperator(newWatchDialog, 0).setText("n");
newWatchDialog.ok();
TopComponentOperator variablesView = new TopComponentOperator(new ContainerOperator(MainWindowOperator.getDefault(), VIEW_CHOOSER), "Variables");
JTableOperator variablesTable = new JTableOperator(variablesView);
assertEquals("n", variablesTable.getValueAt(0, 0).toString());
org.openide.nodes.Node.Property property = (org.openide.nodes.Node.Property) variablesTable.getValueAt(0, 2);
assertEquals("50", property.getValue());
JPopupMenuOperator menu = new JPopupMenuOperator(variablesTable.callPopupOnCell(0, 0));
menu.pushMenu("Delete All");
}
示例4: testViewsHeapWalker2
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
public void testViewsHeapWalker2() {
EditorOperator eo = new EditorOperator("MemoryView.java");
new EventTool().waitNoEvent(500);
Utilities.toggleBreakpoint(eo, 92);
Utilities.startDebugger();
Utilities.checkConsoleLastLineForText("Thread main stopped at MemoryView.java:92");
Utilities.showDebuggerView(Utilities.classesViewTitle);
TopComponentOperator tco = new TopComponentOperator(Utilities.classesViewTitle);
JTableOperator jTableOperator = new JTableOperator(tco);
JComboBoxOperator filter = new JComboBoxOperator(tco);
JPopupMenuOperator popup = new JPopupMenuOperator(jTableOperator.callPopupOnCell(0, 0));
popup.pushMenuNoBlock("Show in Instances View");
filter.clearText();
filter.pushKey(KeyEvent.VK_ENTER);
new EventTool().waitNoEvent(500);
}
示例5: verifyPopup
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
public static boolean verifyPopup(final JPopupMenuOperator popup, String[] menus) {
for (int i = 0; i < menus.length; i++) {
try {
popup.showMenuItem(menus[i]);
} catch (NullPointerException npe) {
throw new JemmyException("Popup path [" + menus[i] + "] not found.");
}
}
//close popup and wait until is not visible
popup.waitState(new ComponentChooser() {
public boolean checkComponent(Component comp) {
popup.pushKey(KeyEvent.VK_ESCAPE);
return !popup.isVisible();
}
public String getDescription() {
return "Popup menu closed";
}
});
return true;
}
示例6: deleteNode
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
/**
* Deletes a node (file, package)
* using pop-up menu
*/
public static void deleteNode(String path) {
try {
Node pn = new ProjectsTabOperator().getProjectRootNode(
Utilities.TEST_PROJECT_NAME);
if(pn != null && pn.isPresent()) {
pn.select();
Node n = new Node(pn, path);
n.select();
JPopupMenuOperator jpmo = n.callPopup();
jpmo.pushMenu("Delete");
new NbDialogOperator(CONFIRM_OBJECT_DELETION).btOK().push(); //confirm
takeANap(500);
}
} catch (TimeoutExpiredException e) {
System.out.println("Node hasn't been found!!!");
}
}
示例7: testSelectTestFromEditorContextMenu
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
/**
* Test selecting appropriate test from Editor's context menu
*/
public void testSelectTestFromEditorContextMenu() {
//open sample class
Node n = Utilities.openFile(Utilities.SRC_PACKAGES_PATH +
"|" + TEST_PACKAGE_NAME+ "|" + Utilities.TEST_CLASS_NAME);
EditorOperator eos = new EditorOperator(Utilities.TEST_CLASS_NAME);
eos.clickForPopup();
JPopupMenuOperator jpmo = new JPopupMenuOperator();
String[] sf = {"Navigate", "Go to Test/Tested class"};
Utilities.takeANap(Utilities.ACTION_TIMEOUT);
jpmo.pushMenu(sf[0]);
JMenuItemOperator jmio = new JMenuItemOperator(new JMenuOperator(jpmo, sf[0]).getItem(2));
//Check if goto test is enabled inside menu
assertTrue("Goto Test disabled when invoked from Explorer, over a class node!" +
"see: http://www.netbeans.org/issues/show_bug.cgi?id=88599",
jmio.isEnabled());
jpmo.pushMenu(sf);
EditorOperator eot = new EditorOperator(Utilities.TEST_CLASS_NAME);
assertTrue("Test for \"" + TEST_PACKAGE_NAME +
Utilities.TEST_CLASS_NAME + "\" not opened!", eot.isVisible());
eot.close(false);
eos.close(false);
}
示例8: testResultWindowOpened
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
/** Tests visiblility of results window */
public void testResultWindowOpened() {
//open Test package
Node n = Utilities.openFile(Utilities.TEST_PACKAGES_PATH +
"|" + TEST_PACKAGE_NAME + "|" + Utilities.TEST_CLASS_NAME);
Utilities.takeANap(5000);
JPopupMenuOperator jpmo = n.callPopup();
Utilities.takeANap(5000);
jpmo.pushMenu(Utilities.RUN_FILE);
Utilities.takeANap(9000);
ResultWindowOperator rwo = ResultWindowOperator.invoke();
assertTrue("Junit Output window should be visible", rwo.isVisible());
rwo.close(); //close it
assertFalse("Junit Output window is visible," +
"should be closed", rwo.isShowing());
}
示例9: performTomcatServerAction
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
private static Node performTomcatServerAction(String action) {
Node asNode = getTomcatServerNode();
asNode.select();
new EventTool().waitNoEvent(10000);
String serverIDEName = asNode.getText();
log("ServerNode name = "+serverIDEName);
JPopupMenuOperator popup = asNode.callPopup();
if (popup == null) {
throw new Error("Cannot get context menu for Tomcat server node ");
}
boolean startEnabled = popup.showMenuItem(action).isEnabled();
if(startEnabled) {
popup.pushMenuNoBlock(action);
}
return asNode;
}
示例10: performPopup
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
/**
* performs action through popup menu
*
* @param component component to be action performed on
* @throws UnsupportedOperationException when action does not support popup
* mode
*/
public void performPopup(ComponentOperator component) {
if (popupPath == null) {
throw new UnsupportedOperationException(getClass().toString() + " does not define popup path");
}
// Need to wait here to be more reliable.
// TBD - It can be removed after issue 23663 is solved.
new EventTool().waitNoEvent(500);
component.clickForPopup();
new JPopupMenuOperator(component).pushMenu(popupPath, "|", getComparator());
try {
Thread.sleep(AFTER_ACTION_WAIT_TIME);
} catch (Exception e) {
throw new JemmyException("Sleeping interrupted", e);
}
}
示例11: isEnabled
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
/**
* Checks whether this action is enabled for given ComponentOperator. First
* it makes component visible and focused. If IDE system action class is
* defined, it calls its isEnabled() method. Else if main menu path is
* defined, it checks menu item is enabled. Otherwise it throws
* UnsupportedOperationException.
*
* @param componentOperator instance of ComponentOperator
* @return true if this action is enabled; false otherwise
*/
@SuppressWarnings("unchecked")
public boolean isEnabled(ComponentOperator componentOperator) {
componentOperator.makeComponentVisible();
componentOperator.getFocus();
if (systemActionClass != null) {
return SystemAction.get(systemActionClass).isEnabled();
} else if (popupPath != null) {
// Need to wait here to be more reliable.
// TBD - It can be removed after issue 23663 is solved.
new EventTool().waitNoEvent(500);
componentOperator.clickForPopup();
return new JPopupMenuOperator(componentOperator).showMenuItem(
popupPath, "|", getComparator()).isEnabled();
} else if (menuPath != null) {
return MainWindowOperator.getDefault().menuBar().showMenuItem(
menuPath, "|", getComparator()).isEnabled();
} else {
throw new UnsupportedOperationException("Cannot detect if " + getClass().getName() + " is enabled.");
}
}
示例12: performPopup
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
/**
* performs action through popup menu
*
* @param component component to be action performed on
* @throws UnsupportedOperationException when action does not support popup
* mode
*/
@Override
public void performPopup(ComponentOperator component) {
if (popupPath == null) {
throw new UnsupportedOperationException(getClass().toString() + " does not define popup path");
}
// Need to wait here to be more reliable.
// TBD - It can be removed after issue 23663 is solved.
new EventTool().waitNoEvent(500);
component.clickForPopup();
JPopupMenuOperator popup = new JPopupMenuOperator(component);
popup.setComparator(getComparator());
popup.pushMenuNoBlock(popupPath, "|");
try {
Thread.sleep(AFTER_ACTION_WAIT_TIME);
} catch (Exception e) {
throw new JemmyException("Sleeping interrupted", e);
}
}
示例13: callPopupOnPaths
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
/** Calls popup menu on specified tree paths.
* @param paths an array of TreePath instances
* @param mouseButton mouse button identification
* @return JPopupMenu instance opened by this method
*/
public JPopupMenu callPopupOnPaths(TreePath[] paths, int mouseButton) {
oper.makeComponentVisible();
for(int i = 0; i < paths.length; i++) {
if(paths[i].getParentPath() != null) {
expandPath(paths[i].getParentPath());
}
}
selectPaths(paths);
scrollToPath(paths[paths.length - 1]);
Point point = getPointToClick(paths[paths.length - 1]);
return(JPopupMenuOperator.callPopup(oper.getSource(),
(int)point.getX(),
(int)point.getY(),
mouseButton));
}
示例14: verifyPopup
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
/**
* verifies node's popup paths for presence (without invocation)
*
* @param popupPaths String[] popup paths
*/
public void verifyPopup(String[] popupPaths) {
//invocation of root popup
final JPopupMenuOperator popup = callPopup();
for (int i = 0; i < popupPaths.length; i++) {
try {
popup.showMenuItem(popupPaths[i], "|");
} catch (NullPointerException npe) {
throw new JemmyException("Popup path [" + popupPaths[i] + "] not found.");
}
}
//close popup and wait until is not visible
popup.waitState(new ComponentChooser() {
@Override
public boolean checkComponent(Component comp) {
popup.pushKey(KeyEvent.VK_ESCAPE);
return !popup.isVisible();
}
@Override
public String getDescription() {
return "Popup menu closed";
}
});
}
示例15: pushMenuOnTab
import org.netbeans.jemmy.operators.JPopupMenuOperator; //导入依赖的package包/类
/** Makes top component active and pushes given menu on its tab.
* @param popupPath menu path separated by '|' (e.g. "CVS|Refresh")
*/
public void pushMenuOnTab(String popupPath) {
if (isOpened()) {
this.makeComponentVisible();
TabbedContainer ta = (TabbedContainer) findTabbedAdapter();
int index = ta.indexOf((TopComponent) getSource());
Rectangle r = new Rectangle();
ta.getTabRect(index, r);
Point p = new Point(r.x + (r.width / 2), r.y + (r.height / 2));
Component tabsComp = ta.getComponentAt(p);
new JPopupMenuOperator(JPopupMenuOperator.callPopup(tabsComp, p.x, p.y)).pushMenu(popupPath);
} else {
// try to find enclosing MultiviewTopComponent
TopComponentOperator parent = findParentTopComponent();
if (parent != null) {
parent.pushMenuOnTab(popupPath);
}
}
}