Search in sources :

Example 1 with AbsModelManager

use of org.absmodels.abs.plugin.editor.reconciling.AbsModelManager in project abstools by abstools.

the class ABSEditor method initCompilationUnit.

private void initCompilationUnit() {
    AbsNature absNature = UtilityFunctions.getAbsNature(getResource());
    if (absNature != null) {
        AbsModelManager modelManager = absNature.getModelManager();
        compilationUnit = modelManager.getCompilationUnit(getAbsoluteFilePath());
    } else {
        // we are looking at abslang.abs or a file inside a jar-package
        IURIEditorInput uriInput = (IURIEditorInput) getEditorInput().getAdapter(IURIEditorInput.class);
        if (uriInput != null) {
            // We're looking e.g. at abslang.abs which only exists in memory.
            // create an empty model which only contains abslang.abs:
            absNature = new AbsNature();
            absNature.emptyModel();
            File f = new File(uriInput.getURI());
            String path = f.getAbsolutePath();
            compilationUnit = absNature.getCompilationUnit(path);
        }
    }
}
Also used : IURIEditorInput(org.eclipse.ui.IURIEditorInput) AbsModelManager(org.absmodels.abs.plugin.editor.reconciling.AbsModelManager) IFile(org.eclipse.core.resources.IFile) File(java.io.File) AbsNature(org.absmodels.abs.plugin.builder.AbsNature)

Aggregations

File (java.io.File)1 AbsNature (org.absmodels.abs.plugin.builder.AbsNature)1 AbsModelManager (org.absmodels.abs.plugin.editor.reconciling.AbsModelManager)1 IFile (org.eclipse.core.resources.IFile)1 IURIEditorInput (org.eclipse.ui.IURIEditorInput)1