KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > update > internal > core > PluginEntryContentConsumer


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.update.internal.core;
12 import org.eclipse.core.runtime.*;
13 import org.eclipse.update.core.*;
14
15 /**
16  * ContentConsumer for a plugin entry of a feature
17  */

18
19 public class PluginEntryContentConsumer extends ContentConsumer {
20
21     private boolean closed = false;
22
23     private IContentConsumer contentConsumer;
24         
25     /*
26      * Constructor
27      */

28     public PluginEntryContentConsumer(IContentConsumer contentConsumer){
29         this.contentConsumer = contentConsumer;
30     }
31
32     /*
33      * @see ContentConsumer#store(ContentReference, IProgressMonitor)
34      */

35     public void store(ContentReference contentReference, IProgressMonitor monitor) throws CoreException {
36         if (!closed){
37             contentConsumer.store(contentReference,monitor);
38         } else {
39             UpdateCore.warn("Attempt to store in a closed PluginEntryContentConsumer",new Exception JavaDoc()); //$NON-NLS-1$
40
}
41     }
42
43     /*
44      * @see ContentConsumer#close()
45      */

46     public void close() throws CoreException {
47         if (!closed){
48             closed = true;
49             contentConsumer.close();
50         } else {
51             UpdateCore.warn("Attempt to close a closed PluginEntryContentConsumer",new Exception JavaDoc()); //$NON-NLS-1$
52
}
53     }
54
55 }
56
Popular Tags