Browse Source

Refactoring of Property Pages, first commit for transition ordering

Andreas Mülder 13 years ago
parent
commit
a6894de3d6
10 changed files with 1 additions and 740 deletions
  1. 0 2
      de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/META-INF/MANIFEST.MF
  2. 1 0
      de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/highlighting/HighlightingSupportAdapter.java
  3. 0 108
      de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/GenericFormBasedPropertySection.java
  4. 0 123
      de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/SemanticPropertySection.java
  5. 0 165
      de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/descriptors/AbstractPropertyDescriptor.java
  6. 0 72
      de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/descriptors/ComboPropertyDescriptor.java
  7. 0 54
      de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/descriptors/IFormPropertyDescriptor.java
  8. 0 49
      de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/descriptors/TextAreaPropertyDescriptor.java
  9. 0 63
      de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/descriptors/TextPropertyDescriptor.java
  10. 0 104
      de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/descriptors/XtextPropertyDescriptor.java

+ 0 - 2
de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/META-INF/MANIFEST.MF

@@ -24,7 +24,5 @@ Export-Package: de.itemis.gmf.runtime.commons.commands,
  de.itemis.gmf.runtime.commons.highlighting,
  de.itemis.gmf.runtime.commons.palette,
  de.itemis.gmf.runtime.commons.parsers,
- de.itemis.gmf.runtime.commons.properties,
- de.itemis.gmf.runtime.commons.properties.descriptors,
  de.itemis.gmf.runtime.commons.util,
  de.itemis.gmf.runtime.commons.validation

+ 1 - 0
de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/highlighting/HighlightingSupportAdapter.java

