KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > ide > model > WorkbenchAdapterBuilder


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.ide.model;
12
13 import org.eclipse.core.resources.IFile;
14 import org.eclipse.core.resources.IFolder;
15 import org.eclipse.core.resources.IMarker;
16 import org.eclipse.core.resources.IProject;
17 import org.eclipse.core.resources.IWorkspace;
18 import org.eclipse.core.resources.IWorkspaceRoot;
19 import org.eclipse.core.runtime.IAdapterFactory;
20 import org.eclipse.core.runtime.IAdapterManager;
21 import org.eclipse.core.runtime.Platform;
22
23 /**
24  * Registers the adapters on core constructs
25  * used in the workbench UI.
26  */

27 public final class WorkbenchAdapterBuilder {
28     /**
29      * Creates extenders and registers
30      */

31     public static void registerAdapters() {
32         IAdapterManager manager = Platform.getAdapterManager();
33         IAdapterFactory factory = new WorkbenchAdapterFactory();
34         manager.registerAdapters(factory, IWorkspace.class);
35         manager.registerAdapters(factory, IWorkspaceRoot.class);
36         manager.registerAdapters(factory, IProject.class);
37         manager.registerAdapters(factory, IFolder.class);
38         manager.registerAdapters(factory, IFile.class);
39         manager.registerAdapters(factory, IMarker.class);
40
41         // properties adapters
42
IAdapterFactory paFactory = new StandardPropertiesAdapterFactory();
43         manager.registerAdapters(paFactory, IWorkspace.class);
44         manager.registerAdapters(paFactory, IWorkspaceRoot.class);
45         manager.registerAdapters(paFactory, IProject.class);
46         manager.registerAdapters(paFactory, IFolder.class);
47         manager.registerAdapters(paFactory, IFile.class);
48         manager.registerAdapters(paFactory, IMarker.class);
49     }
50 }
51
Popular Tags