Search in sources :

Example 6 with RootEntity

use of org.openlca.core.model.RootEntity in project olca-app by GreenDelta.

the class InfoSection method link.

static void link(Composite comp, String label, Object entity) {
    new Label(comp, SWT.NONE).setText(label);
    var link = new ImageHyperlink(comp, SWT.TOP);
    link.setForeground(Colors.linkBlue());
    if (entity instanceof RootDescriptor) {
        var d = (RootDescriptor) entity;
        link.setText(Labels.name(d));
        link.setImage(Images.get(d));
        Controls.onClick(link, e -> App.open(d));
    } else if (entity instanceof RootEntity) {
        var ce = (RootEntity) entity;
        link.setText(Labels.name(ce));
        link.setImage(Images.get(ce));
        Controls.onClick(link, e -> App.open(ce));
    }
}
Also used : M(org.openlca.app.M) Text(org.eclipse.swt.widgets.Text) Labels(org.openlca.app.util.Labels) Button(org.eclipse.swt.widgets.Button) App(org.openlca.app.App) Colors(org.openlca.app.util.Colors) Controls(org.openlca.app.util.Controls) Images(org.openlca.app.rcp.images.Images) CalculationSetup(org.openlca.core.model.CalculationSetup) RootEntity(org.openlca.core.model.RootEntity) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) RootDescriptor(org.openlca.core.model.descriptors.RootDescriptor) FileType(org.openlca.app.util.FileType) UI(org.openlca.app.util.UI) Composite(org.eclipse.swt.widgets.Composite) SWT(org.eclipse.swt.SWT) Label(org.eclipse.swt.widgets.Label) Editors(org.openlca.app.editors.Editors) ProcessType(org.openlca.core.model.ProcessType) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) Label(org.eclipse.swt.widgets.Label) RootDescriptor(org.openlca.core.model.descriptors.RootDescriptor) RootEntity(org.openlca.core.model.RootEntity)

Example 7 with RootEntity

use of org.openlca.core.model.RootEntity in project olca-modules by GreenDelta.

the class VersionChangeTest method testUpdate.

@Test
public void testUpdate() throws Exception {
    for (Class<?> clazz : classes) {
        RootEntity entity = (RootEntity) clazz.newInstance();
        testUpdate(entity);
    }
}
Also used : RootEntity(org.openlca.core.model.RootEntity) Test(org.junit.Test)

Example 8 with RootEntity

use of org.openlca.core.model.RootEntity in project olca-modules by GreenDelta.

the class ExchangeUseSearchTest method tearDown.

@After
public void tearDown() {
    while (!modelStack.isEmpty()) {
        RootEntity entity = modelStack.pop();
        @SuppressWarnings("unchecked") BaseDao<RootEntity> dao = (BaseDao<RootEntity>) Daos.base(db, entity.getClass());
        dao.delete(entity);
    }
}
Also used : BaseDao(org.openlca.core.database.BaseDao) RootEntity(org.openlca.core.model.RootEntity) After(org.junit.After)

Example 9 with RootEntity

use of org.openlca.core.model.RootEntity in project olca-app by GreenDelta.

the class CopyPaste method copy.

private static void copy(ModelElement element, INavigationElement<?> categoryElement) {
    RootEntity copy = copy(element);
    if (copy == null)
        return;
    copy.category = getCategory(categoryElement);
    insert(copy);
}
Also used : RootEntity(org.openlca.core.model.RootEntity)

Aggregations

RootEntity (org.openlca.core.model.RootEntity)9 ImageHyperlink (org.eclipse.ui.forms.widgets.ImageHyperlink)3 RootDescriptor (org.openlca.core.model.descriptors.RootDescriptor)3 CLabel (org.eclipse.swt.custom.CLabel)2 Composite (org.eclipse.swt.widgets.Composite)2 Label (org.eclipse.swt.widgets.Label)2 LinkedList (java.util.LinkedList)1 Action (org.eclipse.jface.action.Action)1 SWT (org.eclipse.swt.SWT)1 Button (org.eclipse.swt.widgets.Button)1 Text (org.eclipse.swt.widgets.Text)1 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)1 Section (org.eclipse.ui.forms.widgets.Section)1 After (org.junit.After)1 Test (org.junit.Test)1 App (org.openlca.app.App)1 M (org.openlca.app.M)1 Editors (org.openlca.app.editors.Editors)1 CommentControl (org.openlca.app.editors.comments.CommentControl)1 CategoryElement (org.openlca.app.navigation.elements.CategoryElement)1