Search in sources :

Example 1 with CallDataTypeDialog

use of org.palladiosimulator.editors.commons.dialogs.datatype.CallDataTypeDialog 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 2 with CallDataTypeDialog

use of org.palladiosimulator.editors.commons.dialogs.datatype.CallDataTypeDialog in project Palladio-Editors-Sirius by PalladioSimulator.

the class OperationsEditorSection 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[SIGNATURENAME_COLUMN_INDEX] = new TextCellEditor(table);
    // create 'DeleteCellValueListener' and as SelectionListener to the 'TableVewer'
    OperationDeleteCellValueListener cellValueListener = new OperationDeleteCellValueListener(viewer);
    viewer.addSelectionChangedListener(cellValueListener);
    editors[RETURNTYPE_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(getSelectedSignature());
            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();
        }
    };
    editors[PARAMETER_COLUMN_INDEX] = new DialogCellEditor(table) {

        @Override
        protected Object openDialogBox(Control cellEditorWindow) {
            ParametersDialog dialog = new ParametersDialog(cellEditorWindow.getShell(), getSelectedSignature());
            if (dialog.open() == Dialog.OK)
                viewer.refresh();
            return null;
        }
    };
    return editors;
}
Also used : CellEditor(org.eclipse.jface.viewers.CellEditor) TypeDialogCellEditor(org.palladiosimulator.editors.commons.tabs.operations.TypeDialogCellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) DialogCellEditor(org.eclipse.jface.viewers.DialogCellEditor) ArrayList(java.util.ArrayList) TypeDialogCellEditor(org.palladiosimulator.editors.commons.tabs.operations.TypeDialogCellEditor) ParametersDialog(org.palladiosimulator.editors.commons.dialogs.parameters.ParametersDialog) CallDataTypeDialog(org.palladiosimulator.editors.commons.dialogs.datatype.CallDataTypeDialog) Control(org.eclipse.swt.widgets.Control) Repository(org.palladiosimulator.pcm.repository.Repository) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) TypeDialogCellEditor(org.palladiosimulator.editors.commons.tabs.operations.TypeDialogCellEditor) DialogCellEditor(org.eclipse.jface.viewers.DialogCellEditor) DataType(org.palladiosimulator.pcm.repository.DataType) OperationDeleteCellValueListener(org.palladiosimulator.editors.commons.tabs.operations.OperationDeleteCellValueListener) EObject(org.eclipse.emf.ecore.EObject) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) EReference(org.eclipse.emf.ecore.EReference)

Aggregations

ArrayList (java.util.ArrayList)2 EObject (org.eclipse.emf.ecore.EObject)2 EReference (org.eclipse.emf.ecore.EReference)2 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 DataType (org.palladiosimulator.pcm.repository.DataType)2 Repository (org.palladiosimulator.pcm.repository.Repository)2 DialogCellEditor (org.eclipse.jface.viewers.DialogCellEditor)1 ParametersDialog (org.palladiosimulator.editors.commons.dialogs.parameters.ParametersDialog)1 EventTypeDeleteCellValueListener (org.palladiosimulator.editors.commons.tabs.operations.EventTypeDeleteCellValueListener)1 OperationDeleteCellValueListener (org.palladiosimulator.editors.commons.tabs.operations.OperationDeleteCellValueListener)1