View Javadoc

1   /*
2    * This file is a part of CAST project.
3    * (c) Copyright 2007, AGH University of Science & Technology
4    * https://caribou.iisg.agh.edu.pl/trac/cast
5    *
6    * Licensed under the Eclipse Public License, Version 1.0 (the "License").
7    * You may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    * http://www.eclipse.org/legal/epl-v10.html
10   */
11  /*
12   * File: AbstractContentProvider.java
13   * Created: 2005-11-30
14   * Author: apohllo
15   * $Id: AbstractContentProvider.java 2312 2009-01-12 22:53:55Z tmilos $
16   */
17  
18  package pl.edu.agh.cast.ui;
19  
20  import org.apache.log4j.Logger;
21  import org.eclipse.jface.viewers.IContentProvider;
22  import org.eclipse.jface.viewers.Viewer;
23  import org.eclipse.ui.IMemento;
24  
25  import pl.edu.agh.cast.Activator;
26  
27  /**
28   * This is base class for content providers which are used with viewers in GUI. It provides the basic functionality and
29   * fields used in all types of content providers.
30   *
31   * @author AGH CAST Team
32   */
33  public abstract class AbstractContentProvider implements IContentProvider {
34  
35  	/**
36  	 * The view, where this content provider is used (i.e. it displays the content provided by this content provider).
37  	 */
38  	protected AbstractConfigurableView view = null;
39  
40  	/**
41  	 * The viewer which is the master of this content provider (i.e. this content provider provides content for this
42  	 * viewer).
43  	 */
44  	protected Viewer viewer = null;
45  
46  	/**
47  	 * The configuration of the view.
48  	 */
49  	protected IMemento configuration = null;
50  
51  	/**
52  	 * Logger.
53  	 */
54  	protected Logger log = Activator.getLogger();
55  
56  	/**
57  	 * Basic constructor - initializes this content provider with necessary information.
58  	 *
59  	 * @param viewer
60  	 *            the viewer which is the master of this content provider
61  	 * @param view
62  	 *            the view, where this content provider is used
63  	 */
64  	public AbstractContentProvider(Viewer viewer, AbstractConfigurableView view) {
65  		this.view = view;
66  		this.viewer = viewer;
67  		if (view != null) {
68  			this.configuration = view.getConfiguration();
69  		}
70  	}
71  
72  	/**
73  	 * The default implementation does not grab any resources, so this method is empty.
74  	 */
75  	public void dispose() {
76  	}
77  
78  }