blob: 3dc171e9f6dcb7899ddf33b0febd088cb273fa0f [file] [log] [blame]
/**
* Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Florian Pirchner - Initial implementation
*/
package org.eclipse.osbp.vaaclipse.addons.perspective.handler;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.e4.core.contexts.Active;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
import org.eclipse.e4.ui.model.application.ui.menu.MItem;
import org.eclipse.osbp.vaaclipse.addons.application.handler.AbstractHandler;
import org.eclipse.osbp.vaaclipse.publicapi.perspective.IPerspectiveHandler;
/**
* The Class ResetPerspectiveHandler.
*/
public class ResetPerspectiveHandler extends AbstractHandler {
/** The handler. */
@Inject
private IPerspectiveHandler handler;
/** The user id. */
@Inject
@Optional
@Named("userId")
private String userId;
/**
* Execute.
*
* @param context
* the context
* @param perspective
* the perspective
* @param item
* the item
*/
@Execute
public void execute(@Active MContext context,
@Active MPerspective perspective, @Active MItem item) {
handler.revertPerspective(perspective);
}
/**
* Can execute.
*
* @param perspective
* the perspective
* @return true, if successful
*/
@CanExecute
public boolean canExecute(@Active MPerspective perspective) {
return handler.canRevertPerspective(perspective);
}
}