本文整理汇总了Java中org.netbeans.jemmy.operators.JEditorPaneOperator类的典型用法代码示例。如果您正苦于以下问题:Java JEditorPaneOperator类的具体用法?Java JEditorPaneOperator怎么用?Java JEditorPaneOperator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JEditorPaneOperator类属于org.netbeans.jemmy.operators包,在下文中一共展示了JEditorPaneOperator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cutCopyViaStrokes
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的package包/类
protected void cutCopyViaStrokes(JEditorPaneOperator txtOper, int key, int mod){
Transferable oldClipValue = txtOper.getToolkit().getSystemClipboard().getContents(txtOper);
String oldVal = getClipBoardContent(oldClipValue);
log("");
log("oldClipValue:"+oldVal);
txtOper.requestFocus();
txtOper.pushKey(key, mod);
// give max WAIT_MAX_MILIS_FOR_CLIPBOARD milis for clipboard to change
boolean success = waitMaxMilisForValue(WAIT_MAX_MILIS_FOR_CLIPBOARD, getClipboardResolver(txtOper, key, mod, oldVal), Boolean.FALSE);
if (success == false){
// give it one more chance. maybe selection was not ready at the time of
// copying
log("!!!! ONCE AGAIN");
txtOper.pushKey(key, mod);
// give max WAIT_MAX_MILIS_FOR_CLIPBOARD milis for clipboard to change
waitMaxMilisForValue(WAIT_MAX_MILIS_FOR_CLIPBOARD, getClipboardResolver(txtOper, key, mod, oldVal), Boolean.FALSE);
}
}
示例2: newWatch
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的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");
}
示例3: evaluateExpression
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的package包/类
/**
* Evaluates simple expression during debugging session.
*/
public void evaluateExpression() throws IllegalAccessException, InvocationTargetException, InterruptedException, InvalidExpressionException {
TopComponentOperator variablesView = new TopComponentOperator(new ContainerOperator(MainWindowOperator.getDefault(), VIEW_CHOOSER), "Variables");
JToggleButtonOperator showEvaluationResultButton = new JToggleButtonOperator(variablesView, 0);
showEvaluationResultButton.clickMouse();
TopComponentOperator evaluationResultView = new TopComponentOperator("Evaluation Result");
new Action("Debug|Evaluate Expression...", null).perform();
TopComponentOperator expressionEvaluator = new TopComponentOperator("Evaluate Expression");
JEditorPaneOperator expressionEditor = new JEditorPaneOperator(expressionEvaluator);
new EventTool().waitNoEvent(1000);
expressionEditor.setText("\"If n is: \" + n + \", then n + 1 is: \" + (n + 1)");
JPanel buttonsPanel = (JPanel) expressionEvaluator.getComponent(2);
JButton expressionEvaluatorButton = (JButton) buttonsPanel.getComponent(1);
assertEquals("Evaluate code fragment (Ctrl + Enter)", expressionEvaluatorButton.getToolTipText());
expressionEvaluatorButton.doClick();
JTableOperator variablesTable = new JTableOperator(evaluationResultView);
assertValue(variablesTable, 0, 2, "\"If n is: 50, then n + 1 is: 51\"");
assertEquals("\"If n is: \" + n + \", then n + 1 is: \" + (n + 1)", variablesTable.getValueAt(0, 0).toString().trim());
}
示例4: testFieldBreakpointCreation
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的package包/类
/**
*
*/
public void testFieldBreakpointCreation() {
//open source
Node beanNode = new Node(new SourcePackagesNode(Utilities.testProjectName), "examples.advanced|MemoryView.java"); //NOI18N
new OpenAction().performAPI(beanNode);
EditorOperator eo = new EditorOperator("MemoryView.java");
try {
eo.clickMouse(50,50,1);
} catch (Throwable t) {
System.err.println(t.getMessage());
}
NbDialogOperator dialog = Utilities.newBreakpoint(36, 36);
setBreakpointType(dialog, "Field");
new JEditorPaneOperator(dialog, 0).setText("examples.advanced.MemoryView");
new JEditorPaneOperator(dialog, 1).setText("msgMemory");
new JComboBoxOperator(dialog, 2).selectItem(Bundle.getString("org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle", "LBL_Field_Breakpoint_Type_Access"));
dialog.ok();
Utilities.showDebuggerView(Utilities.breakpointsViewTitle);
JTableOperator jTableOperator = new JTableOperator(new TopComponentOperator(Utilities.breakpointsViewTitle));
assertEquals("Field breakpoint was not created.", "Field MemoryView.msgMemory access", jTableOperator.getValueAt(0, 0).toString());
}
示例5: testConditionalFieldBreakpointFunctionality
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的package包/类
public void testConditionalFieldBreakpointFunctionality() throws Throwable {
NbDialogOperator dialog = Utilities.newBreakpoint(36, 36);
setBreakpointType(dialog, "Field");
new JComboBoxOperator(dialog, 2).selectItem(Bundle.getString("org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle", "LBL_Field_Breakpoint_Type_Access"));
new JCheckBoxOperator(dialog, 0).changeSelection(true);
new JEditorPaneOperator(dialog, 2).setText("UPDATE_TIME >= 1001");
dialog.ok();
EditorOperator eo = new EditorOperator("MemoryView.java");
Utilities.toggleBreakpoint(eo, 109);
Utilities.startDebugger();
assertTrue("Thread didn't stop at field breakpoint.", Utilities.checkConsoleLastLineForText("Thread main stopped at MemoryView.java:109"));
new ContinueAction().perform();
Thread.sleep(1000);
assertTrue("Thread didn't stop at field breakpoint.", Utilities.checkConsoleLastLineForText("Thread main stopped at MemoryView.java:104"));
}
示例6: testFieldBreakpointsValidation
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的package包/类
public void testFieldBreakpointsValidation() {
NbDialogOperator dialog = Utilities.newBreakpoint(36, 36);
setBreakpointType(dialog, "Field");
String wrongname = "wrongname";
new JEditorPaneOperator(dialog, 1).setText(wrongname);
dialog.ok();
Utilities.startDebugger();
assertTrue("Warning about wrong field breakpoint missing.", Utilities.checkConsoleLastLineForText("Not able to submit breakpoint FieldBreakpoint examples.advanced.MemoryView.wrongname"));
dialog = Utilities.newBreakpoint(36, 36);
setBreakpointType(dialog, "Field");
wrongname = "wrongname2";
new JEditorPaneOperator(dialog, 1).setText(wrongname);
dialog.ok();
assertTrue("Warning about wrong field breakpoint missing.", Utilities.checkConsoleLastLineForText("Not able to submit breakpoint FieldBreakpoint examples.advanced.MemoryView.wrongname2"));
}
示例7: testMethodBreakpointCreation
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的package包/类
/**
*
*/
public void testMethodBreakpointCreation() {
EditorOperator eo = new EditorOperator("MemoryView.java");
try {
eo.clickMouse(50,50,1);
} catch (Throwable t) {
System.err.println(t.getMessage());
}
NbDialogOperator dialog = Utilities.newBreakpoint(92);
setBreakpointType(dialog, "Method");
new JEditorPaneOperator(dialog, 0).setText("examples.advanced.MemoryView");
new JEditorPaneOperator(dialog, 1).setText("updateStatus()");
dialog.ok();
Utilities.showDebuggerView(Utilities.breakpointsViewTitle);
JTableOperator jTableOperator = new JTableOperator(new TopComponentOperator(Utilities.breakpointsViewTitle));
assertEquals("Method MemoryView.updateStatus", jTableOperator.getValueAt(0, 0).toString());
}
示例8: testConditionalMethodBreakpointFunctionality
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的package包/类
public void testConditionalMethodBreakpointFunctionality() throws Throwable {
NbDialogOperator dialog = Utilities.newBreakpoint(104);
setBreakpointType(dialog, "Method");
new JComboBoxOperator(dialog, 2).setSelectedItem(Bundle.getString("org.netbeans.modules.debugger.jpda.ui.breakpoints.Bundle", "LBL_Method_Breakpoint_Type_Entry")); //method entry
new JCheckBoxOperator(dialog, 1).changeSelection(true);
new JEditorPaneOperator(dialog, 2).setText("UPDATE_TIME >= 1001");
dialog.ok();
EditorOperator eo = new EditorOperator("MemoryView.java");
//toggle control line breakpoint
Utilities.toggleBreakpoint(eo, 104);
Utilities.startDebugger();
Utilities.waitStatusOrConsoleText("Thread main stopped at MemoryView.java:104");
new ContinueAction().perform();
Utilities.waitStatusOrConsoleText("Thread main stopped at MemoryView.java:92");
}
示例9: testMethodBreakpointsValidation
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的package包/类
public void testMethodBreakpointsValidation() {
NbDialogOperator dialog = Utilities.newBreakpoint(104);
setBreakpointType(dialog, "Method");
String wrongname = "wrong";
new JEditorPaneOperator(dialog, 1).setText(wrongname);
dialog.ok();
Utilities.startDebugger();
assertTrue("Warning about wrong method breakpoint missing.", Utilities.checkConsoleLastLineForText("Not able to submit breakpoint MethodBreakpoint [examples.advanced.MemoryView]." + wrongname));
dialog = Utilities.newBreakpoint(104);
setBreakpointType(dialog, "Method");
wrongname = "wrong2";
new JEditorPaneOperator(dialog, 1).setText(wrongname);
dialog.ok();
assertTrue("Warning about wrong method breakpoint missing.", Utilities.checkConsoleLastLineForText("Not able to submit breakpoint MethodBreakpoint [examples.advanced.MemoryView]." + wrongname));
}
示例10: testNavigator
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的package包/类
public void testNavigator() throws Exception{
String navigatorTestFile = "navigatorTest.css";
openFile(newFileName);
NavigatorOperator navigatorOperator = NavigatorOperator.invokeNavigator();
assertNotNull(navigatorOperator);
JTreeOperator treeOperator = navigatorOperator.getTree();
Object root = treeOperator.getRoot();
assertNotNull(root);
assertEquals("NUMBER OF ROOT CHILD", 2, treeOperator.getChildCount(root));
openFile(navigatorTestFile).setVerification(true);
treeOperator = navigatorOperator.getTree();
root = treeOperator.getRoot();
assertNotNull(root);
assertEquals("NUMBER OF ROOT CHILD", 2, treeOperator.getChildCount(root));
Object firstChild = treeOperator.getChild(root, 0);
assertEquals("NUMBER OF @MEDIA SCREEN CHILD", 2, treeOperator.getChildCount(firstChild));
Object aChild = treeOperator.getChild(firstChild, 1);
assertNotNull("A rule", aChild);
TreePath path = new TreePath(new Object[]{root, firstChild, aChild});
treeOperator.clickOnPath(path, 2);
// new EditorOperator(navigatorTestFile).
JEditorPaneOperator editorPane = new EditorOperator(navigatorTestFile).txtEditorPane();
assertEquals("CARET POSSITION ", 374, editorPane.getCaretPosition());
}
示例11: setUp
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
System.out.println("### " + getName() + " ###");
openDataProjects("SampleProject");
JavaNode lrTestClass = new JavaNode(new SourcePackagesNode("SampleProject"), "sample1.outline|TestOutline.java");
lrTestClass.open();
EditorOperator eo = new EditorOperator("TestOutline.java");
eo.setCaretPosition(67, 1);
new ToggleBreakpointAction().perform();
String windowMenu = Bundle.getStringTrimmed("org.netbeans.core.windows.resources.Bundle", "Menu/Window");
String debugMenu = Bundle.getStringTrimmed("org.netbeans.modules.debugger.resources.Bundle", "Menu/Window/Debug");
String watchesItem = Bundle.getStringTrimmed("org.netbeans.modules.debugger.ui.actions.Bundle", "CTL_WatchesAction");
new Action(windowMenu + "|" + debugMenu + "|" + watchesItem, null).perform();
String debug = Bundle.getStringTrimmed("org.netbeans.modules.project.ui.Bundle", "Menu/RunProject");
String newWatch = Bundle.getStringTrimmed("org.netbeans.modules.debugger.ui.actions.Bundle", "CTL_New_Watch");
for (int i = 0; i < 3; i++) {
new ActionNoBlock(debug + "|" + newWatch, null).performMenu();
NbDialogOperator dia = new NbDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.debugger.ui.actions.Bundle", "CTL_WatchDialog_Title"));
JEditorPaneOperator txtWatch = new JEditorPaneOperator(dia);
txtWatch.typeText("test");
dia.ok();
}
new DebugJavaFileAction().perform(lrTestClass);
MainWindowOperator.getDefault().waitStatusText("stopped at");
}
示例12: testFor
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的package包/类
public void testFor() throws IOException {
EditorOperator oper = null;
try {
openSourceFile("org.netbeans.test.java.editor.codetemplates", "Main");
oper = new EditorOperator("Main");
JEditorPaneOperator txtOper = oper.txtEditorPane();
oper.setCaretPosition(6, 9);
txtOper.typeText("fori");
txtOper.pressKey(KeyEvent.VK_TAB);
oper.setCaretPosition(9, 10);
txtOper.typeText("whilen");
txtOper.pressKey(KeyEvent.VK_TAB);
compareGoldenFile(oper);
} finally {
if (oper != null) {
oper.closeDiscardAll();
}
}
}
示例13: testExperessionOnLeftSide
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的package包/类
public void testExperessionOnLeftSide() {
final String abbrev = "fore";
EditorOperator editor = null;
try {
openSourceFile("org.netbeans.test.java.editor.codetemplates", "Main");
editor = new EditorOperator("Main");
JEditorPaneOperator jepo = editor.txtEditorPane();
editor.setCaretPosition(4, 1);
jepo.typeText("static java.util.List<String> a;static java.util.List<Integer> b;");
useTemplateAt(editor, 6, 9, abbrev);
jepo.pressKey(KeyEvent.VK_TAB);
jepo.typeText("b");
checkContentOfEditorRegexp(editor, ".*for \\(Integer integer \\: b\\) \\{.*");
} finally {
editor.closeDiscard();
}
}
示例14: setEditorState
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的package包/类
public void setEditorState(EditorOperator editor, String goldenFile, int caretLine, int caretColumn) {
JEditorPaneOperator txtOper = editor.txtEditorPane();
StringBuilder fileData = new StringBuilder(1000);
try {
BufferedReader reader = new BufferedReader(new FileReader(getGoldenFile(goldenFile)));
char[] buf = new char[1024];
int numRead;
while ((numRead = reader.read(buf)) != -1) {
fileData.append(buf, 0, numRead);
}
} catch (IOException ex) {
fail(ex);
}
txtOper.removeAll();
txtOper.setText(fileData.toString());
txtOper.pushKey(KeyEvent.VK_BACK_SPACE); // replace the last NL...
editor.setCaretPosition(caretLine, caretColumn);
}
示例15: testLBrace
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入依赖的package包/类
public void testLBrace(){
openDefaultProject();
openDefaultSampleFile();
try {
EditorOperator editor = getDefaultSampleEditorOperator();
// 1. move to adequate place
editor.setCaretPosition(6, 20);
// 2. hit Enter
JEditorPaneOperator txtOper = editor.txtEditorPane();
txtOper.pushKey(KeyEvent.VK_ENTER);
// Compare document content to golden file
compareReferenceFiles(txtOper.getDocument());
} finally {
closeFileWithDiscard();
}
}