org.netbeans.jemmy.operators.JTabbedPaneOperator Java Examples

The following examples show how to use org.netbeans.jemmy.operators.JTabbedPaneOperator. 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: JTabMouseDriver.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void selectItem(final ComponentOperator oper, final int index) {
    if (index != -1) {
        queueTool.invokeSmoothly(new QueueTool.QueueAction<Void>("Selecting tab " + index + " using mouse") {
            @Override
            public Void launch() {
                Rectangle rect = ((JTabbedPaneOperator) oper).
                        getUI().
                        getTabBounds((JTabbedPane) oper.getSource(),
                                index);
                DriverManager.getMouseDriver(oper).
                        clickMouse(oper,
                                (int) (rect.getX() + rect.getWidth() / 2),
                                (int) (rect.getY() + rect.getHeight() / 2),
                                1, Operator.getDefaultMouseButton(), 0,
                                oper.getTimeouts().create("ComponentOperator.MouseClickTimeout"));
                return null;
            }
        });
    }
}
 
Example #2
Source File: xml.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void WaitTab( JTabbedPaneOperator tabs, String name, int count )
{
  int iCount = 0;
  int iIndex = tabs.findPage( "Available" );
  //System.out.println( "+++" + iIndex );
  Pattern p = Pattern.compile( "Available Plugins [(]([0-9]+)[)]" );
  while( true )
  {
    String s = tabs.getTitleAt( iIndex );
    //System.out.println( "+++\"" + s + "\"" );
    Matcher m = p.matcher( s );
    if( m.find( ) )
    {
      int iAvailable = Integer.parseInt( m.group( 1 ) );
      if( iAvailable >= count )
        return; // SUCCESS
    }
    if( ++iCount > 60 )
      fail( "Too long wait for available plugins." );
    Sleep( 1000 );
  }
}
 
Example #3
Source File: Autoupdate.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void CheckUpdated( )
{
  startTest( );

  // Open
  new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenuNoBlock("Tools|Plugins");

  JDialogOperator jdPlugins = new JDialogOperator( "Plugins" );

  JTabbedPaneOperator jtTabs = new JTabbedPaneOperator( jdPlugins, 0 );
  jtTabs.setSelectedIndex( jtTabs.findPage( "Updated" ) );

  // Close by button
  JButtonOperator jbClose = new JButtonOperator( jdPlugins, "Close" );
  jbClose.push( );
  jdPlugins.waitClosed( );

  endTest( );
}
 
Example #4
Source File: CodeTemplatesOperator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public CodeTemplatesOperator setContext(Set<String> set) {
    JTabbedPaneOperator tabbedPane = getTabbedPane();
    tabbedPane.selectPage("Contexts");
    ContainerOperator<JEditorPane> selectedComponent = new ContainerOperator<>((Container)tabbedPane.getSelectedComponent());
    JListOperator list = new JListOperator(selectedComponent);
    for (int i = 0; i < list.getModel().getSize(); i++) {
        JCheckBox checkBox = (JCheckBox) list.getRenderedComponent(i);
        String contextName = checkBox.getText();
        list.scrollToItem(i);
        if(!checkBox.isSelected() && set.contains(contextName)) {
            list.selectItem(i);
        } else if(checkBox.isSelected() && !set.contains(contextName)) {
            list.selectItem(i);
        }            
    }   
    return this;
    
}
 
Example #5
Source File: ParserIssueTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testBuild() {
    //open existing Java SE project
    Project p = (Project) ProjectSupport.openProject(new File(getDataDir(), "projects/Sample"));
    //set Ant verbosity level to "Debug"
    OptionsOperator oo = OptionsOperator.invoke();
    oo.selectJava();
    JTabbedPaneOperator jtpo = new JTabbedPaneOperator(oo);
    jtpo.selectPage("Ant"); // NOI18N
    JComboBoxOperator jcbo = new JComboBoxOperator(oo);
    jcbo.selectItem("Debug");
    oo.ok();
    //open output window
    new OutputWindowViewAction().perform();
    //build project
    Node n = ProjectsTabOperator.invoke().getProjectRootNode("Sample"); 
    new BuildJavaProjectAction().perform(n);
    try {
        Thread.sleep(10000);
    } catch (InterruptedException ie) {
        //ignore
    }
    String output = new OutputTabOperator("Sample").getText();
    assertTrue("build action output: \n" + output, output.contains("BUILD SUCCESSFUL")); //NOI18N
}
 
