23.12.2014 Views

NASA uses Eclipse RCP applications for experiments on the ...

NASA uses Eclipse RCP applications for experiments on the ...

NASA uses Eclipse RCP applications for experiments on the ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Set up <strong>the</strong> tabs based <strong>on</strong> defined perspectives <br />

!protected void createPerspectiveBarTabs(){!<br />

! !<str<strong>on</strong>g>for</str<strong>on</strong>g> (String peID : getPerspectiveExtensi<strong>on</strong>Ids()){!<br />

! ! !// automagically read <strong>the</strong> perspectives c<strong>on</strong>tributed by plugin.xml!<br />

! ! !IC<strong>on</strong>figurati<strong>on</strong>Element[] c<strong>on</strong>fig = Plat<str<strong>on</strong>g>for</str<strong>on</strong>g>m.getExtensi<strong>on</strong>Registry().!<br />

! ! ! !getC<strong>on</strong>figurati<strong>on</strong>ElementsFor("org.eclipse.ui", "perspectives", peID);!<br />

! ! !<str<strong>on</strong>g>for</str<strong>on</strong>g> (IC<strong>on</strong>figurati<strong>on</strong>Element e : c<strong>on</strong>fig) {!<br />

! ! ! !CTabItem item = createTabItem(m_cTabFolder, !<br />

! ! ! ! !e.getAttribute("name"), m_page, e.getAttribute("id"));!<br />

! ! !}!<br />

! !}!<br />

!!<br />

! !// have <strong>the</strong> tabs listen <str<strong>on</strong>g>for</str<strong>on</strong>g> selecti<strong>on</strong> and change perspective!<br />

! !final CTabFolder tabFolder = m_cTabFolder;!<br />

! !m_cTabFolder.addSelecti<strong>on</strong>Listener(new Selecti<strong>on</strong>Listener() {!<br />

! ! !public void widgetSelected(Selecti<strong>on</strong>Event e) {!<br />

! ! ! !CTabItem tabItem = tabFolder.getSelecti<strong>on</strong>();!<br />

! ! ! !String perspectiveID = (String)tabItem.getData();!<br />

! ! ! !selectPerspective(perspectiveID, e);!<br />

! ! ! !tabItem.getC<strong>on</strong>trol().setFocus();!<br />

! ! !}!<br />

! !});!<br />

! !!<br />

! !// have <strong>the</strong> tabs autochange if <strong>the</strong> perspective changes!<br />

! !m_workbenchWindow.addPerspectiveListener(new PerspectiveAdapter() {!<br />

! ! !public void perspectiveActivated(IWorkbenchPage page,<br />

! ! ! ! ! !IPerspectiveDescriptor perspectiveDescriptor) {!<br />

! ! ! !CTabItem foundTab = getTabForPerspective(perspectiveDescriptor.getId());!<br />

! ! ! !if (foundTab != null){m_cTabFolder.setSelecti<strong>on</strong>(foundTab);}!<br />

! ! !}!<br />

! !});!<br />

! !!<br />

! !m_cTabFolder.setSelecti<strong>on</strong>(0);!<br />

! !populateTopRightButt<strong>on</strong>s(m_cTabFolder); // this is how we c<strong>on</strong>tribute Stop SPHERES butt<strong>on</strong>!<br />

! !m_cTabFolder.pack();!<br />

!}!<br />

<str<strong>on</strong>g>Eclipse</str<strong>on</strong>g> <str<strong>on</strong>g>RCP</str<strong>on</strong>g> <str<strong>on</strong>g>for</str<strong>on</strong>g> ISS Experiments <br />

16

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!