Search in sources :

Example 26 with IArchimateConcept

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

the class DrillDownManager method goInto.

void goInto() {
    IStructuredSelection sel = (IStructuredSelection) fGraphViewer.getSelection();
    IArchimateConcept concept = (IArchimateConcept) sel.getFirstElement();
    if (isValidObject(concept)) {
        saveCurrentState();
        fBackStack.push(fCurrentConcept);
        fCurrentConcept = concept;
        setGraphViewerInput(concept);
        updateNavigationButtons();
        restoreLastState();
        fView.updateLabel();
    }
}
Also used : IArchimateConcept(com.archimatetool.model.IArchimateConcept) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 27 with IArchimateConcept

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

the class NavigatorView method setElement.

private void setElement(Object object) {
    fDrillDownAdapter.reset();
    IArchimateConcept concept = null;
    if (object instanceof IArchimateConcept) {
        concept = (IArchimateConcept) object;
    } else if (object instanceof IAdaptable) {
        concept = ((IAdaptable) object).getAdapter(IArchimateConcept.class);
    }
    if (concept != null) {
        // Need to use an array
        getViewer().setInput(new Object[] { concept });
    } else {
        getViewer().setInput(null);
    }
    fCurrentArchimateConcept = concept;
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) IArchimateConcept(com.archimatetool.model.IArchimateConcept)

Example 28 with IArchimateConcept

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

the class MagicConnectionCreationTool method setTargetEditPart.

@Override
protected void setTargetEditPart(EditPart editpart) {
    /*
         * Set editpart to null if it's not an Archimate target concept so we can handle it as if we clicked on the canvas.
         * This also disables unwanted connection target feedback.
         */
    if (editpart != null && !(editpart.getModel() instanceof IDiagramModelArchimateComponent)) {
        editpart = null;
    }
    /*
         * Check whether we are trying to connect an element to a relation where the relation is already connected to that element
         * If we are, set editpart to null to veto it.
         */
    if (editpart != null) {
        EditPart sourceEditPart = ((CreateConnectionRequest) getSourceRequest()).getSourceEditPart();
        if (sourceEditPart != null) {
            if (sourceEditPart.getModel() instanceof IDiagramModelArchimateComponent && editpart.getModel() instanceof IDiagramModelArchimateComponent) {
                IArchimateConcept sourceConcept = ((IDiagramModelArchimateComponent) sourceEditPart.getModel()).getArchimateConcept();
                IArchimateConcept targetConcept = ((IDiagramModelArchimateComponent) editpart.getModel()).getArchimateConcept();
                if (ArchimateModelUtils.hasDirectRelationship(sourceConcept, targetConcept)) {
                    editpart = null;
                }
            }
        }
    }
    super.setTargetEditPart(editpart);
}
Also used : IDiagramModelArchimateComponent(com.archimatetool.model.IDiagramModelArchimateComponent) GroupEditPart(com.archimatetool.editor.diagram.editparts.diagram.GroupEditPart) AbstractBaseEditPart(com.archimatetool.editor.diagram.editparts.AbstractBaseEditPart) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) EditPart(org.eclipse.gef.EditPart) IArchimateConcept(com.archimatetool.model.IArchimateConcept) CreateConnectionRequest(org.eclipse.gef.requests.CreateConnectionRequest)

Example 29 with IArchimateConcept

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

the class ZestViewerContentProvider method getElements.

@Override
public Object[] getElements(Object inputElement) {
    if (inputElement instanceof IArchimateConcept) {
        IArchimateConcept archimateConcept = (IArchimateConcept) inputElement;
        // Check if it was deleted
        if (archimateConcept.eContainer() == null) {
            return new Object[0];
        }
        // Relationship
        if (archimateConcept instanceof IArchimateRelationship) {
            return new Object[] { inputElement };
        }
        // Element - Get its relationships
        if (archimateConcept instanceof IArchimateElement) {
            List<IArchimateRelationship> mainList = new ArrayList<IArchimateRelationship>();
            getRelations(mainList, new ArrayList<IArchimateConcept>(), archimateConcept, 0);
            return mainList.toArray();
        }
    }
    return new Object[0];
}
Also used : ArrayList(java.util.ArrayList) IArchimateConcept(com.archimatetool.model.IArchimateConcept) IArchimateElement(com.archimatetool.model.IArchimateElement) IArchimateRelationship(com.archimatetool.model.IArchimateRelationship)

Example 30 with IArchimateConcept

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

the class ZestViewerLabelProvider method getTooltip.

public IFigure getTooltip(Object entity) {
    if (entity instanceof IArchimateConcept) {
        ToolTipFigure l = new ToolTipFigure();
        String type = ArchiLabelProvider.INSTANCE.getDefaultName(((EObject) entity).eClass());
        l.setText(ArchiLabelProvider.INSTANCE.getLabel(entity));
        // $NON-NLS-1$
        l.setType(Messages.ZestViewerLabelProvider_0 + " " + type);
        if (entity instanceof IArchimateRelationship) {
            l.setRubric(ArchiLabelProvider.INSTANCE.getRelationshipSentence((IArchimateRelationship) entity));
        }
        return l;
    }
    return null;
}
Also used : ToolTipFigure(com.archimatetool.editor.diagram.figures.ToolTipFigure) IArchimateConcept(com.archimatetool.model.IArchimateConcept) IArchimateRelationship(com.archimatetool.model.IArchimateRelationship)

Aggregations

IArchimateConcept (com.archimatetool.model.IArchimateConcept)38 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)14 ArrayList (java.util.ArrayList)9 IDiagramModel (com.archimatetool.model.IDiagramModel)7 EObject (org.eclipse.emf.ecore.EObject)7 IArchimateElement (com.archimatetool.model.IArchimateElement)6 IDiagramModelArchimateComponent (com.archimatetool.model.IDiagramModelArchimateComponent)6 Test (org.junit.Test)6 IDiagramModelComponent (com.archimatetool.model.IDiagramModelComponent)5 IDiagramModelArchimateConnection (com.archimatetool.model.IDiagramModelArchimateConnection)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 IArchimateDiagramEditor (com.archimatetool.editor.diagram.IArchimateDiagramEditor)3 IDiagramModelEditor (com.archimatetool.editor.diagram.IDiagramModelEditor)3 IArchimateModel (com.archimatetool.model.IArchimateModel)3 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)3 CSVParseException (com.archimatetool.csv.CSVParseException)2 NonNotifyingCompoundCommand (com.archimatetool.editor.model.commands.NonNotifyingCompoundCommand)2 IConnectable (com.archimatetool.model.IConnectable)2 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)2 IDiagramModelConnection (com.archimatetool.model.IDiagramModelConnection)2