Example #6
Source File: SurroundTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testNoLogging() {
       String file = "Surround";
openSourceFile("org.netbeans.test.java.hints.HintsTest",file);        
       OptionsOperator oo = OptionsOperator.invoke();
       oo.selectEditor();
       JTabbedPaneOperator jtpo = new JTabbedPaneOperator(oo);
       jtpo.selectPage("Hints");
       JSplitPaneOperator jspo = new JSplitPaneOperator(oo);       
       JTreeOperator jto = new JTreeOperator(jtpo);                        
       selectHintNode(jto,"errors","Surround with try-catch");
       JCheckBoxOperator chbox1 = new JCheckBoxOperator(new ContainerOperator((Container)jspo.getRightComponent()),"Use org.openide.util.Exceptions.printStackTrace" );        
       chBoxSetSelected(chbox1, false);        
       JCheckBoxOperator chbox2 = new JCheckBoxOperator(new ContainerOperator((Container)jspo.getRightComponent()),"Use java.util.logging.Logger");        
       chBoxSetSelected(chbox2, false);        
       oo.ok();        
       new EventTool().waitNoEvent(1000);
       editor = new EditorOperator(file);
editor.setCaretPosition(18,1);
String pattern = ".*"+
       "try \\{.*"+
       "    FileReader fr = new FileReader\\(\"file\"\\);.*"+
       "\\} catch \\(FileNotFoundException ex\\) \\{.*"+
       "    ex.printStackTrace\\(\\);.*"+
       "\\}.*";        
       useHint("Surround Statement",new String[]{"Add throws","Surround Block","Surround Statement"},pattern);
   }
 
Example #7
Source File: SurroundTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testLoggerLogging() {
       String file = "Surround";
openSourceFile("org.netbeans.test.java.hints.HintsTest",file);        
       OptionsOperator oo = OptionsOperator.invoke();
       oo.selectEditor();
       JTabbedPaneOperator jtpo = new JTabbedPaneOperator(oo);
       jtpo.selectPage("Hints");
       JSplitPaneOperator jspo = new JSplitPaneOperator(oo);       
       JTreeOperator jto = new JTreeOperator(jtpo);
       selectHintNode(jto,"errors","Surround with try-catch");                
       JCheckBoxOperator chbox1 = new JCheckBoxOperator(new ContainerOperator((Container)jspo.getRightComponent()),"Use org.openide.util.Exceptions.printStackTrace" );
       chBoxSetSelected(chbox1, false);
       JCheckBoxOperator chbox2 = new JCheckBoxOperator(new ContainerOperator((Container)jspo.getRightComponent()),"Use java.util.logging.Logger");
       chBoxSetSelected(chbox2, true);
       oo.ok();
       new EventTool().waitNoEvent(1000);
       editor = new EditorOperator(file);
editor.setCaretPosition(18,1);
String pattern = ".*"+
       "try \\{.*"+
       "    FileReader fr = new FileReader\\(\"file\"\\);.*"+
       "\\} catch \\(FileNotFoundException ex\\) \\{.*"+
       "    Logger.getLogger\\(Surround.class.getName\\(\\)\\).log\\(Level.SEVERE, null, ex\\);.*"+
       "\\}.*";        
       useHint("Surround Statement",new String[]{"Add throws","Surround Block","Surround Statement"},pattern);
   }
 
Example #8
Source File: AddMethodTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void fillExceptions(NbDialogOperator dialog) {
    if (exceptions != null) {
        new JTabbedPaneOperator(dialog).selectPage("Exceptions");
        for (int i = 0; i < exceptions.length; i++) {
            new JButtonOperator(dialog, "Add").pushNoBlock();
            NbDialogOperator findTypeOper = new NbDialogOperator("Find Type");
            new JTextFieldOperator(findTypeOper).setText(exceptions[i]);
            // wait for list populated
            JListOperator typesListOper = new JListOperator(findTypeOper);
            if (exceptions[i].equals("Exception")) {
                // need to select correct item between other matches
                typesListOper.selectItem("Exception (java.lang)");
            } else {
                typesListOper.selectItem(exceptions[i]);
            }
            findTypeOper.ok();
        }
    }
}
 
