Search in sources :

Example 1 with DataType

use of org.palladiosimulator.pcm.repository.DataType in project Palladio-Editors-Sirius by PalladioSimulator.

the class DataTypeSelectionWizard method selectDataType.

public static DataType selectDataType(EObject eObject) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(DataType.class);
    // Additional Child References
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    // Creating the dialog
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, eObject.eResource().getResourceSet());
    // Setting the needed object type
    dialog.setProvidedService(DataType.class);
    dialog.open();
    return (DataType) dialog.getResult();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) DataType(org.palladiosimulator.pcm.repository.DataType) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Example 2 with DataType

use of org.palladiosimulator.pcm.repository.DataType in project Palladio-Editors-Sirius by PalladioSimulator.

the class ReconnectSourceOfContainsRelation method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    CompositeDataType oldSource = (CompositeDataType) parameters.get("source");
    CompositeDataType newSource = (CompositeDataType) parameters.get("target");
    DNodeList otherEnd = (DNodeList) parameters.get("otherEnd");
    DataType target = (DataType) otherEnd.getTarget();
    InnerDeclaration innerDeclaration = (InnerDeclaration) parameters.get("instance");
    EList<InnerDeclaration> newInnerDeclarations = newSource.getInnerDeclaration_CompositeDataType();
    boolean found = false;
    Iterator<InnerDeclaration> it = newInnerDeclarations.iterator();
    while (it.hasNext()) {
        InnerDeclaration current = (InnerDeclaration) it.next();
        if (current.getDatatype_InnerDeclaration() != null && current.getDatatype_InnerDeclaration().equals(target))
            found = true;
    }
    if (found) {
        newInnerDeclarations.remove(innerDeclaration);
    } else {
        innerDeclaration.setDatatype_InnerDeclaration(target);
    }
    EList<InnerDeclaration> oldInnerDeclarations = oldSource.getInnerDeclaration_CompositeDataType();
    it = oldInnerDeclarations.iterator();
    while (it.hasNext()) {
        InnerDeclaration current = (InnerDeclaration) it.next();
        if (current.getDatatype_InnerDeclaration().equals(target))
            it.remove();
    }
}
Also used : DNodeList(org.eclipse.sirius.diagram.DNodeList) CompositeDataType(org.palladiosimulator.pcm.repository.CompositeDataType) DataType(org.palladiosimulator.pcm.repository.DataType) CompositeDataType(org.palladiosimulator.pcm.repository.CompositeDataType) InnerDeclaration(org.palladiosimulator.pcm.repository.InnerDeclaration)

Example 3 with DataType

use of org.palladiosimulator.pcm.repository.DataType in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetInnerDeclaration method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    InnerDeclaration innerDeclaration = (InnerDeclaration) parameters.get("innerDeclaration");
    DataType dt = DataTypeSelectionWizard.selectDataType(innerDeclaration);
    if (dt != null)
        innerDeclaration.setDatatype_InnerDeclaration(dt);
}
Also used : DataType(org.palladiosimulator.pcm.repository.DataType) InnerDeclaration(org.palladiosimulator.pcm.repository.InnerDeclaration)

Example 4 with DataType

use of org.palladiosimulator.pcm.repository.DataType in project Palladio-Editors-Sirius by PalladioSimulator.

the class EventTypesEditorSection method createViewerCellEditors.

/* (non-Javadoc)
	 * @see org.palladiosimulator.editors.commons.tabs.generic.EditorSection#createViewerCellEditors(org.eclipse.swt.widgets.Table)
	 */
