| <!DOCTYPE html> |
| <head> |
| <title>RCPTT Documentation Center</title> |
| <meta charset="UTF-8"> |
| <link rel="stylesheet" href="https://www.eclipse.org/rcptt/shared/css/bootstrap.min.css"> |
| <link rel="stylesheet" href="https://www.eclipse.org/rcptt/shared/css/main.css"> |
| <link rel="stylesheet" href="https://www.eclipse.org/rcptt/shared/css/prism.css"> |
| <link rel="icon" href="https://www.eclipse.org/rcptt/shared/img/favicon.ico"> |
| <script src="https://www.eclipse.org/rcptt/shared/js/jquery.min.js"></script> |
| <script src="https://www.eclipse.org/rcptt/shared/js/bootstrap.min.js"></script> |
| <script src="https://www.eclipse.org/rcptt/shared/js/prism.js"></script> |
| <script src="https://www.eclipse.org/rcptt/shared/js/ecl.js"></script> |
| <script> |
| (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
| (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
| m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
| })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); |
| |
| ga('create', 'UA-39589807-5', 'eclipse.org'); |
| ga('send', 'pageview'); |
| </script> |
| </head> |
| <body> |
| <div id="before-footer"> |
| <header> |
| <nav class="navbar navbar-default navbar-static-top" role="navigation"> |
| <div class="container"> |
| |
| <div class="navbar-header"> |
| <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> |
| <span class="sr-only">Toggle navigation</span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| </button> |
| <span class="navbar-brand">RCPTT Documentation Center</span> |
| </div> |
| <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> |
| <ul class="nav navbar-nav"> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/getstarted">User Guide</a> |
| </li> |
| <li class="active" > |
| <a href="https://www.eclipse.org/rcptt/documentation/faq/">FAQ</a> |
| </li> |
| <li> |
| <a href="http://eclipse.org/rcptt">Back to RCPTT Main Site</a> |
| </li> |
| <li> |
| <a href="http://eclipse.org">Eclipse.org</a> |
| </li> |
| </ul> |
| </div> |
| </nav> |
| </header> |
| <section class="content"> |
| <div class="container"> |
| <div class="row"> |
| <div class="col-sm-3"> |
| <div class="rcptt-sidebar"> |
| <ul class="nav"> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/faq/pass-value/">How to pass a value to a test during its execution?</a> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/faq/install-as-plugin/">Can RCPTT be installed as an Eclipse plugin?</a> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/faq/resize-window/">How to resize a window?</a> |
| </li> |
| <li class="active" ><a href="https://www.eclipse.org/rcptt/documentation/faq/extract-widget/">How to extract an SWT widget from ECL command?</a> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/faq/verify-control-size/">How to verify changing control sizes?</a> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/faq/suite-order/">Is it possible to order tests in a Test Suite?</a> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/faq/runtime-features/">What does each runtime feature stand for?</a> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/faq/get-property-raw/">What is the difference between Assert and Verify commands or how to get raw property values?</a> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <div class="col-sm-9"> |
| <h1>How to extract an SWT widget from ECL command?</h1> |
| <p></p> |
| |
| <div class="panel panel-default"> |
| <div class="panel-body"> |
| <i> I am trying to make a custom ECL command to extract a data from table in order to make my custom assertions on that data. |
| I want to use the result of: get-table | ...<br> |
| But when I read an object from process.getInput().read(), I get an object of the class ControlHandlerImpl and I don't know how to handle this further. |
| Do you have some examples using the input pipe?</i> |
| </div> |
| </div> |
| |
| <p>When RCPTT passes controls around (like in 'get-view "..." | get-tree), it does not operate on widgets, instead, a special descriptor EMF objects used. |
| There is a special command get-object, which allows to extract an actual widget object and pass it to other command.<br> |
| Therefore, while writing custom command, it is better to declare an input parameter in EMF model as EJavaObject and then use it like this:<br> <br></p> |
| |
| <div class="panel panel-default"> |
| <div class="panel-body"> |
| get-view "Package Explorer" | get-tree | get-object | my-custom-tree-command |
| </div> |
| </div> |
| |
| <p>A good starting point to look at might be an <a href="http://download.eclipse.org/rcptt/release/1.5.4/doc/ecl/index.html#invoke">invoke</a> command, which takes a Java object from input and invokes methods via reflection.</p> |
| |
| <p>It's model is described like this:</p> |
| |
| <div class="screenshot"> |
| <img src="https://www.eclipse.org/rcptt/shared/img/screenshot-invoke-model.png"></img> |
| </div> |
| |
| <p> |
| An implementation of <a href="http://download.eclipse.org/rcptt/release/1.5.4/doc/ecl/index.html#invoke">invoke</a> command can be found at RCPTT repo.</p> |
| </div> |
| </div> |
| </div> |
| |
| </section> |
| <script src="https://www.eclipse.org/rcptt/shared/js/main.js"></script> |
| </body> |