Example #9
Source File: IndentCasesTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static void setIndent(int number){
    OptionsOperator options = OptionsOperator.invoke();
    options.selectEditor();
    new JTabbedPaneOperator(options).selectPage("Formatting");
    JLabelOperator label = new JLabelOperator(options, "Number");
    JSpinner spinner = (JSpinner) label.getLabelFor();
    JSpinnerOperator spinnerOp = new JSpinnerOperator(spinner);
    spinnerOp.getNumberSpinner().scrollToValue(number);
    options.ok();
}
 
Example #10
Source File: OutputOperator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Returns active OutputTabOperator instance regardless it is the only one in
 * output or it is in tabbed pane.
 * @return active OutputTabOperator instance
 */
private OutputTabOperator getActiveOutputTab() {
    OutputTabOperator outputTabOper;
    if(null != JTabbedPaneOperator.findJTabbedPane((Container)getSource(), ComponentSearcher.getTrueChooser(""))) {
        outputTabOper = new OutputTabOperator(((JComponent)new JTabbedPaneOperator(this).getSelectedComponent()));
        outputTabOper.copyEnvironment(this);
    } else {
        outputTabOper = new OutputTabOperator("");
    }
    return outputTabOper;
}
 
Example #11
Source File: PluginsOperator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Changes current selected tab to "Updates"
 * @return JTabbedPaneOperator instance
 */
public JTabbedPaneOperator selectUpdates() {
    String updatesTitle = Bundle.getStringTrimmed(
            "org.netbeans.modules.autoupdate.ui.Bundle",
            "PluginManagerUI_UnitTab_Update_Title");
    return selectTab(updatesTitle);
}
 
Example #12
Source File: PluginsOperator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Changes current selected tab to "Downloaded"
 * @return JTabbedPaneOperator of parent tabbed pane
 */
public JTabbedPaneOperator selectDownloaded() {
    String downloadedTitle = Bundle.getString(
            "org.netbeans.modules.autoupdate.ui.Bundle",
            "PluginManagerUI_UnitTab_Local_Title");
    return selectTab(downloadedTitle);
}
 
Example #13
Source File: PluginsOperator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Changes current selected tab to "Settings"
 * @return JTabbedPaneOperator instance
 */
public JTabbedPaneOperator selectSettings() {
    String settingsTitle = Bundle.getStringTrimmed(
            "org.netbeans.modules.autoupdate.ui.Bundle",
            "SettingsTab_displayName");
    return selectTab(settingsTitle);
}
 
Example #14
Source File: AddMethodTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void fillParameters(NbDialogOperator dialog) {
    if (parameters != null) {
        new JTabbedPaneOperator(dialog).selectPage("Parameters");
        JTableOperator operator = new JTableOperator(dialog);

        for (int i = 0; i < parameters.length; i++) {
            new JButtonOperator(dialog, "Add").push();
            int rowCount = operator.getRowCount();
            // use setValueAt for combo box because changeCellObject may accidentally close dialog
            operator.setValueAt(parameters[i][0], rowCount - 1, 1);
            // use changeCellObject for text field to confirm changes
            operator.changeCellObject(rowCount - 1, 0, parameters[i][1]);
        }
    }
}
 
Example #15
Source File: ProfilerValidationTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Test Profiler options.
 */