@@ -120,6 +120,7 @@ public class HighlightingSupportAdapter implements IHighlightingSupport {
 
 	public synchronized void fadeOut(EObject semanticElement,
 			HighlightingParameters parameters) {
+		System.out.println("FADE OUT : " + semanticElement);
 		if (!locked) {
 			throw new IllegalStateException(
 					"May only highlight if editor is locked");

+ 0 - 108
de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/GenericFormBasedPropertySection.java

@@ -1,108 +0,0 @@
-/**
- * Copyright (c) 2011 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 de.itemis.gmf.runtime.commons.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.diagram.ui.properties.sections.AbstractModelerPropertySection;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.ui.forms.widgets.Form;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.views.properties.tabbed.ISection;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-
-import de.itemis.gmf.runtime.commons.properties.descriptors.IFormPropertyDescriptor;
-
-/**
- * This is a generic base implementation with a 2 column layout for {@link Form}
- * based {@link ISection}. Clients can provide different
- * {@link IFormPropertyDescriptor}.
- * 
- * @author andreas muelder
- * 
- */
-public abstract class GenericFormBasedPropertySection extends
-		AbstractModelerPropertySection {
-
-	private List<IFormPropertyDescriptor> descriptors;
-
-	protected abstract void createPropertyDescriptors(
-			List<IFormPropertyDescriptor> descriptors);
-
-	public GenericFormBasedPropertySection() {
-		descriptors = new ArrayList<IFormPropertyDescriptor>();
-	}
-
-	/**
-	 * Hook method, clients may override
-	 */
-	protected Layout createBodyLayout() {
-		return new GridLayout(3, false);
-	}
-
-	@Override
-	public void createControls(Composite parent,
-			TabbedPropertySheetPage aTabbedPropertySheetPage) {
-
-		super.createControls(parent, aTabbedPropertySheetPage);
-		createPropertyDescriptors(descriptors);
-		GridDataFactory.fillDefaults().grab(true, true).applyTo(parent);
-		parent.setLayout(new GridLayout(1, true));
-
-		FormToolkit toolkit = new FormToolkit(parent.getDisplay());
-		Form form = toolkit.createForm(parent);
-		GridDataFactory.fillDefaults().grab(true, true).applyTo(form);
-
-		form.getBody().setLayout(createBodyLayout());
-
-		for (final IFormPropertyDescriptor descriptor : descriptors) {
-			// Create the label in the first column
-			descriptor.createLabelColumn(form.getBody());
-			// create the control in the second column
-			descriptor.createControlColumn(form.getBody());
-			// create help button in third column
-			descriptor.createHelpColumn(form.getBody());
-		}
-	}
-
-	@Override
-	public void refresh() {
-		super.refresh();
-		EObject eObject = getEObject();
-		for (IFormPropertyDescriptor descriptor : descriptors) {
-			descriptor.updateModelBinding(eObject);
-		}
-	}
-
-//	@Override
-//	protected void setEObject(EObject object) {
-//		if (eObject != null) {
-//			for (IFormPropertyDescriptor descriptor : descriptors) {
-//				descriptor.updateModelBinding(eObject);
-//			}
-//		}
-//		super.setEObject(object);
-//	}
-
-	@Override
-	public void dispose() {
-		super.dispose();
-		for (final IFormPropertyDescriptor descriptor : descriptors) {
-			descriptor.dispose();
-		}
-	}
-}

+ 0 - 123
de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/SemanticPropertySection.java

@@ -1,123 +0,0 @@
-/**
- * Copyright (c) 2011 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 de.itemis.gmf.runtime.commons.properties;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.provider.IItemPropertySource;
-import org.eclipse.emf.edit.ui.provider.PropertySource;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.properties.sections.AdvancedPropertySection;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.IPropertySourceProvider;
-
-/**
- * Copied from GMF Tooling generated code. Property Section, that uses
- * {@link IItemPropertySource} generated by EMF (edit plugin) to display
- * semantic model information in the property section.
- * 
- * @author andreas muelder (andreas.muelder@itemis.de)
- * 
- */
-public class SemanticPropertySection extends AdvancedPropertySection implements
-		IPropertySourceProvider {
-
-	public IPropertySource getPropertySource(final Object object) {
-		if (object instanceof IPropertySource) {
-			return (IPropertySource) object;
-		}
-		final AdapterFactory af = getAdapterFactory(object);
-		if (af != null) {
-			final IItemPropertySource ips = (IItemPropertySource) af.adapt(
-					object, IItemPropertySource.class);
-			if (ips != null) {
-				return new PropertySource(object, ips);
-			}
-		}
-		if (object instanceof IAdaptable) {
-			return (IPropertySource) ((IAdaptable) object)
-					.getAdapter(IPropertySource.class);
-		}
-		return null;
-	}
-
-	@Override
-	protected IPropertySourceProvider getPropertySourceProvider() {
-		return this;
-	}
-
-	/**
-	 * Modify/unwrap selection.
-	 */
-	protected Object transformSelection(final Object selected) {
-
-		if (selected instanceof EditPart) {
-			final Object model = ((EditPart) selected).getModel();
-			return model instanceof View ? ((View) model).getElement() : null;
-		}
-		if (selected instanceof View) {
-			return ((View) selected).getElement();
-		}
-		if (selected instanceof IAdaptable) {
-			final View view = (View) ((IAdaptable) selected)
-					.getAdapter(View.class);
-			if (view != null) {
-				return view.getElement();
-			}
-		}
-		return selected;
-	}
-
-	@SuppressWarnings({ "rawtypes", "unchecked" })
-	@Override
-	public void setInput(final IWorkbenchPart part, final ISelection selection) {
-		if (selection.isEmpty()
-				|| false == selection instanceof StructuredSelection) {
-			super.setInput(part, selection);
-			return;
-		}
-		final StructuredSelection structuredSelection = ((StructuredSelection) selection);
-		final ArrayList transformedSelection = new ArrayList(
-				structuredSelection.size());
-		for (final Iterator it = structuredSelection.iterator(); it.hasNext();) {
-			final Object r = transformSelection(it.next());
-			if (r != null) {
-				transformedSelection.add(r);
-			}
-		}
-		super.setInput(part, new StructuredSelection(transformedSelection));
-	}
-
-	protected AdapterFactory getAdapterFactory(final Object object) {
-		if (getEditingDomain() instanceof AdapterFactoryEditingDomain) {
-			return ((AdapterFactoryEditingDomain) getEditingDomain())
-					.getAdapterFactory();
-		}
-		final TransactionalEditingDomain editingDomain = TransactionUtil
-				.getEditingDomain(object);
-		if (editingDomain != null) {
-			return ((AdapterFactoryEditingDomain) editingDomain)
-					.getAdapterFactory();
-		}
-		return null;
-	}
-}

+ 0 - 165
de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/descriptors/AbstractPropertyDescriptor.java

@@ -1,165 +0,0 @@
-/**
- * Copyright (c) 2011 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 de.itemis.gmf.runtime.commons.properties.descriptors;
-
-import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.emf.databinding.EMFDataBindingContext;
-import org.eclipse.emf.databinding.IEMFValueProperty;
-import org.eclipse.emf.databinding.edit.EMFEditProperties;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.jface.dialogs.IDialogLabelKeys;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-
-/**
- * 
- * Abstract base class for all implementers of {@link IFormPropertyDescriptor}.
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public abstract class AbstractPropertyDescriptor implements
-		IFormPropertyDescriptor {
-
-	public final static String HELP_CONTEXT_NONE = "help_context_none";
-
-	private final EStructuralFeature feature;
-
-	private final String labelName;
-
-	private Control control;
-
-	private EMFDataBindingContext bindingContext;
-
-	protected String helpContextId = HELP_CONTEXT_NONE;
-
-	protected abstract Control createControl(Composite parent);
-
-	protected abstract IObservableValue getWidgetValue();
-
-	public AbstractPropertyDescriptor(EStructuralFeature feature,
-			String labelName) {
-		this.feature = feature;
-		this.labelName = labelName;
-	}
-
-	public AbstractPropertyDescriptor(EStructuralFeature feature,
-			String labelName, String helpContextId) {
-		this(feature, labelName);
-		this.helpContextId = helpContextId;
-	}
-
-	public void createControlColumn(Composite parent) {
-		control = createControl(parent);
-		applyLayout(control);
-		applyHelpContext(control);
-	}
-
-	public void createLabelColumn(Composite parent) {
-		FormToolkit toolkit = new FormToolkit(parent.getDisplay());
-		Label label = toolkit.createLabel(parent, labelName);
-		GridDataFactory.fillDefaults().applyTo(label);
-		toolkit.dispose();
-	}
-
-	/**
-	 * Hook method, clients may override if another layouting is needed
-	 */
-	protected void applyLayout(Control control) {
-		GridDataFactory.fillDefaults().applyTo(control);
-	}
-
-	public Control getControl() {
-		return control;
-	}
-
-	public void createHelpColumn(Composite parent) {
-		FormToolkit toolkit = new FormToolkit(parent.getDisplay());
-		final ImageHyperlink helpWidget = toolkit.createImageHyperlink(parent,
-				SWT.CENTER);
-		Image defaultImage = PlatformUI.getWorkbench().getSharedImages()
-				.getImage(ISharedImages.IMG_LCL_LINKTO_HELP);
-		helpWidget.setImage(defaultImage);
-		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP)
-				.applyTo(helpWidget);
-		if (hasHelpContext()) {
-			helpWidget.setToolTipText(JFaceResources
-					.getString(IDialogLabelKeys.HELP_LABEL_KEY));
-			helpWidget.addMouseListener(new MouseAdapter() {
-				public void mouseDown(MouseEvent e) {
-					getControl().setFocus();
-					PlatformUI.getWorkbench().getHelpSystem()
-							.displayDynamicHelp();
-				}
-			});
-			helpWidget.setEnabled(true);
-		} else {
-			helpWidget.setEnabled(false);
-		}
-		toolkit.dispose();
-	}
-
-	protected boolean hasHelpContext() {
-		return !(HELP_CONTEXT_NONE.equals(getHelpContextId()));
-	}
-
-	protected void applyHelpContext(Control control) {
-		if (hasHelpContext()) {
-			PlatformUI.getWorkbench().getHelpSystem()
-					.setHelp(control, getHelpContextId());
-		}
-	}
-
-	public String getHelpContextId() {
-		return helpContextId;
-	}
-
-	public EStructuralFeature getFeature() {
-		return feature;
-	}
-
-	public void updateModelBinding(EObject eObject) {
-		if (bindingContext != null)
-			bindingContext.dispose();
-		bindingContext = new EMFDataBindingContext();
-
-		IObservableValue widgetValue = getWidgetValue();
-		bindingContext.bindValue(widgetValue, getModelValue(eObject));
-	}
-
-	protected IObservableValue getModelValue(EObject eObject) {
-		IEMFValueProperty property = EMFEditProperties.value(
-				TransactionUtil.getEditingDomain(eObject), getFeature());
-		IObservableValue value = property.observe(eObject);
-		return value;
-	}
-
-	public void dispose() {
-		if (getControl() != null && !getControl().isDisposed())
-			getControl().dispose();
-		if (bindingContext != null)
-			bindingContext.dispose();
-	}
-}

+ 0 - 72
de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/descriptors/ComboPropertyDescriptor.java

@@ -1,72 +0,0 @@
-/**
- * Copyright (c) 2011 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 de.itemis.gmf.runtime.commons.properties.descriptors;
-
-import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jface.databinding.viewers.IViewerValueProperty;
-import org.eclipse.jface.databinding.viewers.ViewerProperties;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * Combo viewer for EMF based type safe enumerations
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class ComboPropertyDescriptor extends AbstractPropertyDescriptor {
-
-	private final Enumerator[] items;
-	private ComboViewer comboViewer;
-
-	public ComboPropertyDescriptor(EStructuralFeature feature,
-			String labelName, Enumerator[] items) {
-		super(feature, labelName);
-		this.items = items;
-	}
-
-	public ComboPropertyDescriptor(EStructuralFeature feature,
-			String labelName, Enumerator[] items, String helpContextId) {
-		this(feature, labelName, items);
-		this.helpContextId = helpContextId;
-	}
-
-	@Override
-	protected Control createControl(Composite parent) {
-		comboViewer = new ComboViewer(parent, SWT.READ_ONLY | SWT.SINGLE);
-		comboViewer.setContentProvider(new ArrayContentProvider());
-		comboViewer.setLabelProvider(new LabelProvider());
-		comboViewer.setInput(items);
-		comboViewer.getControl().setEnabled(items.length > 0);
-		return comboViewer.getControl();
-	}
-
-	@Override
-	public Combo getControl() {
-		return (Combo) super.getControl();
-	}
-
-	@Override
-	protected IObservableValue getWidgetValue() {
-		IViewerValueProperty singleSelection = ViewerProperties
-				.singleSelection();
-		return singleSelection.observe(comboViewer);
-	}
-
-}

+ 0 - 54
de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/descriptors/IFormPropertyDescriptor.java

@@ -1,54 +0,0 @@
-/**
- * Copyright (c) 2011 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 de.itemis.gmf.runtime.commons.properties.descriptors;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.Form;
-
-import de.itemis.gmf.runtime.commons.properties.GenericFormBasedPropertySection;
-
-/**
- * Interface for a property descriptor used with a
- * {@link GenericFormBasedPropertySection}. This PropertySection consists of a
- * {@link Form} control with a 3 column GridLayout per Default.
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public interface IFormPropertyDescriptor {
-	/**
-	 * Return the label for the first column of the property page.
-	 */
-	void createLabelColumn(Composite parent);
-
-	/**
-	 * creates a control for the second column of the property page.
-	 */
-	void createControlColumn(Composite parent);
-
-	/**
-	 * Creates a help button for the third column of the property page.
-	 */
-	void createHelpColumn(Composite parent);
-
-	/**
-	 * Creates the binding between UI and model
-	 */
-	void updateModelBinding(EObject eObject);
-
-	/**
-	 * Disposes the UI related parts
-	 */
-	void dispose();
-
-}

