/*******************************************************************************
 * Copyright (c) 2016, 2017 Artal Technologies and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Aurelien Didier (Artal Technologies) - initial API and implementation
 *******************************************************************************/
/**
 * Generated with Acceleo
 */
package org.polarsys.time4sys.ui.views.srm.parts.forms;

// Start of user code for imports
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent;
import org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent;
import org.eclipse.emf.eef.runtime.api.parts.IFormPropertiesEditionPart;
import org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext;
import org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent;
import org.eclipse.emf.eef.runtime.part.impl.SectionPropertiesEditingPart;
import org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy;
import org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider;
import org.eclipse.emf.eef.runtime.ui.parts.PartComposer;
import org.eclipse.emf.eef.runtime.ui.parts.sequence.BindingCompositionSequence;
import org.eclipse.emf.eef.runtime.ui.parts.sequence.CompositionSequence;
import org.eclipse.emf.eef.runtime.ui.parts.sequence.CompositionStep;
import org.eclipse.emf.eef.runtime.ui.utils.EditingUtils;
import org.eclipse.emf.eef.runtime.ui.widgets.EEFFeatureEditorDialog;
import org.eclipse.emf.eef.runtime.ui.widgets.FormUtils;
import org.eclipse.emf.eef.runtime.ui.widgets.ReferencesTable;
import org.eclipse.emf.eef.runtime.ui.widgets.ReferencesTable.ReferencesTableListener;
import org.eclipse.emf.eef.runtime.ui.widgets.TabElementTreeSelectionDialog;
import org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableContentProvider;
import org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.views.properties.tabbed.ISection;
import org.polarsys.time4sys.marte.srm.SrmPackage;
import org.polarsys.time4sys.ui.views.srm.parts.OtherPropertiesEditionPart;
import org.polarsys.time4sys.ui.views.srm.parts.SrmViewsRepository;
import org.polarsys.time4sys.ui.views.srm.providers.SrmMessages;

// End of user code

/**
 * 
 * 
 */
