KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > registry > ExtensionDelta


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.core.internal.registry;
12
13 import org.eclipse.core.runtime.*;
14
15 public class ExtensionDelta implements IExtensionDelta {
16     private int kind;
17     private int extension;
18     private int extensionPoint;
19     private RegistryDelta containingDelta;
20
21     void setContainingDelta(RegistryDelta containingDelta) {
22         this.containingDelta = containingDelta;
23     }
24
25     int getExtensionId() {
26         return extension;
27     }
28
29     int getExtensionPointId() {
30         return extensionPoint;
31     }
32
33     public IExtensionPoint getExtensionPoint() {
34         return new ExtensionPointHandle(containingDelta.getObjectManager(), extensionPoint);
35     }
36
37     public void setExtensionPoint(int extensionPoint) {
38         this.extensionPoint = extensionPoint;
39     }
40
41     public int getKind() {
42         return kind;
43     }
44
45     public IExtension getExtension() {
46         return new ExtensionHandle(containingDelta.getObjectManager(), extension);
47     }
48
49     public void setExtension(int extension) {
50         this.extension = extension;
51     }
52
53     public void setKind(int kind) {
54         this.kind = kind;
55     }
56
57     public String JavaDoc toString() {
58         return "\n\t\t" + getExtensionPoint().getUniqueIdentifier() + " - " + getExtension().getNamespaceIdentifier() + '.' + getExtension().getSimpleIdentifier() + " (" + getKindString(this.getKind()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
59
}
60
61     public static String JavaDoc getKindString(int kind) {
62         switch (kind) {
63             case ADDED :
64                 return "ADDED"; //$NON-NLS-1$
65
case REMOVED :
66                 return "REMOVED"; //$NON-NLS-1$
67
}
68         return "UNKNOWN"; //$NON-NLS-1$
69
}
70 }
71
Popular Tags