Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Handly/Migration08

< Handly
Revision as of 07:45, 8 December 2017 by Pisv.1c.ru (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Migration Guide for Eclipse Handly 0.8

Changes that need to be accommodated by current adopters as part of migrating to Eclipse Handly 0.8 from the previous major release (0.7). Some changes are expected to be less affecting for existing clients than others.

Quick Summary (Most Affecting Changes)

  • The following classes and interfaces have been moved from org.eclipse.handly.model.impl to new package org.eclipse.handly.model.impl.support (526682):
    • Body
    • Element
    • ElementCache
    • ElementChangeEvent
    • ElementChangeListenerList
    • ElementDelta
    • ElementManager
    • IBodyCache
    • IElementImplSupport
    • IModelManager
    • INotificationManager
    • ISourceConstructImplSupport
    • ISourceElementImplSupport
    • ISourceFileImplSupport
    • NotificationManager
    • SourceConstruct
    • SourceElementBody
    • SourceFile
    • StructureHelper
    • WorkspaceSourceFile
  • All methods of *Impl* interfaces in org.eclipse.handly.model.impl and org.eclipse.handly.model.impl.support packages have adopted new naming convention based on the '_' (underscore) suffix instead of the former 'h' prefix. For example, IElementImpl.hName() has been renamed to getName_(), etc. (521851)
  • StructureHelper has been reworked completely (522481)
    • StructureHelper(Map<IElement, Object>)StructureHelper()
    • addChild(Body, IElement, Object) has been removed. A call helper.addChild(parentBody, handle, body) needs to be replaced with the following sequence now: helper.resolveDuplicates(handle); newElements.put(handle, body); helper.pushChild(parentBody, handle);
    • complete(Body) has been removed. A call helper.complete(body) needs to be replaced with body.setChildren(helper.popChildren(body).toArray(Elements.EMPTY_ARRAY))
    • protected void resolveDuplicates(IElement)public void resolveDuplicates(ISourceConstructImplExtension)
    • New API methods:
      • public void pushChild(Object, IElement)
      • public List<IElement> popChildren(Object)
  • IModel is now a marker interface (522115)
    • Clients that implemented IModel need to implement IModelImpl now. Clients that called methods on IModel need to call corresponding methods of the class Models.
    • ApiLevel is now a top-level class in the org.eclipse.handly package
  • ElementCache
    • ensureSpaceLimit(body, element)ensureSpaceLimit(((Body)body).getChildren().length, element) (525399)
  • Body
    • NO_CHILDREN has been removed. Use Elements.EMPTY_ARRAY instead (526929)

Full List of Changes per Package

org.eclipse.handly.model

  • Elements
    • getAncestor(element, type)findAncestorOfType(getParent(element), type). Please note that findAncestorOfType views the element as its own ancestor and thus starts searching from the element itself, while the old method started the search from the element's parent (525952)
    • getChildren(IElement, Class)getChildrenOfType(IElement, Class) (525952)
    • getSourceFile(ISourceElement)getSourceFile(IElement) (525952)
    • getLocationURI(IElement)getLocationUri(IElement) (525446)
    • equalsAndSameParent(IElement, IElement) has been effectively replaced with equalsAndSameParentChain(IElement, IElement), which tests that the elements belong to the same parent chain, not just the same parent (520334)
    • New API fields:
      • public static final IElement[] EMPTY_ARRAY
      • public static final Property<ISnapshot> BASE_SNAPSHOT
    • New API methods (525952):
      • public static Iterable<IElement> getParentChain(IElement)
      • public static Iterable<IElement> getParentChainUntil(IElement, Predicate<? super IElement>)
      • public static Stream<IElement> streamParentChain(IElement)
      • public static Stream<IElement> streamParentChainUntil(IElement, Predicate<? super IElement>)
      • public static <T extends Collection<? super IElement>> T collectParentChain(IElement, T)
      • public static <T extends Collection<? super IElement>> T collectParentChainUntil(IElement, T, Predicate<? super IElement>)
      • public static IElement findMatchingAncestor(IElement, Predicate<? super IElement>)
      • public static IElement findMatchingAncestorUntil(IElement, Predicate<? super IElement>, Predicate<? super IElement>)
      • public static <T> T findAncestorOfType(IElement, Class<T>)
      • public static <T> T findAncestorOfTypeUntil(IElement, Class<T>, Predicate<? super IElement>)
      • public static IElement findLastMatchingAncestor(IElement, Predicate<? super IElement>)
      • public static IElement findLastMatchingAncestorUntil(IElement, Predicate, Predicate<? super IElement>)
      • public static <T> T findLastAncestorOfType(IElement, Class<T>)
      • public static <T> T findLastAncestorOfTypeUntil(IElement, Class<T>, Predicate<? super IElement>)
      • public static IElement findCommonAncestor(IElement, IElement)
      • public static IElement findCommonAncestorUntil(IElement, IElement, Predicate<? super IElement>)
      • public static IElement findCommonAncestor(Iterable<? extends IElement>)
      • public static IElement findCommonAncestorUntil(Iterable<? extends IElement>, Predicate<? super IElement>)
      • public static boolean isAncestorOf(IElement, IElement)
      • public static void removeDescendants(Collection<? extends IElement>)
      • public static boolean isOfModel(IElement, IModel)
      • public static IContext getModelContext(IElement)
      • public static int getModelApiLevel(IElement)
      • public static String getHandleMemento(IElement) (525679)
      • public static void splitIntoElementsAndResources(Iterable<?>, Collection<? super IElement>, IModel, Collection<? super IResource>, IElementHandleFactory)
      • public static IElement[] getChildren(IElement, IContext, IProgressMonitor)
      • public static <T> T[] getChildrenOfType(IElement, Class<T>, IContext, IProgressMonitor)
      • public static ISourceElement getSourceElementAt(ISourceElement, int, IContext, IProgressMonitor)
      • public static ISourceElementInfo getSourceElementInfo(ISourceElement, IContext, IProgressMonitor)
  • IElementExtension
    • getLocationURI()getLocationUri() (525446)
  • ElementDeltas
    • New API fields:
      • public static final IElementDelta[] EMPTY_ARRAY
    • New API methods (520334):
      • public static boolean isEmpty(IElementDelta)
      • public static boolean isNullOrEmpty(IElementDelta)
      • public static boolean isStructuralChange(IElementDelta) (521268)
      • public static IElementDelta findDelta(IElementDelta, IElement)
  • IElementDeltaConstants
    • New API fields:
  • IElementDeltaExtension
    • New API methods:
  • IModel is now a marker interface (522115)
    • Clients that implemented IModel need to implement IModelImpl now. Clients that called methods on IModel need to call corresponding methods of the class Models.
    • ApiLevel is now a top-level class in the org.eclipse.handly package

org.eclipse.handly.model.impl

  • The following classes and interfaces have been moved to new package org.eclipse.handly.model.impl.support (526682):
    • Body
    • Element
    • ElementCache
    • ElementChangeEvent
    • ElementChangeListenerList
    • ElementDelta
    • ElementManager
    • IBodyCache
    • IElementImplSupport
    • IModelManager
    • INotificationManager
    • ISourceConstructImplSupport
    • ISourceElementImplSupport
    • ISourceFileImplSupport
    • NotificationManager
    • SourceConstruct
    • SourceElementBody
    • SourceFile
    • StructureHelper
    • WorkspaceSourceFile
  • All methods of *Impl* interfaces in this package and org.eclipse.handly.model.impl.support have adopted new naming convention based on the '_' (underscore) suffix instead of the former 'h' prefix. For example, IElementImpl.hName() has been renamed to getName_(), etc. (521851)
  • IElementImpl
    • hAncestor(Class) has been removed (525952)
    • hLocationURI()getLocationUri_() (525446)
    • hChildren()getChildren_(IContext, IProgressMonitor) (525952)
    • hChildren(Class)getChildren_(Class, IContext, IProgressMonitor) (525952)
    • New API methods:
      • boolean equalsAndSameParentChain_(IElement) (525952)
      • String getHandleMemento_() (525679)
  • IElementImplExtension
    • hChildren(Object)getChildrenFromBody_(Object) (525952)
  • IElementDeltaImpl
    • New API methods (520334):
      • boolean isEmpty_()
      • IElementDelta findDelta_(IElement)
  • ISourceConstructImplExtension
    • hIncrementOccurrenceCount() has been removed (522481)
    • New API methods:
      • void setOccurrenceCount_(int) (522481)
  • ISourceElementImpl (525952)
    • hSourceElementAt(int, ISnapshot)getSourceElementAt_(int, IContext, IProgressMonitor)
    • hSourceElementInfo()getSourceElementInfo_(IContext, IProgressMonitor)
  • ElementDifferencer has been effectively replaced with org.eclipse.handly.model.impl.support.ElementChangeRecorder, which provides an improved API (520620)
  • WorkingCopyInfo and DefaultWorkingCopyInfo have been removed. WorkingCopyCallback and DefaultWorkingCopyCallback are (indirect) replacements in the new working copy design (520063)
  • New API:

org.eclipse.handly.model.impl.support

  • Body
    • NO_CHILDREN has been removed. Use Elements.EMPTY_ARRAY instead (526929)
    • findContentChange(Body, IElement, ElementDelta.Builder)findContentChange(Body, IElement, IElementDeltaBuilder) (520756)
  • ElementCache (525399)
    • ensureSpaceLimit(body, element)ensureSpaceLimit(((Body)body).getChildren().length, element)
    • getChildCount(IElement, Object) has been removed
  • ElementDelta (520334)
    • All API methods of ElementDelta have adopted new naming convention based on the '_' (underscore) suffix instead of the former 'h' prefix. For example, hSetKind has been renamed to setKind_, etc. (521851)
    • hDeltaFor(IElement)findDelta_(IElement)
    • hInsert(ElementDelta) has been effectively replaced with insertSubTree_(ElementDelta)
    • hClearAffectedChildren() has been removed. Use setAffectedChildren_(ElementDelta[]) with a zero-length array as a replacement
    • hAddResourceDelta(IResourceDelta) has had a contract change: it is no longer a low-level mutator method, e.g. it can now set appropriate change flags
    • Builder.isEmptyDelta and Builder.findDelta have been removed. Use isEmpty_ and findDelta_ on Builder.getDelta() instead
    • New API methods:
      • protected void insertSubTree_(ElementDelta)
      • protected void addAffectedChild_(ElementDelta)
      • protected void mergeWith_(ElementDelta)
      • protected void copyFrom_(ElementDelta, boolean)
      • protected void setAffectedChildren_(ElementDelta[])
  • IElementImplSupport
    • hGenerateBodies(IContext, IProgressMonitor), hGenerateAncestorBodies(IContext, IProgressMonitor), and hOpenableParent() have been removed (525394)
  • IModelManager
    • Provider.hModelManager()getModelManager_()
  • ISourceElementImplSupport (525952)
    • hSourceElementAt(int, ISourceElementInfo)getSourceElementAt_(int, ISourceElementInfo, IContext, IProgressMonitor)
    • checkInRange(int, ISnapshot, ISourceElementInfo)checkInRange(int, ISourceElementInfo, IContext)
  • ISourceFileImplSupport (520063)
    • WORKING_COPY_INFO_FACTORY has been removed
    • WorkingCopyInfo hBecomeWorkingCopy(IContext, IProgressMonitor)boolean ISourceFileImplExtension.becomeWorkingCopy_(IContext, IProgressMonitor) with different expectations about the given context
    • WorkingCopyInfo hAcquireExistingWorkingCopy(IProgressMonitor)boolean ISourceFileImplExtension.acquireExistingWorkingCopy_(IProgressMonitor)
    • hWorkingCopyInfo() has been removed
    • hWorkingCopyContext(IContext) has been replaced with newWorkingCopyContext_(IContext), which specifies a different default implementation
    • New API methods:
      • IContext getWorkingCopyContext_()
  • ISourceFileImplSupport.ReconcileOperation
    • New API methods (520547):
      • protected boolean shouldReconcileStructure(IContext)
      • protected void reconcileStructure(IContext, IProgressMonitor)
  • ISourceFileImplSupport.NotifyingReconcileOperation
    • ElementDifferencer createDifferencer()ElementChangeRecorder newChangeRecorder() (520620)
    • doReconcile(IContext, IProgressMonitor) has been removed (520547)
  • StructureHelper has been reworked completely (522481)
    • StructureHelper(Map<IElement, Object>)StructureHelper()
    • addChild(Body, IElement, Object) has been removed. A call helper.addChild(parentBody, handle, body) needs to be replaced with the following sequence now: helper.resolveDuplicates(handle); newElements.put(handle, body); helper.pushChild(parentBody, handle);
    • complete(Body) has been removed. A call helper.complete(body) needs to be replaced with body.setChildren(helper.popChildren(body).toArray(Elements.EMPTY_ARRAY))
    • protected void resolveDuplicates(IElement)public void resolveDuplicates(ISourceConstructImplExtension)
    • New API methods:
      • public void pushChild(Object, IElement)
      • public List<IElement> popChildren(Object)
  • New API:
    • ElementChangeRecorder (520620)
    • IElementDeltaBuilder (520756)

org.eclipse.handly.util

org.eclipse.handly.ui.navigator

  • LinkHelper is now abstract (526776)
    • setInputElementProvider(IInputElementProvider) has been removed
    • getInputElementProvider() is now abstract
    • getNavigatorView() is now abstract

org.eclipse.handly.ui.outline

  • HandlyOutlinePage
    • setInputElementProvider(IInputElementProvider) has been removed; getInputElementProvider() is now abstract (526776)

org.eclipse.handly.ui.quickoutline

  • HandlyOutlinePopup
    • setInputElementProvider(IInputElementProvider) has been removed; getInputElementProvider() is now abstract (526776)

org.eclipse.handly.xtext.ui.editor

  • XtextWorkingCopyInfo has been removed. XtextWorkingCopyCallback is an (indirect) replacement in the new working copy design (520063)

Back to the top