01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 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.internal.ide.model;
11:
12: import org.eclipse.core.resources.IFile;
13: import org.eclipse.core.resources.IFolder;
14: import org.eclipse.core.resources.IMarker;
15: import org.eclipse.core.resources.IProject;
16: import org.eclipse.core.resources.IWorkspace;
17: import org.eclipse.core.resources.IWorkspaceRoot;
18: import org.eclipse.core.runtime.IAdapterFactory;
19: import org.eclipse.core.runtime.IAdapterManager;
20: import org.eclipse.core.runtime.Platform;
21:
22: /**
23: * Registers the adapters on core constructs
24: * used in the workbench UI.
25: */
26: public final class WorkbenchAdapterBuilder {
27: /**
28: * Creates extenders and registers
29: */
30: public static void registerAdapters() {
31: IAdapterManager manager = Platform.getAdapterManager();
32: IAdapterFactory factory = new WorkbenchAdapterFactory();
33: manager.registerAdapters(factory, IWorkspace.class);
34: manager.registerAdapters(factory, IWorkspaceRoot.class);
35: manager.registerAdapters(factory, IProject.class);
36: manager.registerAdapters(factory, IFolder.class);
37: manager.registerAdapters(factory, IFile.class);
38: manager.registerAdapters(factory, IMarker.class);
39:
40: // properties adapters
41: IAdapterFactory paFactory = new StandardPropertiesAdapterFactory();
42: manager.registerAdapters(paFactory, IWorkspace.class);
43: manager.registerAdapters(paFactory, IWorkspaceRoot.class);
44: manager.registerAdapters(paFactory, IProject.class);
45: manager.registerAdapters(paFactory, IFolder.class);
46: manager.registerAdapters(paFactory, IFile.class);
47: manager.registerAdapters(paFactory, IMarker.class);
48: }
49: }
|