public void testOptions() {
    OptionsOperator options = OptionsOperator.invoke();
    options.selectJava();
    JTabbedPaneOperator tabbedPane = new JTabbedPaneOperator(options);
    tabbedPane.selectPage("Profiler");
    JListOperator categoriesOper = new JListOperator(options);
    // General category
    assertEquals("Wrong profiling port.", 5140, new JSpinnerOperator(options).getValue());
    // manage calibration data
    new JButtonOperator(options, "Manage").pushNoBlock();
    NbDialogOperator manageOper = new NbDialogOperator("Manage Calibration data");
    JTableOperator platformsOper = new JTableOperator(manageOper);
    platformsOper.selectCell(0, 0);
    new JButtonOperator(manageOper, "Calibrate").pushNoBlock();
    new NbDialogOperator("Information").ok();
    manageOper.closeByButton();
    // reset
    new JButtonOperator(options, "Reset").push();
    // Snapshots category
    categoriesOper.selectItem("Snapshots");
    JLabelOperator lblSnapshotOper = new JLabelOperator(options, "When taking snapshot:");
    assertEquals("Wrong value for " + lblSnapshotOper.getText(), "Open snapshot", new JComboBoxOperator((JComboBox) lblSnapshotOper.getLabelFor()).getSelectedItem());
    JLabelOperator lblOpenOper = new JLabelOperator(options, "Open automatically:");
    assertEquals("Wrong value for " + lblOpenOper.getText(), "On first saved snapshot", new JComboBoxOperator((JComboBox) lblOpenOper.getLabelFor()).getSelectedItem());
    // Engine category
    categoriesOper.selectItem("Engine");
    JLabelOperator lblSamplingOper = new JLabelOperator(options, "Sampling frequency");
    assertEquals("Wrong value for " + lblSamplingOper.getText(), 10, new JSpinnerOperator((JSpinner) lblSamplingOper.getLabelFor()).getValue());
    options.cancel();
}
 
Example #16
Source File: SyntaxHighlightTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void changeSetting(int category,int color) {
       OptionsOperator odop = OptionsOperator.invoke();
odop.selectFontAndColors();
JTabbedPaneOperator jtpo = new JTabbedPaneOperator(odop, "Syntax");
jtpo.selectPage(0);
JListOperator jlo = new JListOperator(jtpo, 0);
jlo.selectItem(category);
JComboBoxOperator jcbo = new JComboBoxOperator(jtpo, 1); //change FG
jcbo.selectItem(color); //select fg color
JButtonOperator okOperator = new JButtonOperator(odop, "OK");
okOperator.push(); //confirm OD
   }
 
Example #17
Source File: TabbedPaneDemoTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void testTabs(JFrameOperator mainFrame, String tabPlacement) throws Exception {
    ContainerOperator<?> rbCont = getLabeledContainerOperator(mainFrame, TAB_PLACEMENT);
    new JRadioButtonOperator(rbCont, tabPlacement).doClick();

    final String[] tabTitles = new String[]{CAMILLE, MIRANDA, EWAN, BOUNCE};
    for (int i = 0; i < tabTitles.length; i++) {
        String pageTitle = tabTitles[i];
        JTabbedPaneOperator tabOperator = new JTabbedPaneOperator(mainFrame);
        tabOperator.setVerification(true);
        tabOperator.selectPage(pageTitle);
    }
}
 
Example #18
Source File: ToggleButtonDemoTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test() throws Exception {
    new ClassReference(ToggleButtonDemo.class.getCanonicalName()).startApplication();

    JFrameOperator mainFrame = new JFrameOperator(ToggleButtonDemo.class.getAnnotation(DemoProperties.class).value());
    JTabbedPaneOperator tabPane = new JTabbedPaneOperator(mainFrame);

    // Radio Button Toggles
    testRadioButtons(getBorderTitledJPanelOperator(mainFrame, TEXT_RADIO_BUTTONS), 3, null);
    testRadioButtons(getBorderTitledJPanelOperator(mainFrame, IMAGE_RADIO_BUTTONS), 3, null);
    testRadioButtons(getLabeledContainerOperator(mainFrame, PAD_AMOUNT), 3, (t, i) -> DEFAULT.equals(t));

    // switch to the Check Boxes Tab
    tabPane.selectPage(CHECK_BOXES);

    // Check Box Toggles
    ContainerOperator<?> textCheckBoxesJPanel = getBorderTitledJPanelOperator(mainFrame, TEXT_CHECKBOXES);
    testCheckBox(textCheckBoxesJPanel, CHECK1, false);
    testCheckBox(textCheckBoxesJPanel, CHECK2, false);
    testCheckBox(textCheckBoxesJPanel, CHECK3, false);

    ContainerOperator<?> imageCheckBoxesJPanel = getBorderTitledJPanelOperator(mainFrame, IMAGE_CHECKBOXES);
    testCheckBox(imageCheckBoxesJPanel, CHECK1, false);
    testCheckBox(imageCheckBoxesJPanel, CHECK2, false);
    testCheckBox(imageCheckBoxesJPanel, CHECK3, false);

    ContainerOperator<?> displayOptionsContainer = getLabeledContainerOperator(mainFrame, DISPLAY_OPTIONS);
    testCheckBox(displayOptionsContainer, PAINT_BORDER, false);
    testCheckBox(displayOptionsContainer, PAINT_FOCUS, true);
    testCheckBox(displayOptionsContainer, ENABLED, true);
    testCheckBox(displayOptionsContainer, CONTENT_FILLED, true);

    // Direction Button Toggles
    testToggleButtons(mainFrame);
}
 
