blob: 4b7ad06dc183c1c604cf09d19298c7d5877a8959 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004-2008 Istvan Rath and Daniel Varro
* 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:
* Istvan Rath - initial API and implementation
*******************************************************************************/
package org.eclipse.viatra2.editor.text.light.vtcl;
import org.eclipse.viatra2.editor.text.Activator;
import org.eclipse.viatra2.editor.text.light.VTCLEditor;
import org.eclipse.jface.action.Action;
import org.eclipse.viatra2.framework.FrameworkManager;
public class QuickLoadVTCLAction extends Action
{
public QuickLoadVTCLAction()
{
setActionDefinitionId("org.eclipse.viatra2.editor.text.loadCommand");
}
@Override
public void run()
{
// check if we can load at all (there is at least one framework instance)
if (FrameworkManager.getInstance().getAllFrameWorks().length<1)
return;
// proceed
VTCLEditor iEditor = Activator.getDefault().getCurrentVTCLEditor();
if (iEditor!=null)
{
// attach editor (if already attached, this call will do nothing)
iEditor.attachEditor();
// if dirty, save (& load) first
if (iEditor.isDirty())
{
iEditor.doSave(null);
return; // save already performs load, no need to proceed
}
iEditor.parseOnSave();
}
}
}