本文整理汇总了Java中org.netbeans.jemmy.TimeoutExpiredException类的典型用法代码示例。如果您正苦于以下问题:Java TimeoutExpiredException类的具体用法?Java TimeoutExpiredException怎么用?Java TimeoutExpiredException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TimeoutExpiredException类属于org.netbeans.jemmy包,在下文中一共展示了TimeoutExpiredException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: waitText
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的package包/类
public static boolean waitText(MessageHandler handler) {
int i = 0;
while (!handler.isFinished()) {
i++;
if (i > TIME_OUT) {
throw new TimeoutExpiredException("Text [" + handler.message + "] hasn't been found in reasonable time!");
}
try {
Thread.sleep(500);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
return true;
}
示例2: deleteNode
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的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!!!");
}
}
示例3: prepare
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的package包/类
public void prepare() {
String documentPath = CommonUtilities.SOURCE_PACKAGES + "|" + "allComponents" + "|" + midletName;
long nodeTimeout = pto.getTimeouts().getTimeout("ComponentOperator.WaitStateTimeout");
try {
openNode = new Node(pto.getProjectRootNode(targetProject), documentPath);
} catch (TimeoutExpiredException ex) {
pto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", nodeTimeout);
throw new Error("Cannot find expected node because of Timeout");
}
pto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", nodeTimeout);
if (this.openNode == null) {
throw new Error("Cannot find expected node ");
}
openNode.select();
}
示例4: testPerformMenuOnNode
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的package包/类
/** Test to perform main menu action on node. */
public void testPerformMenuOnNode() {
Node n = new Node(new SourcePackagesNode("SampleProject"), "sample1|SampleClass1.java");
// "Tools"
String toolsItem = Bundle.getStringTrimmed("org.openide.actions.Bundle", "CTL_Tools");
// "Add to Favorites"
String addToFavoritesItem = Bundle.getStringTrimmed("org.netbeans.modules.favorites.Bundle", "ACT_Add");
// "Tools|Add To Favorites"
try {
new Action(toolsItem + "|" + addToFavoritesItem, null).perform(n);
} catch (TimeoutExpiredException e) {
// Try it once more because sometimes for an uknown reason is Tools menu not fully populated first time.
// See http://www.netbeans.org/issues/show_bug.cgi?id=85853.
// push Escape key to ensure there is no open menu
MainWindowOperator.getDefault().pushKey(KeyEvent.VK_ESCAPE);
new Action(toolsItem + "|" + addToFavoritesItem, null).perform(n);
}
new FavoritesOperator().close();
}
示例5: testFontProperty
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的package包/类
/** Test org.netbeans.jellytools.properties.FontProperty. */
public void testFontProperty() {
PropertySheetOperator pso = new PropertySheetOperator(TestNode.NODE_NAME);
FontProperty p = new FontProperty(pso, "Font"); // NOI18N
try {
p.setFontValue("Serif", FontProperty.STYLE_BOLDITALIC, "14"); // NOI18N
} catch (TimeoutExpiredException e) {
// sometimes it fails on Solaris
log("jemmy.log", "ERROR: " + e.getMessage());
JDialog fontDialog = JDialogOperator.findJDialog(p.getName(), false, false);
if (fontDialog != null) {
log("jemmy.log", " Closing Font dialog.");
new NbDialogOperator(fontDialog).close();
}
log("jemmy.log", " Trying to set font once more");
p.setFontValue("Serif", FontProperty.STYLE_BOLDITALIC, "14"); // NOI18N
}
// need to change selection because it gets editable otherwise
pso.tblSheet().selectCell(0, 0);
String s[] = p.getFontValue();
// need to change selection because it gets editable otherwise
pso.tblSheet().selectCell(0, 0);
assertTrue(s[0].indexOf("Serif") >= 0); // NOI18N
assertEquals(FontProperty.STYLE_BOLDITALIC, s[1]);
assertEquals("14", s[2]); // NOI18N
}
示例6: OptionsOperator
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的package包/类
/**
* Waits for the Options window opened
*/
public OptionsOperator() {
super(waitJDialog(optionsSubchooser));
// wait until settings are loaded
// "Loading Settings ..."
String loadingLabel = Bundle.getString("org.netbeans.modules.options.Bundle", "CTL_Loading_Options");
long waitTimeout = this.getTimeouts().getTimeout("ComponentOperator.WaitComponentTimeout");
try {
this.getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 5000);
new JLabelOperator(this, loadingLabel).waitComponentShowing(false);
} catch (TimeoutExpiredException e) {
// ignore - options already loaded
} finally {
// set previous timeout
this.getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", waitTimeout);
}
}
示例7: waitText
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的package包/类
public static boolean waitText(MessageHandler handler) {
int i = 0;
while (!handler.isFinished()) {
i++;
if (i > TIME_OUT) {
throw new TimeoutExpiredException("Text [" + handler.message + "] hasn't been found in reasonable time!");
}
try {
Thread.sleep(500);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
return true;
}
示例8: selectCategory
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的package包/类
/** Selects given project category
* @param category name of the category to select
*/
public void selectCategory(String category) {
// we need to wait until some node is selected because 'please, wait' node
// is shown before tree is initialized. Then we can change selection.
try {
new Waiter(new Waitable() {
@Override
public Object actionProduced(Object param) {
return treeCategories().isSelectionEmpty() ? null : Boolean.TRUE;
}
@Override
public String getDescription() {
return ("Wait node is selected");
}
}).waitAction(null);
} catch (InterruptedException e) {
throw new JemmyException("Interrupted.", e);
} catch (TimeoutExpiredException tee) {
// ignore it because sometimes can happen that no category is selected by default
}
new Node(treeCategories(), category).select();
}
示例9: openProject
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的package包/类
/** Open project. Before opening the project is checked opened projects.
* @param projectName is name of the project stored in .../editor/test/qa-functional/data/ directory.
*/
public void openProject(String projectName) {
this.projectName = projectName;
File projectPath = new File(this.getDataDir() + "/projects", projectName);
log("data dir = "+this.getDataDir().toString());
/* 1. check if project is open */
ProjectsTabOperator pto = new ProjectsTabOperator();
pto.invoke();
boolean isOpen = true;
try {
JemmyProperties.setCurrentTimeout("JTreeOperator.WaitNextNodeTimeout", OPENED_PROJECT_ACCESS_TIMEOUT);
ProjectRootNode prn = pto.getProjectRootNode(projectName);
} catch (TimeoutExpiredException ex) {
// This excpeiton is ok, project is not open;
//ex.printStackTrace();
isOpen = false;
}
if ( isOpen ) {
log("Project is open!");
return;
}
/* 2. open project */
//retouche:
// Object prj= ProjectSupport.openProject(projectPath);
}
示例10: closeFile
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的package包/类
/** Close file in open project.
*/
public void closeFile() {
try {
new EditorOperator(fileName).close();
} catch ( TimeoutExpiredException ex) {
log(ex.getMessage());
log("Can't close the file");
}
}
示例11: closeFileWithSave
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的package包/类
/** Close file in open project.
*/
public void closeFileWithSave() {
try {
new EditorOperator(fileName).close(true);
} catch ( TimeoutExpiredException ex) {
log(ex.getMessage());
log("Can't close the file");
}
}
示例12: closeFileWithDiscard
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的package包/类
/** Close file in open project.
*/
public void closeFileWithDiscard() {
try {
new EditorOperator(fileName).closeDiscard();
} catch ( TimeoutExpiredException ex) {
log(ex.getMessage());
log("Can't close the file");
}
}
示例13: waitThreadsNode
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的package包/类
/**
* Waits until given threads node shows up in Debugging view.
* @param name Full display name of the required thread node to be found.
*/
private void waitThreadsNode(String name) {
TopComponentOperator debuggingView = new TopComponentOperator("Debugging");
JTreeOperator threads = new JTreeOperator(debuggingView);
try {
new Node(threads, name);
} catch (TimeoutExpiredException tee) {
// if fails try second time because sometimes it fails for unknown reason
new Node(threads, name);
}
}
示例14: actionOnProject
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的package包/类
/**
* Invoke action on project node from popup menu
* @param project
* @param pushAction
*/
public static void actionOnProject(String project, String pushAction) {
ProjectRootNode prn;
try {
prn = ProjectsTabOperator.invoke().getProjectRootNode(project);
} catch (TimeoutExpiredException e) {
prn = new ProjectsTabOperator().getProjectRootNode(project);
}
prn.callPopup().pushMenuNoBlock(pushAction);
}
示例15: waitScanFinished
import org.netbeans.jemmy.TimeoutExpiredException; //导入依赖的package包/类
/**
* Wait finished scan - repeatedly
*/
public static void waitScanFinished(){
try {
new QueueTool().waitEmpty();
} catch (TimeoutExpiredException tee) {
getLog().println("The following exception is ignored");
tee.printStackTrace(getLog());
}
}