1 package org.simantics.workbench.internal.contributions.e4;
3 import javax.inject.Inject;
4 import javax.inject.Named;
6 import org.eclipse.e4.core.di.annotations.CanExecute;
7 import org.eclipse.e4.core.di.annotations.Execute;
8 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
9 import org.eclipse.e4.ui.services.IServiceConstants;
10 import org.eclipse.e4.ui.workbench.modeling.EPartService;
12 public class ClosePartHandler {
15 EPartService partService;
18 public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart) {
19 if (activePart == null)
21 return activePart.isCloseable();
25 public void closePart(@Named(IServiceConstants.ACTIVE_PART) MPart activePart) {
26 partService.hidePart(activePart);