KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > registry > ActionSetRegistryReader


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

11 package org.eclipse.ui.internal.registry;
12
13 import org.eclipse.core.runtime.*;
14 import org.eclipse.ui.PlatformUI;
15 import org.eclipse.ui.internal.IWorkbenchConstants;
16 import org.eclipse.ui.internal.WorkbenchPlugin;
17
18 /**
19  * A strategy to read view extensions from the registry.
20  */

21 public class ActionSetRegistryReader extends RegistryReader {
22     private static final String JavaDoc TAG_SET="actionSet";//$NON-NLS-1$
23
private ActionSetRegistry registry;
24     
25 /**
26  * RegistryViewReader constructor comment.
27  */

28 public ActionSetRegistryReader() {
29     super();
30 }
31 //for dynamic UI
32
public ActionSetRegistryReader(ActionSetRegistry registry) {
33     this.registry = registry;
34 }
35 /**
36  * readElement method comment.
37  */

38 //for dynamic UI: change access from protected to public
39
public boolean readElement(IConfigurationElement element) {
40     if (element.getName().equals(TAG_SET)) {
41         try {
42             ActionSetDescriptor desc = new ActionSetDescriptor(element);
43             registry.addActionSet(desc);
44         } catch (CoreException e) {
45             // log an error since its not safe to open a dialog here
46
WorkbenchPlugin.log("Unable to create action set descriptor.",e.getStatus());//$NON-NLS-1$
47
}
48         return true;
49     } else {
50         return false;
51     }
52 }
53 /**
54  * Read the view extensions within a registry.
55  */

56 public void readRegistry(IExtensionRegistry in, ActionSetRegistry out)
57 {
58     registry = out;
59     readRegistry(in, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_ACTION_SETS);
60     out.mapActionSetsToCategories();
61 }
62 }
63
Popular Tags