1 /******************************************************************************* 2 * Copyright (c) 2000, 2006 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.team.internal.ui.synchronize; 12 13 import org.eclipse.core.runtime.IProgressMonitor; 14 import org.eclipse.jface.util.IPropertyChangeListener; 15 import org.eclipse.jface.viewers.StructuredViewer; 16 import org.eclipse.jface.viewers.ViewerSorter; 17 import org.eclipse.team.core.synchronize.SyncInfoSet; 18 import org.eclipse.team.internal.ui.TeamUIPlugin; 19 import org.eclipse.team.ui.synchronize.ISynchronizeModelElement; 20 21 /** 22 * This class represents provisional API. A provider is not required to 23 * implement this API. Implementers, and those who reference it, do so with the 24 * awareness that this class may be removed or substantially changed at future 25 * times without warning. 26 */ 27 public interface ISynchronizeModelProvider { 28 29 /** 30 * Property constant used to indicate that the veiwer sorter has changed. 31 * Property change notifications for the viewer sorter change do not include 32 * the old and new viewer sorter. Instead, clients should re-obtain the sorter 33 * from the provider. 34 */ 35 public static final String P_VIEWER_SORTER = TeamUIPlugin.ID + ".P_VIEWER_SORTER"; //$NON-NLS-1$ 36 37 /** 38 * Returns the sync set this model provider is showing. 39 * @return the sync set this model provider is showing. 40 */ 41 public abstract SyncInfoSet getSyncInfoSet(); 42 43 /** 44 * Returns the description for this model provider. 45 * @return the description for this model provider. 46 */ 47 public ISynchronizeModelProviderDescriptor getDescriptor(); 48 49 /** 50 * Return the <code>AbstractTreeViewer</code> asociated with this content 51 * provider or <code>null</code> if the viewer is not of the proper type. 52 * @return the viewer 53 */ 54 public abstract StructuredViewer getViewer(); 55 56 /** 57 * Builds the viewer model based on the contents of the sync set. 58 * @return the root element of the generated model. 59 */ 60 public abstract ISynchronizeModelElement prepareInput(IProgressMonitor monitor); 61 62 /** 63 * Dispose of the builder 64 */ 65 public abstract void dispose(); 66 67 /** 68 * Returns the input created by this controller or <code>null</code> if 69 * {@link #prepareInput(IProgressMonitor)} hasn't been called on this object yet. 70 * @return the model element 71 */ 72 public abstract ISynchronizeModelElement getModelRoot(); 73 74 /** 75 * Returns the sorter for this model. 76 * @return the sorter for this model. 77 */ 78 public abstract ViewerSorter getViewerSorter(); 79 80 /** 81 * Allows the provider to save state. Is usually called before provider is disposed and it 82 * is safe to access the viewer. 83 */ 84 public abstract void saveState(); 85 86 /** 87 * Register a property change listener with this provider. 88 * @param listener the property change listener 89 */ 90 public abstract void addPropertyChangeListener(IPropertyChangeListener listener); 91 92 /** 93 * Remove a property change listener from this provider. 94 * @param listener the property change listener 95 */ 96 public abstract void removePropertyChangeListener(IPropertyChangeListener listener); 97 } 98