View Javadoc

1   /*
2    * $Id: JenaContainerPage.java,v 1.5 2004/09/20 14:21:38 jlerner Exp $
3    *
4    * Copyright (c) 1999-2004, BBN Technologies, LLC.
5    * All rights reserved.
6    * http://www.daml.org/legal/opensource/bbn_license.html
7    */
8   
9   package com.bbn.jena;
10  
11  import org.eclipse.core.runtime.IPath;
12  import org.eclipse.core.runtime.Path;
13  import org.eclipse.jdt.core.IClasspathEntry;
14  import org.eclipse.jdt.core.JavaCore;
15  import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
16  import org.eclipse.jface.wizard.WizardPage;
17  import org.eclipse.swt.SWT;
18  import org.eclipse.swt.widgets.Composite;
19  import org.eclipse.swt.widgets.Label;
20  
21  /***
22   * Makes "Jena" appear in the "Add Library..." list under Java build properties.
23   * The wizard page itself provides no 
24   * customization, it is just a placeholder to make Jena appear in the Library
25   * list.
26   * @author jlerner
27   */
28  public class JenaContainerPage
29     extends WizardPage
30     implements IClasspathContainerPage
31  {
32     /***
33      * Creates a new JenaContainerPage with the name "Jena Library".
34      */
35     public JenaContainerPage()
36     {
37        super("Jena Library");
38     }
39  
40     /*
41      *  (non-Javadoc)
42      * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
43      */
44     public void createControl(Composite parent)
45     {
46        initializeDialogUnits(parent);
47        Label label = new Label(parent, SWT.NONE);
48        label.setText(
49           "Click Finish to add the Jena libraries to your classpath.");
50        label.setFont(parent.getFont());
51        setControl(label);
52     }
53  
54     /*
55      *  (non-Javadoc)
56      * @see org.eclipse.jdt.ui.wizards.IClasspathContainerPage#finish()
57      */
58     public boolean finish()
59     {
60        if (_entry == null)
61        {
62           IPath path = new Path("com.bbn.jena.jenaContainer");
63           _entry = JavaCore.newContainerEntry(path);
64        }
65        return true;
66     }
67  
68     /*
69      *  (non-Javadoc)
70      * @see org.eclipse.jdt.ui.wizards.IClasspathContainerPage#getSelection()
71      */
72     public IClasspathEntry getSelection()
73     {
74        return _entry;
75     }
76  
77     private IClasspathEntry _entry;
78     /*
79      *  (non-Javadoc)
80      * @see org.eclipse.jdt.ui.wizards.IClasspathContainerPage#setSelection(org.eclipse.jdt.core.IClasspathEntry)
81      */
82     public void setSelection(IClasspathEntry containerEntry)
83     {
84        if (containerEntry == null)
85        {
86           IPath path = new Path("com.bbn.jena.jenaContainer");
87           _entry = JavaCore.newContainerEntry(path);
88        }
89        else
90        {
91           _entry = containerEntry;
92        }
93     }
94  
95  }