1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Eclipse Public License, Version 1.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.eclipse.org/org/documents/epl-v10.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.ide.eclipse.adt.internal.editors.ui; 18 19 import org.eclipse.swt.graphics.Image; 20 import org.eclipse.swt.widgets.Composite; 21 import org.eclipse.swt.widgets.Control; 22 import org.eclipse.swt.widgets.ToolBar; 23 24 /** 25 * Describes the content of a {@link IDecorContent}. 26 */ 27 public interface IDecorContent { 28 /** 29 * Creates the control that will be displayed in the {@link IDecorContent}. 30 * The control must be available from {@link #getControl()}. 31 * @param parent The {@link IDecorContent} parent. Never null. 32 */ createControl(Composite parent)33 public void createControl(Composite parent); 34 35 /** 36 * Creates the toolbar items that will be displayed in the {@link IDecorContent}. This 37 * method will always be called <b>after</b> {@link #createControl}, so the 38 * implementation can assume that it can call {@link #getControl()} to obtain the 39 * corresponding control that the toolbar items will operate on. 40 * 41 * @param toolbar the toolbar to add the toolbar items to 42 */ createToolbarItems(ToolBar toolbar)43 public void createToolbarItems(ToolBar toolbar); 44 45 /** 46 * Returns the control previously created by {@link #createControl(Composite)}. 47 * @return A control to display in the {@link IDecorContent}. Must not be null. 48 */ getControl()49 public Control getControl(); 50 51 /** 52 * Returns an optional title for the {@link IDecorContent}'s header. 53 * @return A string to display in the header or null. 54 */ getTitle()55 public String getTitle(); 56 57 /** 58 * Returns an optional image for the {@link IDecorContent}'s header. 59 * @return An image to display in the header or null. 60 */ getImage()61 public Image getImage(); 62 } 63