aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaphael Moll <ralf@android.com>2010-12-17 09:41:06 -0800
committerRaphael Moll <ralf@android.com>2010-12-17 11:46:15 -0800
commitf1c2e4e0ef21fc28c91d4497e6c45e3fb264a9dc (patch)
treeab113b0ebfb3c9ae541d81417ba8a69d8a306a4b
parent671d47558838b7c4c01b0830c251f18125fd89ce (diff)
downloadsdk-f1c2e4e0ef21fc28c91d4497e6c45e3fb264a9dc.zip
sdk-f1c2e4e0ef21fc28c91d4497e6c45e3fb264a9dc.tar.gz
sdk-f1c2e4e0ef21fc28c91d4497e6c45e3fb264a9dc.tar.bz2
New "DecorComposite" for sub-panels in the GLE.
A DecorComposite wraps a control or composite such as the palette and adds a little header with an icon, a title and an optional toolbar of icon/actions. The GLE palette is revamped to use this. Some actions will be added later to toggle viewing views or layouts. Eventually the new property panel will be one of these too. Terminology: I tried to avoid the words "panel" or "page" or "pane" which are just too overused. Since this is merely more than decoration around a control, it's a DecorComposite. I've also added a couple builder classes to make it less verbose to set GridLayout and GridData objects. If these are useful out of the editors, we could move them somewhere else later. Change-Id: I5065411bfe48148c267ec6438b0ec5424123ab8c
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/icons/editor_palette.pngbin0 -> 430 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java5
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java57
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/DecorComposite.java84
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/GridDataBuilder.java140
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/GridLayoutBuilder.java103
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/IDecorContent.java51
7 files changed, 419 insertions, 21 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/icons/editor_palette.png b/eclipse/plugins/com.android.ide.eclipse.adt/icons/editor_palette.png
new file mode 100755
index 0000000..c682f57
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/icons/editor_palette.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
index 0c8257c..01393c4 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
@@ -38,6 +38,7 @@ import com.android.ide.eclipse.adt.internal.editors.layout.configuration.Configu
import com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.IConfigListener;
import com.android.ide.eclipse.adt.internal.editors.layout.gle2.IncludeFinder.Reference;
import com.android.ide.eclipse.adt.internal.editors.layout.gre.RulesEngine;
+import com.android.ide.eclipse.adt.internal.editors.ui.DecorComposite;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs;
@@ -394,7 +395,9 @@ public class GraphicalEditorPart extends EditorPart
mSashPalette = new SashForm(parent, SWT.HORIZONTAL);
mSashPalette.setLayoutData(new GridData(GridData.FILL_BOTH));
- mPalette = new PaletteControl(mSashPalette, this);
+ DecorComposite paleteDecor = new DecorComposite(mSashPalette, SWT.BORDER);
+ paleteDecor.setContent(new PaletteControl.PaletteDecor(this));
+ mPalette = (PaletteControl) paleteDecor.getContentControl();
mSashError = new SashForm(mSashPalette, SWT.VERTICAL | SWT.BORDER);
mSashError.setLayoutData(new GridData(GridData.FILL_BOTH));
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java
index 5413f99..c00367b 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java
@@ -25,6 +25,7 @@ import static com.android.ide.common.layout.LayoutConstants.VALUE_WRAP_CONTENT;
import com.android.ide.common.api.InsertType;
import com.android.ide.common.api.Rect;
import com.android.ide.common.layoutlib.LayoutLibrary;
+import com.android.ide.eclipse.adt.internal.editors.IconFactory;
import com.android.ide.eclipse.adt.internal.editors.descriptors.DescriptorsUtils;
import com.android.ide.eclipse.adt.internal.editors.descriptors.DocumentDescriptor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;
@@ -34,6 +35,10 @@ import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDes
import com.android.ide.eclipse.adt.internal.editors.layout.gre.NodeFactory;
import com.android.ide.eclipse.adt.internal.editors.layout.gre.NodeProxy;
import com.android.ide.eclipse.adt.internal.editors.layout.uimodel.UiViewElementNode;
+import com.android.ide.eclipse.adt.internal.editors.ui.DecorComposite;
+import com.android.ide.eclipse.adt.internal.editors.ui.GridDataBuilder;
+import com.android.ide.eclipse.adt.internal.editors.ui.GridLayoutBuilder;
+import com.android.ide.eclipse.adt.internal.editors.ui.IDecorContent;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
@@ -61,7 +66,6 @@ import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
@@ -106,6 +110,33 @@ import javax.xml.parsers.ParserConfigurationException;
*/
public class PaletteControl extends Composite {
+ /**
+ * Wrapper to create a {@link PaletteControl} into a {@link DecorComposite}.
+ */
+ public static class PaletteDecor implements IDecorContent {
+ private final GraphicalEditorPart mEditorPart;
+ private Control mControl;
+
+ public PaletteDecor(GraphicalEditorPart editor) {
+ mEditorPart = editor;
+ }
+
+ public String getTitle() {
+ return "Palette";
+ }
+
+ public Image getImage() {
+ return IconFactory.getInstance().getIcon("editor_palette"); //$NON-NLS-1$
+ }
+
+ public void createControl(Composite parent) {
+ mControl = new PaletteControl(parent, mEditorPart);
+ }
+
+ public Control getControl() {
+ return mControl;
+ }
+ }
/** The parent grid layout that contains all the {@link Toggle} and {@link Item} widgets. */
private Composite mRoot;
@@ -120,7 +151,7 @@ public class PaletteControl extends Composite {
* @param editor An editor associated with this palette.
*/
public PaletteControl(Composite parent, GraphicalEditorPart editor) {
- super(parent, SWT.BORDER | SWT.V_SCROLL);
+ super(parent, SWT.V_SCROLL);
mEditor = editor;
mVBar = getVerticalBar();
@@ -183,10 +214,10 @@ public class PaletteControl extends Composite {
c.dispose();
}
- setGridLayout(this, 2);
+ GridLayoutBuilder.create(this).columns(1).columnsEqual().hSpacing(0).noMargins();
mRoot = new Composite(this, SWT.NONE);
- setGridLayout(mRoot, 0);
+ GridLayoutBuilder.create(mRoot).columns(1).columnsEqual().spacing(0).noMargins();
if (targetData != null) {
addGroup(mRoot, "Views", targetData.getLayoutDescriptors().getViewDescriptors());
@@ -266,25 +297,12 @@ public class PaletteControl extends Composite {
}
}
- private void setGridLayout(Composite parent, int spacing) {
- GridLayout gl = new GridLayout(1, false);
- gl.horizontalSpacing = 0;
- gl.verticalSpacing = 0;
- gl.marginHeight = spacing;
- gl.marginBottom = spacing;
- gl.marginLeft = spacing;
- gl.marginRight = spacing;
- gl.marginTop = spacing;
- gl.marginBottom = spacing;
- parent.setLayout(gl);
- }
-
private void addGroup(Composite parent,
String uiName,
List<ElementDescriptor> descriptors) {
Composite group = new Composite(parent, SWT.NONE);
- setGridLayout(group, 0);
+ GridLayoutBuilder.create(group).columns(1).columnsEqual().spacing(0).noMargins();
Toggle toggle = new Toggle(group, uiName);
@@ -298,8 +316,7 @@ public class PaletteControl extends Composite {
Item item = new Item(group, this, desc);
toggle.addItem(item);
- GridData gd = new GridData();
- item.setLayoutData(gd);
+ GridDataBuilder.create(item);
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/DecorComposite.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/DecorComposite.java
new file mode 100755
index 0000000..6b310b3
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/DecorComposite.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.ui;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ToolBar;
+
+/**
+ * A composite that wraps a control, with a header composed of an image/label
+ * and a set of toolbar icons.
+ */
+public class DecorComposite extends Composite {
+
+ private CLabel mTitle;
+ private ToolBar mToolbar;
+ private IDecorContent mContent;
+
+ public DecorComposite(Composite parent, int style) {
+ super(parent, style);
+
+ GridLayoutBuilder.create(this).noMargins().columns(2);
+
+ mTitle = new CLabel(this, SWT.NONE);
+ GridDataBuilder.create(mTitle).hGrab().hFill().vCenter();
+
+ mToolbar = new ToolBar(this, SWT.FLAT | SWT.RIGHT);
+ GridDataBuilder.create(mToolbar).fill();
+
+ Label sep = new Label(this, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridDataBuilder.create(sep).hSpan(2).hFill();
+ }
+
+ public DecorComposite setTitle(String title) {
+ mTitle.setText(title);
+ return this;
+ }
+
+ public DecorComposite setImage(Image image) {
+ mTitle.setImage(image);
+ return this;
+ }
+
+ public DecorComposite setContent(IDecorContent content) {
+ mContent = content;
+ content.createControl(this);
+ GridDataBuilder.create(content.getControl()).hSpan(2).grab().fill();
+
+ String t = content.getTitle();
+ if (t != null) {
+ setTitle(t);
+ }
+
+ Image i = content.getImage();
+ if (i != null) {
+ setImage(i);
+ }
+
+ return this;
+ }
+
+ public Control getContentControl() {
+ return mContent == null ? null : mContent.getControl();
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/GridDataBuilder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/GridDataBuilder.java
new file mode 100755
index 0000000..6c95cc5
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/GridDataBuilder.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.ui;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * A little helper to create a new {@link GridData} and set its properties.
+ * <p/>
+ * Example of usage: <br/>
+ * <code>
+ * GridDataHelper.create(myControl).hSpan(2).hAlignCenter().fill();
+ * </code>
+ */
+public final class GridDataBuilder {
+
+ private GridData mGD;
+
+ private GridDataBuilder() {
+ mGD = new GridData();
+ }
+
+ /**
+ * Creates new {@link GridData} and associates it on the <code>control</code> composite.
+ */
+ static public GridDataBuilder create(Control control) {
+ GridDataBuilder gdh = new GridDataBuilder();
+ control.setLayoutData(gdh.mGD);
+ return gdh;
+ }
+
+ /** Sets <code>widthHint</code> to <code>w</code>. */
+ public GridDataBuilder wHint(int w) {
+ mGD.widthHint = w;
+ return this;
+ }
+
+ /** Sets <code>heightHint</code> to <code>h</code>. */
+ public GridDataBuilder hHint(int h) {
+ mGD.heightHint = h;
+ return this;
+ }
+
+ /** Sets <code>horizontalIndent</code> to <code>h</code>. */
+ public GridDataBuilder hIndent(int h) {
+ mGD.horizontalIndent = h;
+ return this;
+ }
+
+ /** Sets <code>horizontalSpan</code> to <code>h</code>. */
+ public GridDataBuilder hSpan(int h) {
+ mGD.horizontalSpan = h;
+ return this;
+ }
+
+ /** Sets <code>verticalSpan</code> to <code>v</code>. */
+ public GridDataBuilder vSpan(int v) {
+ mGD.verticalSpan = v;
+ return this;
+ }
+
+ /** Sets <code>horizontalAlignment</code> to {@link SWT#CENTER}. */
+ public GridDataBuilder hCenter() {
+ mGD.horizontalAlignment = SWT.CENTER;
+ return this;
+ }
+
+ /** Sets <code>verticalAlignment</code> to {@link SWT#CENTER}. */
+ public GridDataBuilder vCenter() {
+ mGD.verticalAlignment = SWT.CENTER;
+ return this;
+ }
+
+ /** Sets <code>verticalAlignment</code> to {@link SWT#TOP}. */
+ public GridDataBuilder vTop() {
+ mGD.verticalAlignment = SWT.TOP;
+ return this;
+ }
+
+ /** Sets <code>horizontalAlignment</code> to {@link GridData#FILL}. */
+ public GridDataBuilder hFill() {
+ mGD.horizontalAlignment = GridData.FILL;
+ return this;
+ }
+
+ /** Sets <code>verticalAlignment</code> to {@link GridData#FILL}. */
+ public GridDataBuilder vFill() {
+ mGD.verticalAlignment = GridData.FILL;
+ return this;
+ }
+
+ /**
+ * Sets both <code>horizontalAlignment</code> and <code>verticalAlignment</code>
+ * to {@link GridData#FILL}.
+ */
+ public GridDataBuilder fill() {
+ mGD.horizontalAlignment = GridData.FILL;
+ mGD.verticalAlignment = GridData.FILL;
+ return this;
+ }
+
+ /** Sets <code>grabExcessHorizontalSpace</code> to true. */
+ public GridDataBuilder hGrab() {
+ mGD.grabExcessHorizontalSpace = true;
+ return this;
+ }
+
+ /** Sets <code>grabExcessVerticalSpace</code> to true. */
+ public GridDataBuilder vGrab() {
+ mGD.grabExcessVerticalSpace = true;
+ return this;
+ }
+
+ /**
+ * Sets both <code>grabExcessHorizontalSpace</code> and
+ * <code>grabExcessVerticalSpace</code> to true.
+ */
+ public GridDataBuilder grab() {
+ mGD.grabExcessHorizontalSpace = true;
+ mGD.grabExcessVerticalSpace = true;
+ return this;
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/GridLayoutBuilder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/GridLayoutBuilder.java
new file mode 100755
index 0000000..5d51525
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/GridLayoutBuilder.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.ui;
+
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * A little helper to create a new {@link GridLayout}, associate to a {@link Composite}
+ * and set its common attributes.
+ * <p/>
+ * Example of usage: <br/>
+ * <code>
+ * GridLayoutHelper.create(myComposite).noMargins().vSpacing(0).columns(2);
+ * </code>
+ */
+public final class GridLayoutBuilder {
+
+ private static GridLayout mGL;
+
+ private GridLayoutBuilder() {
+ mGL = new GridLayout();
+ }
+
+ /**
+ * Creates new {@link GridLayout} and associates it on the <code>parent</code> composite.
+ */
+ static public GridLayoutBuilder create(Composite parent) {
+ GridLayoutBuilder glh = new GridLayoutBuilder();
+ parent.setLayout(glh.mGL);
+ return glh;
+ }
+
+ /** Sets all margins to 0. */
+ public GridLayoutBuilder noMargins() {
+ mGL.marginHeight = 0;
+ mGL.marginWidth = 0;
+ mGL.marginLeft = 0;
+ mGL.marginTop = 0;
+ mGL.marginRight = 0;
+ mGL.marginBottom = 0;
+ return this;
+ }
+
+ /** Sets all margins to <code>n</code>. */
+ public GridLayoutBuilder margins(int n) {
+ mGL.marginHeight = n;
+ mGL.marginWidth = n;
+ mGL.marginLeft = n;
+ mGL.marginTop = n;
+ mGL.marginRight = n;
+ mGL.marginBottom = n;
+ return this;
+ }
+
+ /** Sets <code>numColumns</code> to <code>n</code>. */
+ public GridLayoutBuilder columns(int n) {
+ mGL.numColumns = n;
+ return this;
+ }
+
+ /** Sets <code>makeColumnsEqualWidth</code> to true. */
+ public GridLayoutBuilder columnsEqual() {
+ mGL.makeColumnsEqualWidth = true;
+ return this;
+ }
+
+ /** Sets <code>verticalSpacing</code> to <code>v</code>. */
+ public GridLayoutBuilder vSpacing(int v) {
+ mGL.verticalSpacing = v;
+ return this;
+ }
+
+ /** Sets <code>horizontalSpacing</code> to <code>h</code>. */
+ public GridLayoutBuilder hSpacing(int h) {
+ mGL.horizontalSpacing = h;
+ return this;
+ }
+
+ /**
+ * Sets <code>horizontalSpacing</code> and <code>verticalSpacing</code>
+ * to <code>s</code>.
+ */
+ public GridLayoutBuilder spacing(int s) {
+ mGL.verticalSpacing = s;
+ mGL.horizontalSpacing = s;
+ return this;
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/IDecorContent.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/IDecorContent.java
new file mode 100755
index 0000000..eb06a1b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/IDecorContent.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.ui;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * Describes the content of a {@link IDecorContent}.
+ */
+public interface IDecorContent {
+ /**
+ * Creates the control that will be displayed in the {@link IDecorContent}.
+ * The control must be available from {@link #getControl()}.
+ * @param parent The {@link IDecorContent} parent. Never null.
+ */
+ public void createControl(Composite parent);
+
+ /**
+ * Returns the control previously created by {@link #createControl(Composite)}.
+ * @return A control to display in the {@link IDecorContent}. Must not be null.
+ */
+ public Control getControl();
+
+ /**
+ * Returns an optional title for the {@link IDecorContent}'s header.
+ * @return A string to display in the header or null.
+ */
+ public String getTitle();
+
+ /**
+ * Returns an optional image for the {@link IDecorContent}'s header.
+ * @return An image to display in the header or null.
+ */
+ public Image getImage();
+}