Open main menu

CDOT Wiki β

Changes

Teams Winter 2011/team1/RCP/Define and use editors

1 byte removed, 18:30, 4 March 2011
3. Define and Use Editors
3.4.2 Add a "double click" listener to the <code>StudentsView</code> class <br/>
For this, we need to add <code>''hookDoubleClick()''</code> method to the </code>StudentsView.java </code>. <br/>
The view makes his viewer available as selection provider via the following line:<br/>
<code>''getSite().setSelectionProvider(viewer);''</code> <br/>
This make is possible for the command which opens the editor to get the selection of the view. All workbench parts have a site, which can be accessed via the method <code>getSite()</code>.
<source lang=java>
private void hookDoubleClickCommand() {
}
</source>
We will call this command method from <code>''createPartControl()''</code> method.The view makes his viewer available as selection provider via the following line:<br/><code>''getSite().setSelectionProvider(viewer);''</code> <br/>This make is possible for the command which opens the editor to get the selection of the view. All workbench parts have a site, which can be accessed via the method <code>getSite()</code>.
<source lang=java>
public void createPartControl(Composite parent) {
1
edit