public class OtherPropertiesEditionPartForm extends SectionPropertiesEditingPart
		implements IFormPropertiesEditionPart, OtherPropertiesEditionPart {

	protected Text packetSize;
	protected Button isMaskable;
	protected Button isStaticSchedulingFeature;
	protected Button isIntraMemoryPartitionInteraction;
	protected Text memoryBlockAddressElements;
	protected Button editMemoryBlockAddressElements;
	private EList memoryBlockAddressElementsList;
	protected Text stackSizeElements;
	protected Button editStackSizeElements;
	private EList stackSizeElementsList;
	protected Text heapSizeElements;
	protected Button editHeapSizeElements;
	private EList heapSizeElementsList;
	protected Text maskElements;
	protected Button editMaskElements;
	private EList maskElementsList;
	protected Text vectorElements;
	protected Button editVectorElements;
	private EList vectorElementsList;
	protected Text memoryBlockSizeElements;
	protected Button editMemoryBlockSizeElements;
	private EList memoryBlockSizeElementsList;
	protected ReferencesTable ownedService;
	protected List<ViewerFilter> ownedServiceBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> ownedServiceFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable pInterface;
	protected List<ViewerFilter> pInterfaceBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> pInterfaceFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable rInterface;
	protected List<ViewerFilter> rInterfaceBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> rInterfaceFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable pServices;
	protected List<ViewerFilter> pServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> pServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable rServices;
	protected List<ViewerFilter> rServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> rServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable createServices;
	protected List<ViewerFilter> createServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> createServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable deleteServices;
	protected List<ViewerFilter> deleteServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> deleteServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable initializeServices;
	protected List<ViewerFilter> initializeServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> initializeServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable activateServices;
	protected List<ViewerFilter> activateServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> activateServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable resumeServices;
	protected List<ViewerFilter> resumeServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> resumeServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable suspendServices;
	protected List<ViewerFilter> suspendServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> suspendServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable enableConcurrencyServices;
	protected List<ViewerFilter> enableConcurrencyServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> enableConcurrencyServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable disableConcurrencyServices;
	protected List<ViewerFilter> disableConcurrencyServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> disableConcurrencyServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable forkServices;
	protected List<ViewerFilter> forkServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> forkServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable exitServices;
	protected List<ViewerFilter> exitServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> exitServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable memorySpaces;
	protected List<ViewerFilter> memorySpacesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> memorySpacesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable closeServices;
	protected List<ViewerFilter> closeServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> closeServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable openServices;
	protected List<ViewerFilter> openServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> openServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable acquireServices;
	protected List<ViewerFilter> acquireServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> acquireServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable releaseServices;
	protected List<ViewerFilter> releaseServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> releaseServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable controlServices;
	protected List<ViewerFilter> controlServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> controlServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable sendServices;
	protected List<ViewerFilter> sendServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> sendServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable receiveServices;
	protected List<ViewerFilter> receiveServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> receiveServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable readServices;
	protected List<ViewerFilter> readServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> readServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable writeServices;
	protected List<ViewerFilter> writeServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> writeServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable flushServices;
	protected List<ViewerFilter> flushServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> flushServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable signalServices;
	protected List<ViewerFilter> signalServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> signalServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable waitServices;
	protected List<ViewerFilter> waitServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> waitServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable clearServices;
	protected List<ViewerFilter> clearServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> clearServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable lockServices;
	protected List<ViewerFilter> lockServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> lockServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable unlockServices;
	protected List<ViewerFilter> unlockServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> unlockServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable joinServices;
	protected List<ViewerFilter> joinServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> joinServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable yieldServices;
	protected List<ViewerFilter> yieldServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> yieldServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable delayServices;
	protected List<ViewerFilter> delayServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> delayServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable mapServices;
	protected List<ViewerFilter> mapServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> mapServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable unmapServices;
	protected List<ViewerFilter> unmapServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> unmapServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable terminateServices;
	protected List<ViewerFilter> terminateServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> terminateServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable routineConnectServices;
	protected List<ViewerFilter> routineConnectServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> routineConnectServicesFilters = new ArrayList<ViewerFilter>();
	protected ReferencesTable routineDisconnectServices;
	protected List<ViewerFilter> routineDisconnectServicesBusinessFilters = new ArrayList<ViewerFilter>();
	protected List<ViewerFilter> routineDisconnectServicesFilters = new ArrayList<ViewerFilter>();

	/**
	 * For {@link ISection} use only.
	 */
	public OtherPropertiesEditionPartForm() {
		super();
	}

	/**
	 * Default constructor
	 * 
	 * @param editionComponent
	 *            the {@link IPropertiesEditionComponent} that manage this part
	 * 
	 */
	public OtherPropertiesEditionPartForm(IPropertiesEditionComponent editionComponent) {
		super(editionComponent);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.eef.runtime.api.parts.IFormPropertiesEditionPart#
	 *      createFigure(org.eclipse.swt.widgets.Composite,
	 *      org.eclipse.ui.forms.widgets.FormToolkit)
	 * 
	 */
	public Composite createFigure(final Composite parent, final FormToolkit widgetFactory) {
		ScrolledForm scrolledForm = widgetFactory.createScrolledForm(parent);
		Form form = scrolledForm.getForm();
		view = form.getBody();
		GridLayout layout = new GridLayout();
		layout.numColumns = 3;
		view.setLayout(layout);
		createControls(widgetFactory, view);
		return scrolledForm;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.eef.runtime.api.parts.IFormPropertiesEditionPart#
	 *      createControls(org.eclipse.ui.forms.widgets.FormToolkit,
	 *      org.eclipse.swt.widgets.Composite)
	 * 
	 */
	public void createControls(final FormToolkit widgetFactory, Composite view) {
		CompositionSequence otherStep = new BindingCompositionSequence(propertiesEditionComponent);
		CompositionStep propertiesStep = otherStep.addStep(SrmViewsRepository.Other.Properties.class);
		propertiesStep.addStep(SrmViewsRepository.Other.Properties.packetSize);
		propertiesStep.addStep(SrmViewsRepository.Other.Properties.isMaskable);
		propertiesStep.addStep(SrmViewsRepository.Other.Properties.isStaticSchedulingFeature);
		propertiesStep.addStep(SrmViewsRepository.Other.Properties.isIntraMemoryPartitionInteraction);
		propertiesStep.addStep(SrmViewsRepository.Other.Properties.memoryBlockAddressElements);
		propertiesStep.addStep(SrmViewsRepository.Other.Properties.stackSizeElements);
		propertiesStep.addStep(SrmViewsRepository.Other.Properties.heapSizeElements);
		propertiesStep.addStep(SrmViewsRepository.Other.Properties.maskElements);
		propertiesStep.addStep(SrmViewsRepository.Other.Properties.vectorElements);
		propertiesStep.addStep(SrmViewsRepository.Other.Properties.memoryBlockSizeElements);
		propertiesStep.addStep(SrmViewsRepository.Other.Properties.ownedService);
		propertiesStep.addStep(SrmViewsRepository.O