Reputation: 1516
What I need is: An app with welcome page and then to switch to another perspective. To switch the perspective the following code was used:
public class SwitchPerspectiveAction extends Action {
public void run() {
if (PlatformUI.getWorkbench() != null) {
try {
PlatformUI.getWorkbench().showPerspective(Perspective.ID, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
} catch (WorkbenchException e) {
e.printStackTrace();
}
}
}
}
and nothing has hapend :-(
Upvotes: 2
Views: 2163
Reputation: 1516
Solved:
public class SwitchPerspectiveAction extends Action {
public void run() {
if (PlatformUI.getWorkbench() != null) {
try {
IPerspectiveDescriptor descriptor = window.getWorkbench()
.getPerspectiveRegistry()
.findPerspectiveWithId(Perspective.ID);
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().setPerspective(descriptor);
} catch (WorkbenchException e) {
e.printStackTrace();
}
}
}
}
Upvotes: 1