/******************************************************************************* | |
* 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; | |
import org.eclipse.viatra2.framework.IFramework; | |
public class LPGParseVTCLAction extends Action | |
{ | |
public LPGParseVTCLAction() | |
{ | |
setActionDefinitionId("org.eclipse.viatra2.editor.lpgParseCommand"); | |
} | |
@Override | |
public void run() { | |
VTCLEditor iEditor = Activator.getDefault().getCurrentVTCLEditor(); | |
if (FrameworkManager.getInstance().getAllFrameWorks().length<1) | |
return; | |
String iFrameworkID = FrameworkManager.getInstance().getAllFrameWorks()[0]; | |
if (iEditor!=null && iFrameworkID!=null) | |
{ | |
IFramework fw = FrameworkManager.getInstance().getFramework(iFrameworkID); | |
if (fw==null) | |
return; | |
if (iEditor.isDirty()) | |
iEditor.doSave(null); | |
try { | |
// -- Changed by Daniel Varro to initiate parsing from a single method | |
iEditor.executeParsing(true); | |
} catch (Exception e) | |
{ | |
fw.getLogger().fatal(e.getMessage()); | |
} | |
} | |
} | |
} |