org.netbeans.jemmy.operators.JPopupMenuOperator Java Examples

The following examples show how to use org.netbeans.jemmy.operators.JPopupMenuOperator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: testNavigation.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void GoToLine( int iLineToGo, int iLineToCome )
{
  EditorOperator eoPHP = new EditorOperator( "EmptyPHPWebPage.php" );
  eoPHP.clickForPopup( );
  JPopupMenuOperator menu = new JPopupMenuOperator( );
  eoPHP.typeKey('g', InputEvent.CTRL_MASK);
  JDialogOperator jdGoto = new JDialogOperator( "Go to Line or Bookmark" );
  JComboBoxOperator jcLine = new JComboBoxOperator( jdGoto, 0 );
  JTextFieldOperator jtTemp = jcLine.getTextField( );
  jtTemp.setText( "" + iLineToGo );
  JButtonOperator jbGoto = new JButtonOperator( jdGoto, "Go To" );
  jbGoto.push( );
  jdGoto.waitClosed( );
  int iLine = eoPHP.getLineNumber( );
  if( iLineToCome != iLine )
  {
    fail( "Navigate go to line came to incorrect one. Found: " + iLine + ", expected: " + iLineToCome );
  }
}
 
Example #2
Source File: Action.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #3
Source File: GeneralPHP.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void SetTagsSupport(String sTag, String sProject, boolean b) {
    // Open project properties
    ProjectsTabOperator pto = new ProjectsTabOperator();
    ProjectRootNode prn = pto.getProjectRootNode(sProject);
    prn.select();
    prn.callPopup();
    JPopupMenuOperator popup = new JPopupMenuOperator();
    popup.pushMenuNoBlock("Properties");
    JDialogOperator jdProperties = new JDialogOperator("Project Properties - ");
    // Set support
    JCheckBoxOperator box = new JCheckBoxOperator(jdProperties, sTag);
    if (box.isSelected() ^ b) {
        box.clickMouse();
    }
    //Sleep( 10000 );
    // Close dialog
    JButtonOperator bOk = new JButtonOperator(jdProperties, "OK");
    bOk.push();
    jdProperties.waitClosed();
}
 
Example #4
Source File: CommonUtilities.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #5
Source File: CloseScriptingFilesTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void prepare() {
    String path = nodePath + "|" + fileName;
    fileToBeOpened = new Node(getProjectNode(testProject), path);
    JPopupMenuOperator popup = fileToBeOpened.callPopup();
    if (popup == null) {
        throw new Error("Cannot get context menu for node [" + fileToBeOpened.getPath() + "] in project [" + testProject + "]");
    }
    try {
        popup.pushMenu(menuItem);
    } catch (org.netbeans.jemmy.TimeoutExpiredException tee) {
        tee.printStackTrace(getLog());
        throw new Error("Cannot push menu item [" + menuItem + "] of node [" + fileToBeOpened.getPath() + "] in project [" + testProject + "]");
    }
    editor = new EditorOperator(this.fileName);
}
 
Example #6
Source File: Action.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * 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.");
    }
}
 
Example #7
Source File: ResultsWindowTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** 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());
}
 
Example #8
Source File: GotoTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #9
Source File: testFormatting.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void Format_default_code_of_PHP_web_page() {
    startTest();

    EditorOperator eoPHP = new EditorOperator("EmptyPHPWebPage.php");
    String sTextOriginal = eoPHP.getText();
    Sleep(1000);
    eoPHP.clickForPopup();
    Sleep(1000);
    JPopupMenuOperator menu = new JPopupMenuOperator();
    menu.pushMenu("Format");
    String sTextFormatted = eoPHP.getText();

    if (!sTextOriginal.equals(sTextFormatted)) {
        fail("Default formatting is not valid.");
    }

    endTest();
}
 
Example #10
Source File: Utilities.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * 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!!!");
    }
}
 
