diff options
Diffstat (limited to 'plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/mergeviewer/item/provider')
4 files changed, 195 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/mergeviewer/item/provider/IMergeViewerItemContentProvider.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/mergeviewer/item/provider/IMergeViewerItemContentProvider.java new file mode 100644 index 000000000..4e2475a3f --- /dev/null +++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/mergeviewer/item/provider/IMergeViewerItemContentProvider.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2016 EclipseSource Muenchen GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexandra Buzila - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.rcp.ui.mergeviewer.item.provider; + +import org.eclipse.jface.viewers.ITreeContentProvider; + +/** + * Interface for specialized {@link ITreeContentProvider tree content providers} for the comparison content + * merge viewer. + * + * @author Stefan Dirix <sdirix@eclipsesource.com> + * @since 4.4 + */ +public interface IMergeViewerItemContentProvider extends IOptionalProvider { + + /** + * Determine the parent of the given {@code object}. + * + * @param object + * the {@link Object} for which the parent is to be determined. + * @param configuration + * the {@link IMergeViewerItemProviderConfiguration}. + * @return the determined parent object, {@code null} if there is none. + */ + public Object getParent(Object object, IMergeViewerItemProviderConfiguration configuration); + + /** + * Determine the children of the given {@code object} + * + * @param object + * the {@link Object} for which the children are to be determined. + * @param configuration + * the {@link IMergeViewerItemProviderConfiguration}. + * @return an array with the determined children, an empty array if there are none. + */ + public Object[] getChildren(Object object, IMergeViewerItemProviderConfiguration configuration); + + /** + * Indicates whether the given {@code object} has children. + * + * @param object + * the {@link Object} for which it is indicated whether it has children. + * @param configuration + * the {@link IMergeViewerItemProviderConfiguration}. + * @return {@code true} if the given object has children, {@code false} otherwise. + */ + public boolean hasChildren(Object object, IMergeViewerItemProviderConfiguration configuration); +} diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/mergeviewer/item/provider/IMergeViewerItemProvider.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/mergeviewer/item/provider/IMergeViewerItemProvider.java new file mode 100644 index 000000000..694b136fd --- /dev/null +++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/mergeviewer/item/provider/IMergeViewerItemProvider.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2016 EclipseSource Muenchen GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Stefan Dirix - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.rcp.ui.mergeviewer.item.provider; + +import java.util.List; + +import org.eclipse.emf.compare.rcp.ui.mergeviewer.item.IMergeViewerItem; + +/** + * The contract for providers responsible for determining root elements in merge viewers. Typically these are + * {@link IMergeViewerItem}s but they not necessarily have to be. + * + * @author Stefan Dirix <sdirix@eclipsesource.com> + * @since 4.4 + */ +public interface IMergeViewerItemProvider extends IOptionalProvider { + + /** + * Determine the root merge viewer items for the given {@code object}. + * + * @param object + * the {@link Object} for which the root merge viewer items are to be determined. + * @param configuration + * the {@link IMergeViewerItemProviderConfiguration}. + * @return a list of the root elements. + */ + public List<Object> getMergeViewerItems(Object object, + IMergeViewerItemProviderConfiguration configuration); + + /** + * Determine the merge viewer item which shall be selected. + * + * @param object + * the {@link Object} for which the selected merge viewer item is to be determined. + * @param configuration + * the {@link IMergeViewerItemProviderConfiguration}. + * @return the merge viewer item to select. + */ + public Object getItemToSelect(Object object, IMergeViewerItemProviderConfiguration configuration); +} diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/mergeviewer/item/provider/IMergeViewerItemProviderConfiguration.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/mergeviewer/item/provider/IMergeViewerItemProviderConfiguration.java new file mode 100644 index 000000000..313a1602f --- /dev/null +++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/mergeviewer/item/provider/IMergeViewerItemProviderConfiguration.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2016 EclipseSource Muenchen GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Stefan Dirix - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.rcp.ui.mergeviewer.item.provider; + +import com.google.common.base.Predicate; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.compare.Comparison; +import org.eclipse.emf.compare.rcp.ui.mergeviewer.IMergeViewer.MergeViewerSide; +import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroupProvider; +import org.eclipse.emf.ecore.EObject; + +/** + * The configuration used by {@link IMergeViewerItemContentProvider}s. + * + * @author Stefan Dirix <sdirix@eclipsesource.com> + * @since 4.4 + */ +public interface IMergeViewerItemProviderConfiguration { + + /** + * Get the {@link AdapterFactory}. + * + * @return the {@link AdapterFactory}, + */ + public AdapterFactory getAdapterFactory(); + + /** + * Get the {@link IDifferenceGroupProvider}. + * + * @return the {@link IDifferenceGroupProvider}. + */ + public IDifferenceGroupProvider getDifferenceGroupProvider(); + + /** + * Get the difference filter {@link Predicate}. + * + * @return the difference filter {@link Predicate}. + */ + public Predicate<? super EObject> getDifferenceFilterPredicate(); + + /** + * Get the {@link Comparison}. + * + * @return the {@link Comparison}. + */ + public Comparison getComparison(); + + /** + * Get the {@link MergeViewerSide}. + * + * @return the {@link MergeViewerSide}. + */ + public MergeViewerSide getSide(); +} diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/mergeviewer/item/provider/IOptionalProvider.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/mergeviewer/item/provider/IOptionalProvider.java new file mode 100644 index 000000000..31c2d9884 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/mergeviewer/item/provider/IOptionalProvider.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2016 EclipseSource Muenchen GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Stefan Dirix - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.rcp.ui.mergeviewer.item.provider; + +/** + * A contract for a provider which can indicate whether it wants to handle a certain object. + * + * @author Stefan Dirix <sdirix@eclipsesource.com> + * @since 4.4 + */ +public interface IOptionalProvider { + /** + * Indicates whether this provider wants to handle the given {@code object}. + * + * @param object + * the {@link Object}. + * @return {@code true} if the provider wants to handle the given {@code object}, {@code false} otherwise. + */ + boolean canHandle(Object object); +} |