| 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.ui.dialogs; |
| 12 | |
| 13 | import org.eclipse.core.runtime.IAdaptable; |
| 14 | import org.eclipse.jface.preference.PreferencePage; |
| 15 | import org.eclipse.ui.IWorkbenchPropertyPage; |
| 16 | |
| 17 | /** |
| 18 | * Abstract base implementation of a workbench property page ( |
| 19 | * <code>IWorkbenchPropertyPage</code>). The implementation is a JFace |
| 20 | * preference page with an adapatable element. |
| 21 | * <p> |
| 22 | * Subclasses must implement the <code>createContents</code> framework method |
| 23 | * to supply the property page's main control. |
| 24 | * </p> |
| 25 | * <p> |
| 26 | * Subclasses should extend the <code>doComputeSize</code> framework method to |
| 27 | * compute the size of the page's control. |
| 28 | * </p> |
| 29 | * <p> |
| 30 | * Subclasses may override the <code>performOk</code>, |
| 31 | * <code>performApply</code>,<code>performDefaults</code>, |
| 32 | * <code>performCancel</code>, and <code>performHelp</code> framework |
| 33 | * methods to react to the standard button events. |
| 34 | * </p> |
| 35 | * <p> |
| 36 | * Subclasses may call the <code>noDefaultAndApplyButton</code> framework |
| 37 | * method before the page's control has been created to suppress the standard |
| 38 | * Apply and Defaults buttons. |
| 39 | * </p> |
| 40 | * |
| 41 | * @see IWorkbenchPropertyPage |
| 42 | */ |
| 43 | public abstract class PropertyPage extends PreferencePage implements |
| 44 | IWorkbenchPropertyPage { |
| 45 | /** |
| 46 | * The element. |
| 47 | */ |
| 48 | private IAdaptable element; |
| 49 | |
| 50 | /** |
| 51 | * Creates a new property page. |
| 52 | */ |
| 53 | public PropertyPage() { |
| 54 | } |
| 55 | |
| 56 | /* |
| 57 | * (non-Javadoc) |
| 58 | * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement() |
| 59 | */ |
| 60 | public IAdaptable getElement() { |
| 61 | return element; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Sets the element that owns properties shown on this page. |
| 66 | * |
| 67 | * @param element |
| 68 | * the element |
| 69 | */ |
| 70 | public void setElement(IAdaptable element) { |
| 71 | this.element = element; |
| 72 | } |
| 73 | } |