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.ui.synchronize; 12 13 import org.eclipse.jface.dialogs.IDialogSettings; 14 import org.eclipse.jface.viewers.ISelectionProvider; 15 import org.eclipse.swt.widgets.Shell; 16 import org.eclipse.ui.IActionBars; 17 import org.eclipse.ui.IKeyBindingService; 18 import org.eclipse.ui.IWorkbenchPart; 19 import org.eclipse.ui.IWorkbenchSite; 20 21 /** 22 * A site which provides access to the context in which this page 23 * is being displayed. Instances of this interface serve a similar purpose 24 * to <code>IWorkbenchSite</code> instances but is provided as a separate 25 * objects to allow clients to access the different site types 26 * (view, editor, dialog) using a common interface. This interface also provides 27 * access to the part for the site because this is required by some UI 28 * components. Clients should not need to access the part. 29 * <p> 30 * Clients can determine the type of workbench site by doing <code>instanceof</code> 31 * checks on the object returned by <code>getWorkbenchSite</code>. Similar 32 * <code>instanceof</code> checks can be done with the part. 33 * <p> 34 * Clients are not intended to implement this interface 35 * 36 * @since 3.0 37 */ 38 public interface ISynchronizePageSite { 39 40 /** 41 * Return the workbench site for the page 42 * or <code>null</code> if a workbench site is not available (e.g. if 43 * the page is being shown in a dialog). 44 * @return the workbench site for the page or <code>null</code> 45 */ 46 IWorkbenchSite getWorkbenchSite(); 47 48 /** 49 * Return the workbench part for the page 50 * or <code>null</code> if a workbench part is not available (e.g. if 51 * the page is being shown in a dialog). 52 * @return the workbench part for the page or <code>null</code> 53 */ 54 IWorkbenchPart getPart(); 55 56 /** 57 * Returns the shell for this site. 58 * @return the shell for this site 59 */ 60 Shell getShell(); 61 62 /** 63 * Get the selection provider that gives access to the selection 64 * of the synchronize page associated with this page site. 65 * @return the selection provider for the page 66 */ 67 ISelectionProvider getSelectionProvider(); 68 69 /** 70 * Sets the selection provider for this workbench site. 71 * @param provider the selection provider, or <code>null</code> to clear it 72 */ 73 void setSelectionProvider(ISelectionProvider provider); 74 75 /** 76 * Get the keybinding service for the site or <code>null</code> 77 * if one is not available. 78 * @return the keybinding service for the site or <code>null</code> 79 * if one is not available 80 */ 81 IKeyBindingService getKeyBindingService(); 82 83 /** 84 * Give the page focus. 85 */ 86 void setFocus(); 87 88 /** 89 * Return a settings node that can be used by the 90 * page to save state. A <code>null</code> value 91 * is returned if the site does not allow for 92 * persisted settings. 93 * @return a settings node or <code>null</code> 94 */ 95 IDialogSettings getPageSettings(); 96 97 /** 98 * Returns the action bars for this synchronize page site. 99 * 100 * @return the action bars 101 */ 102 IActionBars getActionBars(); 103 104 /** 105 * Returns whether the site is associated with a page being 106 * shown in a modal dialog 107 * @return whether the site is associated with a page being 108 * shown in a modal dialog 109 */ 110 boolean isModal(); 111 112 } 113