KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 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.core.internal.registry;
12
13 import java.lang.ref.SoftReference JavaDoc;
14 import org.eclipse.core.runtime.IConfigurationElement;
15
16 public class FlushableExtension extends Extension {
17
18     public FlushableExtension() {
19         super();
20     }
21
22     public IConfigurationElement[] getConfigurationElements() {
23         synchronized (this) {
24             if (!fullyLoaded) {
25                 fullyLoaded = true;
26                 RegistryCacheReader reader = getRegistry().getCacheReader();
27                 if (reader != null)
28                     elements = new SoftReference JavaDoc(reader.loadConfigurationElements(this, subElementsCacheOffset));
29             }
30             if (elements == null)
31                 elements = new IConfigurationElement[0];
32
33             if (((SoftReference JavaDoc) elements).get() == null) {
34                 RegistryCacheReader reader = getRegistry().getCacheReader();
35                 if (reader != null)
36                     elements = new SoftReference JavaDoc(reader.loadConfigurationElements(this, subElementsCacheOffset));
37             }
38         }
39         return (IConfigurationElement[]) ((SoftReference JavaDoc) elements).get();
40     }
41
42     public void setSubElements(IConfigurationElement[] value) {
43         elements = new SoftReference JavaDoc(value);
44     }
45 }
Popular Tags