Example #19
Source File: JTabAPIDriver.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void selectItem(final ComponentOperator oper, final int index) {
    if (index != -1) {
        queueTool.invokeSmoothly(new QueueTool.QueueAction<Void>("Selecting tab " + index + " by setting selectedIndex") {
            @Override
            public Void launch() {
                ((JTabbedPaneOperator) oper).setSelectedIndex(index);
                return null;
            }
        });
    }
}
 
Example #20
Source File: DefaultVisualizer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Switches tabs to make the component visible.
 *
 * @param tabOper an operator representing a tabbed pane.
 * @param target a component - target to be made visible.
 */
protected void switchTab(JTabbedPaneOperator tabOper, Component target) {
    int tabInd = 0;
    for (int j = 0; j < tabOper.getTabCount(); j++) {
        if (target == tabOper.getComponentAt(j)) {
            tabInd = j;
            break;
        }
    }
    if (tabOper.getSelectedIndex() != tabInd) {
        tabOper.selectPage(tabInd);
    }
}
 
Example #21
Source File: ProfilerValidationTest.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Test Profiler options.
 */
public void testOptions() {
    OptionsOperator options = OptionsOperator.invoke();
    options.selectJava();
    JTabbedPaneOperator tabbedPane = new JTabbedPaneOperator(options);
    tabbedPane.selectPage("Profiler");
    JListOperator categoriesOper = new JListOperator(options);
    // General category
    assertEquals("Wrong profiling port.", 5140, new JSpinnerOperator(options).getValue());
    // manage calibration data
    new JButtonOperator(options, "Manage").pushNoBlock();
    NbDialogOperator manageOper = new NbDialogOperator("Manage Calibration data");
    JTableOperator platformsOper = new JTableOperator(manageOper);
    platformsOper.selectCell(0, 0);
    new JButtonOperator(manageOper, "Calibrate").pushNoBlock();
    new NbDialogOperator("Information").ok();
    manageOper.closeByButton();
    // reset
    new JButtonOperator(options, "Reset").push();
    // Snapshots category
    categoriesOper.selectItem("Snapshots");
    JLabelOperator lblSnapshotOper = new JLabelOperator(options, "When taking snapshot:");
    assertEquals("Wrong value for " + lblSnapshotOper.getText(), "Open snapshot", new JComboBoxOperator((JComboBox) lblSnapshotOper.getLabelFor()).getSelectedItem());
    JLabelOperator lblOpenOper = new JLabelOperator(options, "Open automatically:");
    assertEquals("Wrong value for " + lblOpenOper.getText(), "On first saved snapshot", new JComboBoxOperator((JComboBox) lblOpenOper.getLabelFor()).getSelectedItem());
    // Engine category
    categoriesOper.selectItem("Engine");
    JLabelOperator lblSamplingOper = new JLabelOperator(options, "Sampling frequency");
    assertEquals("Wrong value for " + lblSamplingOper.getText(), 10, new JSpinnerOperator((JSpinner) lblSamplingOper.getLabelFor()).getValue());
    options.cancel();
}
 
