1

I just added 2 perspectives in my RCP App. I can switch from one to another without problems.

But I didn't find a way to reset perspective, for example if I close a Part excidently I need to reset my perspective.

  1. PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().resetPerspective();

this didn't work because I use E4.

  1. -clearPersistedState -persistState false

is not a solution cause I need to reset without restart my App.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Tristate
  • 1,498
  • 2
  • 18
  • 38

1 Answers1

1

Use the resetPerspective method of EModelService:

public void resetPerspectiveModel(MPerspective persp, MWindow window)

Note that PlatformUI and associated APIs can't be used in a pure e4 application.

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • I tried the following but it didn't do anything: `MPerspective currentPerspective = (MPerspective) modelService.find(PERSPECTIVE_ID, application); MWindow window = application.getChildren().get(0); modelService.resetPerspectiveModel(currentPerspective, window);` – kgibm Oct 31 '18 at 21:29