@Override
protected CellEditor[] createViewerCellEditors(Table table) {
    CellEditor[] editors = new CellEditor[columnNames.length];
    editors[EVENTTYPENAME_COLUMN_INDEX] = new TextCellEditor(table);
    // create 'DeleteCellValueListener' and as SelectionListener to the 'TableVewer'
    EventTypeDeleteCellValueListener cellValueListener = new EventTypeDeleteCellValueListener(viewer);
    viewer.addSelectionChangedListener(cellValueListener);
    editors[PARAMETER_NAME_COLUMN_INDEX] = new TextCellEditor(table);
    editors[PARAMETER_TYPE_COLUMN_INDEX] = new TypeDialogCellEditor(table, cellValueListener) {

        /* (non-Javadoc)
			 * @see org.eclipse.jface.viewers.DialogCellEditor#openDialogBox(org.eclipse.swt.widgets.Control)
			 */
        @Override
        protected Object openDialogBox(Control cellEditorWindow) {
            TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(getSelectedEventType());
            ArrayList<Object> filterList = new ArrayList<Object>();
            filterList.add(DataType.class);
            filterList.add(Repository.class);
            ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
            CallDataTypeDialog dialog = new CallDataTypeDialog(cellEditorWindow.getShell(), filterList, additionalReferences, editingDomain.getResourceSet());
            dialog.setProvidedService(DataType.class);
            dialog.open();
            if (!(dialog.getResult() instanceof DataType))
                return null;
            return dialog.getResult();
        }
    };
    return editors;
}
Also used : TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) CellEditor(org.eclipse.jface.viewers.CellEditor) TypeDialogCellEditor(org.palladiosimulator.editors.commons.tabs.operations.TypeDialogCellEditor) ArrayList(java.util.ArrayList) TypeDialogCellEditor(org.palladiosimulator.editors.commons.tabs.operations.TypeDialogCellEditor) CallDataTypeDialog(org.palladiosimulator.editors.commons.dialogs.datatype.CallDataTypeDialog) Control(org.eclipse.swt.widgets.Control) Repository(org.palladiosimulator.pcm.repository.Repository) EventTypeDeleteCellValueListener(org.palladiosimulator.editors.commons.tabs.operations.EventTypeDeleteCellValueListener) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) DataType(org.palladiosimulator.pcm.repository.DataType) EObject(org.eclipse.emf.ecore.EObject) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) EReference(org.eclipse.emf.ecore.EReference)

Example 5 with DataType

use of org.palladiosimulator.pcm.repository.DataType in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetInnerType method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    CollectionDataType cdt = (CollectionDataType) parameters.get("collection");
    DataType dt = DataTypeSelectionWizard.selectDataType(cdt);
    if (dt != null)
        cdt.setInnerType_CollectionDataType(dt);
}
Also used : CollectionDataType(org.palladiosimulator.pcm.repository.CollectionDataType) CollectionDataType(org.palladiosimulator.pcm.repository.CollectionDataType) DataType(org.palladiosimulator.pcm.repository.DataType)

Aggregations

DataType (org.palladiosimulator.pcm.repository.DataType)7 ArrayList (java.util.ArrayList)3 EObject (org.eclipse.emf.ecore.EObject)3 EReference (org.eclipse.emf.ecore.EReference)3 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)2 CellEditor (org.eclipse.jface.viewers.CellEditor)2 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)2 Control (org.eclipse.swt.widgets.Control)2 CallDataTypeDialog (org.palladiosimulator.editors.commons.dialogs.datatype.CallDataTypeDialog)2 TypeDialogCellEditor (org.palladiosimulator.editors.commons.tabs.operations.TypeDialogCellEditor)2 CollectionDataType (org.palladiosimulator.pcm.repository.CollectionDataType)2 InnerDeclaration (org.palladiosimulator.pcm.repository.InnerDeclaration)2 Repository (org.palladiosimulator.pcm.repository.Repository)2 DialogCellEditor (org.eclipse.jface.viewers.DialogCellEditor)1 DNodeList (org.eclipse.sirius.diagram.DNodeList)1 ParametersDialog (org.palladiosimulator.editors.commons.dialogs.parameters.ParametersDialog)1 PalladioSelectEObjectDialog (org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog)1 EventTypeDeleteCellValueListener (org.palladiosimulator.editors.commons.tabs.operations.EventTypeDeleteCellValueListener)1 OperationDeleteCellValueListener (org.palladiosimulator.editors.commons.tabs.operations.OperationDeleteCellValueListener)1 CompositeDataType (org.palladiosimulator.pcm.repository.CompositeDataType)1