KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > core > schema > AbstractSchemaDescriptor


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.pde.internal.core.schema;
12
13 import java.net.*;
14
15 import org.eclipse.core.runtime.IPath;
16 import org.eclipse.pde.internal.core.ischema.*;
17
18 public abstract class AbstractSchemaDescriptor implements ISchemaDescriptor {
19     protected Schema schema;
20
21     public AbstractSchemaDescriptor() {
22         super();
23     }
24
25     public IPath getPluginRelativePath(String JavaDoc pluginId, IPath path) {
26         return null;
27     }
28
29     protected Schema createSchema() {
30         URL url = getSchemaURL();
31         if (url == null)
32             return null;
33         return new Schema(this, url);
34     }
35     public void dispose() {
36         if (schema != null && schema.isDisposed() == false) {
37             schema.dispose();
38         }
39         schema = null;
40     }
41
42     public ISchema getSchema() {
43         if (schema == null) {
44             loadSchema();
45         }
46         return schema;
47     }
48     protected void loadSchema() {
49         schema = createSchema();
50         if (schema != null)
51             schema.load();
52     }
53     public void reload() {
54         if (schema != null) {
55             schema.reload();
56         }
57     }
58     public boolean isStandalone() {
59         return false;
60     }
61
62     public abstract boolean isEnabled();
63 }
64
Popular Tags