use of org.eclipse.ui.IPerspectiveRegistry in project liferay-ide by liferay.
the class UIUtil method switchToLiferayPerspective.
public static void switchToLiferayPerspective(String perspectiveId, boolean confirm) {
// Retrieve the new project open perspective preference setting
String perspSetting = PrefUtil.getAPIPreferenceStore().getString(IDE.Preferences.PROJECT_OPEN_NEW_PERSPECTIVE);
IDEWorkbenchPlugin plugin = IDEWorkbenchPlugin.getDefault();
String promptSetting = plugin.getPreferenceStore().getString(IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE);
if (!(promptSetting.equals(MessageDialogWithToggle.PROMPT)) && perspSetting.equals(IWorkbenchPreferenceConstants.NO_NEW_PERSPECTIVE)) {
return;
}
// Map perspective id to descriptor.
IWorkbench workbench = PlatformUI.getWorkbench();
IPerspectiveRegistry reg = workbench.getPerspectiveRegistry();
IPerspectiveDescriptor finalPersp = reg.findPerspectiveWithId(perspectiveId);
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
if (window != null) {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
IPerspectiveDescriptor currentPersp = page.getPerspective();
if (finalPersp.equals(currentPersp)) {
return;
}
}
if (confirm && !_confirmPerspectiveSwitch(window, finalPersp)) {
return;
}
}
// replace active perspective setting otherwise
_replaceCurrentPerspective(finalPersp);
}
use of org.eclipse.ui.IPerspectiveRegistry in project pmd-eclipse-plugin by pmd.
the class ReviewCodeCmd method switchToPmdPerspective.
/**
* opens the PMD perspective
*
* @author SebastianRaffel ( 07.05.2005 )
*/
private static void switchToPmdPerspective() {
final IWorkbench workbench = PlatformUI.getWorkbench();
final IPerspectiveRegistry reg = workbench.getPerspectiveRegistry();
final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
window.getActivePage().setPerspective(reg.findPerspectiveWithId(PMDRuntimeConstants.ID_PERSPECTIVE));
}
Aggregations