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.context;
11:
12: import org.eclipse.swt.layout.FillLayout;
13: import org.eclipse.swt.widgets.Composite;
14: import org.eclipse.ui.IPageLayout;
15: import org.eclipse.ui.internal.components.framework.ComponentException;
16: import org.eclipse.ui.internal.components.framework.FactoryMap;
17: import org.eclipse.ui.internal.part.Part;
18: import org.eclipse.ui.internal.part.components.services.IWorkbenchPartFactory;
19:
20: /**
21: * View that demonstrates how to create two nested children
22: * with the default context. Since we haven't supplied the
23: * children with any meaningful context, the children won'
24: * t have a toolbar or menu, and their selection, name, and
25: * icon will be ignored.
26: * <p>
27: * The fact that the parent is using the default context
28: * means that it doesn't care about these things and isn't
29: * prepared to deal with them. If the parent cared about,
30: * say, the selection in one of its children, it would need
31: * to pass an ISelectionHandler to that child.
32: * </p>
33: *
34: * @since 3.1
35: */
36: public class DefaultContextView {
37: /**
38: * Component constructor. Do not invoke directly.
39: */
40: public DefaultContextView(Composite parent,
41: IWorkbenchPartFactory factory) throws ComponentException {
42: // Create a resource navigator
43: FactoryMap viewContext1 = new FactoryMap();
44: Part view1 = factory.createView(IPageLayout.ID_RES_NAV, parent,
45: null, viewContext1);
46:
47: // Create property view
48: FactoryMap viewContext2 = new FactoryMap();
49: Part view2 = factory.createView(IPageLayout.ID_PROP_SHEET,
50: parent, null, viewContext2);
51:
52: parent.setLayout(new FillLayout());
53: }
54: }
|