Search in sources :

Example 76 with IArchimateModel

use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.

the class PreviewHTMLReportHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IArchimateModel model = getActiveArchimateModel();
    if (model != null) {
        HTMLReportExporter exporter = new HTMLReportExporter(model);
        exporter.preview();
    }
    return null;
}
Also used : IArchimateModel(com.archimatetool.model.IArchimateModel)

Example 77 with IArchimateModel

use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.

the class JasperReportsHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IArchimateModel model = getActiveArchimateModel();
    if (model != null) {
        WizardDialog dialog = new ExtendedWizardDialog(workbenchWindow.getShell(), new ExportJasperReportsWizard(model), // $NON-NLS-1$
        "ExportJasperReportsWizard");
        dialog.open();
    }
    return null;
}
Also used : ExtendedWizardDialog(com.archimatetool.editor.ui.components.ExtendedWizardDialog) IArchimateModel(com.archimatetool.model.IArchimateModel) WizardDialog(org.eclipse.jface.wizard.WizardDialog) ExtendedWizardDialog(com.archimatetool.editor.ui.components.ExtendedWizardDialog)

Example 78 with IArchimateModel

use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.

the class CreateMapViewCheatSheetAction method run.

public void run(String[] params, ICheatSheetManager manager) {
    IViewPart viewPart = ViewManager.showViewPart(ITreeModelView.ID, true);
    if (viewPart == null) {
        MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.CreateMapViewCheatSheetAction_0, Messages.CreateMapViewCheatSheetAction_1);
        return;
    }
    IArchimateModel model = viewPart.getAdapter(IArchimateModel.class);
    if (model == null) {
        MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.CreateMapViewCheatSheetAction_2, Messages.CreateMapViewCheatSheetAction_3);
        return;
    }
    EList<IDiagramModel> diagramModels = model.getDiagramModels();
    if (diagramModels.size() < 2) {
        MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.CreateMapViewCheatSheetAction_4, Messages.CreateMapViewCheatSheetAction_5);
        return;
    }
    CommandStack stack = (CommandStack) model.getAdapter(CommandStack.class);
    if (stack != null) {
        stack.execute(new NewMapViewCommand(model));
    }
}
Also used : CommandStack(org.eclipse.gef.commands.CommandStack) IViewPart(org.eclipse.ui.IViewPart) IDiagramModel(com.archimatetool.model.IDiagramModel) IArchimateModel(com.archimatetool.model.IArchimateModel)

Example 79 with IArchimateModel

use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.

the class FieldDataFactory method getFieldValue.

public static Object getFieldValue(Object dataElement, String fieldName) {
    if ("this".equals(fieldName)) {
        // $NON-NLS-1$
        return dataElement;
    }
    if ("id".equals(fieldName) && dataElement instanceof IIdentifier) {
        // $NON-NLS-1$
        return ((IIdentifier) dataElement).getId();
    }
    if ("name".equals(fieldName) && dataElement instanceof INameable) {
        // $NON-NLS-1$
        String name = ((INameable) dataElement).getName();
        if (name == null || "".equals(name)) {
            // $NON-NLS-1$
            name = ArchiLabelProvider.INSTANCE.getDefaultName(((EObject) dataElement).eClass());
        }
        return name;
    }
    if ("type".equals(fieldName) && dataElement instanceof EObject) {
        // $NON-NLS-1$
        return ArchiLabelProvider.INSTANCE.getDefaultName(((EObject) dataElement).eClass());
    }
    if ("documentation".equals(fieldName) && dataElement instanceof IDocumentable) {
        // $NON-NLS-1$
        String s = ((IDocumentable) dataElement).getDocumentation();
        return StringUtils.isSet(s) ? s : null;
    }
    if ("purpose".equals(fieldName) && dataElement instanceof IArchimateModel) {
        // $NON-NLS-1$
        String s = ((IArchimateModel) dataElement).getPurpose();
        return StringUtils.isSet(s) ? s : null;
    }
    if ("relation_source".equals(fieldName) && dataElement instanceof IArchimateRelationship) {
        // $NON-NLS-1$
        IArchimateRelationship relation = (IArchimateRelationship) dataElement;
        IArchimateConcept source = relation.getSource();
        String s = source.getName();
        return StringUtils.isSet(s) ? s : null;
    }
    if ("relation_target".equals(fieldName) && dataElement instanceof IArchimateRelationship) {
        // $NON-NLS-1$
        IArchimateRelationship relation = (IArchimateRelationship) dataElement;
        IArchimateConcept target = relation.getTarget();
        String s = target.getName();
        return StringUtils.isSet(s) ? s : null;
    }
    return null;
}
Also used : IDocumentable(com.archimatetool.model.IDocumentable) IIdentifier(com.archimatetool.model.IIdentifier) INameable(com.archimatetool.model.INameable) EObject(org.eclipse.emf.ecore.EObject) IArchimateConcept(com.archimatetool.model.IArchimateConcept) IArchimateRelationship(com.archimatetool.model.IArchimateRelationship) IArchimateModel(com.archimatetool.model.IArchimateModel)

Example 80 with IArchimateModel

use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.

the class ValidatorView method selectionChanged.

public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    if (part == this || part == null) {
        return;
    }
    IArchimateModel model = part.getAdapter(IArchimateModel.class);
    if (model != null) {
        fModel = model;
    }
    fActionValidate.setEnabled(fModel != null);
}
Also used : IArchimateModel(com.archimatetool.model.IArchimateModel)

Aggregations

IArchimateModel (com.archimatetool.model.IArchimateModel)124 Test (org.junit.Test)51 File (java.io.File)35 IOException (java.io.IOException)22 IArchimateElement (com.archimatetool.model.IArchimateElement)14 EObject (org.eclipse.emf.ecore.EObject)14 IArchiveManager (com.archimatetool.editor.model.IArchiveManager)13 ArchimateTestModel (com.archimatetool.testingtools.ArchimateTestModel)13 IDiagramModel (com.archimatetool.model.IDiagramModel)12 CommandStack (org.eclipse.gef.commands.CommandStack)11 IFolder (com.archimatetool.model.IFolder)10 ArrayList (java.util.ArrayList)10 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)9 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)9 IArchimateModelObject (com.archimatetool.model.IArchimateModelObject)7 IArchimateDiagramModel (com.archimatetool.model.IArchimateDiagramModel)6 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)6 IDiagramModelArchimateConnection (com.archimatetool.model.IDiagramModelArchimateConnection)5 IIdentifier (com.archimatetool.model.IIdentifier)5 GraficoModelLoader (org.archicontribs.modelrepository.grafico.GraficoModelLoader)5