Java Code Examples for org.eclipse.swtbot.swt.finder.results.StringResult

The following examples show how to use org.eclipse.swtbot.swt.finder.results.StringResult. These examples are extracted from open source projects. 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 Project: tracecompass   Source File: CopyToClipboardTest.java    License: Eclipse Public License 2.0 6 votes vote down vote up
private static void assertClipboardContentsEquals(final String expected) {
    fBot.waitUntil(new DefaultCondition() {
        String actual;
        @Override
        public boolean test() throws Exception {
            actual = UIThreadRunnable.syncExec(new StringResult() {
                @Override
                public String run() {
                    Clipboard clipboard = new Clipboard(Display.getDefault());
                    TextTransfer textTransfer = TextTransfer.getInstance();
                    try {
                        return (String) clipboard.getContents(textTransfer);
                    } finally {
                        clipboard.dispose();
                    }
                }
            });
            return expected.equals(actual);
        }
        @Override
        public String getFailureMessage() {
            return NLS.bind("Clipboard contents:\n{0}\nExpected:\n{1}",
                    actual, expected);
        }
    });
}
 
Example 2
Source Project: saros   Source File: RemoteBotShell.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public String getMessage() throws RemoteException {
  activate();
  final String message =
      UIThreadRunnable.syncExec(
          new StringResult() {
            @Override
            public String run() {
              WizardDialog dialog = (WizardDialog) widget.widget.getData();
              return dialog.getMessage();
            }
          });
  if (message == null) {
    throw new WidgetNotFoundException("could not find message!");
  }
  return message;
}
 
Example 3
/**
 * Gets the plainID of the given object.
 *
 * @return the username on the widget.
 */
public String getPlainID() {
  return syncExec(
      new StringResult() {
        @Override
        public String run() {
          return widget.getUsername();
        }
      });
}
 
Example 4
/**
 * Gets the cell data for the given row/column index.
 *
 * @param row the row in the table.
 * @param column the column in the table.
 * @return the cell at the location specified by the row and column
 */
public String cell(final int row, final int column) {
	assertIsLegalCell(row, column);

	return syncExec(new StringResult() {
		public String run() {
			TableItem item = widget.getTable().getItem(row);
			return item.getText(column);
		}
	});
}