public void transactionEnded(Transaction transaction) {
    IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
    for (int i = 0; i < windows.length; ++i) {
      IWorkbenchPage[] pages = windows[i].getPages();
      for (int j = 0; j < pages.length; ++j) {
        IViewReference[] views = pages[j].getViewReferences();
        for (int k = 0; k < views.length; ++k) {
          if (views[k].getPart(false) instanceof PropertySheet) {
            final PropertySheet ps = (PropertySheet) views[k].getPart(false);
            if (ps.getCurrentPage() instanceof PropertySheetPage) {
              final PropertySheetPage psp = (PropertySheetPage) ps.getCurrentPage();

              Display d2 = PlatformUI.getWorkbench().getDisplay();
              if (d2 == null) {
                d2 = Ooaofooa.m_display;
              }
              if (d2 != null) {
                // always run async to prevent infinite loops
                // when the update comes from the property view
                d2.asyncExec(
                    new Runnable() {
                      public void run() {
                        if (!psp.getControl().isDisposed()) psp.refresh();
                      }
                    });
              }
              break;
            }
          }
        }
      }
    }
  }
  private void updatePropertiesView(IStructuredSelection selection) {
    IWorkbench workbench = PlatformUI.getWorkbench();
    if (workbench == null) return;
    IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
    if (window == null) return;
    IWorkbenchPage page = window.getActivePage();
    if (page == null) return;
    PropertySheet propertiesView = (PropertySheet) page.findView(IPageLayout.ID_PROP_SHEET);
    if (propertiesView == null) return;

    propertiesView.partActivated(EFactoryWithTreeEditor.this);
    propertiesView.selectionChanged(EFactoryWithTreeEditor.this, selection);
  }
  @Override
  public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Remove the Pin item
    IMenuManager menuManager = getViewSite().getActionBars().getMenuManager();
    menuManager.removeAll();
    //        for(IContributionItem item : menuManager.getItems()) {
    //            if(item instanceof ActionContributionItem) {
    //                if(((ActionContributionItem)item).getAction() instanceof
    // PinPropertySheetAction) {
    //                    menuManager.remove(item);
    //                    break;
    //                }
    //            }
    //        }

    IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
    toolBarManager.removeAll();
    //        for(IContributionItem item : toolBarManager.getItems()) {
    //            if(item instanceof ActionContributionItem) {
    //                if(((ActionContributionItem)item).getAction() instanceof
    // PinPropertySheetAction) {
    //                    toolBarManager.remove(item);
    //                    break;
    //                }
    //            }
    //        }
  }
 @Override
 protected void partHidden(IWorkbenchPart part) {
   // Don't lose Properties if it's one of our views
   if (part instanceof IModelView) {
     return;
   }
   super.partHidden(part);
 }
  /** Shows the current selection (if valid) in the transformed data view. */
  private void showSelectionInDataView() {
    InstanceSelection selection = getValidSelection();
    if (selection != null) {
      IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

      // pin the property sheet if possible
      IViewReference ref = page.findViewReference(IPageLayout.ID_PROP_SHEET);
      if (ref != null) {
        IViewPart part = ref.getView(true);
        if (part instanceof PropertySheet) ((PropertySheet) part).setPinned(true);
      }

      // show transformed data view with selection if possible
      try {
        TransformedDataView transformedDataView =
            (TransformedDataView) page.showView(TransformedDataView.ID);
        transformedDataView.showSelection(selection, reportImage);
      } catch (PartInitException e) {
        // if it's not there, we cannot do anything
      }
    }
  }