Search in sources :

Example 1 with SimpleEditorInput

use of org.openlca.app.editors.SimpleEditorInput in project olca-app by GreenDelta.

the class BigParameterTable method show.

public static void show() {
    if (Database.get() == null) {
        MsgBox.info(M.NoDatabaseOpened, M.NeedOpenDatabase);
        return;
    }
    String id = "BigParameterTable";
    Editors.open(new SimpleEditorInput(id, M.Parameters), id);
}
Also used : SimpleEditorInput(org.openlca.app.editors.SimpleEditorInput)

Example 2 with SimpleEditorInput

use of org.openlca.app.editors.SimpleEditorInput in project olca-app by GreenDelta.

the class LibraryInfoPage method init.

@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    super.init(site, input);
    try {
        var inp = (SimpleEditorInput) input;
        library = Workspace.getLibraryDir().getLibrary(inp.id).orElseThrow();
        info = library.getInfo();
        var db = Database.get();
        if (db != null && db.getLibraries().contains(library.id())) {
            this.db = db;
        }
    } catch (Exception e) {
        throw new PartInitException("failed to init library page", e);
    }
}
Also used : SimpleEditorInput(org.openlca.app.editors.SimpleEditorInput) PartInitException(org.eclipse.ui.PartInitException) PartInitException(org.eclipse.ui.PartInitException)

Example 3 with SimpleEditorInput

use of org.openlca.app.editors.SimpleEditorInput in project olca-app by GreenDelta.

the class MappingTool method open.

public static void open(FlowMap mapping) {
    if (mapping == null)
        return;
    String uid = mapping.refId;
    if (uid == null) {
        uid = UUID.randomUUID().toString();
        mapping.refId = uid;
    }
    AppCache cache = Cache.getAppCache();
    var cacheID = uid + " /mapping";
    cache.put(cacheID, mapping);
    Editors.open(new SimpleEditorInput(cacheID, "Flow mapping"), "MappingTool");
}
Also used : SimpleEditorInput(org.openlca.app.editors.SimpleEditorInput) AppCache(org.openlca.app.db.AppCache)

Example 4 with SimpleEditorInput

use of org.openlca.app.editors.SimpleEditorInput in project olca-app by GreenDelta.

the class MappingTool method open.

/**
 * Open an existing mapping from the database.
 */
public static void open(MappingFile mapping) {
    if (mapping == null)
        return;
    var uid = "db:mapping/" + mapping.id;
    Cache.getAppCache().put(uid, mapping);
    Editors.open(new SimpleEditorInput(uid, mapping.name), "MappingTool");
}
Also used : SimpleEditorInput(org.openlca.app.editors.SimpleEditorInput)

Example 5 with SimpleEditorInput

use of org.openlca.app.editors.SimpleEditorInput in project olca-app by GreenDelta.

the class ProjectResultEditor method init.

@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    super.init(site, input);
    var simpleInput = (SimpleEditorInput) input;
    var obj = Cache.getAppCache().remove(simpleInput.id);
    if (!(obj instanceof ProjectResultData))
        throw new PartInitException("editor input must be a project result");
    data = (ProjectResultData) obj;
    setPartName("Result of: " + Labels.name(data.project()));
}
Also used : SimpleEditorInput(org.openlca.app.editors.SimpleEditorInput) PartInitException(org.eclipse.ui.PartInitException) ProjectResultData(org.openlca.app.editors.projects.ProjectResultData)

Aggregations

SimpleEditorInput (org.openlca.app.editors.SimpleEditorInput)5 PartInitException (org.eclipse.ui.PartInitException)2 AppCache (org.openlca.app.db.AppCache)1 ProjectResultData (org.openlca.app.editors.projects.ProjectResultData)1