]> git.uio.no Git - ifi-stolz-refaktor.git/blame - case-study/jdt-before/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/JavadocLocationDialog.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-before / ui / org / eclipse / jdt / internal / ui / wizards / buildpaths / JavadocLocationDialog.java
CommitLineData
1b2798f6
EK
1/*******************************************************************************
2 * Copyright (c) 2000, 2011 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 *******************************************************************************/
11package org.eclipse.jdt.internal.ui.wizards.buildpaths;
12
13import java.net.URL;
14
15import org.eclipse.swt.layout.GridData;
16import org.eclipse.swt.widgets.Composite;
17import org.eclipse.swt.widgets.Control;
18import org.eclipse.swt.widgets.Shell;
19
20import org.eclipse.core.runtime.IStatus;
21
22import org.eclipse.jface.dialogs.StatusDialog;
23
24import org.eclipse.ui.PlatformUI;
25
26import org.eclipse.jdt.internal.corext.util.Messages;
27
28import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
29import org.eclipse.jdt.internal.ui.preferences.JavadocConfigurationBlock;
30import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
31import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
32
33/**
34 * Dialog to configure a Javadoc location
35 */
36public class JavadocLocationDialog extends StatusDialog {
37
38 private JavadocConfigurationBlock fJavadocConfigurationBlock;
39
40 /**
41 * Shows the UI for configuring a javadoc location.
42 * Use {@link org.eclipse.jdt.ui.JavaUI} to access and configure Javadoc locations.
43 *
44 * @param parent The parent shell for the dialog.
45 * @param libraryName Name of of the library to which configured javadoc location belongs.
46 * @param initialURL The initial URL or <code>null</code>.
47 */
48 public JavadocLocationDialog(Shell parent, String libraryName, URL initialURL) {
49 super(parent);
50
51 IStatusChangeListener listener= new IStatusChangeListener() {
52 public void statusChanged(IStatus status) {
53 updateStatus(status);
54 }
55 };
56
57 setTitle(Messages.format(NewWizardMessages.LibrariesWorkbookPage_JavadocPropertyDialog_title, libraryName));
58 fJavadocConfigurationBlock= new JavadocConfigurationBlock(parent, listener, initialURL, false);
59 }
60
61 /*
62 * @see org.eclipse.jface.dialogs.Dialog#isResizable()
63 * @since 3.4
64 */
65 @Override
66 protected boolean isResizable() {
67 return true;
68 }
69
70 /* (non-Javadoc)
71 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
72 */
73 @Override
74 protected Control createDialogArea(Composite parent) {
75 Composite composite= (Composite) super.createDialogArea(parent);
76 Control inner= fJavadocConfigurationBlock.createContents(composite);
77 inner.setLayoutData(new GridData(GridData.FILL_BOTH));
78 applyDialogFont(composite);
79 return composite;
80 }
81
82 /**
83 * Returns the configured Javadoc location. The result is only valid after the dialog
84 * has been opened and has not been cancelled by the user.
85 * @return The configured javadoc location
86 */
87 public URL getResult() {
88 return fJavadocConfigurationBlock.getJavadocLocation();
89 }
90
91 /*
92 * @see org.eclipse.jface.window.Window#configureShell(Shell)
93 */
94 @Override
95 protected void configureShell(Shell newShell) {
96 super.configureShell(newShell);
97 PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, IJavaHelpContextIds.JAVADOC_PROPERTY_DIALOG);
98 }
99}