Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-incubator-e4-dev] YAMI (Yet Another Model Interface)

Michael Scharf wrote:
> Ok, let's do a simple validity test. How would an EMF based YAMI solution
> replace the following IMemento code:
>
> from org.eclipse.ui.internal.FastViewBar


I am all for concrete questions - and concrete code - instead of an abstract discussion, but do you have a better example?  The example code from FastViewBar.java is about extracting the persistent model from a particular class which we haven't split properly into a model part and a UI part yet.  My hope would be that code like the one below would be obsolete once we have a proper split, in which case the model is exactly what you would persist, and there would be no need for extracting just the right properties in an ad-hoc way.

This is not to say that YAMI is a bad idea, just that the example you are referring to is not very good.

Boris

>      public void saveState(IMemento memento) {
>          memento.putInteger(IWorkbenchConstants.TAG_FAST_VIEW_SIDE,
> getSide());
>
>          Iterator iter = viewOrientation.keySet().iterator();
>          while (iter.hasNext()) {
>              String next = (String) iter.next();
>              IMemento orientation = memento
>                      .createChild(IWorkbenchConstants.
> TAG_FAST_VIEW_ORIENTATION);
>
>              orientation.putString(IWorkbenchConstants.TAG_VIEW, next);
>              orientation.putInteger(IWorkbenchConstants.TAG_POSITION,
>                      ((Integer) viewOrientation.get(next)).intValue());
>          }
>      }
>
>      public void restoreState(IMemento memento) {
>          Integer bigInt;
>          bigInt = memento.getInteger(IWorkbenchConstants.TAG_FAST_VIEW_SIDE);
>          if (bigInt != null) {
>              dock(bigInt.intValue());
>          }
>
>          IMemento[] orientations = memento
>                  .getChildren(IWorkbenchConstants.TAG_FAST_VIEW_ORIENTATION);
>          for (int i = 0; i < orientations.length; i++) {
>              IMemento next = orientations[i];
>
>              viewOrientation.put(next.getString(IWorkbenchConstants.TAG_VIEW),
>                      next.getInteger(IWorkbenchConstants.TAG_POSITION));
>          }
>      }


Back to the top