Example #22
Source File: FoDSearchInOptionsTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void searchFor(String searchTxt, String[] selectedTabIndexes, String[] selectedCategories, ArrayList<String> enabledCategories, String clusterName) {
      jTextFieldOperator.setText(searchTxt);
      new EventTool().waitNoEvent(500);
      jTextFieldOperator.pushKey(KeyEvent.VK_ENTER);
      new EventTool().waitNoEvent(1000);
      for (int i = 0; i < selectedCategories.length; i++) {
          String selectedCategory = selectedCategories[i];
          if (selectedCategory.equals("General")) { // NOI18N
              optionsOperator.selectGeneral();
          } else if (selectedCategory.equals("Editor")) { // NOI18N
              optionsOperator.selectEditor();
          } else if (selectedCategory.equals("FontsAndColors")) { // NOI18N
              optionsOperator.selectFontAndColors();
          } else if (selectedCategory.equals("Keymaps")) { // NOI18N
              optionsOperator.selectKeymap();
          } else if (selectedCategory.equals("Java")) { // NOI18N
              optionsOperator.selectJava();
          } else if (selectedCategory.equals("Miscellaneous")) { // NOI18N
              optionsOperator.selectMiscellaneous();
          } else if (selectedCategory.equals("PHP") || selectedCategory.equals("C/C++")) { // NOI18N
              optionsOperator.selectCategory(selectedCategory);
          }
          new EventTool().waitNoEvent(1000);
          String selectedTabTitle = selectedTabIndexes[i];
          if (selectedTabTitle != null) {
              jTabbedPaneOperator = new JTabbedPaneOperator(optionsOperator);
              assertEquals(selectedTabTitle, jTabbedPaneOperator.getTitleAt(jTabbedPaneOperator.getSelectedIndex()));
if(clusterName != null) {
    JLabelOperator jLabelOperator = new JLabelOperator(jTabbedPaneOperator);
    assertEquals("In order to use this functionality, support for "+clusterName+" must be activated.", jLabelOperator.getText()); // NOI18N
}
          }
      }
      for (String category : enabledCategories) {
          assertTrue(getJLabelOperator(category).isEnabled());
      }
  }
 
Example #23
Source File: SearchInOptionsTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void searchFor(String searchTxt, String[] selectedTabTitles, String[] selectedCategories, ArrayList<String> enabledCategories) {
    jTextFieldOperator.setText(searchTxt);
    new EventTool().waitNoEvent(500);
    jTextFieldOperator.pushKey(KeyEvent.VK_ENTER);
    new EventTool().waitNoEvent(1000);
    for (int i = 0; i < selectedCategories.length; i++) {
        String selectedCategory = selectedCategories[i];
        if (selectedCategory.equals("General")) {
            optionsOperator.selectGeneral();
        } else if (selectedCategory.equals("Editor")) {
            optionsOperator.selectEditor();
        } else if (selectedCategory.equals("FontsAndColors")) {
            optionsOperator.selectFontAndColors();
        } else if (selectedCategory.equals("Keymaps")) {
            optionsOperator.selectKeymap();
        } else if (selectedCategory.equals("Java")) {
            optionsOperator.selectJava();
        } else if (selectedCategory.equals("Miscellaneous")) {
            optionsOperator.selectMiscellaneous();
        } else if (selectedCategory.equals("PHP") || selectedCategory.equals("C/C++")) {
            optionsOperator.selectCategory(selectedCategory);
        }
        new EventTool().waitNoEvent(1000);
        String selectedTabTitle = selectedTabTitles[i];
        if (selectedTabTitle != null) {
            jTabbedPaneOperator = new JTabbedPaneOperator(optionsOperator);
            assertEquals(selectedTabTitle, jTabbedPaneOperator.getTitleAt(jTabbedPaneOperator.getSelectedIndex()));
        }
    }
    for (String category : enabledCategories) {
        assertTrue(getJLabelOperator(category).isEnabled());
    }
}
 
Example #24
Source File: Autoupdate.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void CheckDownloaded( )
{
  startTest( );

  // Open
  new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenuNoBlock("Tools|Plugins");

  JDialogOperator jdPlugins = new JDialogOperator( "Plugins" );

  JTabbedPaneOperator jtTabs = new JTabbedPaneOperator( jdPlugins, 0 );
  jtTabs.setSelectedIndex( jtTabs.findPage( "Downloaded" ) );

  // Check buttons
  JButtonOperator jbAdd = new JButtonOperator( jdPlugins, "Add Plugins..." );
  JButtonOperator jbInstall = new JButtonOperator( jdPlugins, "Install" );

  // Check table
  JTableOperator jtTable = new JTableOperator( jdPlugins, 0 );
  int iOriginalRows = jtTable.getRowCount( );

  // Close by button
  JButtonOperator jbClose = new JButtonOperator( jdPlugins, "Close" );
  jbClose.push( );
  jdPlugins.waitClosed( );

  endTest( );
}
 
