KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > wizards > buildpaths > JavadocLocationDialog


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.jdt.internal.ui.wizards.buildpaths;
12
13 import java.net.URL JavaDoc;
14
15 import org.eclipse.core.runtime.IStatus;
16
17 import org.eclipse.swt.SWT;
18 import org.eclipse.swt.layout.GridData;
19 import org.eclipse.swt.widgets.Composite;
20 import org.eclipse.swt.widgets.Control;
21 import org.eclipse.swt.widgets.Shell;
22
23 import org.eclipse.jface.dialogs.StatusDialog;
24
25 import org.eclipse.ui.PlatformUI;
26
27 import org.eclipse.jdt.internal.corext.util.Messages;
28
29 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
30 import org.eclipse.jdt.internal.ui.preferences.JavadocConfigurationBlock;
31 import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
32 import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
33
34 /**
35  * Dialog to configure a Javadoc location
36  */

37 public class JavadocLocationDialog extends StatusDialog {
38
39     private JavadocConfigurationBlock fJavadocConfigurationBlock;
40     
41     /**
42      * Shows the UI for configuring a javadoc location.
43      * Use {@link org.eclipse.jdt.ui.JavaUI} to access and configure Javadoc locations.
44      *
45      * @param parent The parent shell for the dialog.
46      * @param libraryName Name of of the library to which configured javadoc location belongs.
47      * @param initialURL The initial URL or <code>null</code>.
48      */

49     public JavadocLocationDialog(Shell parent, String JavaDoc libraryName, URL JavaDoc initialURL) {
50         super(parent);
51         setShellStyle(getShellStyle() | SWT.RESIZE);
52         
53         IStatusChangeListener listener= new IStatusChangeListener() {
54             public void statusChanged(IStatus status) {
55                 updateStatus(status);
56             }
57         };
58         
59         setTitle(Messages.format(NewWizardMessages.LibrariesWorkbookPage_JavadocPropertyDialog_title, libraryName));
60         fJavadocConfigurationBlock= new JavadocConfigurationBlock(parent, listener, initialURL, false);
61     }
62
63     /* (non-Javadoc)
64      * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
65      */

66     protected Control createDialogArea(Composite parent) {
67         Composite composite= (Composite) super.createDialogArea(parent);
68         Control inner= fJavadocConfigurationBlock.createContents(composite);
69         inner.setLayoutData(new GridData(GridData.FILL_BOTH));
70         applyDialogFont(composite);
71         return composite;
72     }
73     
74     /**
75      * Returns the configured Javadoc location. The result is only valid after the dialog
76      * has been opened and has not been cancelled by the user.
77      * @return The configured javadoc location
78      */

79     public URL JavaDoc getResult() {
80         return fJavadocConfigurationBlock.getJavadocLocation();
81     }
82
83     /*
84      * @see org.eclipse.jface.window.Window#configureShell(Shell)
85      */

86     protected void configureShell(Shell newShell) {
87         super.configureShell(newShell);
88         PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, IJavaHelpContextIds.JAVADOC_PROPERTY_DIALOG);
89     }
90 }
91
Popular Tags