01: /*******************************************************************************
02: * Copyright (c) 2004, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.examples.components.views;
11:
12: import org.eclipse.swt.layout.GridData;
13: import org.eclipse.swt.layout.GridLayout;
14: import org.eclipse.swt.widgets.Composite;
15: import org.eclipse.ui.IPageLayout;
16: import org.eclipse.ui.internal.components.framework.ComponentException;
17: import org.eclipse.ui.internal.components.framework.FactoryMap;
18: import org.eclipse.ui.internal.part.Part;
19: import org.eclipse.ui.internal.part.components.services.IWorkbenchPartFactory;
20:
21: /**
22: * Example view containing a nested error log on the left and a nested property
23: * view on the right.
24: *
25: * @since 3.1
26: */
27: public class TestCompositeView {
28:
29: public TestCompositeView(Composite parent,
30: IWorkbenchPartFactory factory) throws ComponentException {
31: // Create PDE error log view
32: FactoryMap logViewContext = new FactoryMap();
33: Part logView = factory.createView(
34: "org.eclipse.debug.ui.BreakpointView",
35: //"org.eclipse.debug.ui.DebugView",
36: //"org.eclipse.pde.runtime.LogView",
37: parent, null, logViewContext);
38:
39: // Create Property view
40: FactoryMap emptyContext = new FactoryMap();
41: Part propertiesView = factory.createView(
42: IPageLayout.ID_PROP_SHEET, parent, null, emptyContext);
43:
44: // Construct layout
45: GridLayout layout = new GridLayout();
46: layout.numColumns = 2;
47: parent.setLayout(layout);
48:
49: // Arrange error log view
50: GridData data1 = new GridData(GridData.FILL_BOTH);
51: logView.getControl().setLayoutData(data1);
52:
53: // Arrange properties view
54: GridData data2 = new GridData(GridData.FILL_BOTH);
55: propertiesView.getControl().setLayoutData(data2);
56:
57: }
58: }
|