Просмотр исходного кода

Added Transition Priority Property Page for Choices

Andreas Mülder 14 лет назад
Родитель
Сommit
5ad20f6c0f

+ 8 - 1
plugins/org.yakindu.sct.ui.editor/plugin.xml

@@ -491,7 +491,7 @@
          <propertySection
             id="property.section.domain.exit" 
             tab="property.tab.domain"
-            class="org.yakindu.sct.ui.editor.propertysheets.NamePropertySection">
+            class="org.yakindu.sct.ui.editor.propertysheets.ExitPropertySection">
             <input type="org.yakindu.sct.ui.editor.editparts.ExitEditPart"/>
          </propertySection>
             <!-- Region model section -->         
@@ -501,6 +501,13 @@
             class="org.yakindu.sct.ui.editor.propertysheets.RegionPropertySection">
             <input type="org.yakindu.sct.ui.editor.editparts.RegionEditPart"/>
          </propertySection>
+            <!-- Choice model section -->         
+         <propertySection
+            id="property.section.domain.choice" 
+            tab="property.tab.domain"
+            class="org.yakindu.sct.ui.editor.propertysheets.ChoicePropertySection">
+            <input type="org.yakindu.sct.ui.editor.editparts.ChoiceEditPart"/>
+         </propertySection>
          
          <propertySection id="property.section.ConnectorAppearancePropertySection" 
             filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.ConnectionEditPartPropertySectionFilter" 

+ 54 - 0
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/propertysheets/ChoicePropertySection.java

@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2012 itemis AG 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:
+ * 	itemis AG - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.ui.editor.propertysheets;
+
+import org.eclipse.emf.databinding.EMFDataBindingContext;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.yakindu.sct.model.sgraph.SGraphPackage;
+import org.yakindu.sct.ui.editor.propertysheets.OrderElementControl.ISourceObjectCallback;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class ChoicePropertySection extends AbstractEditorPropertySection
+		implements ISourceObjectCallback {
+
+	private OrderElementControl orderElementControl;
+
+	@Override
+	public void createControls(Composite parent) {
+		Label label = getToolkit().createLabel(parent, "Transition Priority:");
+		GridDataFactory.fillDefaults().applyTo(label);
+		orderElementControl = new OrderElementControl(
+				parent, SGraphPackage.Literals.VERTEX__OUTGOING_TRANSITIONS,
+				this);
+		GridDataFactory.fillDefaults().grab(true, false)
+				.applyTo(orderElementControl);
+	}
+
+	@Override
+	public void bindModel(EMFDataBindingContext context) {
+		orderElementControl.refreshInput();
+	}
+
+	//Enhance visibility
+	@Override
+	public EObject getEObject() {
+		return super.getEObject();
+	}
+
+}

+ 52 - 0
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/propertysheets/ExitPropertySection.java

@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2012 itemis AG 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:
+ * 	itemis AG - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.ui.editor.propertysheets;
+
+import org.eclipse.emf.databinding.EMFDataBindingContext;
+import org.eclipse.emf.databinding.IEMFValueProperty;
+import org.eclipse.emf.databinding.edit.EMFEditProperties;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.jface.databinding.swt.ISWTObservableValue;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.yakindu.sct.model.sgraph.SGraphPackage;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class ExitPropertySection extends AbstractEditorPropertySection {
+	
+	private Text nameText;
+
+	@Override
+	public void createControls(Composite parent) {
+		getToolkit().createLabel(parent, "Name: ");
+		nameText = getToolkit().createText(parent, "");
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText);
+	}
+
+	@Override
+	public void bindModel(EMFDataBindingContext context) {
+		IEMFValueProperty property = EMFEditProperties.value(
+				TransactionUtil.getEditingDomain(eObject),
+				SGraphPackage.Literals.NAMED_ELEMENT__NAME);
+		ISWTObservableValue observe = WidgetProperties.text(SWT.FocusOut)
+				.observe(nameText);
+		context.bindValue(observe, property.observe(eObject));
+	}
+
+}