Example #25
Source File: JavaCompletionInEditorTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize() {
    repaintManager().addRegionFilter(COMPLETION_FILTER);
    new OptionsViewAction().performMenu();
    oo = new OptionsOperator();
    oo.selectEditor();
    new JTabbedPaneOperator(oo).selectPage("Code Completion");
    new JCheckBoxOperator(oo,"Auto Popup Documentation Window").changeSelection(false);
    oo.ok();
    new OpenAction().performAPI(new Node(new SourcePackagesNode("PerformanceTestData"), "org.netbeans.test.performance|Main.java"));
    editorOperator = EditorWindowOperator.getEditor("Main.java");
    editorOperator.setCaretPositionToLine(lineNumber);
    editorOperator.insert(ccText);
    MY_END_EVENT = ActionTracker.TRACK_COMPONENT_SHOW;
}
 
Example #26
Source File: FindUsagesMethodTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testTabName() {
    FindUsagesMethodTest.browseChild = false;
    findUsages("fumethod", "Test", 47, 19, FIND_USAGES | NOT_SEARCH_IN_COMMENTS);
    findUsages("fumethod", "Test", 47, 19, FIND_USAGES | NOT_SEARCH_IN_COMMENTS);
    FindUsagesMethodTest.browseChild = true;

    RefactoringResultOperator furo = RefactoringResultOperator.getFindUsagesResult();
    JTabbedPaneOperator tabbedPane = furo.getTabbedPane();
    assertNotNull(tabbedPane);

    String title = tabbedPane.getTitleAt(tabbedPane.getTabCount() - 1);
    ref(title);
    getRef().flush();
}
 
Example #27
Source File: FindUsagesClassTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testTabNamesClass(){
	browseChild = false;
	findUsages("fu", "FUClass", 48, 19, FIND_USAGES | NOT_SEARCH_IN_COMMENTS);
	findUsages("fu", "FUClass", 48, 19, FIND_USAGES | NOT_SEARCH_IN_COMMENTS);
	browseChild = true;
	RefactoringResultOperator furo = RefactoringResultOperator.getFindUsagesResult();
	JTabbedPaneOperator tabbedPane = furo.getTabbedPane();
	assertNotNull(tabbedPane);
	String title = tabbedPane.getTitleAt(tabbedPane.getTabCount() - 1);
	ref(title);
}
 
Example #28
Source File: CodeTemplatesOperator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void switchToTemplates() {
    optionsOperator.selectEditor();
    Component findComponent = optionsOperator.findSubComponent(new JTabbedPaneOperator.JTabbedPaneFinder());
    JTabbedPaneOperator tabbedPane = new JTabbedPaneOperator((JTabbedPane) findComponent);
    tabbedPane.selectPage("Code Templates");
    panel = new ContainerOperator<>((Container) tabbedPane.getSelectedComponent());
}
 
Example #29
Source File: CodeTemplatesOperator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JEditorPaneOperator getEditorOnTab(final String tabName) {
    JTabbedPaneOperator tabbedPane = getTabbedPane();
    tabbedPane.selectPage(tabName);
    ContainerOperator<JEditorPane> selectedComponent = new ContainerOperator<>((Container)tabbedPane.getSelectedComponent());
    JEditorPaneOperator jepo = new JEditorPaneOperator(selectedComponent);
    return jepo;
}
 
Example #30
Source File: HintsTestCase.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void setInPlaceCreation(boolean inPlace) {
    OptionsOperator oo = OptionsOperator.invoke();
    oo.selectEditor();
    JTabbedPaneOperator jtpo = new JTabbedPaneOperator(oo);
    jtpo.selectPage("Hints");
    JSplitPaneOperator jspo = new JSplitPaneOperator(oo);
    JTreeOperator jto = new JTreeOperator(jtpo);
    selectHintNode(jto, "errors", "Create Local Variable");
    JCheckBoxOperator chbox1 = new JCheckBoxOperator(new ContainerOperator((Container) jspo.getRightComponent()), "Create Local Variable In Place");
    chBoxSetSelected(chbox1, inPlace);
    oo.ok();
}