Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Show Properties View in Context Menu
Show Properties View in Context Menu [message #890321] Thu, 21 June 2012 22:49 Go to next message
Benjamin Klatt is currently offline Benjamin KlattFriend
Messages: 36
Registered: September 2010

I am working on a Graphiti Diagram Editor and would like to add an option to the context menu to show a selected element in the Properties View. The functionality should be the same as in the default ecore diagram editors. In the documentation and in the forum I just found information about how to extend the tabbed properties view, but no hint how to open a view from a graphiti feature execute method.
So any hint is welcome!

Re: Show Properties View in Context Menu [message #891352 is a reply to message #890321] Sun, 24 June 2012 19:33 Go to previous message
Aljoscha Hark is currently offline Aljoscha HarkFriend
Messages: 24
Registered: March 2012
Junior Member

i think it is appropriate to implement this in a custom feature as described in [1].

e.g. you could create the following feature:
public class ShowPropertiesViewFeature extends AbstractCustomFeature {
   private static final String VIEW_ID = "org.eclipse.ui.views.PropertySheet"; //$NON-NLS-1$

   public ShowPropertiesViewFeature(IFeatureProvider fp) {

   public boolean canExecute(ICustomContext context) {
      return true;

   public String getName() {
      return "Show Properties View";

   public String getImageId() {
      return ImageProvider.VIEW_PROPERTIES;

   public void execute(ICustomContext context) {
      if (PlatformUI.isWorkbenchRunning()) {
         IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
         if (window != null) {
            IWorkbenchPage page = window.getActivePage();
            if (page != null) {
               try {
               } catch (PartInitException e) {

   public boolean hasDoneChanges() {
      return false;

in your feature provider, override getCustomFeatures(ICustomContext):
private ICustomFeature showPropertiesViewFeature;

public ICustomFeature[] getCustomFeatures(ICustomContext context) {
   Collection<ICustomFeature> features = new ArrayList<ICustomFeature>();


   // others...

   return features.toArray(new ICustomFeature[features.size()]);

private ICustomFeature getShowPropertiesFeature() {
   if (showPropertiesViewFeature == null) {
      showPropertiesViewFeature = new ShowPropertiesViewFeature(this);
   return showPropertiesViewFeature;


[1] (add http)
Previous Topic:Problem Marker deleted at diagram opening
Next Topic:recommended way to group updates?
Goto Forum:

Current Time: Wed Nov 25 10:22:39 GMT 2015

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

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