001: /*******************************************************************************
002: * Copyright (c) 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.jdt.ui.wizards;
011:
012: import java.util.List;
013:
014: import org.eclipse.core.runtime.IStatus;
015: import org.eclipse.core.runtime.Status;
016:
017: import org.eclipse.swt.widgets.Composite;
018: import org.eclipse.swt.widgets.Control;
019:
020: import org.eclipse.jface.operation.IRunnableContext;
021:
022: import org.eclipse.jdt.core.IJavaElement;
023:
024: import org.eclipse.jdt.ui.JavaUI;
025:
026: import org.w3c.dom.Element;
027:
028: /**
029: * A Javadoc export wizard page allows the user to add an additional page to the
030: * Javadoc wizard.
031: * <p>
032: * Clients should extend this class and include the name of their
033: * class in an extension contributed to the jdt.ui's Javadoc export wizard page
034: * extension point (named <code>org.eclipse.jdt.ui.javadocExportWizardPage
035: * </code>).
036: * </p>
037: * <strong>EXPERIMENTAL</strong> This class or interface has been added as part
038: * of a work in progress. This API may change at any given time. Please do not
039: * use this API without consulting with the JDT/UI team. See bug 139818 for discussions.
040: *
041: * @since 3.4
042: */
043: public abstract class JavadocExportWizardPage {
044:
045: /**
046: * The page container.
047: * <p>
048: * This interface is not intended to be implemented by clients.
049: * </p>
050: */
051: public static interface IJavadocExportWizardPageContainer {
052:
053: /**
054: * Returns a runnable context top be used inside this wizard for long running
055: * operations
056: *
057: * @return a runnable context
058: */
059: public IRunnableContext getRunnableContext();
060:
061: /**
062: * Calling this method will update status lines and button enablement in the
063: * wizard page container
064: */
065: public void statusUpdated();
066:
067: /**
068: * Returns the currently configured VM options.
069: * @return the VM Options
070: */
071: public String[] getConfiguredVMOptions();
072:
073: /**
074: * Returns the currently configured Javadoc command options.
075: * @return the Javadoc command options
076: */
077: public String[] getConfiguredJavadocOptions();
078:
079: /**
080: * Returns the Java elements selected for Javadoc generation
081: *
082: * @return the Java elements selected for Javadoc generation
083: */
084: public IJavaElement[] getSelectedJavaElements();
085: }
086:
087: private IStatus fPageStatus = new Status(IStatus.OK,
088: JavaUI.ID_PLUGIN, null);
089: private IJavadocExportWizardPageContainer fContainer;
090:
091: /**
092: * Creates the content of this page under the given parent composite.
093: *
094: * @param parent the parent composite
095: * @return return the created content
096: */
097: public abstract Control createContents(Composite parent);
098:
099: /**
100: * Returns the status of the page. The page is considered valid ('Ok' and 'Next' enabled)
101: * when the severity of the status is {@link IStatus#OK} or {@link IStatus#WARNING}.
102: * The page is invalid when the severity is {@link IStatus#ERROR}.
103: *
104: * @return the page status
105: * @see #setStatus(IStatus) to set the page status
106: */
107: public IStatus getStatus() {
108: return fPageStatus;
109: }
110:
111: /**
112: * Sets the page status. The page status severity must be one of {@link IStatus#OK}
113: * {@link IStatus#WARNING} or {@link IStatus#ERROR}.
114: *
115: * @param status the new status
116: */
117: protected void setStatus(IStatus status) {
118: fPageStatus = status;
119: getContainer().statusUpdated();
120: }
121:
122: /**
123: * Sets the parent wizard container. The Javadoc wizard will set the container before {@link #setVisible} or
124: * {@link #createContents(Composite)} is called.
125: *
126: * @param container the parent container
127: */
128: public void setContainer(IJavadocExportWizardPageContainer container) {
129: fContainer = container;
130: }
131:
132: /**
133: * Gets the parent wizard container
134: *
135: * @return the parent wizard container
136: */
137: protected IJavadocExportWizardPageContainer getContainer() {
138: return fContainer;
139: }
140:
141: /**
142: * Called when the command line arguments are collected. Clients can add or modify arguments.
143: *
144: * @param vmOptions A {@link List} of {@link String} with the VM arguments.
145: * @param toolOptions A {@link List} of {@link String} with the Javadoc tool arguments.
146: * See the <a href="http://java.sun.com/javase/6/docs/technotes/guides/javadoc/index.html"> Javadoc command specification</a> for the format of the arguments.
147: */
148: public void updateArguments(List vmOptions, List toolOptions) {
149: }
150:
151: /**
152: * Called when the Javadoc ANT script is generated.
153: *
154: * @param xmlDocument The XML element for the 'javadoc' node. Clients can add or modify arguments.
155: * See the <a href="http://ant.apache.org/manual/CoreTasks/javadoc.html">Javadoc ANT task</a> specification for the format of the arguments.
156: */
157: public void updateAntScript(Element xmlDocument) {
158: }
159:
160: /**
161: * Disposes the SWT resources allocated by this
162: * dialog page.
163: */
164: public void dispose() {
165: }
166:
167: /**
168: * Notifies that help has been requested for this dialog page.
169: */
170: public void performHelp() {
171: }
172:
173: /**
174: * Called when the page becomes visible or becomes hidden.
175: *
176: * @param visible <code>true</code> when the page becomes visible,
177: * and <code>false</code> when the page is hidden
178: */
179: public void setVisible(boolean visible) {
180: }
181:
182: }
|