Example #11
Source File: ActionNoBlock.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #12
Source File: testFormatting.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void Format_default_code_of_PHP_file() {
    startTest();

    EditorOperator eoPHP = new EditorOperator("EmptyPHP.php");
    String sTextOriginal = eoPHP.getText();
    Sleep(1000);
    eoPHP.clickForPopup();
    Sleep(1000);
    JPopupMenuOperator menu = new JPopupMenuOperator();
    menu.pushMenu("Format");
    String sTextFormatted = eoPHP.getText();

    if (!sTextOriginal.equals(sTextFormatted)) {
        fail("Default formatting is not valid. BUG 181339 may be still valid.");
    }

    endTest();
}
 
Example #13
Source File: testFormatting.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void Undo_Formatting_of_PHP_file() {
    startTest();

    EditorOperator eoPHP = new EditorOperator("EmptyPHP.php");
    String sTextOriginal = eoPHP.getText();
    eoPHP.setCaretPosition(0);
    eoPHP.insert("                          ");
    String sTextChanged = eoPHP.getText();
    Sleep(1000);
    eoPHP.clickForPopup();
    Sleep(1000);
    JPopupMenuOperator menu = new JPopupMenuOperator();
    menu.pushMenu("Format");
    new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenu("Edit|Undo");
    Sleep(5000);
    new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenu("Edit|Undo");
    Sleep(5000);
    String sTextUndo = eoPHP.getText();
    if (!sTextOriginal.equals(sTextUndo)) {
        fail("Undo formatting is not valid. Expected: \n" + sTextOriginal + " but was \n" + sTextUndo);
    }

    endTest();
}
 
Example #14
Source File: DefaultJMenuDriver.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected JPopupMenu waitPopupMenu(final ComponentOperator oper) {
    return ((JPopupMenu) JPopupMenuOperator.waitJPopupMenu(new ComponentChooser() {
        @Override
        public boolean checkComponent(Component comp) {
            return (comp == ((JMenuOperator) oper).getPopupMenu()
                    && comp.isShowing());
        }

        @Override
        public String getDescription() {
            return ((JMenuOperator) oper).getText() + "'s popup";
        }

        @Override
        public String toString() {
            return "waitPopupMenu.ComponentChooser{description = " + getDescription() + '}';
        }
    }).getSource());
}
 
Example #15
Source File: OpenWebFilesTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public ComponentOperator open() {
    JPopupMenuOperator popup = openNode.callPopup();
    if (popup == null) {
        fail("Cannot get context menu for node [" + WEB_PAGES + (fileFolder.equals("") ? "" : "|") + fileFolder + '|' + fileName + "] in project [" + fileProject + "]");
    } else {
        log("------------------------- after popup invocation ------------");
        try {
            popup.pushMenu(menuItem);
        } catch (org.netbeans.jemmy.TimeoutExpiredException tee) {
            fail("Cannot push menu item " + menuItem + " of node [" + WEB_PAGES + (fileFolder.equals("") ? "" : "|") + fileFolder + '|' + fileName + "] in project [" + fileProject + "]");
        }
    }
    log("------------------------- after open ------------");
    return null;
}
 
Example #16
Source File: TreeTableOperator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** 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));
}
 
Example #17
Source File: OpenServletFileTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public ComponentOperator open() {
    JPopupMenuOperator popup = openNode.callPopup();
    if (popup == null) {
        fail("Cannot get context menu for node [" + "Source Packages" + '|' + filePackage + '|' + fileName + "] in project [" + fileProject + "]");
    } else {
        log("------------------------- after popup invocation ------------");
        try {
            repaintManager().addRegionFilter(LoggingRepaintManager.EDITOR_FILTER);
            popup.pushMenu(menuItem);
        } catch (org.netbeans.jemmy.TimeoutExpiredException tee) {
            fail("Cannot push menu item " + menuItem + " of node [" + "Source Packages" + '|' + filePackage + '|' + fileName + "] in project [" + fileProject + "]");
        }
    }
    log("------------------------- after open ------------");
    return new EditorOperator(fileName);
}
 
