Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » [Property View] Shared between model explorer tree, EMF editor and Sirius
[Property View] Shared between model explorer tree, EMF editor and Sirius [message #1738855] Mon, 25 July 2016 13:20 Go to next message
Daveluy Yannick is currently offline Daveluy YannickFriend
Messages: 2
Registered: July 2016
Junior Member
Hello,

I am using Sirius 4.0 and I would like to have the same property view (EEF like) between the Model explorer tree, the EMF editor (generated from the genmodel) and Sirius.

For the moment the property view of the Model explorer tree and the EMF editor are the default ones : table.

Is it possible to add an extension in the Viewpoint specification project ?

Thanks

Yannick
Re: [Property View] Shared between model explorer tree, EMF editor and Sirius [message #1738976 is a reply to message #1738855] Tue, 26 July 2016 13:13 Go to previous messageGo to next message
Melanie Bats is currently offline Melanie BatsFriend
Messages: 35
Registered: July 2009
Member
Hello David,

Le 25/07/2016 à 18:18, Daveluy Yannick a écrit :
> I am using Sirius 4.0 and I would like to have the same property view
> (EEF like) between the Model explorer tree, the EMF editor (generated
> from the genmodel) and Sirius.
>
> For the moment the property view of the Model explorer tree and the EMF
> editor are the default ones : table.
>
> Is it possible to add an extension in the Viewpoint specification project ?

For the Model Explorer, we are working on it, it should be
available in the next 4.1.0 release. Have a look to the associated
bugzilla ticket : https://bugs.eclipse.org/bugs/show_bug.cgi?id=489287

For providing the same properties view for the EMF editor than the ones
you defined for Sirius, it would be a little bit more tricky. The Sirius
properties view are based on EEF and so we provide a bridge for Sirius
to convert the Sirius properties view specification into EEF properties
view. This bridge is not extensible and reusable for another editor than
the Sirius one.

So if you want to get the same properties view for your EMF editor you
should have to provide your own custom bridge which would use the
transactional editing domain provided by Sirius.

Have a look to the EEF Tab Descriptor Provider extension point to
provide your own bridge :
http://help.eclipse.org/neon/topic/org.eclipse.eef.documentation/pages/developerguide/extensionpoints.html?cp=17_2_0_1#eeftabdescriptorprovider

Another way to do it, is by associating the Sirius property sheet page
provider to your editor thanks to the
org.eclipse.sirius.ui.siriusPropertySheetPageProvider extension point.

<extension
point="org.eclipse.sirius.ui.siriusPropertySheetPageProvider">
<siriusPropertySheetPageProvider
class="x.x.x.EEFPropertySheetPageProvider"
contributorId="IDX">
</siriusPropertySheetPageProvider>
</extension>

import org.eclipse.eef.properties.ui.api.EEFTabbedPropertySheetPage;

public class EEFPropertySheetPageProvider implements
ISiriusPropertySheetPageProvider {

/**
* Simple constructor
*/
public EEFPropertySheetPageProvider() {
}

@Override
public IPropertySheetPage getPropertySheetPage(Object source,
String contributorId) {
return new EEFTabbedPropertySheetPage(source, contributorId);
}
}

Then in your editor you have to implement
org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor
with:

@Override
public String getContributorId() {
return "IDX"; //$NON-NLS-1$
}

and then overrides:

@Override
public <T> T getAdapter(Class<T> type) {
if (type == IPropertySheetPage.class) {
// Plug this editor into the property view mechanism
contributedPage = new EEFTabbedPropertySheetPage(this,
getContributorId());
if (contributedPage != null) {
return (T) contributedPage;
}
}
return super.getAdapter(type);
}

Finally, you have to add a listener to your viewer to notify
contributedPage that the selection change:

private final class PropertyViewUpdater implements
ISelectionChangedListener {
@Override
public void selectionChanged(SelectionChangedEvent event) {
if (contributedPage != null) {
// Only display the property page of semantic element
if (hasSemanticElementSelected(event)) {
contributedPage.selectionChanged(getViewSite().getPart(),
event.getSelection());
} else {
contributedPage.selectionChanged(getViewSite().getPart(),
new StructuredSelection(Collections.emptyList()));
}
}

}

/**
* Returns <code>true</code> if the selection has at least one
semantic element
*
* @param event a {@link SelectionChangedEvent}
* @return <code>true</code> if the selection has at least one
semantic element,<code>false</code> otherwise
*/
private boolean hasSemanticElementSelected(SelectionChangedEvent
event) {
return /* Find the semantic element from the selection */;
}
}

Regards,
Mélanie
Re: [Property View] Shared between model explorer tree, EMF editor and Sirius [message #1739039 is a reply to message #1738976] Wed, 27 July 2016 07:13 Go to previous messageGo to next message
Daveluy Yannick is currently offline Daveluy YannickFriend
Messages: 2
Registered: July 2016
Junior Member
Hello Mélanie,

Thanks for your answer.

For the Model explorer I will wait the 4.1.0 release Smile

For the EMF editor, I am trying to use the extension point way on the basicfamily sample :

I added the org.eclipse.sirius.ui.siriusPropertySheetPageProvider extension and the EEFPropertySheetPageProvider in the basicfamily.design project.
I updated the Editor too.

When I open the editor and select a node, the properties view show "No properties available".

I noticed that the EEFPropertySheetPageProvider in basicfamily.design is never called (breakpoint in getPropertySheetPage). I had to update a little bit the PropertyViewUpdater to get the view site.

I attached the basicfamily.tgz, if you can have a look...

Thanks

Yannick
Re: [Property View] Shared between model explorer tree, EMF editor and Sirius [message #1833524 is a reply to message #1739039] Thu, 15 October 2020 16:41 Go to previous message
fares kallel is currently offline fares kallelFriend
Messages: 10
Registered: May 2020
Junior Member
Hi Mélanie,

So I have this EMF editor and I am trying to link it to my SiriusPropertyView. For now, when I select an Element in my Table, the Default property View is triggered so the listener is working.
the Problem I am having is with the EEFTabbedPropertySheetPage. It requires a IEEFTabbedPropertySheetPageContributor to be instanciated not the type and the contributer ID. is that an Old method ? In that case how can I get the Contributer? or is there another approach to achieve this ?

Thanks
Previous Topic:Modeling Project Manager should be able to Load Resource which Identified by Content Type
Next Topic:oclIsKindOf returning unexpected values
Goto Forum:
  


Current Time: Thu Apr 25 23:58:22 GMT 2024

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

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

Back to the top