+ 0 - 49
de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/descriptors/TextAreaPropertyDescriptor.java

@@ -1,49 +0,0 @@
-/**
- * Copyright (c) 2011 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 de.itemis.gmf.runtime.commons.properties.descriptors;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- *
- */
-public class TextAreaPropertyDescriptor extends TextPropertyDescriptor {
-
-	public TextAreaPropertyDescriptor(EAttribute feature, String labelName) {
-		super(feature, labelName);
-	}
-
-	public TextAreaPropertyDescriptor(EAttribute feature, String labelName,
-			String helpContextId) {
-		this(feature, labelName);
-		this.helpContextId = helpContextId;
-	}
-
-	public Text createControl(Composite parent) {
-		FormToolkit toolkit = new FormToolkit(parent.getDisplay());
-		Text control = toolkit.createText(parent, "", SWT.MULTI);
-		return control;
-	}
-
-	@Override
-	protected void applyLayout(Control control) {
-		GridDataFactory.fillDefaults().grab(true, true).applyTo(control);
-	}	
-
-}

+ 0 - 63
de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/descriptors/TextPropertyDescriptor.java

@@ -1,63 +0,0 @@
-/**
- * Copyright (c) 2011 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 de.itemis.gmf.runtime.commons.properties.descriptors;
-
-import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.emf.ecore.EStructuralFeature;
-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.Control;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * Implementation of {@link IFormPropertyDescriptor} for a {@link Text} control.
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class TextPropertyDescriptor extends AbstractPropertyDescriptor {
-
-	public TextPropertyDescriptor(EStructuralFeature feature, String labelName) {
-		super(feature, labelName);
-	}
-
-	public TextPropertyDescriptor(EStructuralFeature feature, String labelName,
-			String helpContextId) {
-		super(feature, labelName, helpContextId);
-	}
-
-	public Text createControl(Composite parent) {
-		FormToolkit toolkit = new FormToolkit(parent.getDisplay());
-		Text control = toolkit.createText(parent, "");
-		return control;
-	}
-	
-	@Override
-	protected void applyLayout(Control control) {
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(control);
-	}
-
-	@Override
-	public Text getControl() {
-		return (Text) super.getControl();
-	}
-
-	@Override
-	protected IObservableValue getWidgetValue() {
-		return  WidgetProperties.text(SWT.FocusOut)
-			.observe(getControl());
-	}
-
-}

+ 0 - 104
de.itemis.gmf.utils/plugins/de.itemis.gmf.runtime.commons/src/de/itemis/gmf/runtime/commons/properties/descriptors/XtextPropertyDescriptor.java

@@ -1,104 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU 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:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package de.itemis.gmf.runtime.commons.properties.descriptors;
-
-import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jface.databinding.swt.WidgetProperties;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-import com.google.inject.Injector;
-
-import de.itemis.xtext.utils.jface.viewers.StyledTextXtextAdapter;
-import de.itemis.xtext.utils.jface.viewers.context.IXtextFakeContextResourcesProvider;
-
-/**
- * 
- * @author andreas.muelder@itemis.de
- * @author alexander.nyssen@itemis.de
- * 
- */
-public class XtextPropertyDescriptor extends AbstractPropertyDescriptor {
-
-	private final Injector injector;
-	private final IXtextFakeContextResourcesProvider contextFakeResourceProvider;
-	private StyledTextXtextAdapter xtextAdapter;
-
-	public XtextPropertyDescriptor(EStructuralFeature feature,
-			String labelName, Injector injector,
-			IXtextFakeContextResourcesProvider contextFakeResourceProvider) {
-		super(feature, labelName);
-		this.injector = injector;
-		this.contextFakeResourceProvider = contextFakeResourceProvider;
-	}
-
-	public XtextPropertyDescriptor(EStructuralFeature feature,
-			String labelName, Injector injector) {
-		this(feature, labelName, injector,
-				IXtextFakeContextResourcesProvider.NULL_CONTEXT_PROVIDER);
-	}
-
-	public XtextPropertyDescriptor(EAttribute feature, String labelName,
-			String helpContextId, Injector injector,
-			IXtextFakeContextResourcesProvider contextResourcesProvider) {
-		this(feature, labelName, injector, contextResourcesProvider);
-		this.helpContextId = helpContextId;
-	}
-
-	public XtextPropertyDescriptor(EAttribute feature, String labelName,
-			String helpContextId, Injector injector) {
-		this(feature, labelName, helpContextId, injector,
-				IXtextFakeContextResourcesProvider.NULL_CONTEXT_PROVIDER);
-	}
-
-	protected int getStyle() {
-		return SWT.MULTI | SWT.BORDER | SWT.V_SCROLL;
-	}
-
-	protected StyledText createControl(Composite parent) {
-		StyledText styledText = new StyledText(parent, getStyle());
-		xtextAdapter = new StyledTextXtextAdapter(getInjector(),
-				contextFakeResourceProvider);
-		xtextAdapter.adapt(styledText);
-		return styledText;
-	}
-
-	@Override
-	protected void applyLayout(Control control) {
-		GridDataFactory.fillDefaults().grab(true, true).applyTo(control);
-	}
-
-	@Override
-	public void dispose() {
-		xtextAdapter.dispose();
-		super.dispose();
-	}
-
-	public Injector getInjector() {
-		return injector;
-	}
-
-	@Override
-	public StyledText getControl() {
-		return (StyledText) super.getControl();
-	}
-
-	@Override
-	protected IObservableValue getWidgetValue() {
-		return WidgetProperties.text(SWT.FocusOut).observe(getControl());
-	}
-
-}