KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > activities > ws > TriggerPointAdvisorDescriptor


1 /*******************************************************************************
2  * Copyright (c) 2004, 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.activities.ws;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.core.runtime.IConfigurationElement;
15 import org.eclipse.ui.activities.ITriggerPointAdvisor;
16 import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
17 import org.eclipse.ui.internal.registry.RegistryReader;
18
19 /**
20  * Descriptor for trigger point advisor extensions.
21  *
22  * @since 3.1
23  */

24 public final class TriggerPointAdvisorDescriptor {
25
26     private String JavaDoc id;
27
28     private IConfigurationElement element;
29
30     /**
31      * Create a new instance of this class.
32      *
33      * @param element
34      * the configuration element
35      * @throws IllegalArgumentException
36      * thrown if the element is missing an id attribute
37      */

38     public TriggerPointAdvisorDescriptor(IConfigurationElement element)
39             throws IllegalArgumentException JavaDoc {
40         id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
41         if (id == null
42                 || RegistryReader.getClassValue(element,
43                         IWorkbenchRegistryConstants.ATT_CLASS) == null) {
44             throw new IllegalArgumentException JavaDoc();
45         }
46         this.element = element;
47     }
48
49     /**
50      * Return the id.
51      *
52      * @return the id
53      */

54     public String JavaDoc getId() {
55         return id;
56     }
57
58     /**
59      * Create the advisor for this descriptor.
60      *
61      * @return the advisor
62      * @throws CoreException
63      * thrown if there is an issue creating the advisor
64      */

65     public ITriggerPointAdvisor createAdvisor() throws CoreException {
66         return (ITriggerPointAdvisor) element
67                 .createExecutableExtension(IWorkbenchRegistryConstants.ATT_CLASS);
68     }
69 }
70
Popular Tags