blob: 9990ac500c2c2a5b204cc83c6de53b51095377ab [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 v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* 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);
}
}