protected void createPartProperties(IWorkbenchPart3 workbenchPart) {
   Iterator i = propertyCache.entrySet().iterator();
   while (i.hasNext()) {
     Map.Entry e = (Map.Entry) i.next();
     workbenchPart.setPartProperty((String) e.getKey(), (String) e.getValue());
   }
 }
  public final IWorkbenchPart getPart(boolean restore) {
    if (isDisposed()) {
      return null;
    }

    if (part == null && restore) {

      if (state == STATE_CREATION_IN_PROGRESS) {
        IStatus result =
            WorkbenchPlugin.getStatus(
                new PartInitException(
                    NLS.bind(
                        "Warning: Detected recursive attempt by part {0} to create itself (this is probably, but not necessarily, a bug)", //$NON-NLS-1$
                        getId())));
        WorkbenchPlugin.log(result);
        return null;
      }

      try {
        state = STATE_CREATION_IN_PROGRESS;

        IWorkbenchPart newPart = createPart();
        if (newPart != null) {
          part = newPart;
          // Add a dispose listener to the part. This dispose listener does nothing but log an
          // exception
          // if the part's widgets get disposed unexpectedly. The workbench part reference is the
          // only
          // object that should dispose this control, and it will remove the listener before it does
          // so.
          getPane().getControl().addDisposeListener(prematureDisposeListener);
          part.addPropertyListener(propertyChangeListener);
          if (part instanceof IWorkbenchPart3) {
            ((IWorkbenchPart3) part).addPartPropertyListener(partPropertyChangeListener);
          }

          refreshFromPart();
          releaseReferences();

          fireInternalPropertyChange(INTERNAL_PROPERTY_OPENED);

          ISizeProvider sizeProvider = (ISizeProvider) Util.getAdapter(part, ISizeProvider.class);
          if (sizeProvider != null) {
            // If this part has a preferred size, indicate that the preferred size may have changed
            // at this point
            if (sizeProvider.getSizeFlags(true) != 0 || sizeProvider.getSizeFlags(false) != 0) {
              fireInternalPropertyChange(IWorkbenchPartConstants.PROP_PREFERRED_SIZE);
            }
          }
        }
      } finally {
        state = STATE_CREATED;
      }
    }

    return part;
  }
 protected void doDisposePart() {
   if (part != null) {
     fireInternalPropertyChange(INTERNAL_PROPERTY_CLOSED);
     // Don't let exceptions in client code bring us down. Log them and continue.
     try {
       part.removePropertyListener(propertyChangeListener);
       if (part instanceof IWorkbenchPart3) {
         ((IWorkbenchPart3) part).removePartPropertyListener(partPropertyChangeListener);
       }
       part.dispose();
     } catch (Exception e) {
       WorkbenchPlugin.log(e);
     }
     part = null;
   }
 }