blob: 100e61f06b9e9e22cdbb7f1632a5d4aceb10aadf [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.application.handler;
import javax.inject.Inject;
import org.eclipse.core.commands.ParameterizedCommand;
import org.eclipse.e4.core.contexts.Active;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.di.Persist;
import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
/**
* The enablement of this handler is controlled by the item itself.
*/
public class ExtSaveHandler extends AbstractHandler {
/** The service. */
@Inject
EModelService service;
/**
* Execute.
*
* @param context
* the context
* @param part
* the part
* @param command
* the command
*/
@Execute
public void execute(@Active MContext context, @Active MPart part,
ParameterizedCommand command) {
final IEclipseContext pmContext = createCallbackContext(context,
command.getCommand());
ContextInjectionFactory.invoke(part.getObject(), Persist.class,
pmContext, null);
}
}