Example #18
Source File: Utilities.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #19
Source File: OutlineViewOperator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** 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));
}
 
Example #20
Source File: ViewsTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #21
Source File: AntSanityTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * 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");
}
 
Example #22
Source File: Node.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * 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";
        }
    });
}
 
Example #23
Source File: AntSanityTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #24
Source File: GapsTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #25
Source File: GeneralCSSPrep.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void clickForTextPopup(EditorOperator eo, String menu) {
    JEditorPaneOperator txt = eo.txtEditorPane();
    JEditorPane epane = (JEditorPane) txt.getSource();
    try {
        Rectangle rct = epane.modelToView(epane.getCaretPosition());
        txt.clickForPopup(rct.x, rct.y);
        JPopupMenuOperator popup = new JPopupMenuOperator();
        popup.pushMenu(menu);
    } catch (BadLocationException ex) {
        System.out.println("=== Bad location");
    }
}
 
Example #26
Source File: ScriptingProjectNodePopupTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Directly sends mouse events causing popup menu displaying to the selected
 * node.
 * <p>
 * Using Jemmy/Jelly to call popup can cause reselecting of node and more
 * events than is desirable for this case.
 *
 * @return JPopupMenuOperator instance
 */
public ComponentOperator open() {
    /* it stopped to work after a while, see issue 58790
     java.awt.Point p = dataObjectNode.tree().getPointToClick(dataObjectNode.getTreePath());
     JPopupMenu menu = callPopup(dataObjectNode.tree(), p.x, p.y, java.awt.event.InputEvent.BUTTON3_MASK);
     return new JPopupMenuOperator(menu);
     */
    java.awt.Point point = dataObjectNode.tree().getPointToClick(dataObjectNode.getTreePath());
    dataObjectNode.tree().clickForPopup(point.x, point.y);
    return new JPopupMenuOperator();
}
 
Example #27
Source File: WidgetOperator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Performs popup action on this widget and no block further execution.
 *
 * @param popupPath path of popup menu item (e.g. 'Go|Next')
 */
public void performPopupActionNoBlock(String popupPath) {
    Point center = getCenter();
    getViewOperator().clickForPopup(center.x, center.y);
    JPopupMenuOperator popupOper = new JPopupMenuOperator();
    popupOper.setComparator(getComparator());
    popupOper.pushMenuNoBlock(popupPath, "|", getComparator());
}
 
Example #28
Source File: WebProjectsNodesViewPopupMenuTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public ComponentOperator open() {
    java.awt.Point point = dataObjectNode.tree().getPointToClick(dataObjectNode.getTreePath());
    int button = JTreeOperator.getPopupMouseButton();
    dataObjectNode.tree().clickMouse(point.x, point.y, 1, button);
    return new JPopupMenuOperator();
}
 
Example #29
Source File: OpenJ2EEFilesTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public ComponentOperator open() {
    JPopupMenuOperator popup = openNode.callPopup();
    if (popup == null) {
        throw new Error("Cannot get context menu for node [" + filePath + "] in project [" + fileProject + "]");
    }
    log("------------------------- after popup invocation ------------");
    try {
        popup.pushMenu(menuItem);
    } catch (org.netbeans.jemmy.TimeoutExpiredException tee) {
        throw new Error("Cannot push menu item " + menuItem + " of node [" + filePath + "] in project [" + fileProject + "]");
    }
    log("------------------------- after open ------------");
    return new TopComponentOperator(editorTitle);
}
 
Example #30
Source File: GapsTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testpopUpDialogOnButton() {
    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.verify();
    
    assertEquals("default small", (String) elso.cbBottom().getItemAt(0));
    assertEquals("default medium", (String) elso.cbBottom().getItemAt(1));
    assertEquals("default large", (String) elso.cbBottom().getItemAt(2));
    
    assertEquals("default", (String) elso.cbLeft().getItemAt(0));
    elso.Cancel();
}