Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms] How do i integrate into Properties View
[EMF Forms] How do i integrate into Properties View [message #1587431] Tue, 27 January 2015 10:38 Go to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13607
Registered: July 2009
Senior Member
Hi,

what do i have to do if i want to integrate into the default EMF Tree Editors Properties view.

Thanks
Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [EMF Forms] How do i integrate into Properties View [message #1587672 is a reply to message #1587431] Tue, 27 January 2015 13:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13607
Registered: July 2009
Senior Member
Here is what i've got so far but i hoped to find something generic

public class AbstractPropertySection4 extends AbstractPropertySection {

	private Composite container;

	@Override
	public void createControls(Composite parent, TabbedPropertySheetPage atabbedPropertySheetPage) {
		final GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true);
		parent.setLayout(new GridLayout(1, true));
		parent.setLayoutData(parentData);
		super.createControls(parent, atabbedPropertySheetPage);
		final Composite composite = new Composite(parent, SWT.FILL);
		composite.setLayout(new GridLayout(1, true));
		composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

		final ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.V_SCROLL | SWT.H_SCROLL);
		scrolledComposite.setShowFocusedControl(true);
		scrolledComposite.setExpandVertical(true);
		scrolledComposite.setExpandHorizontal(true);
		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(scrolledComposite);
		scrolledComposite.setLayout(GridLayoutFactory.fillDefaults().create());
		scrolledComposite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));

		container = new Composite(scrolledComposite, SWT.FILL);
		final GridLayout containerLayout = GridLayoutFactory.fillDefaults().create();
		containerLayout.marginLeft = 10;
		containerLayout.marginRight = 10;
		container.setLayout(containerLayout);

		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(container);
		container.setBackground(scrolledComposite.getBackground());
		scrolledComposite.setContent(container);
		container.addPaintListener(new PaintListener() {

			@Override
			public void paintControl(PaintEvent e) {
				// super.paintControl(e);
				final Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
				scrolledComposite.setMinSize(point);
				container.layout(true);
				scrolledComposite.layout(true);

			}
		});
		container.addControlListener(new ControlListener() {

			@Override
			public void controlResized(ControlEvent e) {
				final Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
				scrolledComposite.setMinSize(point);
				container.layout(true);
				scrolledComposite.layout(true);

			}

			@Override
			public void controlMoved(ControlEvent e) {
				final Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
				scrolledComposite.setMinSize(point);
				container.layout(true);
				scrolledComposite.layout(true);
			}
		});

	}

	@Override
	public void setInput(IWorkbenchPart part, ISelection selection) {
		super.setInput(part, selection);
		if (selection instanceof IStructuredSelection) {
			final Object firstElement = ((IStructuredSelection) selection).getFirstElement();
			if (firstElement instanceof EObject) {
				try {
					for (final Control control : container.getChildren()) {
						control.dispose();
					}
					final ECPSWTView view = ECPSWTViewRenderer.INSTANCE.render(container, (EObject) firstElement);
				} catch (final ECPRendererException ex) {
					ex.printStackTrace();
				}
			}
		}

	}
}


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [EMF Forms] How do i integrate into Properties View [message #1587806 is a reply to message #1587672] Tue, 27 January 2015 15:17 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi Christian,

what exactly do you mean by "something generic"?

Best regards

Jonas

Am 27.01.2015 um 14:44 schrieb Christian Dietrich:
> Here is what i've got so far but i hoped to find something generic
>
>
> public class AbstractPropertySection4 extends AbstractPropertySection {
>
> private Composite container;
>
> @Override
> public void createControls(Composite parent, TabbedPropertySheetPage
> atabbedPropertySheetPage) {
> final GridData parentData = new GridData(SWT.FILL, SWT.FILL,
> true, true);
> parent.setLayout(new GridLayout(1, true));
> parent.setLayoutData(parentData);
> super.createControls(parent, atabbedPropertySheetPage);
> final Composite composite = new Composite(parent, SWT.FILL);
> composite.setLayout(new GridLayout(1, true));
> composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
> true));
>
> final ScrolledComposite scrolledComposite = new
> ScrolledComposite(composite, SWT.V_SCROLL | SWT.H_SCROLL);
> scrolledComposite.setShowFocusedControl(true);
> scrolledComposite.setExpandVertical(true);
> scrolledComposite.setExpandHorizontal(true);
> GridDataFactory.fillDefaults().align(SWT.FILL,
> SWT.FILL).grab(true, true).applyTo(scrolledComposite);
>
> scrolledComposite.setLayout(GridLayoutFactory.fillDefaults().create());
>
> scrolledComposite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
>
>
> container = new Composite(scrolledComposite, SWT.FILL);
> final GridLayout containerLayout =
> GridLayoutFactory.fillDefaults().create();
> containerLayout.marginLeft = 10;
> containerLayout.marginRight = 10;
> container.setLayout(containerLayout);
>
> GridDataFactory.fillDefaults().align(SWT.FILL,
> SWT.FILL).grab(true, true).applyTo(container);
> container.setBackground(scrolledComposite.getBackground());
> scrolledComposite.setContent(container);
> container.addPaintListener(new PaintListener() {
>
> @Override
> public void paintControl(PaintEvent e) {
> // super.paintControl(e);
> final Point point = container.computeSize(SWT.DEFAULT,
> SWT.DEFAULT);
> scrolledComposite.setMinSize(point);
> container.layout(true);
> scrolledComposite.layout(true);
>
> }
> });
> container.addControlListener(new ControlListener() {
>
> @Override
> public void controlResized(ControlEvent e) {
> final Point point = container.computeSize(SWT.DEFAULT,
> SWT.DEFAULT);
> scrolledComposite.setMinSize(point);
> container.layout(true);
> scrolledComposite.layout(true);
>
> }
>
> @Override
> public void controlMoved(ControlEvent e) {
> final Point point = container.computeSize(SWT.DEFAULT,
> SWT.DEFAULT);
> scrolledComposite.setMinSize(point);
> container.layout(true);
> scrolledComposite.layout(true);
> }
> });
>
> }
>
> @Override
> public void setInput(IWorkbenchPart part, ISelection selection) {
> super.setInput(part, selection);
> if (selection instanceof IStructuredSelection) {
> final Object firstElement = ((IStructuredSelection)
> selection).getFirstElement();
> if (firstElement instanceof EObject) {
> try {
> for (final Control control : container.getChildren()) {
> control.dispose();
> }
> final ECPSWTView view =
> ECPSWTViewRenderer.INSTANCE.render(container, (EObject) firstElement);
> } catch (final ECPRendererException ex) {
> ex.printStackTrace();
> }
> }
> }
>
> }
> }
>


--
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] How do i integrate into Properties View [message #1587827 is a reply to message #1587806] Tue, 27 January 2015 15:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13607
Registered: July 2009
Senior Member
Hi,

i mean having a DoWhatIMeanPropertySection


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [EMF Forms] How do i integrate into Properties View [message #1589594 is a reply to message #1587827] Wed, 28 January 2015 14:42 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
You mean a ready to use property section, which reacts to the current
selection? No we currently do not have this, but your code looks like
something like that. Are you interested in contributing that?

Best regards

Jonas

Am 27.01.2015 um 16:34 schrieb Christian Dietrich:
> Hi,
>
> i mean having a DoWhatIMeanPropertySection


--
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] How do i integrate into Properties View [message #1590045 is a reply to message #1589594] Wed, 28 January 2015 20:21 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13607
Registered: July 2009
Senior Member
Yes I mean something ready to use. I am currently still tweaking the code to get the actions running (reference service etc)

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:do I have the correct download for the EMF plugin
Next Topic:[Texo] EMF Client Platform
Goto Forum:
  


Current Time: Fri Sep 25 01:35:44 GMT 2020

Powered by FUDForum. Page generated in 0.01614 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top