commonsrc.ingenias.editor.extension.BasicToolImp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
The INGENIAS Meta-Editor core. It is a set of facilities to generate an editor from a detailed xml description
/**
* Copyright (C) 2010 Jorge J. Gomez-Sanz
*
* This file is part of the INGENME tool. INGENME is an open source meta-editor
* which produces customized editors for user-defined modeling languages
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 3 of the License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
**/
package ingenias.editor.extension;
import ingenias.editor.GUIResources;
import ingenias.editor.IDEState;
import ingenias.editor.IDEUpdater;
import ingenias.editor.ProjectProperty;
import ingenias.exception.NotInitialised;
import ingenias.generator.browser.Browser;
import java.util.*;
import ingenias.generator.datatemplate.*;
import ingenias.generator.interpreter.TemplateTree;
import java.io.*;
import ingenias.generator.browser.*;
/**
* This interface describe the activation method of tools
*
*@author Jorge J. Gomez-Sanz
*@created 30 November 2003
*/
public abstract class BasicToolImp
implements BasicTool {
private Properties prop = new Properties();
public Browser browser=null;
public IDEUpdater ideUpdater=null;
public IDEUpdater getIdeUpdater() {
return ideUpdater;
}
public void setIdeUpdater(IDEUpdater ideUpdater) {
this.ideUpdater = ideUpdater;
}
private IDEState ids;
public IDEState getIds() {
return ids;
}
public void setIds(IDEState ids) {
this.ids = ids;
}
public GUIResources getResources() {
return resources;
}
public void setResources(GUIResources resources) {
this.resources = resources;
}
private GUIResources resources;
/**
* A description of the purpose of this tool
*
*@return The description
*/
public abstract String getDescription();
/**
* The name of this tool. This name will be included in the INGENIAS
* tool
*
*@return The name
*/
public abstract String getName();
/**
* Creates a code generator that reuses that reuses an existing browser
* directly. This constructor is invoked when launching a tool
* from whithin the IDE.
*/
public BasicToolImp(Browser browser) {
this.prop=browser.getState().prop;
for (ProjectProperty pp: this.defaultProperties()){
this.putProperty(pp);
}
this.browser=browser;
}
/**
* Creates a code generator that initialises from scratch a browser.
* This constructor is invoked when launching a stand alone version. When
* the initialisation is made from a file, no default properties are retrieved.
*/
public BasicToolImp(String file) throws ingenias.exception.UnknowFormat,
ingenias.exception.DamagedFormat,
ingenias.exception.CannotLoad {
try {
browser=ingenias.generator.browser.BrowserImp.initialise(file);
Set