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.pde.internal.ui.templates;
11:
12: import org.eclipse.core.runtime.CoreException;
13: import org.eclipse.pde.core.plugin.IPluginReference;
14:
15: public class PluginReference implements IPluginReference {
16: private int match = NONE;
17: private String version;
18: private String id;
19:
20: /**
21: * Constructor for PluginReference.
22: */
23: public PluginReference() {
24: super ();
25: }
26:
27: public boolean equals(Object object) {
28: if (object instanceof IPluginReference) {
29: IPluginReference source = (IPluginReference) object;
30: if (id == null)
31: return false;
32: if (id.equals(source.getId()) == false)
33: return false;
34: if (version == null && source.getVersion() == null)
35: return true;
36: return version.equals(source.getVersion());
37: }
38: return false;
39: }
40:
41: public PluginReference(String id, String version, int match) {
42: this .id = id;
43: this .version = version;
44: this .match = match;
45: }
46:
47: /*
48: * @see IPluginReference#getMatch()
49: */
50: public int getMatch() {
51: return match;
52: }
53:
54: /*
55: * @see IPluginReference#getVersion()
56: */
57: public String getVersion() {
58: return version;
59: }
60:
61: /*
62: * @see IPluginReference#setMatch(int)
63: */
64: public void setMatch(int match) throws CoreException {
65: this .match = match;
66: }
67:
68: /*
69: * @see IPluginReference#setVersion(String)
70: */
71: public void setVersion(String version) throws CoreException {
72: this .version = version;
73: }
74:
75: /*
76: * @see IIdentifiable#getId()
77: */
78: public String getId() {
79: return id;
80: }
81:
82: /*
83: * @see IIdentifiable#setId(String)
84: */
85: public void setId(String id) throws CoreException {
86: this.id = id;
87: }
88:
89: }
|