1 /*******************************************************************************
\r
2 * Copyright (c) 2010 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.sysdyn.ui.handlers.exports;
\r
14 import org.eclipse.core.commands.ExecutionEvent;
\r
15 import org.eclipse.core.commands.ExecutionException;
\r
16 import org.eclipse.ui.handlers.HandlerUtil;
\r
17 import org.simantics.db.Resource;
\r
18 import org.simantics.utils.ui.workbench.WorkbenchUtils;
\r
21 * Exports a selected model asking the location.
\r
22 * Model determination is based on any resource of the model.
\r
24 * @author Tuomas Miettinen
\r
27 public class ExportModelAsButtonHandler extends ExportModelButtonHandler {
\r
30 public Object execute(ExecutionEvent event) throws ExecutionException {
\r
32 status = WorkbenchUtils.getStatusLine( HandlerUtil.getActiveSite(event) );
\r
34 final Resource model = determineModel(event);
\r
38 String selected = getAbsolutePath(model, event, true);
\r
40 if (selected != null) {
\r
41 createFile(model, selected);
\r
42 setExportStatus(model, selected);
\r