use of org.eclipse.ui.IPerspectiveListener in project translationstudio8 by heartsome.
the class ApplicationWorkbenchWindowAdvisor method setListenerToPespective.
/**
* 给默认透视图添加监听,当透视图发生改变时,触发相关事件 robert 2012-10-18
* @param commandService
*/
private void setListenerToPespective(final ICommandService commandService) {
final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IPerspectiveListener perspectiveListener = new IPerspectiveListener() {
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
}
public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
// 改变透视图时,发出监听去检查品质检查结果视图的状态,从而让 视图 菜单的状态与之保持一致。
commandService.refreshElements("net.heartsome.cat.ts.ui.qa.handlers.OpenQAResultViewCommand", null);
// 显示状态栏与工具栏
IHandlerService handlerService = (IHandlerService) window.getService(IHandlerService.class);
IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
boolean statusVisible = preferenceStore.getBoolean(TsPreferencesConstant.TS_statusBar_status);
if (!statusVisible) {
preferenceStore.setValue(TsPreferencesConstant.TS_statusBar_status, false);
try {
handlerService.executeCommand("net.heartsome.cat.ts.command.openStatusBar", null);
} catch (Exception ex) {
throw new RuntimeException("CommandTest.exitcommand not found");
}
}
WorkbenchWindow window_1 = (WorkbenchWindow) window;
if (!window_1.getCoolBarVisible()) {
try {
window_1.toggleToolbarVisibility();
commandService.refreshElements("net.heartsome.cat.ts.command.openToolBar", null);
} catch (Exception ex) {
throw new RuntimeException("CommandTest.exitcommand not found");
}
}
}
};
window.addPerspectiveListener(perspectiveListener);
}
use of org.eclipse.ui.IPerspectiveListener in project yamcs-studio by yamcs.
the class YamcsStudioWorkbenchWindowAdvisor method preWindowOpen.
@Override
public void preWindowOpen() {
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
configurer.setInitialSize(new Point(1920, 1200));
configurer.setShowMenuBar(true);
configurer.setShowCoolBar(true);
configurer.setShowProgressIndicator(true);
configurer.setShowPerspectiveBar(false);
configurer.setShowStatusLine(true);
updateTitle();
configurer.getWindow().addPerspectiveListener(new IPerspectiveListener() {
@Override
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
updateTitle();
}
@Override
public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
updateTitle();
}
});
// Workaround for text editor DND bug.
// See http://www.eclipse.org/forums/index.php/m/333816/
configurer.configureEditorAreaDropListener(new EditorAreaDropAdapter(configurer.getWindow()));
// Bootstrap DIIRT
CompositeDataSource defaultDs = (CompositeDataSource) PVManager.getDefaultDataSource();
defaultDs.putDataSource(new ParameterDataSourceProvider());
defaultDs.setConfiguration(new CompositeDataSourceConfiguration().defaultDataSource("para").delimiter("://"));
PVManager.setDefaultDataSource(defaultDs);
}
use of org.eclipse.ui.IPerspectiveListener in project watchdog by TestRoots.
the class WindowListener method addPerspectiveListener.
private void addPerspectiveListener(IWorkbenchWindow window) {
IPerspectiveListener perspectiveListener = new PerspectiveListener();
window.addPerspectiveListener(perspectiveListener);
// triggers the event for the currently open perspective, if there is
// any
IWorkbenchPage activePage = window.getActivePage();
if (activePage != null) {
IPerspectiveDescriptor currentPerspective = window.getActivePage().getPerspective();
if (currentPerspective != null) {
perspectiveListener.perspectiveActivated(activePage, currentPerspective);
}
}
}
Aggregations